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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 c$ k+ s# f2 W8 A! s  c
  1. [code]EDMA sample test application1 v& H5 D2 j8 i8 E) z  J
  2. /*% t7 s$ X' O: Y3 K! S! Y
  3. * edma_test.c
    7 E2 d: Q5 M: l$ P, o& R4 a) L
  4. *" I, \9 f) p$ _2 n
  5. * brief  EDMA3 Test Application# M. R: h- V4 T. V: a5 E
  6. *
    + Z& A7 u  O# R* X; U& p
  7. *   This file contains EDMA3 Test code.
    ( j5 C0 H$ F$ {
  8. *$ X% d6 j: ?# b: `, z8 I# e
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    4 H" O, q' [0 F3 F* ~6 W; s" m2 e
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) `0 L) b* s% R, x( V5 T
  11. *         TO CHANGE.1 [) o0 \' m* z
  12. *
    1 i) \0 L2 i6 r9 V# D+ ?
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// v0 j' q; f% }5 I# j# i. n) K6 L
  14. *
    ! Q7 y1 o/ d) l: v
  15. * This program is free software; you can redistribute it and/or
    . k: Q6 T: _9 Q. b6 s
  16. * modify it under the terms of the GNU General Public License as
    4 q) Y4 L' \& W0 v
  17. * published by the Free Software Foundation version 2.
    $ b: k# i" |! ~* r- U
  18. */ o% @! f, t/ h% k  X! _' O. |  F
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 }5 [, c2 i+ a9 ^4 z
  20. * kind, whether express or implied; without even the implied warranty; C& i1 _: |4 a: h$ i, U( I
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the, p2 c, L  L3 M1 w# h  k
  22. * GNU General Public License for more details.
    1 y$ n4 _& |/ Y& h4 t6 v* p% K
  23. */+ l" _3 V" w5 \
  24. 7 h6 v$ K+ c* n/ _2 d! E6 D
  25. #include <linux/module.h>" ^" s* Q; q7 ^6 P% p& n
  26. #include <linux/init.h>
    2 m% N) n  K6 }5 X8 ]4 R, _
  27. #include <linux/errno.h>* A, V0 v% M, J
  28. #include <linux/types.h>9 l9 [1 P6 Q. o
  29. #include <linux/interrupt.h>
    . e+ u8 c: c/ x. d7 d
  30. #include <asm/io.h>
    : b" B4 e+ o9 b4 c
  31. #include <linux/moduleparam.h>
      L3 j$ V. w8 O) V
  32. #include <linux/sysctl.h>
    , s# N; W' \+ m$ b
  33. #include <linux/mm.h>$ o& }3 ~" C9 ?. @/ l( c
  34. #include <linux/dma-mapping.h>
    # F1 _  `! ~  B
  35. $ c' s" C$ \: E1 o
  36. #include <mach/memory.h>5 z5 u6 X* m) P+ L# z2 T- N
  37. #include <mach/hardware.h># t/ p/ P) X* ^" T
  38. #include <mach/irqs.h>
    + D+ Y  c7 {6 \0 V* W# X7 _, ^
  39. #include <asm/hardware/edma.h>
    $ |0 B) }8 X/ k; o' d! k

  40. . ^, j. C6 C1 g1 o+ x$ p
  41. #undef EDMA3_DEBUG# L: r  B3 }; y3 ?0 d# B
  42. /*#define EDMA3_DEBUG*/
    $ N6 Z" Z, N8 k( t" b& M$ `

  43. ' n+ c1 j0 [& x) G
  44. #ifdef EDMA3_DEBUG
    5 G, w  w/ ?/ Q6 O  i; A" X8 S
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    & L8 ]  b' X# W" Z6 t& V/ g
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 Z& Z9 F% x. G
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 u2 G0 I8 B# N( w9 u3 i
  48. #else, |4 i4 D2 e  b0 r  G" k  o
  49. #define DMA_PRINTK( x... )7 s0 m! [. M% a0 F- H
  50. #define DMA_FN_IN
    ! ?( f4 a3 K" a
  51. #define DMA_FN_OUT
    4 m( M! B  h( _7 Z
  52. #endif
    & d4 \: S) k! j. P' A/ X1 @

  53. , |5 y9 Q& }! I- {
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    . P. G8 H6 F) M- T
  55. #define STATIC_SHIFT                3
    9 U: _# j3 Z4 z7 G; ^
  56. #define TCINTEN_SHIFT               20
    % Q+ g) n. N$ U1 s6 \! J+ f
  57. #define ITCINTEN_SHIFT              21
    . W9 |; ^  P! g4 |4 O! y
  58. #define TCCHEN_SHIFT                22
    ) w5 j0 z$ r' }3 }
  59. #define ITCCHEN_SHIFT               23
    4 C  n9 T3 u  B9 P
  60. / o6 M6 [  V0 H/ M. Z3 r
  61. static volatile int irqraised1 = 0;
      J8 Q8 k4 @: O& q$ ]9 P
  62. static volatile int irqraised2 = 0;) K/ \6 n; U* y- r+ X
  63. ; Y% J% e0 D2 `: z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; Q% o" ]: V5 Y) J2 I, a: q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; b, j4 v- H( U4 S' P
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 s, K% c: n. v- j

  67. 9 V+ d5 M, E4 a- o) ]
  68. dma_addr_t dmaphyssrc1 = 0;
    / h. R9 m0 ~& ~% e3 n) n7 g0 Y
  69. dma_addr_t dmaphyssrc2 = 0;; P5 e7 w+ M+ P
  70. dma_addr_t dmaphysdest1 = 0;
    % C. g9 U* z/ }* t. K0 K- Z
  71. dma_addr_t dmaphysdest2 = 0;8 J3 p) u7 b1 \/ U# @: I) @

  72. + q/ z) K3 D# H9 D" \" ?% T
  73. char *dmabufsrc1 = NULL;
    " Y; M5 W; h+ j& l
  74. char *dmabufsrc2 = NULL;
    ( m, U9 a! K$ G
  75. char *dmabufdest1 = NULL;2 Y- J9 y" k# n5 H, X4 j0 X' ~% z
  76. char *dmabufdest2 = NULL;$ w4 \& [9 E+ p

  77. * |6 Z% c- Z; A( b+ e* K) X& t" _
  78. static int acnt = 512;
    5 w; }# K/ r1 e; `: h' `( s
  79. static int bcnt = 8;. d9 ?5 F3 P  ]
  80. static int ccnt = 8;4 s! _4 D# H' q' H/ |" g+ E4 Q

  81. ! @# ~5 d4 }' c# x% q
  82. module_param(acnt, int, S_IRUGO);
    - }! r1 {0 G  o# K2 C5 l
  83. module_param(bcnt, int, S_IRUGO);
    : \8 s0 _% g. q! _
  84. module_param(ccnt, int, S_IRUGO);
复制代码
7 s! t0 t* }. Q: c2 ~* G
+ G1 G- B1 `" W
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 f$ ~8 d+ [* H! [+ Carm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. [& `& \/ I4 f  o" o     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ e! {3 g$ l5 {
$ h+ j3 [) Q, e3 T
3 q" B- `$ d( {% h9 @
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-23 09:39 , Processed in 0.041278 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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