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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ P" K6 }7 b: S! o& f
  1. [code]EDMA sample test application! E0 f3 P( ?4 I& K- {8 v2 Z
  2. /*
    % f8 y4 X# u( n5 y+ o
  3. * edma_test.c1 P( N5 _5 e4 K/ F: X1 x* _
  4. *
    & R" O7 b5 L) N3 _7 ?& P) d# V
  5. * brief  EDMA3 Test Application! C6 d& t9 `3 T8 Y% J
  6. *" z2 f# E/ u5 D7 q' t
  7. *   This file contains EDMA3 Test code.
    ' T; q( ~* l1 S8 Q
  8. *; Y2 }4 g8 q/ l6 T  ?& W6 f9 i
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    , K# e  a1 B0 K0 |) u
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 g* u- I, g8 H6 h* W9 r
  11. *         TO CHANGE.* `* f$ t8 v+ X! Y% @  M
  12. *: N4 p) L+ q* z/ o) r2 d3 x4 s# u
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 g) _) {' f3 a9 o: f
  14. *1 x9 X* F# R* H6 {# I
  15. * This program is free software; you can redistribute it and/or
    ) a& b" X6 A) w) B
  16. * modify it under the terms of the GNU General Public License as7 a2 ~% {6 l0 v
  17. * published by the Free Software Foundation version 2.
    1 I  r: m5 J; q' \7 i5 ?5 a) x
  18. *
    9 m; E; s* t9 g; x! G( ~
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ; H" B: H7 r9 ~2 h/ o: R0 S; J+ @) Y
  20. * kind, whether express or implied; without even the implied warranty' ?4 e9 _! U6 u6 T! y5 u9 @
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the3 j& y) \# z/ v9 p" \; {9 X
  22. * GNU General Public License for more details.0 A) A5 i$ _  r2 ?5 f, m, ]5 g
  23. */
    9 F! _9 K/ v( Z
  24. 2 k2 y1 Y+ h' C% Y* g6 L3 v
  25. #include <linux/module.h>
    8 m6 h4 u5 c% M8 \" U: S4 B
  26. #include <linux/init.h>% h, ~% @$ U1 ]
  27. #include <linux/errno.h>
    " w2 b7 ?& p, K% e  P; z9 Y
  28. #include <linux/types.h>
    4 }' G. H# n3 W6 N# e/ E
  29. #include <linux/interrupt.h>
    * J$ S( q) y# c7 U  L
  30. #include <asm/io.h>4 {' m; L' @% n% X% |
  31. #include <linux/moduleparam.h>
    * ?; S9 ?: J' J  n, Z. Q
  32. #include <linux/sysctl.h>" E8 V$ f* q2 S$ h: \
  33. #include <linux/mm.h>5 K2 g9 b4 I& S1 a' W
  34. #include <linux/dma-mapping.h>0 i  `5 u( G& ]. w5 [# v7 ?; |: E
  35. 1 X& Z1 w! n: i& H! l4 g5 D: M
  36. #include <mach/memory.h>& N0 _- ?3 s# _
  37. #include <mach/hardware.h>' j% z% e+ g2 ~+ _8 K
  38. #include <mach/irqs.h>. N7 f4 R, x" T6 C% ~/ O
  39. #include <asm/hardware/edma.h>% n/ V. j  w  ?( F$ p
  40. * V( v* t) K8 h# T1 }+ ~7 I, Q
  41. #undef EDMA3_DEBUG* u, K# n) ?7 z) R
  42. /*#define EDMA3_DEBUG*/
    ! O  C0 t6 t7 T; S) _! b

  43. 3 K" i# |0 r6 X0 x. w
  44. #ifdef EDMA3_DEBUG
    7 z1 A7 M7 S! V1 `! M1 n& f
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ' i8 N; l' B# h; c, h) B$ r
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- e$ I1 A. P4 K3 b8 R
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    3 s1 p+ @; m$ s9 L/ y! M
  48. #else
    ( E2 B1 E) x& w& g- [% w
  49. #define DMA_PRINTK( x... )
    # J& C) ?& E7 \3 Y
  50. #define DMA_FN_IN
    ! Z/ j* o$ R2 R7 o/ u- L
  51. #define DMA_FN_OUT
    2 p1 r; e9 r" M& n5 h2 _
  52. #endif
    9 R; q8 R4 O4 t  F- ?) ?) G" {
  53. ! j$ u; Y6 n5 a) m+ |! I1 g' G
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    7 u, ~; M- n- Z1 t( F
  55. #define STATIC_SHIFT                3
    2 M) I- N; Q; s9 m. W: d
  56. #define TCINTEN_SHIFT               20
    & M! u6 f+ i; i/ e) z1 V$ Q
  57. #define ITCINTEN_SHIFT              211 j7 P& g1 d6 V
  58. #define TCCHEN_SHIFT                220 b! s7 c! U" b
  59. #define ITCCHEN_SHIFT               23
    ; T" o, v" X' n- Y7 r4 F
  60. ! H3 e# w8 E# k3 c) m0 ?
  61. static volatile int irqraised1 = 0;
    3 z: W0 K; {2 [8 L5 \8 P; \
  62. static volatile int irqraised2 = 0;! ]' q$ T: y: O. i5 C2 s+ u
  63. * y6 N+ S$ O- G2 ]( V
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 a( ^+ `1 A- {) c0 t% @
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , d6 R( ?3 a# r3 Q( C) ]0 |
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % V0 _& h$ v+ U; {* o
  67. ; Z; \9 {1 T$ ?" X8 M4 V/ X& P2 ~3 j
  68. dma_addr_t dmaphyssrc1 = 0;( g. @" h' Q+ K) f. i+ {
  69. dma_addr_t dmaphyssrc2 = 0;  h, A+ N7 m6 V) T3 M9 @
  70. dma_addr_t dmaphysdest1 = 0;- ~" [. W) V  p0 F% J, H
  71. dma_addr_t dmaphysdest2 = 0;) _- c8 o! A, {  I& |  B

  72. ) z) @+ r7 P* c& e1 e
  73. char *dmabufsrc1 = NULL;5 m. N* d3 t. g; r
  74. char *dmabufsrc2 = NULL;
    - B6 w8 U3 l$ P
  75. char *dmabufdest1 = NULL;3 \9 p( o& i7 j5 Y0 q/ D$ x
  76. char *dmabufdest2 = NULL;. V6 K1 L( \3 P" y
  77. 5 P' \. O9 w9 g: Z: X0 B7 c8 ?. x
  78. static int acnt = 512;5 p4 u0 P! B7 w* z% _  o, {" z9 a
  79. static int bcnt = 8;
    + T, D! ~) f( Y
  80. static int ccnt = 8;4 [+ u5 b7 Y# Q& ^9 \- J

  81. 9 s, A* C: M; [/ r
  82. module_param(acnt, int, S_IRUGO);
    9 _. F! ]; Z3 p6 f; b
  83. module_param(bcnt, int, S_IRUGO);
    / V1 L/ ~* A+ m: w0 k% r
  84. module_param(ccnt, int, S_IRUGO);
复制代码

  @+ w6 V6 [- T) G! J8 k
6 z/ z/ i# G$ d% M$ }* |      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
  w. O" t5 m5 L; O" l5 {# E. Garm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( C: G8 P/ J0 J1 _
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( P: ?  i4 F1 b6 r) S
0 ]! I; A( f6 J, h8 o/ c9 V( `
$ b6 M) i3 r, r/ X) A) W& M
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-28 18:33 , Processed in 0.039218 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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