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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( k* o9 U4 R8 }, u0 b* u* C5 a( g* Z
  1. [code]EDMA sample test application9 [9 C* }" [" h+ e8 ^. r
  2. /*9 }4 V0 ~; _. u
  3. * edma_test.c6 E9 j: J) b% d, l3 b
  4. *
    7 H: ~( W; A5 H1 k5 v+ Y2 L4 B
  5. * brief  EDMA3 Test Application9 w& \, X4 u. A) D! i( _! l+ y
  6. *6 N- A. K  b, \9 O( S8 w7 Z- ]# \) Z
  7. *   This file contains EDMA3 Test code.$ H1 J4 w' q+ w- w1 D
  8. *. ?4 G; N# w  x6 X$ S
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# Z. X1 h/ a! [2 F# A* K
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, U# m$ W) R# s  `0 e& E
  11. *         TO CHANGE.
    * f5 C% P6 {1 G" ^
  12. *( `3 H3 X( O' `/ q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ E4 s, U( m' b) C& `$ a% n% |+ @
  14. *" b1 Q+ X, B9 q. }: e
  15. * This program is free software; you can redistribute it and/or
    $ C0 T; N3 k& y
  16. * modify it under the terms of the GNU General Public License as
    5 i& r9 t/ E$ Q" O
  17. * published by the Free Software Foundation version 2.
    ; u4 ^( j8 q* d. t% y
  18. *
    3 @8 q% l6 S+ U2 p# [" ^
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    9 ~# F$ D7 ]$ ~$ a$ [
  20. * kind, whether express or implied; without even the implied warranty4 V6 A2 v" t9 _+ J$ n
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    7 M$ J; d; f$ ]; }4 s
  22. * GNU General Public License for more details.
    " j) T6 p& x8 i" M1 y
  23. */
    0 E. t/ y# x( r: |
  24. + m4 d' O6 V( D  j& Z0 W( W
  25. #include <linux/module.h>7 h/ g9 C& i* W; M0 M
  26. #include <linux/init.h>  i4 F5 J: Y( \+ B; g( L
  27. #include <linux/errno.h>
    4 D- M& q3 j  Y  w: f( h6 |
  28. #include <linux/types.h>6 D) o/ O% x4 d$ V- _1 @4 l
  29. #include <linux/interrupt.h>
    * t- u% r! }; c: `( Z. L
  30. #include <asm/io.h>9 c1 }3 N" [5 c* W9 A
  31. #include <linux/moduleparam.h>; k. N( h1 A! z) C8 H' E$ M: c
  32. #include <linux/sysctl.h>- N: Y% X& u8 t) m3 F
  33. #include <linux/mm.h>  L' i0 \7 V  ^
  34. #include <linux/dma-mapping.h>- Z# a) N$ _/ |5 L' |
  35. # O+ S/ x" Z% {+ J: M3 w
  36. #include <mach/memory.h>
    ; s/ [" g% B& m" j* h
  37. #include <mach/hardware.h>7 ^+ }' \2 @1 w1 k0 G& Y5 M  w! D
  38. #include <mach/irqs.h>' J8 n/ B) z" \* i/ C
  39. #include <asm/hardware/edma.h>  |2 h" n4 y* v2 c/ R

  40. 2 Z% r1 N) h- S/ d3 y. @
  41. #undef EDMA3_DEBUG* A/ M, i* L+ W! U8 j  H  Z: X4 F3 J4 g
  42. /*#define EDMA3_DEBUG*/
    . ]# I- `$ N8 M4 k1 b
  43. # C* ~1 Q2 p  U/ g
  44. #ifdef EDMA3_DEBUG* D/ I/ Q7 \, J  \+ Q* m
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): F4 l' Z: {; ?6 _) I1 f0 K% O
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    1 w; a* [; f- g0 Y8 X6 d
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    * D7 d" r% ~7 e
  48. #else
    * m% ~* k+ ~3 r" [+ B6 v/ c
  49. #define DMA_PRINTK( x... )
    , s0 {7 }% T) ~
  50. #define DMA_FN_IN, F1 X) B2 f- i1 h% W" u6 M
  51. #define DMA_FN_OUT
    3 g& [, u! A( u. x% I
  52. #endif5 }  E' \* w4 F
  53. . o' l/ A* k% W( ^
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)  A! x* m, y- r/ h' d% w( V
  55. #define STATIC_SHIFT                3
    / G, h6 D9 o* i' w& N; Z+ G- Y
  56. #define TCINTEN_SHIFT               20; t! a" f" V: @5 Y3 @9 j: I+ V
  57. #define ITCINTEN_SHIFT              21+ u( X9 I7 I* h
  58. #define TCCHEN_SHIFT                22; o8 m( K* l+ Z2 K
  59. #define ITCCHEN_SHIFT               23
    ' Z5 ?( `# C+ W9 p
  60. ' Y6 c3 P, m" w
  61. static volatile int irqraised1 = 0;
    % x) g. m+ T; _; e1 ]. N
  62. static volatile int irqraised2 = 0;0 W$ T  s/ ^  M0 l) q1 C9 F$ N9 E
  63. + m2 c) i' [' ^6 p+ u
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 L& c9 Q; j6 _
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 ]1 {. z3 l! ?3 s7 f' d4 J2 U
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 ?. I! X$ \1 Y! S

  67. 5 Z+ J# b9 }* ~6 S3 |6 p% D
  68. dma_addr_t dmaphyssrc1 = 0;! x" e2 d1 Y* ?& d1 ^7 V
  69. dma_addr_t dmaphyssrc2 = 0;
    6 Y6 g( `' }, f9 [' Z+ I
  70. dma_addr_t dmaphysdest1 = 0;
    ' L( `6 ~1 b  w, I+ j- |8 j
  71. dma_addr_t dmaphysdest2 = 0;) `! u% E2 L3 A. a+ O. g4 e0 P- p

  72. ; j6 I) H& T; ~7 s9 [' f$ G7 e- y/ r# j
  73. char *dmabufsrc1 = NULL;
    + j* L  U5 W: A2 g8 [. T5 P1 h* ]6 m
  74. char *dmabufsrc2 = NULL;
    / A' V, s  T( w" E6 M
  75. char *dmabufdest1 = NULL;) C  m1 o  ]$ d) W# k) T! C- g
  76. char *dmabufdest2 = NULL;
    5 \: z: c) k0 H5 `1 s3 n' Z& F7 `
  77. ! j- t% j: W. M1 k! h
  78. static int acnt = 512;/ e  e) E! ?) A0 ?" I, |( P
  79. static int bcnt = 8;
    / D, `" i& w5 c$ ^" y3 u
  80. static int ccnt = 8;9 q+ B/ d  [, a7 z3 R

  81. 7 O. H3 O' a& m3 x3 ?
  82. module_param(acnt, int, S_IRUGO);4 O  [: I" ~8 Y- X7 ]
  83. module_param(bcnt, int, S_IRUGO);8 g2 ~/ L) [; ^/ j; F; G
  84. module_param(ccnt, int, S_IRUGO);
复制代码
- N' j4 t# J: E# N# f) S7 g. b& A

; {$ |$ s8 t6 ]8 ]! C' I2 u, ^      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% X9 \; L& v# Y) 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, N$ b: j$ |( \7 \     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* S& |+ f6 H1 f3 M, K0 K8 ~9 [  i, g7 |

8 T6 {) y; R* \: k! l0 j/ u
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-24 19:39 , Processed in 0.037020 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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