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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; I: S) A5 I6 G& `; g2 W, s
  1. [code]EDMA sample test application5 _# l; K) Q/ A6 ]
  2. /*( J% \9 B* I8 F' G4 P( q
  3. * edma_test.c! U( J# Q8 W  j0 O( ~, v/ W
  4. *
    # k! e. g, ?9 U& o3 W. R+ w2 a7 s* w) M
  5. * brief  EDMA3 Test Application; _" z& A) M- ^2 m% d% E
  6. *1 M2 K* P! f8 L) Z  A& g
  7. *   This file contains EDMA3 Test code.
      w, B4 _/ A9 t. u6 j, l  e- X
  8. *
    1 z2 u3 Y% S1 }3 k3 ~
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    - ^' j& Y1 m7 E( i6 {
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    % X; w" T0 G! L: c! A
  11. *         TO CHANGE.) q! u3 u$ P4 j) |$ T0 T
  12. *
    1 ^* P- l9 A0 p# S" W8 _+ \- B# }
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& e( g+ J3 l4 N. o
  14. *  m* @, P4 K, g" O5 S2 H1 m  Z
  15. * This program is free software; you can redistribute it and/or
    : m; C$ ]! D$ n# Q0 m
  16. * modify it under the terms of the GNU General Public License as
    " G- n1 \. M9 o5 G4 _/ h
  17. * published by the Free Software Foundation version 2.* P! w3 L  N; \/ ?
  18. *$ J4 S, R1 b& _( J: U
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ( ]% q; Z  Y/ C3 T0 ^
  20. * kind, whether express or implied; without even the implied warranty
    / a: x1 F/ \- H& }
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the% k' C/ W4 |2 Z2 `( k; j) D
  22. * GNU General Public License for more details.7 }" _- b+ [+ X
  23. */
    ( s, c0 O* q* B

  24. 4 l6 n* d0 o; V2 w) s1 C
  25. #include <linux/module.h>
    & H+ h7 A% A) p
  26. #include <linux/init.h>
    ) I' e) {5 H; E1 U; |
  27. #include <linux/errno.h>
    ; o  g2 ?; F. |5 S: \! I3 f
  28. #include <linux/types.h>; O7 m" Y* K! o! d
  29. #include <linux/interrupt.h>% ?6 W$ K; E; s) o4 A0 v
  30. #include <asm/io.h>
    1 m, L6 ^6 O# p" H0 I" d: |
  31. #include <linux/moduleparam.h>
    9 _; N9 t. l; \. Q6 i
  32. #include <linux/sysctl.h>
    ! c& B! n9 w' [# Z2 D( o# o
  33. #include <linux/mm.h>
    - t# ]" T/ n! v  [" o6 }8 v, @
  34. #include <linux/dma-mapping.h>$ ~' x( ]& f3 G' X9 I% K( q
  35. , P' Q) T" f  D) u0 F" i
  36. #include <mach/memory.h>1 N$ a; K: w) r4 I
  37. #include <mach/hardware.h>, B  M5 q, I* |. B' `9 H: D7 j
  38. #include <mach/irqs.h>
    ; Y" t  J! s7 ?5 \* |
  39. #include <asm/hardware/edma.h>! e2 Y- G: F$ @! L5 M) ?& ?$ F8 u3 Z
  40. / W" o# `7 T0 a& W1 X- v' I0 h
  41. #undef EDMA3_DEBUG  G' y  {9 w+ s* A9 @* w; A
  42. /*#define EDMA3_DEBUG*/
    # R( x2 h: }2 s* u8 K1 s" E" P

  43. ) f" c6 B" T, u9 g# v
  44. #ifdef EDMA3_DEBUG
    0 q, V* ^4 q% L9 q; ^" d" D& E' V
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# ]( z) x, c! {6 s
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    1 d) L$ q* G% K$ p: L8 t
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)4 q) ]4 |$ F* o
  48. #else' I+ f8 ]+ V( S- M3 i/ W
  49. #define DMA_PRINTK( x... )2 S0 u  Q+ ~6 {5 e, K
  50. #define DMA_FN_IN3 v/ _" q: o1 C) }$ S
  51. #define DMA_FN_OUT3 a( M; |7 b  V* ]: c/ z! n
  52. #endif
    3 c# p* K8 A8 `  d
  53. 2 f4 t; B4 n1 D: i$ r  l  V9 W
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)4 h! N8 W5 ?7 v+ G
  55. #define STATIC_SHIFT                34 R: E4 p$ ^& G. m0 J4 {
  56. #define TCINTEN_SHIFT               20. \6 j, C2 r+ q/ S. O* V" {: v
  57. #define ITCINTEN_SHIFT              21# h& Q: z3 _* i" P) E# T
  58. #define TCCHEN_SHIFT                22
    * V! B- R0 l  z. I2 E4 O4 a
  59. #define ITCCHEN_SHIFT               238 Q  ]# r. F3 Q5 b! h2 d; ], X
  60. ! O2 a! V5 D8 _% A, o, `3 l! J3 a
  61. static volatile int irqraised1 = 0;6 b. Y+ [7 v- x$ T4 l! r
  62. static volatile int irqraised2 = 0;  u8 u8 C# U, P1 d! y
  63. * l1 p) {: E) G3 {+ N
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% S8 Z$ [" I- A  L0 N3 Q& i2 _
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 {8 a* M0 F- m' O9 o2 Y3 }
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 L, N  b7 ^: w. n+ g

  67. 8 O$ L8 V8 C9 Z/ T; a8 P2 L
  68. dma_addr_t dmaphyssrc1 = 0;
      z/ S8 z: _3 s. h. B+ K7 G
  69. dma_addr_t dmaphyssrc2 = 0;
    1 w, Z7 H" m& m; C2 P3 l0 Y* T! O- q
  70. dma_addr_t dmaphysdest1 = 0;
    % _; r+ }. G4 ^
  71. dma_addr_t dmaphysdest2 = 0;% k: A+ W$ {" X$ r/ Z; |/ t% ~7 N

  72. ) V/ |7 K6 m7 H  y/ j; ]
  73. char *dmabufsrc1 = NULL;# O) w$ |1 f* V4 h9 P
  74. char *dmabufsrc2 = NULL;5 V6 f% V; O2 C# B* D6 ?
  75. char *dmabufdest1 = NULL;
    6 B! ?. T; N% H
  76. char *dmabufdest2 = NULL;- }7 G0 C* D- y% Z

  77. & D8 f7 t+ Q/ N% f5 q. Y
  78. static int acnt = 512;% \+ ~3 h4 z& ?1 G. F6 K
  79. static int bcnt = 8;: J4 T5 M2 O- g) N' R8 e% [
  80. static int ccnt = 8;
    * d$ N4 y/ @: W3 N) u" C: ^

  81. 1 J' A, s7 x* ]- l' U; U0 U9 `3 q2 j
  82. module_param(acnt, int, S_IRUGO);
    4 K3 A$ d; w1 I* k" I8 X( R# i4 u
  83. module_param(bcnt, int, S_IRUGO);
    7 k+ T% ?- R9 O8 \. ?
  84. module_param(ccnt, int, S_IRUGO);
复制代码

; \1 Q+ s2 W9 K# T6 W- m
! w& T% o  J/ ?/ X      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" _$ v9 R9 K: c# K. G2 r" C3 Warm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。6 Q8 P  E  _) O8 d* b
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, e9 N  U: Q. R5 V' g
) T. ]7 n  h% x0 E' o* ^' r$ |, p4 H, r

1 a# U9 g3 x- l
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-27 20:52 , Processed in 0.039556 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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