OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑   V* U7 S( r7 W- ]' Y; N0 h
  1. [code]EDMA sample test application
    ! l- e6 Z3 w6 G; o' T1 S  A  g
  2. /*; ^( ~* u2 ~" j: @' M/ D8 ~
  3. * edma_test.c
    ' ]3 l+ w$ Z: ^) f
  4. *' N2 R0 k' \+ |0 M
  5. * brief  EDMA3 Test Application
    6 @: k( W* n: ]3 G
  6. *
    * v  B2 v* X$ s/ _, A: W1 K4 Q( @
  7. *   This file contains EDMA3 Test code.) F  y& `% U1 |3 M! E  q1 N
  8. *( r- q" \" I9 e2 u* _; J
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 j3 V, B2 U* q- |7 |9 \0 T
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    0 x6 J# X% q" ]+ k* H  ]
  11. *         TO CHANGE.
    9 _9 c5 E3 k& J2 L- m3 L
  12. *; i: M- h* O- e4 Z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    1 l  e+ g' A/ P6 K' L1 s/ p1 W
  14. *' H" _, W8 [& Q. T6 E" f. I
  15. * This program is free software; you can redistribute it and/or
    % o/ H+ e# E6 [) v" G) R1 S6 e
  16. * modify it under the terms of the GNU General Public License as
    , Y9 G& f) v+ W$ {: P+ m
  17. * published by the Free Software Foundation version 2.
    : Y, E4 `1 x; _# V
  18. *6 H5 k- X& F& ^/ u
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    & s5 `+ ~% \. t' v" f9 V& E: S, K
  20. * kind, whether express or implied; without even the implied warranty
    $ u$ L" L( Q& Y: g0 W. ^& H$ W
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the. Q# _9 z  L, b3 N4 M3 y
  22. * GNU General Public License for more details.5 u7 `4 c  E% [- n" n* O! Y$ v$ c6 |! O0 y
  23. */
    : \3 n# [# ~4 I4 B, H
  24. & H9 _# P5 t1 d; r' B
  25. #include <linux/module.h># |" B6 q- K( ]/ P( _$ N
  26. #include <linux/init.h>0 Q0 k& P' S/ Q" T/ @/ e
  27. #include <linux/errno.h>
    - @/ @0 s( T: C
  28. #include <linux/types.h>8 \  I* ?* a7 i
  29. #include <linux/interrupt.h>  k- T* ^/ w( i/ e
  30. #include <asm/io.h>3 o' y, o0 }6 b) A: L! c. J4 Q
  31. #include <linux/moduleparam.h>
    3 \3 ?+ E) ?5 o8 g
  32. #include <linux/sysctl.h>
    3 m- B' x! ?: n  ^
  33. #include <linux/mm.h>
    2 h. E2 m1 C' d* V
  34. #include <linux/dma-mapping.h>
    5 l, X+ h8 e# T6 F' c/ q7 p
  35. $ W! U6 x- |+ `& v& x4 ]
  36. #include <mach/memory.h>, L! p$ o4 c, L1 v0 I2 |
  37. #include <mach/hardware.h>6 E: J9 Y" ^$ Y9 H  C5 x* ]5 D
  38. #include <mach/irqs.h>
    " H6 B5 T  J  A7 |, ?$ \! W- L
  39. #include <asm/hardware/edma.h>
    5 h7 ?9 w" [& k. I8 q

  40. 2 B% z, |& b2 [( n
  41. #undef EDMA3_DEBUG
    8 [  n6 K8 X$ e6 j# C
  42. /*#define EDMA3_DEBUG*/
    $ G" |  c4 M4 Q1 Z0 h1 m0 Y

  43. / S2 h6 |1 r. D) z6 }; Q
  44. #ifdef EDMA3_DEBUG+ r' v1 K) S2 f5 [3 L$ U3 T
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). I3 N* K9 N' L9 S
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 o4 V- d" q; V
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 A% n  Z2 j8 p" N9 F5 M
  48. #else
    0 q7 Z4 j1 G9 J" B+ [- k6 y
  49. #define DMA_PRINTK( x... )
    0 Q' s, ]. ~  ?0 ]
  50. #define DMA_FN_IN% }0 N4 z: f6 v/ G
  51. #define DMA_FN_OUT
    . z# }$ E6 F' F% E- s. v
  52. #endif
    8 {, t8 \! U( w9 J

  53. ) u& Z% g2 v; X0 N; g  |: n! |
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)/ z2 E/ i/ P: J# g/ @
  55. #define STATIC_SHIFT                30 Q0 Y* }' d4 a9 [# c  Z
  56. #define TCINTEN_SHIFT               20
      `1 ^' f- m' z* M4 _* ]
  57. #define ITCINTEN_SHIFT              21
    . n. ^) A) X; t& H5 s9 L+ }
  58. #define TCCHEN_SHIFT                22
    9 c. A; Y/ |6 E
  59. #define ITCCHEN_SHIFT               23/ {6 P& `9 c# ~( [0 d

  60. ) @( v! T3 g2 Q% {: h5 W
  61. static volatile int irqraised1 = 0;* g5 H6 \; H$ o* ^; X! p3 S6 m1 V
  62. static volatile int irqraised2 = 0;
    + H- X5 A9 e( v7 k
  63. * P% {6 e9 g+ P. T3 h. P% X$ L
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 G7 e# M/ ^  s
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 q5 n' ?/ F- G( h( e
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      t& i- E- J5 \

  67.   j% Z$ y" v! z* ]& D
  68. dma_addr_t dmaphyssrc1 = 0;
    % W, c/ s4 X2 ~: p$ t4 r' r$ q3 c
  69. dma_addr_t dmaphyssrc2 = 0;
    9 x8 u/ X) b/ g" k: @
  70. dma_addr_t dmaphysdest1 = 0;! s9 |2 Q; f- {$ N& y1 Y
  71. dma_addr_t dmaphysdest2 = 0;
    ' x' B$ j5 J0 _* ?* }8 x; S! L
  72. - m$ F; C5 L% u* i: `- z. j
  73. char *dmabufsrc1 = NULL;0 a9 A3 o1 Q) N: T. e
  74. char *dmabufsrc2 = NULL;
    1 Y( `  R. _; ?' F
  75. char *dmabufdest1 = NULL;
    0 A* l% D! ]4 s! ~
  76. char *dmabufdest2 = NULL;( a1 J% B2 f7 V; I9 Y$ b

  77. % J: C$ _5 p3 W3 ]4 n
  78. static int acnt = 512;
    / c0 z( N0 S* T: ?( K0 g* C
  79. static int bcnt = 8;! }' P  t6 b: @: C( R% i
  80. static int ccnt = 8;
    ) f6 _6 }% x) e; t( M) b, |; |7 P6 r5 N

  81. & T" `" C3 v3 H: m" o2 h( L
  82. module_param(acnt, int, S_IRUGO);+ T! h, t6 W) [$ r0 E+ l7 _
  83. module_param(bcnt, int, S_IRUGO);
    5 m* c  Z8 `1 M
  84. module_param(ccnt, int, S_IRUGO);
复制代码
- V2 Q" u. g+ q$ Y3 u5 W  u
: e( E" `3 b- Q  j- G
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) X7 A) C! I; g1 c1 h7 C
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" q: e( }' h, s2 E) [  |- e. o0 k
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* h" c" x6 C. K
$ Z& _) P/ J3 s7 _, p
7 i# n  \! A  T' M
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-2 23:42 , Processed in 0.038196 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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