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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , ~# G& `9 [8 p8 D: c: |" x& J* @( _
  1. [code]EDMA sample test application
    & n/ H" W, H! U
  2. /*' u: k+ Z5 `/ }! }+ t3 X
  3. * edma_test.c) }7 I# ?7 B) ?$ S
  4. *
    ' I: J* X9 p3 w
  5. * brief  EDMA3 Test Application
    6 `# N6 l. x5 D0 L! I- F% d: F( s
  6. *9 _9 a2 I) I: m. ^
  7. *   This file contains EDMA3 Test code.
    9 [; q1 I* w" C6 H1 i
  8. *4 M; m' ?2 M+ i3 ~8 }. T
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    7 r# [1 T) U9 V
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 |! o6 }6 @" e$ J6 ]: t  H; D
  11. *         TO CHANGE.
    . `* y# v' c, m0 a4 K. [- b8 q
  12. *8 R5 a0 }/ S. n+ W! _7 F
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    3 @8 Y: E! q4 v+ w/ U& S/ ?. \4 y; |
  14. *
    ( y! Q5 _: `' ^: ?: ]
  15. * This program is free software; you can redistribute it and/or
    6 Q5 r, J. e; t: v3 Y$ t
  16. * modify it under the terms of the GNU General Public License as
    ' i' n; Z8 A3 ~: S) M
  17. * published by the Free Software Foundation version 2.; l! g2 X0 g& e: N4 b' J
  18. *, n0 ?$ a# ^; M1 x  [$ Z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    / K0 c( I1 L9 ]0 b1 J  ~9 l
  20. * kind, whether express or implied; without even the implied warranty+ r. {2 W0 v$ Z9 Q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    + x! L/ S5 W1 O6 J# w( `
  22. * GNU General Public License for more details.5 h! k) j, c# b$ X7 S
  23. */
    ! M! M# r. w4 v

  24. ( N) K+ n% P) Y) F, a1 x
  25. #include <linux/module.h>
    2 ~& S* k( X# M$ K( y- ?: q5 s9 ~
  26. #include <linux/init.h>
    1 K5 ~& b6 o% u9 F
  27. #include <linux/errno.h>- B# x* z" b/ Z$ d
  28. #include <linux/types.h>
    ; q+ Z- q! r0 g% i8 x+ ]: G
  29. #include <linux/interrupt.h>6 m, {, T+ ^% y, {. y0 z
  30. #include <asm/io.h>
    9 Z$ X1 W' |) ]
  31. #include <linux/moduleparam.h>$ V( k& O3 n  x. W
  32. #include <linux/sysctl.h># O" E9 ~& s3 Z$ `, J9 R  ^
  33. #include <linux/mm.h>& }$ P# d. X% k) d( Y" }
  34. #include <linux/dma-mapping.h>4 t% @" o% g+ w0 u. u; L; n
  35. ' E2 p  c4 S7 a; s/ ~3 e# ]
  36. #include <mach/memory.h>: m0 g- n/ g0 H. F
  37. #include <mach/hardware.h>
    ' H+ w- F9 M. q$ P( p
  38. #include <mach/irqs.h>
    . D6 Y. h1 ~6 `( X  C1 ^6 n
  39. #include <asm/hardware/edma.h>
    6 G3 l( e+ `+ R; O/ x# B, y0 l
  40. $ O3 {" y5 }; G0 [7 J
  41. #undef EDMA3_DEBUG
    % h1 D. P0 ]3 Z% X# ^! i' U
  42. /*#define EDMA3_DEBUG*/
    ! u; E" s1 ~/ k3 u* s
  43. 5 R$ @8 r) |5 J: P
  44. #ifdef EDMA3_DEBUG; B4 L+ y) F: r: L" ?( R. k2 k1 l
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 T( W. K+ N6 U1 Z% ]
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    7 m1 I, w. w  F% Z! [. W5 a
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ Q! P) i: M( _
  48. #else
    $ Y, E! M& S: C
  49. #define DMA_PRINTK( x... )
    5 w6 D7 n" r: K; I& \. [) l$ ^$ A
  50. #define DMA_FN_IN
    7 t) L! D! j3 n5 ~% c
  51. #define DMA_FN_OUT
    " L: U: v! u" g  |1 E9 Y: ^
  52. #endif
    ) k& E$ {! _4 R& Q
  53. 3 ]- ?( S/ N, T: u) ]3 i( x
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    / C6 P! @( \( \/ K9 {8 y" ?. F: p
  55. #define STATIC_SHIFT                3) v/ C& A; V6 E# m& @# g/ ~) f
  56. #define TCINTEN_SHIFT               20: |2 x5 V: z% R+ ?* K
  57. #define ITCINTEN_SHIFT              21" [3 E& ^# A3 ^7 T2 I* V" n" O+ M
  58. #define TCCHEN_SHIFT                221 ~, s( p* N( ]$ G$ A3 I
  59. #define ITCCHEN_SHIFT               23
    + z& s$ X6 m; N7 D$ b
  60. 9 s+ R) [% _* h6 [: T
  61. static volatile int irqraised1 = 0;4 ]8 H3 @! m) H& D9 b
  62. static volatile int irqraised2 = 0;# e! o+ Z& D. J# L9 S$ X0 o2 Q: O
  63. ) I4 C: P9 l% u- e: N* F! g2 C$ c
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! C8 y' o9 ^3 V8 r
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + O" W! x7 p% F( Q4 G) Y! j4 }, ~
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 v6 K# c' A8 C( B& G% _

  67. # n  E: h, q; d7 C
  68. dma_addr_t dmaphyssrc1 = 0;' [# s. l# Q6 o
  69. dma_addr_t dmaphyssrc2 = 0;
    0 E$ u( H1 a) g* d* c1 ]$ I% \. _* o
  70. dma_addr_t dmaphysdest1 = 0;% \* b1 v9 P# `$ [- R$ x; m' @
  71. dma_addr_t dmaphysdest2 = 0;
    0 A6 E4 u  z# e' ?

  72.   V, Z9 A( s$ [9 p
  73. char *dmabufsrc1 = NULL;9 C" m: K$ g. q+ p
  74. char *dmabufsrc2 = NULL;
    6 r* X2 {* \/ s5 v+ _7 y
  75. char *dmabufdest1 = NULL;
    9 x6 S5 S6 e' C* y
  76. char *dmabufdest2 = NULL;# ^3 J6 U' q4 P# a$ g# A

  77. 3 _$ R* }- v& }8 Z# f# m, X2 K
  78. static int acnt = 512;" M8 k% D) w  `
  79. static int bcnt = 8;
    & J# }6 w# ~# w5 J; S; G/ I* S* X5 F( F
  80. static int ccnt = 8;4 h; z' T1 z% w8 H- M- Y+ ]* H

  81. . B! x' w- @" R1 s& V
  82. module_param(acnt, int, S_IRUGO);
    . B' I: A2 T' E0 l/ H: |5 b# V
  83. module_param(bcnt, int, S_IRUGO);6 g: s8 i0 F  P& L5 l: ^4 Q
  84. module_param(ccnt, int, S_IRUGO);
复制代码
0 j+ e3 {$ e: ?9 V* }

/ s) v3 S: c' N# l4 ^5 S+ R4 P      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) U+ P3 ?4 `, P7 z; V5 V; L1 ]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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
5 J( K3 ?& f7 K7 E     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ w$ c0 K9 F- a# l# W$ N2 O1 ?* g7 o2 a$ u  ~( O* o, S

0 ^' L+ @* T5 z: R3 G& Y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-10-18 12:47 , Processed in 0.045888 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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