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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 \, N. z$ n0 e6 F$ C: G& ]1 w5 S1 w
  1. [code]EDMA sample test application
    ) \) k8 _# ]! j
  2. /*
    + x/ z2 j/ u  R5 j" U& o6 H" R
  3. * edma_test.c8 I# y% s+ }# X% }' O4 z; e; E/ b
  4. *
    1 i. e) g1 y, \# O
  5. * brief  EDMA3 Test Application
    ! s# l& e: q  C: ]. G/ y' U8 M
  6. *$ o! f0 ]: Q. C
  7. *   This file contains EDMA3 Test code.
    % S) Q( w: B" |0 Q1 n# S
  8. *
    1 K" H" j8 q2 M
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    0 m3 a: ^1 v; t( `1 P4 f% w
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    0 X/ \* t$ w: m3 t
  11. *         TO CHANGE.
    7 j5 X& m4 J2 h7 p. ^/ f/ Z
  12. *
    ' k+ K& \3 v4 z& y: e+ I
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" |# \0 @9 }& z1 G7 Z% J1 m
  14. *
    3 a$ k2 Q3 n  z" }$ t
  15. * This program is free software; you can redistribute it and/or& m6 m- U6 R- W- {- Z' u, S+ B0 n
  16. * modify it under the terms of the GNU General Public License as
    $ u/ p* |: z6 E
  17. * published by the Free Software Foundation version 2.# z: ^+ B8 X( ^+ V6 Y5 }, y; e8 w  Y
  18. *
    5 t9 J+ Y8 X, i! c. h3 e$ [
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    - A( C* X: n4 j4 T8 {$ {& s: A
  20. * kind, whether express or implied; without even the implied warranty- C  n, f& @2 m; ?( F3 t( V
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    7 h: W& [( ^8 B/ M, v; p! a
  22. * GNU General Public License for more details.5 G2 b- a/ V# Y8 w8 t; z
  23. */! \' E. t" W5 ]3 u& r! w

  24.   T+ I2 `) x# |5 A3 C
  25. #include <linux/module.h>
    $ f! B$ L7 |+ P5 e( P% z
  26. #include <linux/init.h>% y5 _# P5 _- V2 Z5 m5 R& a1 B0 v  L
  27. #include <linux/errno.h>. o/ u, H- s: b8 a  t9 }
  28. #include <linux/types.h>
    4 j' g# f3 U6 P, g% P) A- t
  29. #include <linux/interrupt.h>
    & V1 R8 v) u& L% O8 ^% p8 g
  30. #include <asm/io.h>
    8 q3 e( {7 n3 q" v3 g
  31. #include <linux/moduleparam.h>) b( g% S3 O6 b  b3 m
  32. #include <linux/sysctl.h>( [& n8 u# h0 Z( h4 I0 Y/ e
  33. #include <linux/mm.h>, N9 T+ H- T/ Y& Y0 c
  34. #include <linux/dma-mapping.h>
    ' Q( d4 w; z# L% U$ O5 J8 ]

  35. 8 T& a7 S; C* ?/ S3 r* g
  36. #include <mach/memory.h>8 N1 P, y' X" `! s* X
  37. #include <mach/hardware.h>. L# w  K4 H5 J, Z; A
  38. #include <mach/irqs.h>$ O- n& U+ {- L) P- R
  39. #include <asm/hardware/edma.h>
    0 D$ I! Y0 U6 h' E4 n

  40. 9 T  `- a& d% `9 b% Y2 k! {
  41. #undef EDMA3_DEBUG
    . C% {: o5 l6 G% `
  42. /*#define EDMA3_DEBUG*/! l- f9 Y5 i* A- O0 q

  43. $ {  I8 d0 u$ `3 d* q, e2 o
  44. #ifdef EDMA3_DEBUG
    - k6 ?  Z9 @- i! Q. V& a
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" p  ^/ @6 F1 A% |+ M
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' ?# n" m# x1 D2 g& ]" V7 A! v" Q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    9 k- W: K% q  b
  48. #else
    * \% j, I: {! B8 Z& t8 c+ @7 j
  49. #define DMA_PRINTK( x... )/ s1 [6 a1 i& F# H% `' Y
  50. #define DMA_FN_IN
    ; j& p' ?; k0 X0 y" h
  51. #define DMA_FN_OUT
    ' k9 _# @: u# q" j7 k( G
  52. #endif
    & M5 C( |1 c: v
  53. , b* ~8 V: `/ J4 S( I
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)- u: j( `( E4 ^
  55. #define STATIC_SHIFT                3; D. [& M5 v1 y6 b) s% b
  56. #define TCINTEN_SHIFT               20% v' ?. N! S, q3 ^+ e
  57. #define ITCINTEN_SHIFT              21
    % s, y! {* a- r" ^
  58. #define TCCHEN_SHIFT                221 `+ z. e& K$ g' m6 B5 J
  59. #define ITCCHEN_SHIFT               23
    ' a1 W6 I/ \' {$ S1 ^; f8 \4 `4 j8 \
  60. % o" w9 D6 C6 W. a9 |3 R6 ^; M4 I. |
  61. static volatile int irqraised1 = 0;& {, Q0 M  k; A. Y( @
  62. static volatile int irqraised2 = 0;
    8 z6 P+ i9 E+ J

  63. 0 Q5 |5 O: [0 P+ Q5 `" F1 B
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & j5 e$ e0 H: z8 x8 R' O' O+ |
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; u. _! C: q5 e, w# Q: u/ m
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' O4 z5 L" p* B+ O

  67. - }6 b0 N% a1 H4 n5 f0 ]1 q
  68. dma_addr_t dmaphyssrc1 = 0;0 ?$ ?, O$ v1 L0 ]
  69. dma_addr_t dmaphyssrc2 = 0;! B8 x& Y/ r2 o: h, |
  70. dma_addr_t dmaphysdest1 = 0;7 ]1 C7 L& U+ O
  71. dma_addr_t dmaphysdest2 = 0;
    2 e  x( V4 ^+ g
  72. 1 z- T! b; @+ k1 y& K: \0 ]
  73. char *dmabufsrc1 = NULL;2 Z. k( Q2 l3 v  E2 E- L8 I
  74. char *dmabufsrc2 = NULL;% k) [: k; V$ E0 @" O
  75. char *dmabufdest1 = NULL;- B+ s; ]# U3 \' R- ]
  76. char *dmabufdest2 = NULL;* x* |- V9 \7 u5 }3 q4 |

  77. - o- L8 Z3 V0 `3 S
  78. static int acnt = 512;
    * g' D2 F# J% d/ L( C
  79. static int bcnt = 8;
    ! k0 A+ X1 N* o, w1 n2 ]# x% }
  80. static int ccnt = 8;' l' W% l( N5 v; I! b

  81. 8 u7 t6 H7 v. L7 ~
  82. module_param(acnt, int, S_IRUGO);- u# a1 ^* o. t4 Y5 N
  83. module_param(bcnt, int, S_IRUGO);. `  e( _6 i: Y9 L6 V. C* y
  84. module_param(ccnt, int, S_IRUGO);
复制代码

9 \0 X! Q/ W% R
8 U7 H" h7 A6 c+ J1 X      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' C4 R8 c4 s& t& v0 Qarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% e7 }& _+ {+ L9 r3 W& t     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
  ~6 @% M4 y4 [& K* v! t& ]4 E3 M3 B8 ?! V1 h6 g9 B$ W  A
0 f2 S0 H3 q6 O
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-10 23:05 , Processed in 0.044461 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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