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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. |( P% x* ~; W0 Q9 T
  1. [code]EDMA sample test application. s/ R$ P( i& G# M
  2. /*& E5 M3 B0 f. R! ?( H
  3. * edma_test.c) z. u9 y) n* O; g2 j# u2 [: |
  4. *
    7 o9 j$ [/ Y. I9 h  i
  5. * brief  EDMA3 Test Application
    5 o1 P* P2 D' X( D
  6. *
    ( N7 [( C3 Q7 m  U1 J+ n$ v
  7. *   This file contains EDMA3 Test code.
    / K, j( S3 n% a( _* t
  8. *- w. H7 ~1 K8 s0 P2 @, v
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    6 s% O) B; O; v2 z" L$ j
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ) [3 u9 C. Y* G( L3 }; s
  11. *         TO CHANGE.; D) U9 I* q6 C# z! o' O: u
  12. *; W' R8 d1 W; p: c( O+ m
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ' J. X2 B% H) ?4 l
  14. *
    " C6 G) b; C: ?! Y' V
  15. * This program is free software; you can redistribute it and/or2 c2 F, q4 O( Z6 ^# ]
  16. * modify it under the terms of the GNU General Public License as
    6 K8 g, k& P6 V) J
  17. * published by the Free Software Foundation version 2.# g! t7 r8 N& s) Z6 `# p
  18. *. t' a) i8 G' p: v) `/ ?8 Y7 ^
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    . }) M0 r* O% O1 ?* C# u; q$ v, V
  20. * kind, whether express or implied; without even the implied warranty; R  T8 E1 p% ]* S1 u8 b* ~
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    3 O$ G5 P8 i# P5 v9 S
  22. * GNU General Public License for more details.
    0 `* V+ z! N! o( Q7 t
  23. */
    - B& [  D, g( `0 Y7 `# h! }
  24. 2 u# m8 B6 x2 h) |; d
  25. #include <linux/module.h>8 w( J% D& t/ |/ k. z8 u. y
  26. #include <linux/init.h>! W- A2 p  y7 R8 i: L/ Q
  27. #include <linux/errno.h>
    & S0 ]" ]" t. ]
  28. #include <linux/types.h>; S6 j: h; P' F$ ^: Z5 J
  29. #include <linux/interrupt.h>
    3 W# {7 p2 y" y" q1 U% F: Y
  30. #include <asm/io.h>, g% t$ L; U( N
  31. #include <linux/moduleparam.h>
    0 [9 a  s% d* E
  32. #include <linux/sysctl.h>
    / u" j6 i2 s8 O4 q) U
  33. #include <linux/mm.h>
    3 @- t% c8 i! I# B1 {2 n! w
  34. #include <linux/dma-mapping.h>
    0 C% ?) x; a7 ~2 J" k
  35. 0 P: ?0 |& x# ?0 x# C$ w
  36. #include <mach/memory.h>
    ; Z8 a: m7 l4 K; B0 w) P$ H7 X
  37. #include <mach/hardware.h>2 G: g$ P  c) d5 p, k  L/ J
  38. #include <mach/irqs.h>
    % D1 W& |, w! E! a
  39. #include <asm/hardware/edma.h>4 a+ h5 M1 z+ y) l) U7 y. |

  40. ! Y4 _8 a1 _6 e6 h2 ]$ D& I
  41. #undef EDMA3_DEBUG" l8 @' ~, S9 u: Q
  42. /*#define EDMA3_DEBUG*/
    8 F9 \2 L& Q6 p" {# Q

  43. , f3 ]# I% i9 N2 {8 J- G+ n
  44. #ifdef EDMA3_DEBUG7 i3 [, W6 w( f
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ( O/ Q' V0 d7 W+ X* q% m
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ |$ c5 D- ^8 S2 Z9 |2 y$ j; J
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& c8 I/ D2 M1 z9 _8 u& k
  48. #else
    + B' U2 z' b3 s+ \
  49. #define DMA_PRINTK( x... )! _! x7 G: H* R, k9 a
  50. #define DMA_FN_IN+ @; }; Q1 ]& w5 {
  51. #define DMA_FN_OUT
    . g: n8 w' {! S. J
  52. #endif! M5 b( I2 c3 ~  Q: _6 a$ k- f

  53. ; E7 c( ~( ~" X: [1 M
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)# ]5 C. {- \- x0 s% x+ \
  55. #define STATIC_SHIFT                3
    5 ^) C- V6 }7 ^
  56. #define TCINTEN_SHIFT               20; o& I0 V' O! v9 Q- k& K
  57. #define ITCINTEN_SHIFT              216 C& [2 Q5 l8 V
  58. #define TCCHEN_SHIFT                22( R$ A- r# ~. p# W$ G
  59. #define ITCCHEN_SHIFT               235 s' r; l8 O* ~& C+ {
  60. 0 a; c  v; ?+ g. ?# I
  61. static volatile int irqraised1 = 0;
    5 g2 x6 U" L" }: x4 q4 H4 a
  62. static volatile int irqraised2 = 0;! R) Q( V0 Z; q$ U  [
  63. 3 B) @0 R) s9 S/ e% f
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( a: Q9 c3 z4 m4 b# a
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & y8 q" {: B. K$ `: N
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' F& T! J3 h. G9 l
  67. 4 h  l" p7 d8 `* ]% L9 U
  68. dma_addr_t dmaphyssrc1 = 0;1 b/ z# d1 |9 S$ h. {- f
  69. dma_addr_t dmaphyssrc2 = 0;
    # D6 O+ j! I+ `& n
  70. dma_addr_t dmaphysdest1 = 0;6 N! W1 [7 J5 n2 T
  71. dma_addr_t dmaphysdest2 = 0;+ \' B6 R$ O4 X( s. D* C0 \* p# F1 x
  72. ; F) N( J7 v3 d
  73. char *dmabufsrc1 = NULL;! P, z$ {; M0 [7 `7 Q. Q
  74. char *dmabufsrc2 = NULL;
    2 x' b* I) Z3 }- {& ^0 r; S
  75. char *dmabufdest1 = NULL;: C+ X6 o8 r/ k# y
  76. char *dmabufdest2 = NULL;
    1 Q0 ^: m& u$ `% E7 X

  77. 1 M% k2 j' ^0 S0 j* V
  78. static int acnt = 512;
      J' H4 F$ _9 l& Q
  79. static int bcnt = 8;0 E* I5 a& K; |9 U
  80. static int ccnt = 8;3 a( w' Y2 E. u4 p

  81. # F+ B3 M3 w% O$ g7 @7 j7 I0 C
  82. module_param(acnt, int, S_IRUGO);
    % I) I* R$ r" X  B) C0 U
  83. module_param(bcnt, int, S_IRUGO);% c( {3 |+ A- q0 `; n9 p" R
  84. module_param(ccnt, int, S_IRUGO);
复制代码

0 P9 @7 t/ \& @) l
2 H2 ]! N& \  t8 L. O" z- G      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& ~" b6 `. m! M
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' S$ H% W) l0 ?     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, N! g8 L  @. T+ m2 y
, I+ U! B$ r0 Y, W* Y

( b7 N$ a4 V1 p
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-27 23:30 , Processed in 0.039947 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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