OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 9795|回复: 0
打印 上一主题 下一主题

[未解决] OMAPL138如何在Linux下使用EDMA3驱动

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # c$ Y) N8 d! l2 e1 I8 l, A
  1. [code]EDMA sample test application
    - n( D8 i' Y; K
  2. /*
    & |& C4 a1 y; |* m
  3. * edma_test.c2 u' p6 x1 r) _( j0 R3 O
  4. *
    ! Z7 X/ J0 }* z) d) L; J+ ?
  5. * brief  EDMA3 Test Application
    . G6 Y4 S1 S# b; H+ {' }
  6. *
    5 u3 A/ _% H- h9 q; _+ L
  7. *   This file contains EDMA3 Test code./ b" h. ?# ?1 a1 r% O5 z8 g
  8. *) `/ R' c" m5 z( z) b7 o. o' E
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    3 ?/ m# N# A. t+ T& x3 T4 i
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ( i8 d7 `" ^$ L! G, Q
  11. *         TO CHANGE.' l, k4 H$ W8 s8 T; r
  12. *
    0 \, q9 R" F6 U- r
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    5 W, f! O/ q/ |" J0 N4 ]
  14. *
    & H. e  I  X3 K
  15. * This program is free software; you can redistribute it and/or' k! Q6 V  L' e! ^# w0 M
  16. * modify it under the terms of the GNU General Public License as/ ^/ \% j9 k& o1 a3 M9 w, Z6 r5 r, ~) B
  17. * published by the Free Software Foundation version 2.
      D* w# J- \( Y. _. X0 u$ n/ G# w
  18. *& f2 y# ^0 I! |4 `7 y- m
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any% z- Z; V  v+ k0 O3 G
  20. * kind, whether express or implied; without even the implied warranty
    : L3 q8 l. t* J  n6 i" v3 {8 ^( g
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the6 @5 O7 m* T* w+ n; d6 F2 p
  22. * GNU General Public License for more details.
    6 ]1 a  ]: p) B- f( J2 r: O5 y
  23. */
    ' ]; \5 V5 i" `- n# n4 H4 q
  24. 8 I1 H9 E* F, f  i
  25. #include <linux/module.h>
    $ b, l2 ^' V) D+ V4 I
  26. #include <linux/init.h>
    2 V0 z8 F2 n& j3 W9 `4 N
  27. #include <linux/errno.h># U, z3 w7 u5 h' E# \! H: Z( S' s3 r: Y
  28. #include <linux/types.h>
    7 G* X5 y' d! w! `0 j6 K+ S- W6 u
  29. #include <linux/interrupt.h>
    ' P5 i+ a3 o0 C5 m7 ], @: |
  30. #include <asm/io.h>
    * H/ k' ^9 b! V, ?# l
  31. #include <linux/moduleparam.h>5 H: W2 v& @$ v
  32. #include <linux/sysctl.h>4 o& G- a- d( @' u8 [" m: f' y
  33. #include <linux/mm.h>- i' J9 c5 O  v" v
  34. #include <linux/dma-mapping.h>
    ( g, k9 n! J  @( Q& ?! G, y

  35. 7 j. x/ L6 }, K/ G2 G4 D5 P. O
  36. #include <mach/memory.h>0 ^  A# I! w0 l6 S* U
  37. #include <mach/hardware.h>" z4 v) v+ N+ |2 E: L1 h
  38. #include <mach/irqs.h>
    7 V; B; L' O( O
  39. #include <asm/hardware/edma.h>0 ]# P/ ]* h* \2 P6 {
  40. 4 C8 H7 G! d4 Z+ M5 w
  41. #undef EDMA3_DEBUG0 F2 e% [& z& e8 e9 ~, v1 B) l) F
  42. /*#define EDMA3_DEBUG*/
    ! @1 g7 @+ O2 B3 F2 h1 b1 y9 F8 }7 Y
  43. 4 N  }# ^6 G# ~
  44. #ifdef EDMA3_DEBUG/ _- \  e1 s( T5 G. c+ B
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 T. K7 n: K, t8 e
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), F7 K. R: q: x' P3 l3 ~- U
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 a% B, p7 w, Q) e8 [
  48. #else- x7 I# y/ p; x+ @, Y
  49. #define DMA_PRINTK( x... )
    # i* M! ]0 c, E; r3 ]5 ~9 J
  50. #define DMA_FN_IN
    5 z" E) s6 \4 s  {, w& D- ~, L
  51. #define DMA_FN_OUT
    ( J; n( t, h( [4 m5 e
  52. #endif2 P' R2 {# P! ]( c4 ^5 m

  53. + ]5 o  g$ u/ G9 [+ ?
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)7 ?4 ~9 a  l0 V, x* ^3 ^. L
  55. #define STATIC_SHIFT                3
    ( t7 Y1 V0 H, Z
  56. #define TCINTEN_SHIFT               20
    , F1 q0 p( L% I- |8 Y% R
  57. #define ITCINTEN_SHIFT              21
      `2 }0 S& X( u$ `
  58. #define TCCHEN_SHIFT                223 H, G+ y+ E3 V' S: M: v6 J: [
  59. #define ITCCHEN_SHIFT               23; e) L5 }, H) c, A  \
  60. % W5 ~# J3 ]/ E- f4 ^. ~, j
  61. static volatile int irqraised1 = 0;
    # o) \$ t/ a  {9 t# R, d5 g
  62. static volatile int irqraised2 = 0;; R! I& D% Z) E" U! {
  63. 2 z* ~: ]  z( h% [7 W# i: L; I
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. H& }/ Q! ^# f# C* \; a! m/ C
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 x8 ^/ n+ [2 X: l0 r0 G9 c# J
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  [, j+ {, h% x  ?6 x4 c

  67. 8 f: X& r0 Y6 X2 f) U2 k* e
  68. dma_addr_t dmaphyssrc1 = 0;: s/ C+ F# m2 e& j$ C4 \
  69. dma_addr_t dmaphyssrc2 = 0;
    7 b$ q; r& P0 v  U
  70. dma_addr_t dmaphysdest1 = 0;
    " |0 d( y- A& w  f
  71. dma_addr_t dmaphysdest2 = 0;0 n" f( H, S, [& ?$ ~3 w" h

  72. ! m" f( ^" k/ ^4 _% X, ?! F0 ~3 q
  73. char *dmabufsrc1 = NULL;9 x$ u0 \" t" J/ x
  74. char *dmabufsrc2 = NULL;
    & f9 P' t8 s# l' [
  75. char *dmabufdest1 = NULL;* U" @6 G; G1 Y
  76. char *dmabufdest2 = NULL;
    % n$ [2 t; k" C, B. y( L: d) D
  77. # L7 v1 D8 c6 h5 m" v
  78. static int acnt = 512;
    3 n0 T# ~  X1 Y7 u8 l$ z
  79. static int bcnt = 8;2 v3 S  R) ?7 A5 y+ z" y
  80. static int ccnt = 8;
    ) X: R" `- w% l* u! M4 B2 R5 o; G
  81. 3 m3 D3 }" _) B* a' N; f
  82. module_param(acnt, int, S_IRUGO);& _2 m! O! a- Q$ D- k/ k, I
  83. module_param(bcnt, int, S_IRUGO);5 c) g2 D' b2 }- i6 i& e
  84. module_param(ccnt, int, S_IRUGO);
复制代码

& |- J4 I; m% k$ J5 ^: u
( {2 _5 G. F0 [% C* c      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) T9 q2 [5 T. H) s" m+ Oarm-none-linux-gnueabi-gcc  -I /home/tl/omapl138/linux-3.3/arch/arm/include -I /home/tl/omapl138/linux-3.3/include  EDMA3test.cpp -o EDMA3这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" K1 @$ S, A  S+ v3 k     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 k& T- T( |$ S' Z* b5 B
% w, O( k6 o) X* r% ]8 J
; \6 [5 i# |8 `2 g' H6 M  T8 e* ^
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|手机版|小黑屋|嵌入式开发者社区 ( 粤ICP备15055271号

GMT+8, 2026-1-7 21:25 , Processed in 0.036994 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

快速回复 返回顶部 返回列表