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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: h$ y: g& p% ~  s) k* G5 s
  1. [code]EDMA sample test application( y$ N( o8 E; N  ~$ N: B
  2. /*
    ( c. `* T8 a; G
  3. * edma_test.c: x; ?9 _0 Q" B
  4. *% Y" _+ W  a5 [+ j$ U; D7 Y
  5. * brief  EDMA3 Test Application( N' o8 b8 {; ^1 h8 G
  6. *
    4 l, U! d- I' @9 Y+ @; @. z
  7. *   This file contains EDMA3 Test code.- W1 S: ]3 {: ~+ s1 S/ [
  8. *$ Z# o: {- O3 g# A7 q, J& s
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    8 U2 y; [) T- M0 O; x5 x
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; u3 x) ]% G: H( f% V" f! X
  11. *         TO CHANGE.) X" N# b9 ^+ a' w6 V
  12. *
    3 R; ~+ O' e$ Y: g
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: Q  P; b7 l* X4 F0 K
  14. *
    " w* v' f# ]$ e
  15. * This program is free software; you can redistribute it and/or, o* a7 D: p1 {9 ^1 F+ V
  16. * modify it under the terms of the GNU General Public License as. l0 e1 m/ _$ g: Q% W1 S
  17. * published by the Free Software Foundation version 2.' L2 r9 g3 ]* N1 ^$ V8 l
  18. *+ e! C3 T4 x7 d& Q  U6 ?+ \
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 S6 ?- u/ l1 i' Y( O; M
  20. * kind, whether express or implied; without even the implied warranty
    2 H# Z1 j, N; Y5 t6 h( S( u
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the- U0 ?# ?8 j& L
  22. * GNU General Public License for more details.
    2 w1 l: ]: V6 F& L
  23. */0 ~0 o) Y7 B5 w( u, g; J
  24. . Y5 ], j" G- P& N$ N
  25. #include <linux/module.h>4 t! F3 ?$ k6 l8 f2 {
  26. #include <linux/init.h>
    * o* Y& T0 p( i* S4 |! H& s4 l
  27. #include <linux/errno.h>$ c& J# M: W7 J2 W" g
  28. #include <linux/types.h>7 P. T% _6 N- ~+ P" T9 G9 a
  29. #include <linux/interrupt.h>1 k, [6 I: O. P* D' Y3 D* ~( [/ `5 X
  30. #include <asm/io.h>
    6 ]" Q( Q4 _0 ?  s5 \' J5 J
  31. #include <linux/moduleparam.h>; k) C/ n, {" e; ]/ b( p( ^4 Y
  32. #include <linux/sysctl.h>
    ! ]: V  K! g& D0 A6 B/ I
  33. #include <linux/mm.h>
    ! z" u9 e2 v* o8 W( j6 P( Z
  34. #include <linux/dma-mapping.h>
    " G# x8 `) j8 ~2 n0 |5 i# n
  35. 4 i8 f) V# Z* n3 n( \
  36. #include <mach/memory.h>: B% @6 a& g  |5 J9 K; ~& J
  37. #include <mach/hardware.h>
    - [2 x, w: y% H' E; g
  38. #include <mach/irqs.h>) x# `  j  L7 O# |# V6 H
  39. #include <asm/hardware/edma.h>
    ' Z& x( Q7 m$ H, I  g$ z

  40. 5 \! @# o  Y; z2 w# f7 n) Y
  41. #undef EDMA3_DEBUG) F: N+ ~0 x( z4 F/ ?. a
  42. /*#define EDMA3_DEBUG*/
    9 Z  f" m$ B+ B
  43. 5 r; j. L" w2 j$ e2 }1 V$ s0 V
  44. #ifdef EDMA3_DEBUG# p* |! J2 \- f' p8 D9 u
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    + D( n7 z! P- d5 ^. n" _
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' s3 b4 D% B0 w8 v; U6 u* y% s7 r; R
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); \; u$ t2 X  a9 s9 V
  48. #else
    % i, @7 b, \: Y, z& y
  49. #define DMA_PRINTK( x... ); s2 B; Q& m( V0 d/ j" L
  50. #define DMA_FN_IN
    5 z* p1 u0 i5 w2 y/ Y  ~
  51. #define DMA_FN_OUT
    , T! A7 f2 \, s
  52. #endif& G! S' W1 ]- ^9 ^( @3 A
  53. 4 f/ `) m# i% r3 T8 _2 A0 X
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)8 S; g1 Y2 t0 f' q/ p9 W7 \+ S
  55. #define STATIC_SHIFT                3
    0 M( j5 o) Y2 o% k8 S# U8 }
  56. #define TCINTEN_SHIFT               20/ I9 Y5 F$ [" i9 X7 x0 J
  57. #define ITCINTEN_SHIFT              21, N' j( n8 [$ ?/ p) s: k# U& m
  58. #define TCCHEN_SHIFT                22
    1 s/ w0 G+ M  A! K. ~0 t- E7 @. e
  59. #define ITCCHEN_SHIFT               23
    2 w) `7 M  {5 R% l  U& G

  60. 5 h8 {4 _9 ^5 [8 z" a" H6 N
  61. static volatile int irqraised1 = 0;
    ; c3 g9 n; |) N' j
  62. static volatile int irqraised2 = 0;
    3 Q1 T  e& j; t- [6 p- X, f, M
  63. 3 K; q: R( x8 A% ?: D( y! I
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # P/ j8 @! U$ g/ [
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - Y& x; J% u( c. q2 b/ g
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 z( V  e8 ?7 R, c% o! V
  67. ) t9 {2 W% N, }9 O5 l
  68. dma_addr_t dmaphyssrc1 = 0;( n: U1 y2 F8 h
  69. dma_addr_t dmaphyssrc2 = 0;
    ; N# v8 S+ f# D3 G1 ^; `
  70. dma_addr_t dmaphysdest1 = 0;
    * r7 e2 T9 M8 M9 f3 K
  71. dma_addr_t dmaphysdest2 = 0;
    % y$ {# ~1 _9 l$ e0 a& c' @1 s

  72. & V, I+ c, R0 p* n" v8 U: A+ b) |
  73. char *dmabufsrc1 = NULL;  J# u1 v6 p+ k' q+ [% P
  74. char *dmabufsrc2 = NULL;6 V# o  H7 E+ |/ _+ e* K
  75. char *dmabufdest1 = NULL;- i" f+ R( e; A
  76. char *dmabufdest2 = NULL;( Q+ d& T+ }9 C0 M* f! q" m
  77. 0 J3 d, j! b' G6 ]; ]: ]* g3 g
  78. static int acnt = 512;
    ' E5 G0 |, G7 V% D& a* }
  79. static int bcnt = 8;
    ' H4 _  z4 A% c. ]6 s
  80. static int ccnt = 8;% L# m& }; P  R+ v5 @

  81. ( w1 f" c" ^1 Z5 r
  82. module_param(acnt, int, S_IRUGO);
    5 U8 F9 }! _; J( |! i
  83. module_param(bcnt, int, S_IRUGO);( M+ ]3 y1 p* r6 G
  84. module_param(ccnt, int, S_IRUGO);
复制代码
, c( F/ d: }, A3 P' [& a

$ [& y! \) _! b, T      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ f3 \6 i! r' G* H9 m6 A
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ d* y! w' _* O. S
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* ^- }( ?+ q3 E' F8 v) A2 \& M: Q! ^( g: [0 z% O& l

3 w6 q4 x' N/ |6 C; J2 H
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-14 10:06 , Processed in 0.038132 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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