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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- H0 T* a3 B4 w- Y: k5 U
  1. [code]EDMA sample test application+ j4 W, {, F# s9 j
  2. /*- R, A' S% {+ T' N2 }( L
  3. * edma_test.c
    1 i/ B$ m/ k- x# N$ V9 S' ?) L) Q
  4. *
    % h. j) C9 h- o3 P- T
  5. * brief  EDMA3 Test Application
    : W6 n1 {+ O' l2 D- f7 o& L% P3 L# F
  6. *3 C# y' W4 V5 S: g1 I8 l+ n
  7. *   This file contains EDMA3 Test code.
      n: o9 `' Q- ?
  8. *! W$ n5 `) P# D# k( b+ X
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
      }# g! ]9 n! e: x) d( i" Y3 c
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    3 L) M0 x/ \+ T$ U7 \# u3 f
  11. *         TO CHANGE.$ Z9 L1 O6 M9 n2 M/ g
  12. *1 o/ s. q; z  K4 M
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    3 R0 G7 }- c* [0 W/ J
  14. *2 z. p& F8 u1 C9 ~# t* g
  15. * This program is free software; you can redistribute it and/or* n8 }, W: f, g0 H( @- ~
  16. * modify it under the terms of the GNU General Public License as9 J( d; J3 b+ k- `  n
  17. * published by the Free Software Foundation version 2.
    % j6 R/ {5 g; S
  18. *
    & P) K! a: ?1 t4 @; x
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    # a; l; k  y0 W! \$ n: \5 v% }
  20. * kind, whether express or implied; without even the implied warranty5 \9 r3 l5 H1 j
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ' m5 d% t2 m" _" |3 k6 a
  22. * GNU General Public License for more details.# F5 \" \& y, x0 @+ @. @
  23. */. X$ P' B* s& I- ]1 m

  24. " |; D/ `2 V2 ]
  25. #include <linux/module.h>) C; D/ X6 |! U8 e5 ?
  26. #include <linux/init.h>) |* f7 e- m9 Y; e' c, h& D
  27. #include <linux/errno.h>
    ' N# d5 t! U( O6 w& p8 b( I
  28. #include <linux/types.h>! y2 F* ^( U+ m6 K1 K  u
  29. #include <linux/interrupt.h>
    0 x) u, N: [8 c, e' E2 d
  30. #include <asm/io.h>
    9 v6 Y* ^. b3 y% G8 w1 P
  31. #include <linux/moduleparam.h>  N# l6 D# Q7 ]7 \
  32. #include <linux/sysctl.h>
    , `. F: h  v' F0 t. U/ p# ]
  33. #include <linux/mm.h>
    8 n3 x$ J6 [% ?* g1 j
  34. #include <linux/dma-mapping.h>
    " S+ E% E$ n/ L$ P# G

  35. ) B" ~- f# T0 w' B
  36. #include <mach/memory.h>0 D+ F! ]7 E2 y( n. ?' t2 L
  37. #include <mach/hardware.h>9 P4 k* r% F0 |  R$ ]2 P
  38. #include <mach/irqs.h>6 J. {# o9 q4 Z" |* [
  39. #include <asm/hardware/edma.h>
    & N! P  L2 P- F

  40. 0 P5 R1 A4 j. a& e% H" Z! h' E
  41. #undef EDMA3_DEBUG
    + g" J( X7 z  ^* a$ y
  42. /*#define EDMA3_DEBUG*/
    7 D: D9 H( _' I+ `3 P3 R( x

  43. / ?* a% v) Q" _
  44. #ifdef EDMA3_DEBUG
    , O7 x9 d' q# B8 m+ ?$ ~
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    0 e  o) e# z! ~, x
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) M+ o& Y) q, B( l
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)4 z9 v5 ~7 H' S# k: H7 S/ W" r
  48. #else
    + R" R0 r) \3 T. R' |" Y
  49. #define DMA_PRINTK( x... )
    8 l' v& h( F- R
  50. #define DMA_FN_IN8 U. F! S+ _' D5 Y1 {
  51. #define DMA_FN_OUT
    * ^' E2 O/ g6 {9 v
  52. #endif9 a* n8 t: W/ G2 ]0 _8 G. z
  53. + e- h' `! R7 z# G" U
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)4 c" t+ Q* b5 j
  55. #define STATIC_SHIFT                3
    7 E, D, H0 c. s# S. }- t4 o7 Q/ n
  56. #define TCINTEN_SHIFT               20
    0 X9 d5 P/ s- J/ n: F' e6 Y
  57. #define ITCINTEN_SHIFT              21
    7 ^; N6 y% Q1 H6 Z8 t9 Q% A7 m
  58. #define TCCHEN_SHIFT                22
    $ f3 P; z; R" i6 k$ ]- J5 E
  59. #define ITCCHEN_SHIFT               231 r4 p. t3 M& M; c

  60. * t) v3 R5 k+ X8 |- M# T; z- E; @
  61. static volatile int irqraised1 = 0;
      v8 A5 Y1 L. Y7 X7 Z# J1 A3 c
  62. static volatile int irqraised2 = 0;
    ) ?0 S4 c& c* M& X/ z; {( c4 G" t
  63. / h" w7 T7 E# w7 u: h( K/ O* @% d1 I3 i
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 s. V" j% J' X7 ?) G
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# @2 Y: F. m/ Q! \* x. O
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' z4 t$ i; C( M$ n

  67. # |6 x4 ?3 I1 a7 X
  68. dma_addr_t dmaphyssrc1 = 0;" M4 B( _5 h) y. L
  69. dma_addr_t dmaphyssrc2 = 0;
    0 n# @. o8 l2 P( e% x$ t+ E3 k
  70. dma_addr_t dmaphysdest1 = 0;
    % _0 J- d. g$ o# m7 C2 q4 v% }' n( V5 n
  71. dma_addr_t dmaphysdest2 = 0;
    8 Y: J( n  C; W& N

  72. 6 l& `# Q; D* `: r
  73. char *dmabufsrc1 = NULL;$ {$ R1 F- o9 V* q
  74. char *dmabufsrc2 = NULL;
    : l, O7 c/ M6 v6 P2 o) S: L4 i# {3 Q
  75. char *dmabufdest1 = NULL;
    + N0 F1 I5 \" f" r# H1 N
  76. char *dmabufdest2 = NULL;4 k# |+ X4 Q/ G2 d5 }* q% W

  77. % |' n; a2 Y& F+ g# T
  78. static int acnt = 512;* d8 r2 L$ F' M
  79. static int bcnt = 8;
    ! {% S! R3 }2 O. y! M4 N4 C/ d; R
  80. static int ccnt = 8;% _8 h( w1 N/ k* Z
  81. % v* a8 i' m' n
  82. module_param(acnt, int, S_IRUGO);
    5 B) T0 w$ C8 z& r  s4 k
  83. module_param(bcnt, int, S_IRUGO);5 W  B3 f, w8 L" z% h
  84. module_param(ccnt, int, S_IRUGO);
复制代码
/ z! P" e. Z, x

; A8 ~& s( h) h! {! e( T; A) i      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 @6 D5 q5 x( [. O5 ^" _
arm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% v8 m2 k" X% t1 J     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( f, \& g, G! i$ A& s" `" C6 @" J" O. T5 g

/ J4 ~1 z$ }- R- F% w7 I9 `2 M) N
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-2 22:17 , Processed in 0.040953 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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