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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' n% p6 T0 r( t3 [
  1. [code]EDMA sample test application9 f! t) q: n0 `" I: f; q
  2. /*
    ! Z8 z4 ?/ ]" P' G6 F+ T2 H
  3. * edma_test.c
    8 i% `0 T* D  ^5 F
  4. *
    9 d) z. Z( [& H# T
  5. * brief  EDMA3 Test Application& r" r1 z. e" ]' e$ a7 b
  6. *6 w/ i" Q3 C! Z! t9 y2 R
  7. *   This file contains EDMA3 Test code.* }( T" l& I. v3 g0 t3 \+ w' u
  8. *  W! b+ i( G) l& N
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ; o* h4 z6 L( s% z& ~
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* L0 I4 p  J# ^* ?
  11. *         TO CHANGE.% w+ C- h1 o7 f# J+ \9 h
  12. *4 |7 j" ~7 ~. P& g1 r( D
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    8 n3 l9 T8 I4 x+ i3 B0 l
  14. *
    ( b1 ^$ i: Q' v3 }. z- P
  15. * This program is free software; you can redistribute it and/or
    4 x/ \. a9 N8 G" _. N& z$ f
  16. * modify it under the terms of the GNU General Public License as
    # p7 j- a3 ]+ y1 D* a- }
  17. * published by the Free Software Foundation version 2.9 I% _, @) ?  Q& f. F
  18. *0 b  K" s+ W" o% H8 U! E  v; E
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ' [% P! U( N9 y, j' W' ?
  20. * kind, whether express or implied; without even the implied warranty
    # j5 _: v, x& V0 i( r7 I; s5 v( z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the4 m+ X$ ]0 C! P1 a5 m' b
  22. * GNU General Public License for more details.5 q+ p2 ^% m* \* W. w
  23. */; W! K) M/ }$ c; W1 I$ c

  24. / c# M) [' J% L& L5 V/ ^/ x3 y" ]
  25. #include <linux/module.h>
    . w" Z( j  R( G7 t
  26. #include <linux/init.h>
    ( b! A; Z2 m& U! a) e" E0 y& Z" Y
  27. #include <linux/errno.h>
    2 ~3 O9 l) k4 `
  28. #include <linux/types.h>
    8 _  w+ G3 {. [# X& s, \
  29. #include <linux/interrupt.h>' [; r# r( ^& p% s4 W
  30. #include <asm/io.h>6 V: ?6 o  S0 H1 e6 g; ?
  31. #include <linux/moduleparam.h>9 {1 {  j3 `) F" P+ \
  32. #include <linux/sysctl.h>
    & f6 }* d; ], f# y7 g) A
  33. #include <linux/mm.h>. E$ ^" Z# O7 @4 K7 _+ x1 H
  34. #include <linux/dma-mapping.h>
    - y7 K5 O$ B0 q( k1 k- i% t  @' Y: {
  35. , c$ l. `$ H! @7 A9 \) a
  36. #include <mach/memory.h>
    * Q! O& l; |  p8 G7 i7 X6 ~
  37. #include <mach/hardware.h>1 d0 N! S* R4 }4 p% z
  38. #include <mach/irqs.h>2 d) q1 @8 n9 y% l
  39. #include <asm/hardware/edma.h>
    # n; k9 ]" j# D& Y
  40. 6 ?! x3 t7 ~2 I' v8 j6 n( j6 z4 k$ r
  41. #undef EDMA3_DEBUG8 S5 J2 X1 d7 ^+ y
  42. /*#define EDMA3_DEBUG*/
      U$ @  M+ a* J) V

  43. ' l& V* }) W. `
  44. #ifdef EDMA3_DEBUG0 e+ [. B: W9 Q' X2 g; D
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' L: P0 w: Q/ H5 u' C2 j8 |
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    , f! A1 I) {- p6 Z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    , i- l8 t/ q7 y( I3 w
  48. #else
    6 Y$ g% C3 z5 s" Z
  49. #define DMA_PRINTK( x... )
    + B( @  M$ H& C- ~: w1 Z
  50. #define DMA_FN_IN
    9 _& y3 @3 J1 n* H
  51. #define DMA_FN_OUT
    ' G9 K7 q  R, N1 _; W. u6 w
  52. #endif6 Y8 h" ~$ ~) h

  53. " u0 R+ K9 i: }: a1 O/ U
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)4 F4 R8 F, ^; e; B3 K! ?% Z: G, ~
  55. #define STATIC_SHIFT                3
    6 [( Q% F, r7 U$ o5 C& W" i
  56. #define TCINTEN_SHIFT               20
    ' y7 e$ b8 ~5 e, h8 C, U
  57. #define ITCINTEN_SHIFT              21
    2 z% D" u* E1 ~4 O% f; X' b
  58. #define TCCHEN_SHIFT                22
    7 p) B- w9 M2 Q. u4 M2 K
  59. #define ITCCHEN_SHIFT               23* d& v2 U3 Y+ J+ r3 o  R7 [

  60. * h5 O! F2 X) ^& Y
  61. static volatile int irqraised1 = 0;
    ' f' L  A' x( q$ w
  62. static volatile int irqraised2 = 0;
    0 ^+ C" s; U7 f; i; {2 W, B

  63. # W$ j/ u' x) Q8 j( J# |4 Z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " S# J) P. O! _; M( ~; A, m
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : L* r/ [1 m' F! x% Z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 j( P8 C9 H. s9 v  J! K& ?

  67. / `1 f, ^- {& r7 W1 C% _, x
  68. dma_addr_t dmaphyssrc1 = 0;
    6 ^) k  l# O2 \3 i5 W. p
  69. dma_addr_t dmaphyssrc2 = 0;- c. s: h4 S5 e1 Q4 N9 x4 u9 _& h% U
  70. dma_addr_t dmaphysdest1 = 0;1 l! S4 T/ L# Q
  71. dma_addr_t dmaphysdest2 = 0;
    # U8 U' V- }  i9 \

  72. 4 E3 t5 {: C/ M5 [7 X3 O2 }
  73. char *dmabufsrc1 = NULL;
    * }* m+ q/ T3 {  E+ g  W4 H, g  G
  74. char *dmabufsrc2 = NULL;
    0 M4 s  y; @# C7 g% S+ d$ ^
  75. char *dmabufdest1 = NULL;6 M6 b3 i- C& A" p% W" P
  76. char *dmabufdest2 = NULL;
    & @/ O5 V" r8 ^* k/ r/ Z& T. L2 B& t

  77. / w( m! o/ W+ ]
  78. static int acnt = 512;
    7 a4 e% ~7 D6 f* I  y& c' y  s5 {
  79. static int bcnt = 8;2 N$ N: _6 O$ {! w
  80. static int ccnt = 8;' L) a, Q+ F7 M  k4 ^
  81. , N& V& e5 J1 L* m2 s* [
  82. module_param(acnt, int, S_IRUGO);
    3 O" u. W' S6 [# Z( B8 W9 G5 I
  83. module_param(bcnt, int, S_IRUGO);
    $ G, b) A1 _. i! m( f! `
  84. module_param(ccnt, int, S_IRUGO);
复制代码

8 A% Z+ _# h7 e) z# s& @$ q/ T9 i. [5 x" K& q3 D% t- o
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, I, ~- L* p4 i% a; \5 v5 l( }
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& A# w% k1 K3 E4 _
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ H& P7 @* H0 B' E; _4 v; {( k
0 m2 J1 Z- R- T) K

6 S% j8 z4 N+ `, n: d2 f
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-3 19:23 , Processed in 0.121118 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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