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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & m4 H. ?8 U9 U7 Z4 G
  1. [code]EDMA sample test application0 G( V4 R9 U# C6 G4 F
  2. /*, ~' X5 l- o+ A, X
  3. * edma_test.c) @% ?4 F3 q  q- b/ h
  4. *: P/ E$ t( m/ S6 q
  5. * brief  EDMA3 Test Application* G! X9 R  ]: `8 g; p0 U3 w
  6. *" e5 E5 {7 B( ~! D, o9 M$ E
  7. *   This file contains EDMA3 Test code.
    4 `  G/ e3 e9 y- {' @- c
  8. *7 o/ a3 F! S( u" \, U9 K
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" O$ Q/ a7 M% i, @
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# T/ L4 V; L' h7 l  d( h. M; T! }  ~
  11. *         TO CHANGE., U7 V: V( t8 {" v- {, R/ [( |
  12. */ T7 b3 F7 |6 `9 j" ?
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    2 l) y9 c/ Z% ^) X$ S
  14. *
    , v. J+ g; u7 g  m/ Z
  15. * This program is free software; you can redistribute it and/or5 h& @+ B# q& A0 c$ m5 Y; p( v. |
  16. * modify it under the terms of the GNU General Public License as3 p' L/ V) C- l0 T! P
  17. * published by the Free Software Foundation version 2.
    , z8 H% w( u, F+ x
  18. *
    6 m5 Q% k" v4 C1 ?5 a: s
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 P% G# n) `, q8 n9 W
  20. * kind, whether express or implied; without even the implied warranty
    1 ~/ N6 W4 u2 p% `7 ~
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the7 N; t3 J, i5 g9 g6 Z5 p
  22. * GNU General Public License for more details.+ P. b  l: L# N+ d; S
  23. */! ~8 A. Y$ Q) x* c- b5 _
  24. 2 A. y  \" R( Y) Y) j
  25. #include <linux/module.h>
    ( A/ [; P" p! e& h# K# `* L
  26. #include <linux/init.h>$ b$ B) h6 x% \& T$ G$ k# t
  27. #include <linux/errno.h>+ }& I& Q, L! f2 l1 j) Y7 b3 U
  28. #include <linux/types.h>: ]4 M6 [  Z9 i8 X" k& _6 N
  29. #include <linux/interrupt.h>( V0 G) \8 r/ K* s
  30. #include <asm/io.h>7 d3 `  q( n# z% @9 F* ]
  31. #include <linux/moduleparam.h>- M5 e3 y/ y2 l9 r4 c
  32. #include <linux/sysctl.h>
    9 {/ g8 Q5 T' b, j
  33. #include <linux/mm.h>
    . ?' I# }, P3 O; v- P0 X! m" l
  34. #include <linux/dma-mapping.h>" k7 x: V. H; J! A6 p7 \8 {( u3 e
  35. ( r& j$ I" B$ b2 ~/ y; X. W" V
  36. #include <mach/memory.h>
    7 O5 l% q7 B3 f/ Q
  37. #include <mach/hardware.h>
    7 M5 |9 c; U9 B: u/ @
  38. #include <mach/irqs.h>
    . O- B  T: {3 E
  39. #include <asm/hardware/edma.h>
    $ o0 q, U% d7 p# r
  40.   b& o0 I+ Y+ B1 E; L
  41. #undef EDMA3_DEBUG" w9 t- d1 |' n9 U  Y
  42. /*#define EDMA3_DEBUG*/
    * i+ u" _1 @' {3 m4 t

  43. # T1 U; q( x! e$ H" c
  44. #ifdef EDMA3_DEBUG
    + v2 h" R; X: T
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 A5 n( A9 n/ s& K, A1 H
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 v+ Z8 v# J! G- r( X' s" m9 S
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# y% C" O# c3 u. g2 r
  48. #else2 T. V8 z, a4 o
  49. #define DMA_PRINTK( x... )
    4 i. x( D9 z" ^( ?: V
  50. #define DMA_FN_IN
    6 Q& y- p4 |* K
  51. #define DMA_FN_OUT
    8 ?# \5 Y: c& q5 u; J0 \; W% F
  52. #endif
    * n8 a: w  N5 D0 x) N0 L% Y/ K
  53. 9 ^0 Y: E1 {% m
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)- k' D  d0 X4 Z  Z# C& H3 z
  55. #define STATIC_SHIFT                3
    1 K( s! _5 C* u
  56. #define TCINTEN_SHIFT               20/ x# @+ w$ _0 I" U+ M/ d8 P
  57. #define ITCINTEN_SHIFT              21$ g7 C% X9 D. ^6 ^) M/ i6 r3 n& b
  58. #define TCCHEN_SHIFT                22
    7 P" \$ E8 e% \) l
  59. #define ITCCHEN_SHIFT               23$ i! v2 y: _7 U* I) ]  M7 I

  60. 1 m5 u0 D' h) ^) x# S. S
  61. static volatile int irqraised1 = 0;
    0 V) b$ S2 ~3 B
  62. static volatile int irqraised2 = 0;* n9 b; I  `) B) D1 h" I
  63. 2 F3 ~2 o  b/ b8 Y! t  k/ N
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 S8 i  C* V) `) s' n1 J$ u6 w5 }' x& ^
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + Q3 h4 T% i" _) J' e1 _
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  v( O2 C" F! R9 J! T: F' [3 W
  67. / e* @* ^( H8 j/ |: z
  68. dma_addr_t dmaphyssrc1 = 0;7 L8 W: H: m$ t# x) t# \3 t
  69. dma_addr_t dmaphyssrc2 = 0;+ Z8 i6 O% {/ o; f
  70. dma_addr_t dmaphysdest1 = 0;# _) E$ x. l! S8 q5 L+ Y
  71. dma_addr_t dmaphysdest2 = 0;
    8 o: `0 _, p% E" h: s) Z" _$ p
  72. 6 ^& ]2 _/ \* a* R* s0 O, z* l
  73. char *dmabufsrc1 = NULL;/ t# B! p& _  s
  74. char *dmabufsrc2 = NULL;
    5 J6 T+ V! G+ m, p3 A; k( ~
  75. char *dmabufdest1 = NULL;
    2 h3 e! d6 o- ^4 l% @
  76. char *dmabufdest2 = NULL;
    2 x% w2 s& V5 F1 b2 r1 R+ t

  77. + n5 p7 g  T, _9 o: Z- R- \
  78. static int acnt = 512;
    5 @- `! H# F6 c3 f# [
  79. static int bcnt = 8;/ e' K* x6 O+ B& J
  80. static int ccnt = 8;& B2 d! ]4 b. `( O

  81. ! y+ M! r# H  c3 r6 q; `3 t% {
  82. module_param(acnt, int, S_IRUGO);
    4 Z% E' |+ q  v! W) Z+ [. M
  83. module_param(bcnt, int, S_IRUGO);
    / u( {& |( `$ {1 V) @
  84. module_param(ccnt, int, S_IRUGO);
复制代码

+ A5 [$ o* A+ P2 ~" w
* X0 b8 T% ]: s4 ^) u8 k/ K      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" Q% t$ K+ a$ k' |; Warm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- q$ l* N% l9 Y( m% i/ Y+ }     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 ?7 g9 n9 R: z3 n
0 r. g  Y0 J0 ^1 v9 {! Y1 {7 ~
& O3 M: W; ?, v! p
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-16 02:04 , Processed in 0.139342 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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