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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* F( n; V8 A" D5 G
  1. [code]EDMA sample test application
    6 y3 i) P) Z' d6 \- R
  2. /*
    - ?/ l* |7 O, T3 ^) m3 `8 `
  3. * edma_test.c
    - g/ U% m8 x4 q6 e; ]
  4. *' f2 N' g* S$ R3 T8 E
  5. * brief  EDMA3 Test Application
    $ t0 H# a: t5 e: e" K) a" C
  6. *
    7 u, b! t- F7 f% W) t0 L
  7. *   This file contains EDMA3 Test code." P4 @$ e9 J! @% a+ B! w
  8. *% Y# N$ }, R4 E( V5 {  L4 W
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% X+ \; n1 K1 a& f2 j8 ]
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 ^3 C- l! E& f, ]6 a( `
  11. *         TO CHANGE.& D& l1 T7 ~/ H$ N. e& u
  12. *( E$ N! h5 j0 X  B" v7 t9 v0 n) }
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    8 G$ P' i# {* J
  14. *5 J4 R7 P* ~' ?  v+ b2 t
  15. * This program is free software; you can redistribute it and/or
    6 Q  U' t3 X6 G& l+ ?' O! f  p3 B
  16. * modify it under the terms of the GNU General Public License as
    ( H" v  I8 D) U% z. ~+ ^5 a* x8 R
  17. * published by the Free Software Foundation version 2.
    % x$ u# V5 @2 L, d' W- ^% _
  18. *$ H1 ]/ r: v7 |2 j, a. {9 M
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    . H* ?# V; K4 v8 k7 u8 c( _
  20. * kind, whether express or implied; without even the implied warranty
    1 H3 u2 I/ f5 c6 v7 x
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the" Z3 M5 a% `( ]! Q* Q/ b) [
  22. * GNU General Public License for more details.
    8 p% u% n) r' M. i$ q
  23. */7 A7 ?8 z5 f2 V* Q- _5 K6 g" o

  24. ; _; ~2 M$ v- u' l3 b$ H" T( |& h
  25. #include <linux/module.h>! K' I8 j2 D" v8 O& U  n
  26. #include <linux/init.h>; N1 D7 K# @! z) P$ W( T% V
  27. #include <linux/errno.h>5 \+ b2 Y% Q$ w: o1 f
  28. #include <linux/types.h>
    - c4 G7 h, d& F3 r' _: s) V
  29. #include <linux/interrupt.h>: B& R  z6 D# E4 J: C0 V2 e4 X
  30. #include <asm/io.h>+ K7 e, x: S& Z
  31. #include <linux/moduleparam.h>
    * [: s3 ^% k9 X$ J6 R- _
  32. #include <linux/sysctl.h>) ^" [! f& Q% h5 n" ~' d6 {) J
  33. #include <linux/mm.h>
    6 f; b+ v; `- S. W' C- \( ^
  34. #include <linux/dma-mapping.h>
    & b7 |! |/ ?" J

  35. & a/ Z! ~1 t* O$ b/ o+ E
  36. #include <mach/memory.h>
    2 P: T0 F& D+ k! h( U4 |
  37. #include <mach/hardware.h>3 t2 y' n- q2 N4 {# t: s
  38. #include <mach/irqs.h>
    " ^2 `+ L& i6 K! x
  39. #include <asm/hardware/edma.h>- b+ T+ @3 Z0 o$ h# ?$ ]
  40. 9 H% ~( `* f! F1 M; F
  41. #undef EDMA3_DEBUG9 |' \. ^0 J+ x4 P+ A
  42. /*#define EDMA3_DEBUG*/5 G, o5 q1 e' n; j1 X4 h4 `+ `

  43. 7 B- `( E' G, v# ]1 s! e; b" T" ]
  44. #ifdef EDMA3_DEBUG  ~+ v/ M! ^% E+ V6 g% n! F: K4 \' D
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    6 F' |1 a3 p: v6 ]
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    $ u. d4 j- Q1 k) t8 I  |% ~7 |+ M) l) D
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ p0 Q# H7 J8 t! Y# l. d
  48. #else
    ' }" h7 k0 O: o7 P
  49. #define DMA_PRINTK( x... )
    0 U$ Q4 ~$ J8 W, {
  50. #define DMA_FN_IN
    * f4 I* N; c2 z
  51. #define DMA_FN_OUT- N& `+ _/ r$ T8 Q3 k% ?
  52. #endif2 \4 S: e! P- Y8 |5 r

  53. ! p" X8 o6 b6 z' h1 k8 Y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    6 Q* }0 E3 R# V6 f
  55. #define STATIC_SHIFT                3  r# x$ D5 O! ]7 }9 X
  56. #define TCINTEN_SHIFT               20/ N. z5 m( o0 b0 }6 b' x' b
  57. #define ITCINTEN_SHIFT              21
    ( S7 P6 c' A$ S2 {& ?/ }  c, [
  58. #define TCCHEN_SHIFT                22
    2 D* h' ^( r" U8 X3 K& r
  59. #define ITCCHEN_SHIFT               23
    . T5 w- r0 H% Q5 v8 r( r

  60. : Z. V1 I4 g8 X1 F
  61. static volatile int irqraised1 = 0;
    , l, {0 M" j* S
  62. static volatile int irqraised2 = 0;
    ; V  g& _% p8 e) }9 X

  63. 0 v1 h& }+ c5 F% A3 h- V
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ k4 D: n; F& B$ t0 M
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . J0 ^. w! J$ \
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 }4 h; w) _# q. \7 A, P
  67. 4 h' U1 [3 R* k! y
  68. dma_addr_t dmaphyssrc1 = 0;6 W1 |9 z. ]5 U" G. K
  69. dma_addr_t dmaphyssrc2 = 0;2 K- C# U  I3 w% a5 Z
  70. dma_addr_t dmaphysdest1 = 0;
    % D. \$ ?% r2 ~1 _' t# i, v  R; l
  71. dma_addr_t dmaphysdest2 = 0;
    5 O5 y8 a( S7 \8 g% P2 d! G) A

  72. 8 Q5 I% A+ G5 O
  73. char *dmabufsrc1 = NULL;& a$ W* l: X5 K. O+ C- t7 E
  74. char *dmabufsrc2 = NULL;
    ' B( k1 B4 y1 q+ }3 o- J+ u; A
  75. char *dmabufdest1 = NULL;
      U% E0 y, L# v4 D- C7 E
  76. char *dmabufdest2 = NULL;# b" i  }5 M) _

  77. ; D" n) E, C1 V* M* `: u9 T
  78. static int acnt = 512;
    3 o" T; M, m5 m4 V& P, ^4 U/ {
  79. static int bcnt = 8;
    % w: }% R8 B$ ^: p6 M0 z) o
  80. static int ccnt = 8;, N* u1 ?) _7 |( c

  81. 7 e6 P3 V/ M2 X" J/ m& F* ]# u
  82. module_param(acnt, int, S_IRUGO);
    ! ~" w! L# F, K# w( ~3 B( _
  83. module_param(bcnt, int, S_IRUGO);
    + T5 ?- L6 z  b' s9 f# R
  84. module_param(ccnt, int, S_IRUGO);
复制代码

4 g7 [( Y. V1 i7 J7 b
; P2 ?8 H5 a. j6 M( C      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- N# g) Z6 i# [
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, [# L& M6 l! r     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。" b2 P! \! n+ y& E, d* v. {

& M0 u# Y7 h; l# \0 K$ i
0 _+ b) U8 @% k. [$ ^2 T
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-7 00:00 , Processed in 0.043836 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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