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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , V+ K$ k: y/ ~' b
  1. [code]EDMA sample test application
    ' s! C# G$ s0 N) P+ _. b7 U5 B
  2. /*" R! _% s* I4 n: Q
  3. * edma_test.c  i; E# p. a% ?8 J" S6 a. s
  4. *' S" S- q3 x3 _/ u! a" D* Y! t( z
  5. * brief  EDMA3 Test Application3 T. v  i+ v9 R1 ]! `6 k: c+ L
  6. ** o& c2 h# X+ k) v8 n4 l
  7. *   This file contains EDMA3 Test code.9 W6 j3 X' I: ~: b* ~
  8. *- B) M; F) O* v7 C3 i
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 U* h5 d+ b- K/ |9 u' c
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 G% k  W* ~& {) |% S
  11. *         TO CHANGE.
    ( ]7 n/ H/ i1 k9 H  E- A
  12. *3 O; ]5 n" z. n: N: b* [& v# s
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ! P, F+ ^% M8 I; h
  14. *- d+ C1 ?- `0 s% o( _
  15. * This program is free software; you can redistribute it and/or
    / [3 u) W) Z& e4 P4 |; E. w
  16. * modify it under the terms of the GNU General Public License as' F+ `+ E5 ^7 b; F2 V2 {
  17. * published by the Free Software Foundation version 2.3 H2 G1 d: ]1 Q9 E5 Y& A  m
  18. *
    0 T" E- o& b7 z: w3 F$ s
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any) {! e* s0 G0 w% A% D
  20. * kind, whether express or implied; without even the implied warranty) d% _- w: b8 f, k
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the' R* B/ k* S" u3 d1 C" X3 u
  22. * GNU General Public License for more details.
    9 k3 t2 Y; n8 j6 @& r2 E
  23. */4 I4 F. `1 x- o1 A" q( i1 B
  24. - H! f: x, u" i6 v1 B' A/ E5 Z
  25. #include <linux/module.h>
    8 k6 Q- }- F4 d0 A
  26. #include <linux/init.h>  F6 S7 ?: _8 j2 z; b+ |4 g
  27. #include <linux/errno.h># A# k" K6 K  G7 a# W
  28. #include <linux/types.h>( k$ t8 @5 G5 k& A0 d
  29. #include <linux/interrupt.h>3 j2 S  p2 I" k; i, O! w
  30. #include <asm/io.h>7 I% U. o9 s7 b
  31. #include <linux/moduleparam.h>: X6 \( C% p( y
  32. #include <linux/sysctl.h>6 U# F" t1 o5 F$ u7 w5 W
  33. #include <linux/mm.h>& V6 Z2 ]% M2 s% R) t$ ]
  34. #include <linux/dma-mapping.h>( ?, g4 j0 z9 s/ I8 a# {# n
  35. 4 B* _6 k( Y+ B
  36. #include <mach/memory.h>
    6 w$ g' m4 i( G% ~
  37. #include <mach/hardware.h>
    6 E/ {3 F, i$ m5 q/ `
  38. #include <mach/irqs.h>. o$ ]! u1 E* @$ y- o! @; _
  39. #include <asm/hardware/edma.h>+ h6 n( I2 p3 h) t
  40. 5 v: y" M! G& x6 m
  41. #undef EDMA3_DEBUG3 r3 ?% M- d1 S/ q6 @+ J5 T
  42. /*#define EDMA3_DEBUG*/6 u" A7 H5 g: b7 ]
  43. $ A: Y( K! |2 s2 z
  44. #ifdef EDMA3_DEBUG
    $ \' Y) M& {3 J
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ) w( b7 x8 q) X8 o! G% G6 g: ^3 P3 [
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    $ B% @+ k3 j- K! t
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- Q& @' u! j+ R, q: G, [4 K/ g
  48. #else
    1 {" J' L+ P; n4 L8 \3 Z& q
  49. #define DMA_PRINTK( x... )
    $ \' O5 w7 g! u4 X
  50. #define DMA_FN_IN$ s! U$ n8 }& @) o: r4 y& ~
  51. #define DMA_FN_OUT6 c& j# T* G; ?. k; x! w
  52. #endif
    7 C% I  C' ]2 `* W/ b
  53. % q6 _3 t! n) ?. j, C) y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    5 |- ^2 N/ I2 {3 K/ a* q' u- @
  55. #define STATIC_SHIFT                3
    * H2 _/ Z- F* U4 ^/ o
  56. #define TCINTEN_SHIFT               20
    ) W! C# G3 j' I' [7 w% O4 p  Z* ]" t
  57. #define ITCINTEN_SHIFT              21
    ' C6 G( G  X9 g2 z# Y" u
  58. #define TCCHEN_SHIFT                22
    - @( b" t2 J* |  i
  59. #define ITCCHEN_SHIFT               23
    ' S$ Q. x( F7 V0 [  F# x. U
  60. 8 K0 n, |/ t0 G4 S
  61. static volatile int irqraised1 = 0;4 w# Z5 I& a- h3 h* G% E9 w& N0 ]
  62. static volatile int irqraised2 = 0;: w4 b& M2 b) S; o1 F' e4 V

  63. 8 K. N/ C# x' g" b) {9 h% h+ G
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & `, C! ]. P- ^* c+ \
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 Z$ m) [$ w" r" o% V& Z* C# c
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 R; d% ^2 l5 D7 {2 |3 F8 `8 ^
  67. & Z! S, F1 v8 a0 I" D# m$ ~& ^
  68. dma_addr_t dmaphyssrc1 = 0;3 V; R! X5 L3 V4 R
  69. dma_addr_t dmaphyssrc2 = 0;9 c6 W4 n) D- t- `) P, P, E
  70. dma_addr_t dmaphysdest1 = 0;* G# X9 K, h8 ^2 ^( a* X. `& ^4 ?% j
  71. dma_addr_t dmaphysdest2 = 0;
    0 R" @+ B( m5 D; f
  72. 3 j$ H5 W4 _6 A. `; ?7 x
  73. char *dmabufsrc1 = NULL;! G& G) n* a# u9 g
  74. char *dmabufsrc2 = NULL;/ [2 r: O6 @3 b$ {  z1 w- v8 Z& B3 d2 \
  75. char *dmabufdest1 = NULL;/ }" c9 m, D& h& k: W# }; C. Q  W
  76. char *dmabufdest2 = NULL;1 y3 w0 Y* q: d! G/ O/ e4 D& G8 ^) Y

  77. 6 C2 x. J9 c3 D# B% J% G
  78. static int acnt = 512;4 Q+ V/ d# j4 ^5 Z3 a7 b) r2 J
  79. static int bcnt = 8;* @, u% e! ]! F. |
  80. static int ccnt = 8;" y! W- H  q% D

  81. ) v8 i, k6 N  s
  82. module_param(acnt, int, S_IRUGO);
    # Z, c5 x& {/ w: t: d2 H/ M/ N
  83. module_param(bcnt, int, S_IRUGO);# J$ \. k: C8 o/ D( ~& o
  84. module_param(ccnt, int, S_IRUGO);
复制代码
, F% {* X( ^8 U- J
/ V! F. v& j, Q0 X. S
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 w  a9 `, z  }: i1 rarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! m& q7 r! Z- T+ q
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, ~. V* ]9 r4 `$ X
$ W/ F* P, j' y5 R/ ]

& r( m5 Q$ I' n" A7 ]
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-16 14:37 , Processed in 0.040404 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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