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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' F4 I3 b# i' J. ^+ K
  1. [code]EDMA sample test application% s2 h1 D0 O, t
  2. /*
    ! t2 P4 m. F+ y9 s+ c- k
  3. * edma_test.c  B1 Q0 J) h' {
  4. *; S1 R3 [' H! A7 c/ |% p2 _
  5. * brief  EDMA3 Test Application" f+ r) O' F  s+ k8 v: p% q& g
  6. *
    ! r( \' j! ^8 X
  7. *   This file contains EDMA3 Test code.
    ; |% p- y3 f0 n3 t+ O
  8. *
    - S! c( d( q6 z: m" L) B
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 s: J& `, E* a8 M$ V
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ u+ F" D7 A$ f2 g; g/ S
  11. *         TO CHANGE.9 J5 [& C, W1 ?
  12. *
    6 [* I- k. k& [2 S& y
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 P& D& w" Q% n0 Q
  14. *4 ?. k0 V6 x3 \! K) U! v4 A
  15. * This program is free software; you can redistribute it and/or+ e; M( M' w, m2 N( _. t2 s" U, x8 Q- z
  16. * modify it under the terms of the GNU General Public License as
    8 \; i  A( ~+ u9 @3 U+ g) h; |
  17. * published by the Free Software Foundation version 2.+ z  _; R" t- c% m6 [* b$ w3 X
  18. *
    , {" n5 ^9 M( v# M( g( H8 I
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ F$ U* R9 Q8 r: }  R7 e' T, y! X
  20. * kind, whether express or implied; without even the implied warranty
    4 f4 U6 W6 ^9 o9 I
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      p% h; G2 T$ p* Q3 X4 U- q  o
  22. * GNU General Public License for more details.( n" T1 V5 j, L, V+ E" O
  23. */
    % `8 l( a! Y$ u% S# r

  24. & r; i$ E( x5 @/ R
  25. #include <linux/module.h>2 V% V( O1 d! s3 S2 ^4 e
  26. #include <linux/init.h>$ Q  e$ Z5 o" W5 f+ v( A- C( [% s; |
  27. #include <linux/errno.h>
    # n8 D  {6 b0 u' J2 S
  28. #include <linux/types.h>
    " D1 X; K; M* S! u8 f: F, @
  29. #include <linux/interrupt.h>
    $ a. E2 y  _$ B
  30. #include <asm/io.h>. I, v7 w+ B- s
  31. #include <linux/moduleparam.h>
    $ x7 y; r: z, }: x6 s3 D, M
  32. #include <linux/sysctl.h>
    # E5 ]3 z  V# r% I7 }8 v
  33. #include <linux/mm.h>$ a* q. T1 w4 L$ x- o9 s5 ?# x( r
  34. #include <linux/dma-mapping.h>% l9 d# N; X2 H) R8 M
  35. + B' j$ e) `0 Z4 S' d1 O
  36. #include <mach/memory.h>
    4 I; \' g6 D/ k' ~) g9 I4 ~
  37. #include <mach/hardware.h>6 `# b  _5 f  ^1 l6 i
  38. #include <mach/irqs.h>4 E0 G. g/ |+ I8 S
  39. #include <asm/hardware/edma.h>
    2 C+ n% n  E8 x1 Y

  40. % w/ ?3 \1 e$ c
  41. #undef EDMA3_DEBUG( j- K5 Z; f4 ~+ r; m. n
  42. /*#define EDMA3_DEBUG*/7 E+ C) l7 R5 k7 f3 ?% {. r6 l8 o

  43. 1 |. E  y; b, Y# u( Q4 F
  44. #ifdef EDMA3_DEBUG  B) d* v- h0 N
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): Y4 }9 V4 S) Q
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" ?' V) l: _* d, t/ e
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 v4 L# P1 W% \1 |& V
  48. #else& S; D( T2 @( q& \2 a: I
  49. #define DMA_PRINTK( x... )
    0 T  E& @3 f8 s6 A- G, I
  50. #define DMA_FN_IN
      R* S2 L. `  @
  51. #define DMA_FN_OUT: k4 m/ s* C4 H( B  `5 ^) J
  52. #endif' m/ Q/ e1 y9 l' N. ^
  53. * l8 q- F1 j# `! r2 p5 D! t
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ( f+ n" G. t. L
  55. #define STATIC_SHIFT                3
    ) D7 U% T. B: V+ N5 j0 Y
  56. #define TCINTEN_SHIFT               204 t- {  Y1 q% l7 q) b# _- |: P
  57. #define ITCINTEN_SHIFT              21) X3 r) o+ F2 ]& ?! u) b) F% g, z4 n
  58. #define TCCHEN_SHIFT                22( U. P6 b8 j/ b1 z
  59. #define ITCCHEN_SHIFT               23! t1 y* L3 b6 B! e' p/ u
  60. 3 {0 x) J* D& W" B5 n$ A
  61. static volatile int irqraised1 = 0;
      E; k  Y8 o7 m+ Q+ b( b* w
  62. static volatile int irqraised2 = 0;. g) a0 q* e7 b9 a

  63. ) L9 d& w! g. M0 ]2 d6 M: K$ v; M
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 ]; u) Y$ P+ \
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ G( [3 a: v$ M% X
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 q6 E- B9 i* w8 H& l
  67. . h" l2 G- M  s
  68. dma_addr_t dmaphyssrc1 = 0;
    5 _( r$ v7 Q" i9 o5 W: o5 G0 U
  69. dma_addr_t dmaphyssrc2 = 0;
    # [) I! ?" J/ L  m( A9 A
  70. dma_addr_t dmaphysdest1 = 0;4 N$ q2 }. Z' m) L- c
  71. dma_addr_t dmaphysdest2 = 0;
    + L% v  Y0 l, k6 f7 c- ^* K

  72. & X( |3 `$ v0 M  z. ^
  73. char *dmabufsrc1 = NULL;( S5 `: p/ B# m- Z% V% I
  74. char *dmabufsrc2 = NULL;
    - z  k# E. b0 o
  75. char *dmabufdest1 = NULL;# ?- \/ h' W  y2 S" ^
  76. char *dmabufdest2 = NULL;
    , H  g1 q4 r( e: d3 F% N0 H( T" K

  77. , S, H$ L! x! ]5 B" n
  78. static int acnt = 512;
    % U$ a9 c- \* N( k0 x. h# d# W
  79. static int bcnt = 8;
    1 J0 {, a% N; N+ `3 m
  80. static int ccnt = 8;
    ( e' V$ Q' |, u

  81. 8 A1 T- o! V7 N) P, y6 b7 z4 B
  82. module_param(acnt, int, S_IRUGO);
    / E2 p, h+ [) l, A! V
  83. module_param(bcnt, int, S_IRUGO);
    8 t& H1 t+ [: Q  O
  84. module_param(ccnt, int, S_IRUGO);
复制代码
7 N1 m, X* g# ~8 C; ?9 |  y
' W# F( m# ~! u' Q  A3 h" m
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" \& k1 W( C6 @! V0 |( k
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。6 l1 V' z! f0 _; a- x6 o; v& T
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( M. u. M) |& Q6 L  k+ s
+ n# T) {4 e6 e! e

6 K' l/ Z$ w: l, c) L
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-8-28 15:48 , Processed in 0.045460 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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