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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' d- @8 ~! t# \+ h
  1. [code]EDMA sample test application' A3 W  @( k  z
  2. /*
    9 z  D2 V6 L$ ^  r, O$ H
  3. * edma_test.c
    4 @% P$ y- \. F, K. t* [
  4. *
    ) y" q3 z: L. I. i; G7 a) \
  5. * brief  EDMA3 Test Application
    2 T7 M3 l- Y2 v  w" L! w
  6. *
    ! \0 H' W. D; E* o+ z) j3 t* R
  7. *   This file contains EDMA3 Test code.
    ; O( b3 j. x5 v' c: }$ v) M
  8. *6 B8 ]# A- k& J8 H
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ h7 o5 f) r# ~3 V
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 r# B9 `" R+ T( V# u
  11. *         TO CHANGE.
    / t2 s2 ?- c8 K. _0 k
  12. *2 B1 ^4 {( w4 w$ ?. p& M$ H
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 s& t2 r& m$ H" z1 ~
  14. *
    8 ~4 k& d: U7 `9 F' H  x9 Q
  15. * This program is free software; you can redistribute it and/or
    " U3 ?' c; Q2 f
  16. * modify it under the terms of the GNU General Public License as
    & {  A( a. p$ a! G
  17. * published by the Free Software Foundation version 2.
    $ I- z: Z5 U- A) e& J% M% Q! q
  18. ** j# w" J% B7 q# ~4 n
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ X7 Y. B1 q8 z; N2 {% d; i
  20. * kind, whether express or implied; without even the implied warranty
    7 Z$ n! e7 {$ _2 j' r- Y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    . W6 N# _; k8 {: ^2 E1 |
  22. * GNU General Public License for more details.+ e5 N2 a+ j; _) \& [' a3 ]
  23. */2 c" P1 n( R& Q5 p+ D# N+ f( {
  24. 8 u: H. Z/ n# T" S
  25. #include <linux/module.h>
    3 Q% A$ d% Y3 d& r2 c. B# d
  26. #include <linux/init.h>
    # U7 ?# |; `$ O/ }
  27. #include <linux/errno.h>$ S* `  k( B4 y; E
  28. #include <linux/types.h>* P8 y# h' j4 S
  29. #include <linux/interrupt.h>: c6 f: F* U$ S& a+ ]
  30. #include <asm/io.h>* l" d' u- `& w8 L
  31. #include <linux/moduleparam.h>
    ' P3 S0 n  D8 r+ E$ f! P5 ]3 B
  32. #include <linux/sysctl.h>
    . M/ h& W! b6 A$ d7 P2 r
  33. #include <linux/mm.h>  D$ i+ _2 M. t3 j
  34. #include <linux/dma-mapping.h>. a/ ~5 i9 X) o
  35. ( S7 |6 |( K* K6 P7 D: x
  36. #include <mach/memory.h>  }/ s) Q' \2 v3 V7 B) o4 Y
  37. #include <mach/hardware.h>0 t3 k: L2 a; Z7 b% ]; R2 k& I5 M
  38. #include <mach/irqs.h>6 I; ^! F6 Y8 V! f: w
  39. #include <asm/hardware/edma.h>- L) u# {6 ~3 b! @

  40. 6 m7 E" S+ j$ v
  41. #undef EDMA3_DEBUG) \1 Y- X& o% |1 k/ e5 e0 K6 Z; q
  42. /*#define EDMA3_DEBUG*/$ a' k) A  A! N8 J+ X: _8 }0 b, u. \
  43. # n5 w/ Y& e. J$ q- k
  44. #ifdef EDMA3_DEBUG- Q. \# R, x! t
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 w. W. V( @% `% c7 \
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& l: }& x+ z& _( x
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    7 N1 _: |6 F0 P6 |& {
  48. #else6 \+ Y5 f. R  K+ I1 w" y/ h% \
  49. #define DMA_PRINTK( x... )& e; M* f( z  m, m
  50. #define DMA_FN_IN, }+ T- D# g" T8 I9 W& @
  51. #define DMA_FN_OUT
    ; {) j0 b/ ^/ W
  52. #endif
    ' Z$ z8 [7 C! b+ Y

  53. 9 J1 J; D0 _, {5 t7 K/ }; n
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ! h/ T  E# p: q& }9 a
  55. #define STATIC_SHIFT                3. \' h. N0 Z, v! g; V* ?
  56. #define TCINTEN_SHIFT               20, Q4 o! q9 j  w5 I8 A
  57. #define ITCINTEN_SHIFT              21
    $ R4 I$ H8 M9 c* ~% x9 q7 _7 g4 H
  58. #define TCCHEN_SHIFT                221 `2 C8 o, n1 k2 q$ z, Y
  59. #define ITCCHEN_SHIFT               23; E0 s; T: h/ L+ B7 I0 d  ~
  60.   b( x$ y* h7 `  z: @8 G& \
  61. static volatile int irqraised1 = 0;
    4 |# h! e( M: u; o1 D
  62. static volatile int irqraised2 = 0;
    , F, F$ u/ X2 O. v* |& S% _3 s6 D

  63. . Q" R  H9 M1 B6 H! E. |& N
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ t) X' S, s% D; ^9 }. a
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 B* l& m8 I, |: p( t" W
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 Y) F( u  t; ]
  67. 6 c" k( p, h! F. }4 U0 Z% `
  68. dma_addr_t dmaphyssrc1 = 0;% p! I% I% ~" l- Z4 Z8 \
  69. dma_addr_t dmaphyssrc2 = 0;
    . b( o, X, C8 H5 h$ W$ E' Q( e
  70. dma_addr_t dmaphysdest1 = 0;
    9 M3 j: o6 a, L4 q! q
  71. dma_addr_t dmaphysdest2 = 0;/ z- N0 v4 N$ {1 E. y

  72. $ V, w3 H  Q- V
  73. char *dmabufsrc1 = NULL;
    , ~0 y4 M& F$ N/ @3 u; ]+ W: q) }
  74. char *dmabufsrc2 = NULL;0 a4 G9 D" k$ K8 _! @# Y
  75. char *dmabufdest1 = NULL;9 j( s% i2 Y2 Q/ s+ q3 @
  76. char *dmabufdest2 = NULL;' o; S  ~- V) H

  77. % [' C/ B8 ~& N. p! h) W1 t  U0 n& g. P
  78. static int acnt = 512;
    * }: d" n  N' |" V9 p  N2 T" C; ^- l
  79. static int bcnt = 8;
    7 {- F. n5 S& }1 B9 t5 y+ S
  80. static int ccnt = 8;6 ~* X" d  e! x" C$ S

  81. * j( u: R5 @* P# T; R3 F2 u
  82. module_param(acnt, int, S_IRUGO);
      @& {  C( A' o) {# c
  83. module_param(bcnt, int, S_IRUGO);
    ! f7 ?+ V  t: F: u6 g- ^+ Q
  84. module_param(ccnt, int, S_IRUGO);
复制代码
$ ]. O7 O0 ?# z4 Y, j/ B+ `
; b' g0 _) a+ l& b- [
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 V4 w* o8 W  y+ \. c. Uarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 d5 Z) |7 N# h( b+ Q3 Z! T8 ^     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. }6 x7 \6 K0 m( u! R0 i
3 e6 U5 \+ e& J6 h
0 n0 c- l& r8 `( k6 J9 k2 e
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-15 17:37 , Processed in 0.038483 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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