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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
  f8 b1 `+ ?) K! x# ?' z; F
  1. [code]EDMA sample test application
    9 C2 w( J! g5 J" v
  2. /** }+ I6 K  u8 i5 n
  3. * edma_test.c
      a+ t! W3 B" e: r
  4. *' m3 `0 @5 y3 s
  5. * brief  EDMA3 Test Application
      k6 O4 ^2 K  N5 i+ J# @
  6. *
    ! d2 V5 t" Y- T: T  {
  7. *   This file contains EDMA3 Test code.7 R" i3 b3 O  \, D
  8. *
    * t) T' A" ]( ~2 T# r- F- I
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    / T. e+ [6 G+ ~" |( G+ m0 H) c
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    9 k' i9 j; G2 h$ f: }2 [
  11. *         TO CHANGE.$ G) K" }3 z& n. G5 R6 b4 Y3 `
  12. *+ j. U: u5 J0 t3 i( [; {: y
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    % H; V" x0 I' {
  14. *
    1 J" T) E& X! u/ x% w
  15. * This program is free software; you can redistribute it and/or+ H$ n0 i& {6 q: [: R3 \
  16. * modify it under the terms of the GNU General Public License as
    / y0 b3 x: q0 {" a" A( C
  17. * published by the Free Software Foundation version 2.+ p+ b1 E9 d1 L) l
  18. *# @7 j7 T7 e9 N9 h1 f. j- A
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any! D! l' P# B! }
  20. * kind, whether express or implied; without even the implied warranty
    / c; v1 e; s1 r( ]" [- `- [
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the) \7 V: `' E) \9 g, S0 U" [: @5 X
  22. * GNU General Public License for more details.
    " f) O$ r) r/ Q& f8 b9 ^& j, s
  23. */
    8 Q- A7 ~4 e" C4 Q  @8 ~
  24. $ k6 x& q/ T- k+ A
  25. #include <linux/module.h>7 w' Z' M: h; w# G( z
  26. #include <linux/init.h>
    0 ^! r& {; P) F$ @8 u
  27. #include <linux/errno.h>
    7 J2 t/ G0 {) E0 a2 S  k8 O/ g
  28. #include <linux/types.h>
    6 _9 m6 J: X# d0 @' _0 x  s. J9 u
  29. #include <linux/interrupt.h>$ V: e" L' J/ J2 ~
  30. #include <asm/io.h>
    3 _0 x+ H& p. a6 M+ F
  31. #include <linux/moduleparam.h>
    0 c6 f! }- M0 q. ?
  32. #include <linux/sysctl.h>% q; c. o  @0 W
  33. #include <linux/mm.h>0 U$ v$ C% }4 c7 d3 g: w
  34. #include <linux/dma-mapping.h>
    $ s7 g' Z' b) L
  35. 7 F2 }% P$ g. C6 N2 A
  36. #include <mach/memory.h>
    % ]& O  [9 g0 i0 ]  a1 h
  37. #include <mach/hardware.h>
    ! v: q7 E- h. l% n4 B# ?! v
  38. #include <mach/irqs.h>7 h( N4 P. U" X0 q5 \" f
  39. #include <asm/hardware/edma.h>
    2 L/ D8 S( U+ H0 s$ V
  40. - @/ \% _  Y; ]- v% Y/ W  I, I1 C
  41. #undef EDMA3_DEBUG
    " N* {: o- ]' u' X" C
  42. /*#define EDMA3_DEBUG*/6 ?6 q% C9 p3 T$ @$ @

  43. ; u' T) [5 u8 ^' {9 E8 x1 d
  44. #ifdef EDMA3_DEBUG
    % Q0 H' Z, _' i( |/ H
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! p( k" N3 c- S6 E) @" x# H+ f7 n
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    % ^2 x; ?' q# X0 K% k; y( r$ @
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    2 F9 {1 u3 q- i- y- n) n
  48. #else
    ) Q+ b" A& I3 y/ z1 V
  49. #define DMA_PRINTK( x... )
    2 [8 M9 D- q$ R! _
  50. #define DMA_FN_IN& a0 B+ b9 n  L, t8 b
  51. #define DMA_FN_OUT, x/ ~+ E3 F0 S4 e. C" m7 z
  52. #endif' G* D* e# U. w: E! A/ y6 s! ~

  53. , M6 a1 @+ {1 D4 {) o
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    0 m; P( U6 |# Z; r, g9 e2 n
  55. #define STATIC_SHIFT                3" O* x$ p2 E$ N. H0 l1 l1 U3 `
  56. #define TCINTEN_SHIFT               20
    4 Q4 R4 s7 M9 g  _2 h' N
  57. #define ITCINTEN_SHIFT              21
    : Y; x, J, J( H, k, L
  58. #define TCCHEN_SHIFT                22
    ) {, L/ o3 Y; {0 V, p4 T$ c; S% E
  59. #define ITCCHEN_SHIFT               23
    * O& ]9 U3 ~8 ]3 ?  ~1 c" d

  60. * D3 {( w1 Y8 Q# V  |( D
  61. static volatile int irqraised1 = 0;
    ' |& z' z8 c6 U/ p4 y4 M( A) K
  62. static volatile int irqraised2 = 0;
    : r% \9 I  O0 F' m4 ~

  63. , k1 x+ j' d, J
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ p1 I* F2 A% I+ _
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 F1 k9 }0 l  E. w1 n) \* r
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ N8 V; u- m$ X

  67. 9 a6 V/ r* Y" E; J
  68. dma_addr_t dmaphyssrc1 = 0;* x! D% W2 E: w3 @; V! L& X, T7 N" k
  69. dma_addr_t dmaphyssrc2 = 0;
    1 ^2 p) E( @: P0 _  y& n1 \
  70. dma_addr_t dmaphysdest1 = 0;9 ]  c( F$ d4 M# T
  71. dma_addr_t dmaphysdest2 = 0;
    2 V: J/ o; \8 U% e: j0 \
  72. 6 }9 m2 q- q: q. n
  73. char *dmabufsrc1 = NULL;
    - c  _! z! l9 ]# i
  74. char *dmabufsrc2 = NULL;0 y) T* I2 a5 K. |# \9 \% F
  75. char *dmabufdest1 = NULL;/ U/ h- X& Z  N4 K
  76. char *dmabufdest2 = NULL;
    ' ?! G# h' r/ I$ D$ `8 R# `' y

  77. / H& }) j3 ?* o" b, K' |
  78. static int acnt = 512;  l/ K) x! Y  m; v% W
  79. static int bcnt = 8;& I$ d) ^! O# g9 `9 x, v& {
  80. static int ccnt = 8;1 \5 T* |1 o4 Q9 L1 l) b

  81. " [; f! `( t, ]
  82. module_param(acnt, int, S_IRUGO);0 p% n9 \& o: j' c& F9 X, @
  83. module_param(bcnt, int, S_IRUGO);1 b$ {& |  r( I/ \, W! X* z$ t
  84. module_param(ccnt, int, S_IRUGO);
复制代码

0 d, E$ Q, n0 |+ i/ z+ g3 J
7 ]# u' J" `( f* |      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 X+ y) L0 {& p# @+ O  A1 karm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# l' v8 L4 v5 N- u. R     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 {# Q. U- n* Y  N
# ~0 J: o6 |% e
( n! e0 Z4 e4 c. U8 I4 g' z$ j8 Z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-14 02:01 , Processed in 0.039866 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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