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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% y% B8 O( L2 v' q3 d
  1. [code]EDMA sample test application
    , g, P4 \% F  A7 I9 a
  2. /*  \1 d6 F, Z$ a% \, L0 C
  3. * edma_test.c
    * I/ i  x" x- Q/ i
  4. *
    * W: d! z3 Z9 S1 B! k
  5. * brief  EDMA3 Test Application
    ! y! M2 [( L1 n; G5 ]" w, s
  6. *
    4 k) W4 [1 F6 \# S
  7. *   This file contains EDMA3 Test code.
    . V5 h2 D: e* y# X3 o( Y1 |
  8. *2 z# ?3 v$ l% b1 _
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    - l  U2 K& B5 u5 N; B- f
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    - Q: _6 I6 V  y1 i8 x' ?- J/ @3 B
  11. *         TO CHANGE.
    * H9 i7 R, c! x' ]% O7 v6 S
  12. *, f0 X. r9 B( ~7 i
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% Q* N' D3 x6 t/ Y! G! x- K( t
  14. *
    ( C4 o  y( |3 X0 f% `* H2 l
  15. * This program is free software; you can redistribute it and/or6 g7 @9 x( l* H% _) k+ Z
  16. * modify it under the terms of the GNU General Public License as
    / B* U5 }2 ^2 B, ?- g8 O
  17. * published by the Free Software Foundation version 2.
    * `& f0 k' i3 N! Q! U8 a7 u5 i- K$ g5 J
  18. *
    + H% `2 c- E4 Y* l* S- @2 c' E7 {
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    8 k! h1 T* r1 W+ s1 w) R
  20. * kind, whether express or implied; without even the implied warranty
    ' _' r0 O1 |) N! m* g+ ~( \  ]: G, k
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ; c) u+ F: H: u. C
  22. * GNU General Public License for more details." [* N: T; \) ^# N- K
  23. */( x5 c: s1 W& `5 U( S! d2 x+ R( Z+ l
  24. 3 B8 }. q/ H# ?3 H( z5 ]
  25. #include <linux/module.h>
    9 X8 M9 T% k2 X3 b6 a; T
  26. #include <linux/init.h>
    ) R* u9 x) t' x% u8 B/ ~
  27. #include <linux/errno.h>: D' q4 L# ~, d
  28. #include <linux/types.h>
    & L7 i: J1 |: c: Z. G
  29. #include <linux/interrupt.h>
    / w, T& Q, i( |& W/ N, H% V( Q
  30. #include <asm/io.h>0 ^- T6 Y5 N; X
  31. #include <linux/moduleparam.h>6 v1 K1 B  s8 _; M
  32. #include <linux/sysctl.h>' n. I! K+ d/ r% f/ N& t, j+ a
  33. #include <linux/mm.h>. l8 \5 i/ c, c! u2 ^
  34. #include <linux/dma-mapping.h>
    9 Y0 s: X# K  n# Y1 b
  35. + {6 t' @8 H+ n( v; g
  36. #include <mach/memory.h>
    + B  s9 w, h  P0 Q2 d! b
  37. #include <mach/hardware.h>* o0 Q+ H- `5 P1 `2 Z: y0 S  b
  38. #include <mach/irqs.h>
    + _6 D2 w, g- B0 u4 Z0 s
  39. #include <asm/hardware/edma.h>
    4 d6 N, d8 m  m) y: \, a  M. i

  40. : b6 D% {4 i% b% @2 s/ p! d; H# Z
  41. #undef EDMA3_DEBUG
    * z+ s  w( N9 b6 ~
  42. /*#define EDMA3_DEBUG*/2 _: K& T) f1 X" k: X9 T

  43. + o0 B* F0 [2 B; B) O: V
  44. #ifdef EDMA3_DEBUG, D, f4 M. B/ t8 I1 F. L( u
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    + D. X: i7 C# b: _! G
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    * H% p; F2 S5 w; J" R# e% d/ ]2 H1 G
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    . H* u! }$ k9 ^8 p# Z
  48. #else
    , R2 K: z$ G4 R/ {9 @+ [" v
  49. #define DMA_PRINTK( x... )
    ! a) S  b4 b9 ^2 B- s% I
  50. #define DMA_FN_IN
    4 J0 |4 e, O4 B; h
  51. #define DMA_FN_OUT: z! _- a, @9 J# L+ ^! b
  52. #endif
    ' B/ }8 I; {1 |5 M1 [" q3 E3 s  ^
  53. 2 p6 u% U! y: Z) h
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)  p, w' p( e' ]& Y3 @1 s
  55. #define STATIC_SHIFT                3
    ' P* |8 c! Q& ]+ p' T- N
  56. #define TCINTEN_SHIFT               20
    7 P5 H5 o' @1 B, J( f# h6 _
  57. #define ITCINTEN_SHIFT              21
    1 @6 s: c  L, j5 M. Q, C3 N5 R9 ^) N2 m
  58. #define TCCHEN_SHIFT                22( w" Z7 I6 j& _0 c: r3 R- Z
  59. #define ITCCHEN_SHIFT               23
    - O7 D1 t7 @& Q; {& R0 k& \

  60. $ c% _. R9 c3 h, e  d
  61. static volatile int irqraised1 = 0;* Q6 t" N% U1 b4 @% K
  62. static volatile int irqraised2 = 0;
    7 T: i* H, a$ R  }) \
  63. 9 t" O" @3 u1 J) t
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 `( l, n0 J3 \$ m7 |1 w
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; a# h+ A8 `  x1 J" Y% w. O/ p
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; N3 j+ e/ O0 M2 r
  67. % z/ p' m0 Y/ d
  68. dma_addr_t dmaphyssrc1 = 0;
    ) H; H5 @7 ]# [5 E
  69. dma_addr_t dmaphyssrc2 = 0;
    , u! r# c, X8 e1 y' M8 [
  70. dma_addr_t dmaphysdest1 = 0;1 K+ S' s+ ], D- b3 H, J
  71. dma_addr_t dmaphysdest2 = 0;
    / H: f/ |) j9 J, d3 g! r* L
  72. + w' G8 W- g9 o! g" l( g0 F7 T
  73. char *dmabufsrc1 = NULL;
    5 x" Z( r8 E$ V# z9 q
  74. char *dmabufsrc2 = NULL;' R  y3 m! D) \  z! ^% u: O
  75. char *dmabufdest1 = NULL;
    7 s# {, _6 D: |4 o
  76. char *dmabufdest2 = NULL;
    ! G' u9 Y3 h0 F% s
  77. , j/ B4 ]+ i5 u* s
  78. static int acnt = 512;
    # y5 p  A( d/ H8 i% B2 s3 z8 h" l
  79. static int bcnt = 8;
    4 q( `* H8 A4 s0 A% w3 c
  80. static int ccnt = 8;: ^3 Z" j2 x" c. t" I+ u4 O

  81.   Y7 Y7 A/ i5 J5 d7 e9 _
  82. module_param(acnt, int, S_IRUGO);
    3 j! Z+ a6 o5 Y& l
  83. module_param(bcnt, int, S_IRUGO);/ Y9 a$ n* v5 i. O/ r  D9 O7 m4 d3 U
  84. module_param(ccnt, int, S_IRUGO);
复制代码
5 j$ l  _% f9 ~" g$ a; {

3 k+ l' L, z) Q/ v      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 j3 [/ }* w8 V$ e  M! Marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# i! e. k" U: s. U* O; |
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 R9 d8 w* p/ X9 K! \) r
7 X" ~2 \, h$ l! m. o6 G8 d: B6 o
6 F+ L' Q2 r; s/ P
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-27 22:53 , Processed in 0.040098 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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