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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 u2 M5 M+ L% F) q
  1. [code]EDMA sample test application
    * g9 p+ S2 ^- M3 |
  2. /*4 d+ B9 x: e  a( M* Q
  3. * edma_test.c0 S1 G$ K" l' H9 j
  4. *
    ! K% S* {2 d# _5 U! `- \+ Z
  5. * brief  EDMA3 Test Application. E) V, L. R0 y
  6. *: Q" A, P2 ]! _9 N! X0 @
  7. *   This file contains EDMA3 Test code.
    : Z7 V# S& n, O# U
  8. *
    . s# _$ X7 G6 S: Z7 M
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    9 {) Y! r- D2 c* y7 P
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ y& C  d; x, s- Y$ s5 S% I$ w
  11. *         TO CHANGE.7 j, Z7 {5 n' u4 D
  12. *% t( s) _" l* |
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    7 A% U8 u7 d8 H' ^2 [& E( ~0 _
  14. *
    8 ]: q' N7 H# _8 t" A6 b
  15. * This program is free software; you can redistribute it and/or
    % K3 i' v9 @. N6 s
  16. * modify it under the terms of the GNU General Public License as% _8 M9 P% z+ D6 H5 @
  17. * published by the Free Software Foundation version 2.7 R1 N/ t4 s; X% B3 y! E
  18. *
    2 p# w1 c4 h/ G( {; T: v2 M# E( q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    1 H( X5 e2 U" k3 z  W5 h0 p
  20. * kind, whether express or implied; without even the implied warranty
    ! N/ o" ^* M1 h1 w5 O
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the' W5 b% |9 K6 O. ]( {
  22. * GNU General Public License for more details.) i& H1 w# V! Z7 ]* ?
  23. */
    . B1 ?' M% `. L: P9 r
  24. . r' e: A& q3 A* e( U
  25. #include <linux/module.h>
    9 A- T2 l* a" `  h- f
  26. #include <linux/init.h>
    7 i* @- X& b) ^+ W5 z" C
  27. #include <linux/errno.h>
    ) d7 S& T( I, B# P* t5 Q
  28. #include <linux/types.h>
    8 H4 I/ d: j. x
  29. #include <linux/interrupt.h>) m6 a; d' v5 e6 m7 U: w1 R! J6 q! m
  30. #include <asm/io.h>
    1 s2 o9 K* M) M4 Y9 m
  31. #include <linux/moduleparam.h>, m/ p  h9 \' w4 J' X4 i$ v3 g2 o
  32. #include <linux/sysctl.h>9 n  n' v8 n( U( _4 U) `$ f6 ~
  33. #include <linux/mm.h>( V; M. [; H( U  a6 u7 u
  34. #include <linux/dma-mapping.h>
    0 ^1 w  D1 f  s8 w; @0 q8 y+ C
  35. 7 Z/ I% U# ?. r$ X# t  U
  36. #include <mach/memory.h>
    / L- k+ R( r1 C  d0 W
  37. #include <mach/hardware.h>4 b  m. F. F/ s* L! Z- u4 Z
  38. #include <mach/irqs.h>
    ) P1 Z1 b+ k: @8 |
  39. #include <asm/hardware/edma.h>
    6 t; D* A4 _- _5 p& `

  40. : f  t& n$ B8 R6 x
  41. #undef EDMA3_DEBUG
    + H* P% i- {7 H1 b9 [
  42. /*#define EDMA3_DEBUG*/
    , O+ Y) y8 c0 g; l9 J0 W+ v1 q

  43.   s) l; V( p& U" @6 \( s
  44. #ifdef EDMA3_DEBUG
    2 \/ u' ~5 v) v' j0 \
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- l$ O, G2 ]8 X6 v
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    * H2 Q  K1 I' h8 u9 n
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    7 V+ ]7 v0 `" V
  48. #else5 l, u6 i2 u; u) ]5 f9 x. E
  49. #define DMA_PRINTK( x... )# x% S, G5 f# S. ^2 W1 W& G
  50. #define DMA_FN_IN
    9 K2 B3 f# \! E' X0 [) O  |
  51. #define DMA_FN_OUT
    ; C+ U3 ?0 F$ p, i9 j
  52. #endif
    ' s- G; O* D5 D" A9 z

  53. 7 N; d( y! P, b/ c3 Z7 h) d
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)$ }; ]9 T- Z- p2 ]5 n0 Y4 I
  55. #define STATIC_SHIFT                32 i$ N6 c' z4 m  O- W/ M# _
  56. #define TCINTEN_SHIFT               20: D7 g9 F% u0 x$ R+ g/ ~
  57. #define ITCINTEN_SHIFT              21
    & F1 |6 |: @5 S
  58. #define TCCHEN_SHIFT                22& K& {, p" |! I  \! E  p" q* U
  59. #define ITCCHEN_SHIFT               23
    $ N. E( W5 B5 U, Y# O" G! E# U

  60. * u: D; q3 }; F2 C- w# i" i2 C
  61. static volatile int irqraised1 = 0;
    5 T: h* i$ V4 }( N
  62. static volatile int irqraised2 = 0;
    & O; a+ L' @0 u
  63. ) P3 O3 h3 s5 y3 R# f
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 w% ^' l! W* m) `3 i( O
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 ^# V$ h. N# Z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% O  c  `% |5 W8 S' K7 N# |. T, a
  67. ! H' T2 S! c. m( }0 `; O
  68. dma_addr_t dmaphyssrc1 = 0;; q3 P4 V) C9 Z) @6 k# O3 t5 ~
  69. dma_addr_t dmaphyssrc2 = 0;9 ~: [8 Z6 R' y- i( {5 I) B5 ~
  70. dma_addr_t dmaphysdest1 = 0;
    ! W5 Y- O( r7 g( Q+ \4 b
  71. dma_addr_t dmaphysdest2 = 0;
    ; x& B. }* `, N6 _$ B! q

  72. 1 ?7 J0 J' n, h" v
  73. char *dmabufsrc1 = NULL;0 K: L2 G* F. B4 z" x7 J5 @, [
  74. char *dmabufsrc2 = NULL;- _. }1 A: Z- q3 p+ v
  75. char *dmabufdest1 = NULL;- C& G- l0 l4 E
  76. char *dmabufdest2 = NULL;
    4 U9 C$ z& k& {- U
  77. ; B7 V# r# Y; J  ?
  78. static int acnt = 512;2 m# e5 T1 N7 d. G  O
  79. static int bcnt = 8;" A* m: l  b/ {- s4 D
  80. static int ccnt = 8;, C9 d3 g2 o+ V6 r0 {
  81. & o; a: W" m, }8 a9 q
  82. module_param(acnt, int, S_IRUGO);$ J4 m9 V( f, ?7 p5 N% A" g
  83. module_param(bcnt, int, S_IRUGO);) t, n! E. t, @+ C; V/ E  v" @
  84. module_param(ccnt, int, S_IRUGO);
复制代码
0 L/ B5 r( x3 ^  n4 h3 u

  x, z$ t  b4 A      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# F7 g" O( \' {: d2 T4 ~
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ ^0 F2 r  k  K7 k/ `, \4 u+ h& C
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 ^6 _" t2 s; O# }8 o% h# l4 s) o

6 y6 r3 Y. E) P: d& e
4 o: `5 l8 v$ J5 M2 n( P
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-9 22:56 , Processed in 0.041123 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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