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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) Z. t  {/ U7 K+ n( E& t8 J' G3 Q
  1. [code]EDMA sample test application: }$ |/ f; a' B+ k
  2. /** x9 v+ N/ E% e
  3. * edma_test.c
    , |# L( |& Y: \
  4. *2 [# a- p$ Z5 j
  5. * brief  EDMA3 Test Application
    * [8 u7 Q; B# e' l
  6. *6 b$ F# m% Z& g/ h5 a, N2 w9 s" i
  7. *   This file contains EDMA3 Test code.
    ( N( l; h5 Z6 r5 K, {" T8 o. B& A
  8. *- I5 {. l. z! Y9 k2 e+ D
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ f" S6 [# j& i5 V* F- S) ~/ L6 G
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ x. z) u) B5 J; O6 V9 _& {$ p+ w
  11. *         TO CHANGE.
    ( Q5 K% Z- {7 j) z
  12. *
    5 B2 ?7 J" ?% a8 y4 g- o8 b" a1 b
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ) r# U5 k4 K, r* H% L
  14. *! t( s, A# A# O5 i" D: v( P
  15. * This program is free software; you can redistribute it and/or6 f) r+ Y3 l/ j2 i, I7 g3 h( A# o0 a% I
  16. * modify it under the terms of the GNU General Public License as! a' L7 v, r" Z
  17. * published by the Free Software Foundation version 2.0 I9 x/ i. [3 Q/ w! ?1 t
  18. *0 b" ~9 ]. |6 e9 P0 ^# m1 F
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    - m! _( Y! ~9 r7 C$ j6 K
  20. * kind, whether express or implied; without even the implied warranty1 T( ]5 M" t) P5 V; z$ q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the- @5 a- I  \! e" o3 z
  22. * GNU General Public License for more details.
    9 I3 j" j; ~' }! ?$ k' ?
  23. */
    / v) K2 Z/ @; F& L3 l
  24. ' w. p' _6 K0 X, k
  25. #include <linux/module.h>0 \( D; V4 d' ~  K% _; V
  26. #include <linux/init.h>4 e2 Z2 _  e3 g
  27. #include <linux/errno.h>! F2 U4 v) ?" K/ q/ b0 N" C
  28. #include <linux/types.h>$ I- a1 \1 c. m8 a# S% r! e" C/ _
  29. #include <linux/interrupt.h>$ N1 W7 V. b' ?3 s" G, \% c
  30. #include <asm/io.h>
    ' C5 I* U& Q4 e2 P
  31. #include <linux/moduleparam.h>$ S4 Z, y/ c2 o- j5 |
  32. #include <linux/sysctl.h>
    $ d9 T6 i# S, r$ ~
  33. #include <linux/mm.h>5 [* X0 q% \, F/ W4 w  ~
  34. #include <linux/dma-mapping.h>& U# y( o5 d- v+ s5 O  k
  35. 9 R* y# `5 U+ d2 U% }
  36. #include <mach/memory.h>
    ) M! }0 _! K4 o  p' R
  37. #include <mach/hardware.h>
    ' V3 o( @! C5 T  D& \" x0 u+ l
  38. #include <mach/irqs.h>1 ~& O+ D7 D; {$ e2 |
  39. #include <asm/hardware/edma.h>
    9 O* H" k5 N6 ^) b! D7 ^

  40. 8 q- F; _; T2 f9 y
  41. #undef EDMA3_DEBUG2 p4 v' h4 U4 `; w
  42. /*#define EDMA3_DEBUG*/9 w. m; j) U( E1 d: @6 ]( E2 E* Z

  43. 8 A& L1 y2 i/ {+ e( x
  44. #ifdef EDMA3_DEBUG0 v0 i5 o; q$ z5 S6 G& M* l- J8 h
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    , f( b! {4 J' }3 @
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    0 Y2 w6 o" B( V2 f6 {) R
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ( h/ O4 M# G, C- @& N+ n
  48. #else. X5 P: K2 p3 T" F- b
  49. #define DMA_PRINTK( x... ): C& Z0 ]4 r: L9 A( u- l! _
  50. #define DMA_FN_IN
    2 N% c7 D4 @3 g& m, x0 z
  51. #define DMA_FN_OUT5 H. b( h1 w6 ~
  52. #endif1 P: z; U7 |& H
  53. 2 s  O) @. D$ x/ K) F$ [( D$ t
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)" h5 W5 t/ n6 _0 O" B' o
  55. #define STATIC_SHIFT                3' N0 L1 w4 u# B1 c/ p. L' a+ o. m7 G5 I
  56. #define TCINTEN_SHIFT               202 _4 H% D/ d7 m# P9 Q; K
  57. #define ITCINTEN_SHIFT              21* M* e) t( ]2 R) ]2 ~3 d" n
  58. #define TCCHEN_SHIFT                22& V  A3 p7 U0 _
  59. #define ITCCHEN_SHIFT               23+ z8 \9 [- o0 e( N

  60. # Q) C6 F4 Z5 I0 @+ ]. J6 n/ w
  61. static volatile int irqraised1 = 0;+ G8 V0 h- k: S! p  _% d
  62. static volatile int irqraised2 = 0;- ?. X7 A; K$ `

  63. , W0 c' B3 M1 H- i% \( S+ q! Q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' R: A4 w0 t" p4 @
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 o( i! H8 Q) O- s6 e6 h/ _2 R
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * \2 o$ f" M: W5 r( e

  67.   M9 A% j; j- R
  68. dma_addr_t dmaphyssrc1 = 0;
    3 B% G- u$ l, _; D1 I  ~
  69. dma_addr_t dmaphyssrc2 = 0;
    4 R* |/ v+ q7 z8 E3 x! Y
  70. dma_addr_t dmaphysdest1 = 0;
    & S/ B$ o1 E- [. u5 w4 i2 y# m8 ]* V
  71. dma_addr_t dmaphysdest2 = 0;
    1 E- {4 s5 g& ?  J
  72. 9 o* c( J/ L3 P+ J, n( q0 b
  73. char *dmabufsrc1 = NULL;
    # m+ E0 l3 `3 `" @' u
  74. char *dmabufsrc2 = NULL;" V% V8 u' i5 s" v4 V
  75. char *dmabufdest1 = NULL;8 L8 [4 i4 v5 n: W/ T( \4 S: @/ T
  76. char *dmabufdest2 = NULL;
    ' u3 u- L' z# U2 j# Y5 _

  77. / L& B- C& r1 `9 ~
  78. static int acnt = 512;
    : o3 B$ V& U& r% |/ R' _/ W
  79. static int bcnt = 8;, l; ?9 H* @& h( s( {
  80. static int ccnt = 8;
    # V) Y4 o$ k7 K* }

  81. ) D; S" @2 H( I
  82. module_param(acnt, int, S_IRUGO);
    7 c6 k3 G1 L3 B( u
  83. module_param(bcnt, int, S_IRUGO);9 G, o* V+ @5 G9 b- x
  84. module_param(ccnt, int, S_IRUGO);
复制代码
$ L7 P) \2 i, U; O' s4 P% y! [

0 T+ Y$ X( d  n4 O1 C0 g* @2 {6 J      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 s& l- h7 h) Garm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( [. M1 A* z# D; |. ~3 S- ^
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! V# a4 \9 B" R8 f# B* ]
* s1 y, Z& r, G5 P; O; i$ x4 M) D9 H9 g0 ]. `' O: S
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-2 17:46 , Processed in 0.039885 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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