OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站
点击跳转“创龙科技服务通”

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - J0 v2 m4 @" @  }' A, R. m
  1. [code]EDMA sample test application9 f/ @$ g0 i5 L- c5 c4 ]& T
  2. /*0 u% r6 @5 m  v" Q* I$ }
  3. * edma_test.c4 ~" D; ]) c0 X, P# ~
  4. *
    ) i8 q; b9 W) P9 m5 P. w; \
  5. * brief  EDMA3 Test Application  u. w/ f, ^* K/ M
  6. *
    * d+ g) }- M' n/ `4 I+ x5 r) p; I
  7. *   This file contains EDMA3 Test code.
    ) u% I5 G" a" P3 `% L$ G8 s% t
  8. *
    2 q& {" G+ H& T
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE  t+ l4 e/ @4 `) X
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    , q5 H. x: ?4 A' b- v
  11. *         TO CHANGE.
    : n3 J. F' \. h: Y8 a) L* B
  12. */ v: ]& e: ?" e1 _# N' w$ N0 V
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    % O" {1 b2 H+ X% Q# g2 z5 T* h
  14. *
    5 |* d" K  \6 ~3 L& r0 L; _
  15. * This program is free software; you can redistribute it and/or7 T7 q$ S0 T: T
  16. * modify it under the terms of the GNU General Public License as) w$ E+ ~& V* O* Y4 @
  17. * published by the Free Software Foundation version 2.- C6 }) y: ~6 Q/ ~
  18. *" P6 ^% @& G  y- G9 n$ o
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    + w# R: o. T0 e# o0 M& M, v4 w
  20. * kind, whether express or implied; without even the implied warranty
    . Q. e% M$ p. g6 O+ @4 i+ }( ]
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    2 x$ I4 m6 Z+ r* }
  22. * GNU General Public License for more details.
    1 Q7 Y% \$ ~1 a
  23. */
    8 m) ]9 e: R% r, w, j4 t8 U  h
  24. ; V, B2 G9 c! O; e  U; V
  25. #include <linux/module.h>
    / e. H( m5 E( h0 ?
  26. #include <linux/init.h>: q- n+ R9 Q; ?0 \+ X* b; m
  27. #include <linux/errno.h>
    . c1 G4 h1 P5 J2 B* J
  28. #include <linux/types.h>5 f/ z% q) Q$ R& c% W/ K8 B
  29. #include <linux/interrupt.h>
    ( i6 c% M& [$ Q. F) n  b
  30. #include <asm/io.h>
    1 l/ j* w6 n/ u$ G
  31. #include <linux/moduleparam.h>
    4 g3 u" u6 H: i/ D
  32. #include <linux/sysctl.h>0 c& j% D$ k5 Q9 e3 E
  33. #include <linux/mm.h>
    4 w3 P2 H/ }6 {  a. [- Q) N$ i% T# M6 O
  34. #include <linux/dma-mapping.h>
    ! h, @# T2 b; A" D2 l: j

  35. 9 ^3 Z% V& P9 m6 k0 M# n
  36. #include <mach/memory.h>
    6 z0 Z, _0 |( o3 u
  37. #include <mach/hardware.h>% B3 s2 i3 G5 [: [4 p' B; Y
  38. #include <mach/irqs.h>
    / }6 K5 `! p5 [0 _. }! i/ ]' \8 F
  39. #include <asm/hardware/edma.h>
    ' L$ K. K* Q) K+ P, w

  40. 8 ]3 X  ^; ~7 k' H' K
  41. #undef EDMA3_DEBUG
    ! a+ Z2 h; {) U* J8 ]
  42. /*#define EDMA3_DEBUG*/1 F5 s! ]# i7 w
  43. / L3 z  R  K% z
  44. #ifdef EDMA3_DEBUG2 o; K7 B6 q3 M9 E6 `2 y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    - L- C8 E$ W: d( S0 f% J
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    - x; i$ d) {0 O2 m9 r
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    5 j, B* O; O; w
  48. #else
    * D* |/ @+ _+ W. V' Z( b
  49. #define DMA_PRINTK( x... )
    ; E  ]8 w$ \# F5 {  G2 x
  50. #define DMA_FN_IN
    $ i- E, N7 I3 U7 ]/ T- `
  51. #define DMA_FN_OUT2 p0 m. G$ m$ E  n( w& t
  52. #endif2 l9 p$ }) Q8 _3 W3 R% G7 R

  53. ; N- e8 P; B( x9 n6 g. a
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)$ U& c. [# K  X8 P$ @
  55. #define STATIC_SHIFT                3! F7 n, }6 }( y, O' ^% d
  56. #define TCINTEN_SHIFT               204 ]1 |0 a8 l/ t3 v; ?  d0 ]
  57. #define ITCINTEN_SHIFT              216 ]+ c/ _5 A  }- }  [% {
  58. #define TCCHEN_SHIFT                22
    " a, R" i1 y: `) B, q
  59. #define ITCCHEN_SHIFT               23* s. }: W7 R- \) b7 P
  60. ' o3 m- X! b9 D
  61. static volatile int irqraised1 = 0;7 u- y" Q" b! _
  62. static volatile int irqraised2 = 0;
    ( \" I( q$ V2 I" c6 z

  63. ' s, b/ Y, D( V: e# Y4 m
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / M% Y$ Q$ Z* n
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& L! l5 s. p# o" `: b
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" \( F7 G& R6 A% J7 Y0 E; o

  67. & G' E6 A8 [4 `5 P% t2 P6 u0 l
  68. dma_addr_t dmaphyssrc1 = 0;
    5 @3 l- ^* z* w3 f5 ?, t" R" }  j
  69. dma_addr_t dmaphyssrc2 = 0;
    % Z9 k& F8 x: `; b! o; [1 D$ \
  70. dma_addr_t dmaphysdest1 = 0;
    + z; Z& K* b! F% U
  71. dma_addr_t dmaphysdest2 = 0;
    : w" `( X: ^6 U9 C3 L0 `# n/ K

  72. 9 {" F+ K- p! y# {0 h2 G
  73. char *dmabufsrc1 = NULL;
    / Y% e' N+ Z" f) j" W* U
  74. char *dmabufsrc2 = NULL;
    0 @9 R  O; Z9 R$ m  W; L& t8 o% a' ~' ]! T
  75. char *dmabufdest1 = NULL;7 P& g+ t; B. `9 e
  76. char *dmabufdest2 = NULL;
    8 m8 {7 q4 p. s8 y

  77. ! ~( N1 y" @' O
  78. static int acnt = 512;
    ; E& a0 U7 T( n- P* v
  79. static int bcnt = 8;" t3 y/ ?- R2 F) W4 e; m2 K
  80. static int ccnt = 8;9 {3 L- O, c# |+ A

  81. 4 \& S$ F. M- J1 y" v# l
  82. module_param(acnt, int, S_IRUGO);: ?3 I: T( l; K/ Z9 m
  83. module_param(bcnt, int, S_IRUGO);% C3 f  ^% u+ \" l
  84. module_param(ccnt, int, S_IRUGO);
复制代码

) M. y( A3 x( s  {. g
6 {* u! U: d$ S/ e- n# @      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, G: L7 T6 t& ]$ D) {6 narm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( W7 C2 ^& s" }9 o' B# D/ t     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 A" s3 \! b6 d
* H3 l) t7 t  `5 @
0 G, o( s1 n2 @$ G; [
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

点击跳转“创龙科技服务通”

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

GMT+8, 2026-2-15 21:23 , Processed in 0.040959 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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