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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, \# y+ Q, C3 i5 r& v/ I# V9 c  Q% k
  1. [code]EDMA sample test application
    9 @4 T+ [0 P, W6 P- u
  2. /*7 g- l! r6 {4 s* I! ]( j' @
  3. * edma_test.c
    % R' [$ v( ?9 ?
  4. *
    # p& i: x1 b: l& `! Q8 y# {1 {
  5. * brief  EDMA3 Test Application0 u4 R9 D: n/ R: A
  6. *
    + D" a+ A6 U) t. I  V& ?
  7. *   This file contains EDMA3 Test code.
    7 T' K( ?) @, I' {" e% ~" s) x6 D
  8. *- D" @3 @/ G4 P/ }6 H
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' z5 p7 _9 j, M3 F4 \' s* M9 U
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( C$ p. Q) d6 q$ D
  11. *         TO CHANGE.2 m* C; A4 S4 _
  12. *6 w% j& d2 F/ Q( g$ T
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    . f# G" C* l$ Z1 }. n1 |# B
  14. *9 N  k4 D$ C" H: e) v/ {$ s
  15. * This program is free software; you can redistribute it and/or2 Z; \  u4 Y& C/ |1 M
  16. * modify it under the terms of the GNU General Public License as  Z6 L3 I8 n, g) d* ~
  17. * published by the Free Software Foundation version 2.$ i/ r# q7 D# @" b, u& M
  18. *2 V' K6 u6 f( T$ t6 R' Y9 q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any! b: O/ Q: @  k% m4 C. T5 v0 i& @# X
  20. * kind, whether express or implied; without even the implied warranty' p  F) ~+ }. M5 m  g6 F% e# ~
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ; w$ B4 {/ k# p
  22. * GNU General Public License for more details.9 W3 z- W* u4 @' k3 l
  23. */
    $ Z" e" N4 T9 o) @: q1 v* E

  24. & }: L0 y3 a" v; B0 ?+ a
  25. #include <linux/module.h>; Q$ \1 }$ k. n" y' q: y
  26. #include <linux/init.h>
    . y( L  Y1 ~2 l0 M* i& [
  27. #include <linux/errno.h># b/ l" y6 l% C
  28. #include <linux/types.h>
    % J/ v. E  A' s# F
  29. #include <linux/interrupt.h>
    : P& u  E$ z% x% [* c( v
  30. #include <asm/io.h>
    ) L7 F% ^- v1 H3 d
  31. #include <linux/moduleparam.h>
    3 ?0 U+ G- P# t0 [( c
  32. #include <linux/sysctl.h>
    , I# ~, a, |4 N  u- C; y
  33. #include <linux/mm.h>
    ; C3 N5 J9 V; j! n
  34. #include <linux/dma-mapping.h>! J6 o1 ]: u; `

  35. : u% p" a7 a/ z: f  y7 O! {
  36. #include <mach/memory.h>
      ^& `% {: C8 i3 ?
  37. #include <mach/hardware.h>
      r7 L% Z& q3 V1 E. \% j7 a
  38. #include <mach/irqs.h>, `+ s4 ^' ^( `5 ^+ a* t) ]
  39. #include <asm/hardware/edma.h>
    , p% ?8 `% b$ v: m1 G
  40. * i. \& P5 R" L  w( }) m
  41. #undef EDMA3_DEBUG. [; s5 a9 ?/ ?( p
  42. /*#define EDMA3_DEBUG*/7 O( \" s5 Q& A

  43. 7 d$ _3 E& _! e% y3 u
  44. #ifdef EDMA3_DEBUG& Y3 ?3 l" Q$ r
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    2 X3 H& |* ]6 Q! \0 P) Q4 M
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    : o1 ^% U7 y- p; p% ^
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): n3 Q* q7 w3 x8 m# T4 u2 B
  48. #else0 ?; o4 _4 T$ |
  49. #define DMA_PRINTK( x... )
    ) q( X& z1 ]6 Q: d) G- y* J( n' m# Q
  50. #define DMA_FN_IN
    . g2 y$ i- r% S" ]0 k. x
  51. #define DMA_FN_OUT
    - ?1 Z, O6 ?! _" ^5 `. T
  52. #endif+ u; K8 s) Y% @
  53. 6 U- }4 R4 [7 Q* f+ B- L6 j
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)& I' K" q* W/ d
  55. #define STATIC_SHIFT                3
    " ?8 F0 C1 C( O" c- i
  56. #define TCINTEN_SHIFT               20
    ! }+ `7 ^$ H8 ?9 J3 d
  57. #define ITCINTEN_SHIFT              21
    ) y6 F) ?; Z  x; u% a7 A; n
  58. #define TCCHEN_SHIFT                22
    % q- {& y7 H: d2 y+ P4 x
  59. #define ITCCHEN_SHIFT               23/ V# T* F- H$ O8 X2 d3 K
  60. " K- o! ^: P% P6 I
  61. static volatile int irqraised1 = 0;
    / Q2 {. ~/ M7 r
  62. static volatile int irqraised2 = 0;% ?/ L7 Y0 t3 n3 T) f: l

  63. - {7 p; t; k# |- h4 z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " v; g( u) u2 F1 ^" a3 o
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 _% v6 {; U1 H6 J
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 G7 b5 f3 t2 h7 ]9 _8 y" L

  67.   x: \  }! Z. s
  68. dma_addr_t dmaphyssrc1 = 0;
    8 ^. V/ \  w; G4 L8 {; u
  69. dma_addr_t dmaphyssrc2 = 0;3 Z* `# F  n4 K4 M+ {
  70. dma_addr_t dmaphysdest1 = 0;1 z- H& F4 _# ]- m4 j; I; t& K
  71. dma_addr_t dmaphysdest2 = 0;
    $ X9 K4 Y. y8 w

  72. . \; p% F6 r1 `; Q6 ^: u- a
  73. char *dmabufsrc1 = NULL;7 @2 s2 j* |% Q
  74. char *dmabufsrc2 = NULL;, Z) S; m3 V, A
  75. char *dmabufdest1 = NULL;
    4 C8 ?) c$ k' x6 I
  76. char *dmabufdest2 = NULL;# ?: p. R7 R2 \- @

  77. ' \4 k0 H( \# a
  78. static int acnt = 512;
    + n3 V0 @$ C1 e9 f# c3 `0 y
  79. static int bcnt = 8;- Q- b/ s! o9 A4 |$ D2 Z; X8 _
  80. static int ccnt = 8;* Q2 f/ N- C+ h9 B5 ~  }
  81. ! A  W  ^. Z2 @
  82. module_param(acnt, int, S_IRUGO);* D6 n! N: ]; }' C# @
  83. module_param(bcnt, int, S_IRUGO);: R7 u- O: D3 r& _/ i% ^
  84. module_param(ccnt, int, S_IRUGO);
复制代码

5 |2 S( H5 ~* X5 {" A9 _; B1 e, m  S( l. C
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# f% }) M. X8 q3 p. l
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 l$ }4 @8 `& m% k" C     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( |; f& U5 q( e; H( m, @
, z/ f( _8 N: }) ?0 v

7 F1 g" B& a* z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-12-6 06:05 , Processed in 0.040368 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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