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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: p- `6 K0 ~& e  y( q0 j7 X( z
  1. [code]EDMA sample test application
    * d& v9 r6 C& z! _" i8 W1 C
  2. /*
      g6 Q. s$ V# _8 s$ X/ T+ ~
  3. * edma_test.c6 x$ P/ Q8 N! D2 ~
  4. *& D! D% u4 U' B% Z! _! |% O
  5. * brief  EDMA3 Test Application
    9 `2 z0 @8 ]4 L3 Q" d. I1 q
  6. *4 N- V% J/ |  ]" ~1 g: _
  7. *   This file contains EDMA3 Test code.
    % n! R1 t2 G; `1 u' L
  8. *$ g8 a0 U5 X6 z. I
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    & [% v9 L  r3 {2 C
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    2 S) o% p; K" Z" D  B
  11. *         TO CHANGE.
    , k2 f. T$ L! N+ a6 e  O
  12. *
    # U$ `* F0 Q* T1 T. I# u2 _
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
      x2 d% Z% U; s: {+ v, T" U
  14. *
    3 o, a3 K. P' x
  15. * This program is free software; you can redistribute it and/or
    ! |! ?# R9 N: y, o, x5 C, z5 O# s
  16. * modify it under the terms of the GNU General Public License as
    - J8 A0 [/ w, D- D* g. R
  17. * published by the Free Software Foundation version 2.% M2 P! k6 Y7 ^' C
  18. *6 O" v. T, ~, K
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ M0 b, T! m* V! ^) D
  20. * kind, whether express or implied; without even the implied warranty1 @8 x# p9 T4 b3 |* r
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the3 @6 p0 W, U6 B; l5 D7 v. b
  22. * GNU General Public License for more details., M! a, i4 n/ w: F* y8 [
  23. */9 V- q  A4 |$ h2 u

  24.   {; z; h+ a2 V* m- Y& n, S
  25. #include <linux/module.h>
    6 m- q( @  G4 _2 i/ p- b. A* V
  26. #include <linux/init.h>3 [' Q+ ?) \) C8 u$ \
  27. #include <linux/errno.h>
    $ g  }& [/ s! C& b8 ~
  28. #include <linux/types.h>
    : g% T* O% L- |  r1 t% B
  29. #include <linux/interrupt.h>& |2 s/ \- `* T" I, o! q, g( r
  30. #include <asm/io.h>
    / r8 f  L5 G4 a- T, f' w1 u$ N
  31. #include <linux/moduleparam.h>
    / ^* C1 u! E1 t6 B7 k' [9 `" Z
  32. #include <linux/sysctl.h>
    # X/ k1 m2 |. D. m; M' c0 T7 o
  33. #include <linux/mm.h>
    0 T) X7 F3 p2 C* b
  34. #include <linux/dma-mapping.h>( K) T5 t$ I. J: a1 a# o/ \
  35. ' Y. c. e8 }! @( n- A& ^
  36. #include <mach/memory.h>) j% x' c6 d- c: f# w5 a7 g' }9 `, p
  37. #include <mach/hardware.h>
    1 E( C: i7 K& ?% v+ O1 E
  38. #include <mach/irqs.h>& R8 \5 {: D9 d. X' i  }  j
  39. #include <asm/hardware/edma.h>
    8 F2 ^& T+ s: y$ X% S

  40. * y* W2 \6 H- g. O  ~7 V) I6 S2 r
  41. #undef EDMA3_DEBUG$ k, y# m0 T! w! B+ S
  42. /*#define EDMA3_DEBUG*/, b6 L& d2 ^0 M: u  A) ?
  43. - V( S" z& g+ H7 M
  44. #ifdef EDMA3_DEBUG
    " D$ c7 y1 D0 i* j) S8 d1 p# G+ \
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& @4 z! G# E& D
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    + {+ o/ p2 p/ o. ?0 p
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    3 W( n( e1 o. J4 s. @$ l! @% K+ _
  48. #else
    8 X' t  L1 ?# C5 E
  49. #define DMA_PRINTK( x... )
    4 f; S: \- m9 \4 i5 |
  50. #define DMA_FN_IN& Y; _0 L; I3 ^0 ^" i( Q) o& e' K$ E
  51. #define DMA_FN_OUT1 q) o% M& {5 J$ G$ j# ^2 U
  52. #endif
    $ _: K6 J  ?5 l2 d* i
  53. + J% q) @( v4 I
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)* Z" R: T1 {, e9 v4 k# ^9 i
  55. #define STATIC_SHIFT                3$ S% M3 o* B( [1 D, j
  56. #define TCINTEN_SHIFT               20
    ( E& c* g& d9 {6 @1 k
  57. #define ITCINTEN_SHIFT              21- }. _9 v- p. w5 `1 q" K- s
  58. #define TCCHEN_SHIFT                22
    # w' m4 c% O! F) G/ S
  59. #define ITCCHEN_SHIFT               235 e. Z2 s+ o9 j' `

  60.   s) f' _* \, a  L( L$ j
  61. static volatile int irqraised1 = 0;
    3 f3 S8 f7 Q; P( K, E
  62. static volatile int irqraised2 = 0;' b7 n" `: }5 F: b! b6 _
  63. 4 U  i1 r/ v2 T
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 R/ w; s' _0 {3 R$ w8 |0 Y( t2 Y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" Q/ m0 Q4 _; ^2 c2 J9 `3 h# ?5 {
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " @! K4 U8 V9 v! `7 z
  67. * J; [. o3 ~- A' n- |* ~+ Z
  68. dma_addr_t dmaphyssrc1 = 0;/ y$ O9 ~+ q' b6 c8 U( U" t. c5 W; x
  69. dma_addr_t dmaphyssrc2 = 0;1 j! D  t$ v/ V$ I; y
  70. dma_addr_t dmaphysdest1 = 0;
    + F2 b0 _0 v( e" o; j- y6 L) F
  71. dma_addr_t dmaphysdest2 = 0;
    / \( L& m6 o* N& r% K" v9 I
  72. " I  d6 c0 A) V! v. B
  73. char *dmabufsrc1 = NULL;$ ?3 I' x2 K. v/ g' M% u
  74. char *dmabufsrc2 = NULL;
    , C; d. v7 }8 c, d% |" l0 k! l
  75. char *dmabufdest1 = NULL;
    7 R( A( Y3 X7 `. n
  76. char *dmabufdest2 = NULL;5 C/ ~0 ?1 K/ a! c/ y

  77. 9 n2 z) P% {* x1 p7 r
  78. static int acnt = 512;* e$ C2 f4 a9 u7 [4 D+ `' m9 S
  79. static int bcnt = 8;; @+ G9 t; h4 B& j7 h: j
  80. static int ccnt = 8;
    ; ?( A- O  q* W% I

  81. $ y7 _% Q5 T4 u- r4 p, U- y9 a+ {
  82. module_param(acnt, int, S_IRUGO);
    - |, w! ~" T7 o! ^3 m0 {
  83. module_param(bcnt, int, S_IRUGO);% m4 t% r" w1 i+ I
  84. module_param(ccnt, int, S_IRUGO);
复制代码
# }) D) T' ~9 M
2 H% _" U% v  \; V
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! b. b6 q; [- e& A( c8 x, n. M
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。% o1 m# l* G7 H  M$ X! d3 i$ V
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% x+ p: ~9 S# t8 s  B3 L, D+ G

0 q+ }0 p7 C6 C: [
6 m$ Z, c. ~( j! u: Q/ ^
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-25 02:38 , Processed in 0.044537 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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