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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 F9 g5 ^4 a& Y8 u
  1. [code]EDMA sample test application
    9 M. q( D( Q% t* ?, }) k/ V3 K
  2. /*. P! Z* U& N! w0 Y& j2 T& r
  3. * edma_test.c1 j! ?0 q; D7 Z& h* V0 y( d
  4. *
    . _9 z" d* `, F" m
  5. * brief  EDMA3 Test Application& k% N9 {0 A! W) Y  b
  6. *- Y1 k# l/ ~6 @" ?" B$ l$ f+ h: p
  7. *   This file contains EDMA3 Test code.1 P/ _( i+ G6 j$ x2 j1 p
  8. *' C) E/ k  }0 ~- j  Q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 y) }/ W/ O4 s- u3 k
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( B5 X9 I! [3 u7 Y/ `3 `" ^% o
  11. *         TO CHANGE.: q2 v" _4 T; N/ B' C
  12. *% ^/ s5 r: E9 ?7 a$ a3 ]) y/ {
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& P0 I, M& y2 W# h+ s9 {; k8 a
  14. *
    7 f/ y0 |3 K4 f; U
  15. * This program is free software; you can redistribute it and/or6 D1 m; i4 G0 j. M$ y6 Y! f
  16. * modify it under the terms of the GNU General Public License as
    $ k8 ]! Q$ n# ^1 x# L" y6 k
  17. * published by the Free Software Foundation version 2.
    6 Z# D) w' g9 Z, P3 Y/ H4 m
  18. *% \' ^% j. u# P
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    3 v/ A8 h. o+ t- A# s5 h
  20. * kind, whether express or implied; without even the implied warranty
    , ?+ W6 g% N: f: U1 E8 j
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    5 ~* Q  e& E6 Q9 m- W$ f3 r
  22. * GNU General Public License for more details.
    6 l6 J7 Z9 C( V6 {7 g8 v5 e" s
  23. */  m7 `: _% J1 {

  24. ! L+ u1 x, L! Q* a6 d: [0 D) s$ p
  25. #include <linux/module.h>7 T" z. D1 |% d7 i3 s
  26. #include <linux/init.h>
    $ p* f, C) z+ q0 G! f
  27. #include <linux/errno.h>
    3 D- n: K+ Q/ ?2 ~1 R) X% n
  28. #include <linux/types.h>
    / J) ^$ e6 q5 L$ E9 p- I
  29. #include <linux/interrupt.h>
    ; n. D* Z5 e# n, l! `
  30. #include <asm/io.h>7 `: F6 @; r, E! U2 K! m2 O% {
  31. #include <linux/moduleparam.h>7 o! ~& s6 G5 Y& N
  32. #include <linux/sysctl.h>4 [/ a5 o0 B6 o1 }9 ?
  33. #include <linux/mm.h>3 W" B8 k0 p/ M9 a  a( K! }& V, y
  34. #include <linux/dma-mapping.h>$ h) j$ \6 V+ v; ~

  35. 1 ~- r4 m8 v0 v. e( k
  36. #include <mach/memory.h>0 A4 j/ B- F: L4 _& h. [
  37. #include <mach/hardware.h>
    ; A) C4 `1 h: U  }1 X% @
  38. #include <mach/irqs.h>
    / l% g% x/ J0 ?
  39. #include <asm/hardware/edma.h>
    * T& H8 o% H: I" Y  c$ A) L

  40. 9 O" ^) L9 ]5 j. s/ @5 s
  41. #undef EDMA3_DEBUG
    * v( @. ]/ `+ Q" K. E
  42. /*#define EDMA3_DEBUG*/  y6 Q  X! j; e- \% E
  43. " G0 p  Z( D0 ?5 ]* A$ I  f
  44. #ifdef EDMA3_DEBUG7 b: r& o/ O" q) B4 t* ^
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ! h1 ^% E7 q; i0 ], s$ q* @9 T% k
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# i$ i$ e7 i# s7 A
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' B3 f! N9 J; U% g1 x# z
  48. #else
    2 R; a/ G3 r( A3 \
  49. #define DMA_PRINTK( x... )
    5 r$ }7 W% {/ ~: ?
  50. #define DMA_FN_IN6 {, Q$ H8 f+ R7 T" t2 ~
  51. #define DMA_FN_OUT
    ; K: M$ j- w/ ]' T3 |+ [: {0 W
  52. #endif
    8 w" X/ a7 C  D5 J

  53. ; W- x6 t* L" v3 v
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    % A  t1 z  S; j4 y- ?9 l
  55. #define STATIC_SHIFT                37 K4 ?. d6 T; o. E2 E' P
  56. #define TCINTEN_SHIFT               20
    * e) D6 p8 P/ g5 y5 ~2 O5 Q
  57. #define ITCINTEN_SHIFT              21
    : B. o( K7 n/ C0 Z$ R# x2 t
  58. #define TCCHEN_SHIFT                22* ]" b1 ^1 O- c( J* O: P: x
  59. #define ITCCHEN_SHIFT               23
    " I, X: o$ M9 C. ~( s+ _- y+ Q5 U9 f

  60. + _" E  y* y9 u, r3 d$ h5 U6 j$ z
  61. static volatile int irqraised1 = 0;7 K$ ~: g; k( t5 `) M+ f  c
  62. static volatile int irqraised2 = 0;
    ; F" z0 s3 K/ E( B2 b9 j3 f3 d

  63. ! i3 g& e" G) y6 v
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ `) i6 S3 c8 p( S4 w1 R: S
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" G: U; N: {1 ~
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , {  c# u& _; \! y8 R/ d( [( v( e- a
  67. 0 Y) O* `0 X+ c2 _
  68. dma_addr_t dmaphyssrc1 = 0;
    ' a* d. J) U; I5 Y
  69. dma_addr_t dmaphyssrc2 = 0;
    , v: j- J# P1 P5 D
  70. dma_addr_t dmaphysdest1 = 0;; Q/ k6 f- K: C! N0 ?( w4 f) P: p9 `
  71. dma_addr_t dmaphysdest2 = 0;! S/ K! n2 V) q: v. E
  72. ) p9 H% j0 V" N
  73. char *dmabufsrc1 = NULL;8 T& W# ^, |3 i+ ]
  74. char *dmabufsrc2 = NULL;
    4 B* u9 H6 S; N9 R: N/ F# v
  75. char *dmabufdest1 = NULL;; n  b- n. U& b
  76. char *dmabufdest2 = NULL;
    2 G/ ?8 e3 G+ p8 B3 H6 _3 Y
  77. 8 t4 B; p; t3 l6 S0 Y
  78. static int acnt = 512;
    ! Q% }& x  Z9 v8 y; [9 c3 O
  79. static int bcnt = 8;
    2 E- E" c  a& S. x/ x% G0 b
  80. static int ccnt = 8;$ w: w  _8 Z+ y$ E% R  y, k
  81. 1 X1 ?0 H* \9 F, i+ n& s
  82. module_param(acnt, int, S_IRUGO);
    $ r" {  g, d7 U& b
  83. module_param(bcnt, int, S_IRUGO);
    & m  b1 Q) U7 N( I+ n- q
  84. module_param(ccnt, int, S_IRUGO);
复制代码
, M' _) o; L8 c( X4 e8 b% q7 d

  p4 A6 W3 b% v3 S8 a      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 o' T6 r! s) W/ d
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" U' o# S2 ]" M; W1 x
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ L3 s. U2 M  u, O- d& e. l- [0 |5 `: ~

7 U: Z7 I4 o. s  ]
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-7 20:10 , Processed in 0.036497 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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