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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % y- E/ c; X( i; l; Q" @, T; c
  1. [code]EDMA sample test application
    ! m+ P7 D+ T) P0 M+ F
  2. /*
    3 M1 Q  f& ]- }' }# _4 k
  3. * edma_test.c) X, h: o' B5 ^( S3 b/ b
  4. *" ~$ V% E( p" f& B7 D* T
  5. * brief  EDMA3 Test Application$ m# ?! O0 w& ?9 G
  6. *
    2 J0 `8 S  Q. v( n1 j4 X
  7. *   This file contains EDMA3 Test code./ D& B- W& D( f& c) D8 h6 x( e
  8. *
    8 b0 _: S1 y% E5 L- r5 X
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& g# V- p' Y( f& q, y% }
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    # @, K& K6 \0 F8 D# Y/ @$ J
  11. *         TO CHANGE.0 Q" k! Z* `( U& N3 M/ h0 |
  12. *
    . G/ r- `% s# Y* v
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 u4 y5 L: v8 m% {3 w
  14. *% l# D$ _& c' F
  15. * This program is free software; you can redistribute it and/or
    - s  O1 K1 Z# Q* Y4 p& U
  16. * modify it under the terms of the GNU General Public License as/ y/ p0 p/ B6 E/ F2 y
  17. * published by the Free Software Foundation version 2.2 ^* S8 ~2 e6 d2 K5 s. y0 Z7 H1 K0 X
  18. *
    5 Z- N' K) c, j$ m5 w
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    * _5 s+ w5 d' V5 L
  20. * kind, whether express or implied; without even the implied warranty
    - N- K/ |. B" G
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      D  J4 h' D& X4 F
  22. * GNU General Public License for more details.
    $ g+ `9 D9 Z. t- N) D7 e
  23. */
    - D2 [9 u, c/ ^- a8 L; Q

  24. 2 }# t8 U# ^# C/ z/ ~
  25. #include <linux/module.h>0 p" V8 H& q# x: x8 x% t
  26. #include <linux/init.h>1 `- Z. E+ f$ C) R: j
  27. #include <linux/errno.h>
    ; a3 G; I% @* y7 R
  28. #include <linux/types.h>. M, G9 P4 ~4 a7 u  j- O  |) |0 S
  29. #include <linux/interrupt.h>) y% Q* G7 e( M/ @3 N! m# i
  30. #include <asm/io.h>
    5 g" W8 ?, ?& x! x/ Z0 A; |, B  W
  31. #include <linux/moduleparam.h>" L" P% z- |: v5 ?" v
  32. #include <linux/sysctl.h>6 _  i, n. E" j# M4 E$ S
  33. #include <linux/mm.h>5 Q9 p3 S2 Q- ?
  34. #include <linux/dma-mapping.h># M; C# B* E2 ]- Q! s$ r5 U; N, \
  35. + b: m7 C6 K" N- ]
  36. #include <mach/memory.h>
    2 B, M' o6 K* Q6 B7 U3 d# ^6 w
  37. #include <mach/hardware.h>6 t& r0 o0 j0 r8 Y4 s  N% R( W
  38. #include <mach/irqs.h>5 G7 ~' |) F; f/ C4 G" h
  39. #include <asm/hardware/edma.h>
    * G# ~5 u( i2 o- ?

  40. ; E/ J3 U" K& n0 C8 P" X
  41. #undef EDMA3_DEBUG
    % r1 |* j0 u; g: ?
  42. /*#define EDMA3_DEBUG*/, T. _+ T3 U) c
  43. 7 g" P5 j: P, H- K
  44. #ifdef EDMA3_DEBUG
    ; D( @( ^' L, k; Y8 ?  s+ o5 e; q+ o
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    % }4 r6 X2 g+ v( i0 e7 d! M* t
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    + D9 Y/ c3 J3 o
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    % ^. U* D( x3 c& S! a0 v
  48. #else
    8 \: K5 d; S. V+ a1 c4 s4 x$ m$ N& W. P
  49. #define DMA_PRINTK( x... ); x, d: b/ E$ n9 D
  50. #define DMA_FN_IN$ v& R: z! D. k+ q
  51. #define DMA_FN_OUT3 D: l/ l0 X5 |. x  w
  52. #endif/ M9 }: Y. R- F, l

  53. / z2 @& F7 A+ u9 w) N8 k+ Z  U
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    . j4 Z8 R+ n- T) H
  55. #define STATIC_SHIFT                3
    " Q3 v. e- m; h9 p. }, r3 }
  56. #define TCINTEN_SHIFT               20/ v6 s" t  h* S  E% s" D
  57. #define ITCINTEN_SHIFT              21$ V* `7 w: H  x6 |1 S. Q4 b6 R& u
  58. #define TCCHEN_SHIFT                22
    # O  }$ t# Y" m* n# v! K
  59. #define ITCCHEN_SHIFT               23
    + e3 o6 a) n2 _  x8 |& Y9 X. I
  60. . W6 j, p9 d. s
  61. static volatile int irqraised1 = 0;
    / C7 `  |# t( R1 v" W
  62. static volatile int irqraised2 = 0;
    & [5 r5 [6 Z/ \+ U2 |

  63. 3 b: z" R& O6 X4 S9 ]$ ~' F2 ~
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( h+ D. [. [: g! ~
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- q* t+ n5 x% m" y) e- L; o; Q% v
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) ^0 D) k. R, U% S4 R  i. `
  67. ; n: U9 J! [2 d! x  I/ _, }3 p; x
  68. dma_addr_t dmaphyssrc1 = 0;" ]* i) @/ g: L) t: S) R
  69. dma_addr_t dmaphyssrc2 = 0;* T" _3 b8 p/ y$ @
  70. dma_addr_t dmaphysdest1 = 0;( s/ f: j% U& e! R: w
  71. dma_addr_t dmaphysdest2 = 0;
    , `* ~$ P, }, E) X: H/ _# }$ r+ @
  72. % y  W2 A" t# N( s% e) z) k# g& |
  73. char *dmabufsrc1 = NULL;: D  d# W7 @1 ?  L: J) F# k
  74. char *dmabufsrc2 = NULL;+ T4 ?2 z4 Y, r5 U4 l7 ~
  75. char *dmabufdest1 = NULL;- s; `+ o, j8 J- b% S0 g
  76. char *dmabufdest2 = NULL;
    ' Z7 P$ G! _( }" A2 q& b/ Q* b( a
  77. / E6 I; f( G2 s0 f3 W
  78. static int acnt = 512;
    1 C8 w: g  Q) b( w) S7 ~* M" ~
  79. static int bcnt = 8;% t8 m% [' X- `& _
  80. static int ccnt = 8;
    + X# K3 \& L7 }. M4 O

  81. 8 t5 {+ \- H8 n7 H5 p0 a7 n
  82. module_param(acnt, int, S_IRUGO);
    : [7 l" i9 g/ U$ F- a% A- U
  83. module_param(bcnt, int, S_IRUGO);& o% O% i5 G) U1 O, N8 v# ~0 o
  84. module_param(ccnt, int, S_IRUGO);
复制代码
0 S5 w: d& ~8 o$ \3 A7 }: o

0 m+ t, N) X0 b; v      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) i! \* ]! `% Z/ X  L! uarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 u2 ]0 E& t3 }& I' k. C' j     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 Y4 p! M, b. v, |: X( G4 ]9 w( |0 A. C  I) \

1 v. K. C6 D- p/ t+ {! h
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-3 01:10 , Processed in 0.038605 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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