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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' [+ i* {  H* _2 A
  1. [code]EDMA sample test application
    # E8 w) t& @, ?# S; A3 \3 i! I
  2. /*
    0 T& O1 H1 A/ V7 u
  3. * edma_test.c
    5 k; }- y! A: g  p% ^1 h
  4. *% B5 T1 M2 {( h' d7 n
  5. * brief  EDMA3 Test Application
    " K5 l3 ?$ c! d7 Z
  6. *: q1 M: f9 ]6 R2 a7 U" a
  7. *   This file contains EDMA3 Test code.+ ^/ g% w3 D1 t8 V
  8. *
    1 F3 M( y' p, w
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    & P/ ~) I" T# r  B
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 M& D9 h. g( L% K' l
  11. *         TO CHANGE.: p7 F' z# B* U; [2 ^( p; t' ?8 x2 g* y8 ^0 Z
  12. *
    ) K7 f8 D+ p4 o2 S7 N
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ e) M, o. E4 g3 t' H
  14. *
    0 D/ i: f+ q# @6 V: U- w. `4 \
  15. * This program is free software; you can redistribute it and/or" |, k5 [9 Z) z3 A6 F; Z
  16. * modify it under the terms of the GNU General Public License as
    ; M8 F" [5 R$ W" O4 a  t) l( f4 h. J
  17. * published by the Free Software Foundation version 2.* j3 w; K/ N) I0 ?# v, ]2 B) C
  18. *  w$ o$ z* h, x! m3 w
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 F. Q. l* ]( N) i& X8 @
  20. * kind, whether express or implied; without even the implied warranty
    , V: e! m6 K0 D$ r/ t
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the1 s. x) i/ n, r- |: O5 u- U
  22. * GNU General Public License for more details.- A; Q/ }  U$ Q/ D3 H0 U
  23. */
    + D" m- S! P0 B: q7 k9 V6 f" I/ Q
  24. 3 g( D% r' e- T6 W& d% `
  25. #include <linux/module.h>6 m! F. I9 D* O9 e' a. Z6 @
  26. #include <linux/init.h>
    3 ?; X3 c  x& f9 [0 X$ F+ e9 ^4 R8 l
  27. #include <linux/errno.h>% |& ^8 b8 G2 B8 v
  28. #include <linux/types.h>$ g" Q, Q  J4 z; q9 I
  29. #include <linux/interrupt.h>( K% ~) d( B9 C" a) p8 e9 \, Y
  30. #include <asm/io.h>9 S9 H- n% z  f/ g% f$ l$ k: D
  31. #include <linux/moduleparam.h>
    5 G$ c2 @! {4 a) M* R( h
  32. #include <linux/sysctl.h>
    " I. g4 x4 M- a( v2 \' `
  33. #include <linux/mm.h>
    / o1 e! h4 x& Y; w. [0 z0 b3 n
  34. #include <linux/dma-mapping.h>1 B! c/ N% D" _
  35. 1 Z" D& x/ \3 `" K6 B, w
  36. #include <mach/memory.h>
    5 e3 F7 p" I0 B8 p
  37. #include <mach/hardware.h>
    ' [8 C9 a: p4 W3 }
  38. #include <mach/irqs.h>9 \) A/ M: F; i0 ]9 Z4 c$ t8 |0 O
  39. #include <asm/hardware/edma.h>& M0 |9 z# k0 D0 `+ W( p: ]

  40. ! H! c( _4 I0 W! V8 I( Z* b$ X
  41. #undef EDMA3_DEBUG
    $ b* }3 K' e+ Q9 A  y
  42. /*#define EDMA3_DEBUG*/
    7 ?" k5 k( D- C# x$ {0 @; x5 ]& R
  43. % X; o6 A3 Q3 c" T- A% v/ G
  44. #ifdef EDMA3_DEBUG/ V- H1 D: W$ s1 ?) B% s( f" E5 j
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)  k8 m& l) E( A' |/ v) }/ X/ y( R
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 X& b$ u9 D$ }  @  i3 }0 U. P1 V
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    $ T3 H/ d( |  A- O) X8 n0 U
  48. #else
    : i/ y& d0 W! Y+ g/ X% ^2 ?/ {
  49. #define DMA_PRINTK( x... )! Z0 \$ N9 L# g' L/ H7 g+ ~
  50. #define DMA_FN_IN0 o4 h( Z9 p: Y6 h7 n
  51. #define DMA_FN_OUT
    $ A9 |0 ~* X5 u" m% [
  52. #endif* P% u. O* K0 Z( N( S+ N

  53. 5 W1 T- [/ I1 d* ?5 O1 f4 ?
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)+ z9 b. c- y( q' D
  55. #define STATIC_SHIFT                33 _, z) O9 r. x6 T
  56. #define TCINTEN_SHIFT               20
    9 p9 [( {3 F8 w" v. _3 d
  57. #define ITCINTEN_SHIFT              21
    2 `: n/ V5 C8 R, N/ f
  58. #define TCCHEN_SHIFT                22, a1 Q$ j; h. h1 `0 W; f
  59. #define ITCCHEN_SHIFT               23/ I4 O, D  \; l+ s$ K* m- i
  60.   f4 d; X( ]# E- }& m5 {
  61. static volatile int irqraised1 = 0;
    1 L& ^8 {" S9 W% P2 J+ b  X
  62. static volatile int irqraised2 = 0;
    - u9 p6 j9 `" U8 p

  63. 4 J7 o' Q+ P/ Y  y  U' f/ a
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  b2 ?0 K8 D" V& x( G
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( F3 O% D5 p& G( k
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 z3 ~! w  v- c* a+ n3 k1 S8 ?

  67. ! F8 a! z: X+ d0 `& H
  68. dma_addr_t dmaphyssrc1 = 0;# Z- M9 \; {0 ?+ ]0 S' G$ j
  69. dma_addr_t dmaphyssrc2 = 0;  L( k) @; T* M% g/ A
  70. dma_addr_t dmaphysdest1 = 0;
    ! z( I) K: J7 b% p) a% F
  71. dma_addr_t dmaphysdest2 = 0;4 T7 k6 M( u( p$ q( H

  72. ( i  n3 c4 }, i7 }& v' r3 u: @
  73. char *dmabufsrc1 = NULL;
    ! I) j; w. L: P! Q2 l0 q# E
  74. char *dmabufsrc2 = NULL;: L7 g; Z1 _7 v& z3 @
  75. char *dmabufdest1 = NULL;
    % T' T8 Y; L! n# l1 j
  76. char *dmabufdest2 = NULL;
    ; I. I5 p) Q# Z7 P

  77. 8 B3 X" J5 q  V4 L) D4 L
  78. static int acnt = 512;, T* M' I% v) o& P7 n6 S; T
  79. static int bcnt = 8;
    ( n) _+ v  k, s- e* O' e! T
  80. static int ccnt = 8;1 N$ Z$ H- [4 O/ z) {7 D

  81. ' {1 G0 V, ~: B2 _6 k9 E
  82. module_param(acnt, int, S_IRUGO);
    1 G- Q( |; E/ {" \2 }
  83. module_param(bcnt, int, S_IRUGO);
    / I; k% z* B8 H% K1 O9 u& z
  84. module_param(ccnt, int, S_IRUGO);
复制代码

/ }; z6 c# I4 p7 v8 d  J! o
. `4 N2 [7 e( C- R1 o      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ b" m' ?) h+ r0 ~+ H3 E! N
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 Z, S7 Z  X5 g, T+ z0 ]
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, t. s$ W; q& t% v2 Y2 G5 e& E. j7 Z
* h! {; p' y8 `. W
2 k) j7 L9 h1 O# {3 d
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-15 00:05 , Processed in 0.039694 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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