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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : J1 z% {' r4 V! i. n+ M' }
  1. [code]EDMA sample test application, O+ D; p( z( U' N5 h" D9 v
  2. /*
    " a/ |6 c+ i3 a* N5 a3 V  D
  3. * edma_test.c
    3 _$ X: ^2 [% @( [- b6 ~) H1 m/ e! V- h
  4. *+ f/ r. w2 h0 l. o& L0 u( E. a
  5. * brief  EDMA3 Test Application. h* I* u6 S7 j* I
  6. *: _2 g: ]( Y6 ^8 u0 s
  7. *   This file contains EDMA3 Test code.& Q* G! r+ m& P: |5 J
  8. *
    1 S& A+ j  n1 t  ~) _, K$ t* U5 w
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    1 x1 A$ B8 b4 r5 u% t
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% z  l" g( Y# U/ s' ^
  11. *         TO CHANGE.
    ; d! G8 T9 G# q$ G- {, l. |
  12. *
    - |! A8 ]4 o' A! A4 W9 ^
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    - ]% ^% t7 R9 b9 O
  14. *; ~" I6 X9 n8 t! O
  15. * This program is free software; you can redistribute it and/or
    . r$ d  |+ C3 d9 X0 T+ y! t
  16. * modify it under the terms of the GNU General Public License as8 |  D3 |  p$ k7 f* n+ p
  17. * published by the Free Software Foundation version 2.1 m+ P3 }6 s  w
  18. *% W: C8 P1 q% @1 V
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 ^2 z; k/ n7 m& y# d- q. b+ C& U6 h
  20. * kind, whether express or implied; without even the implied warranty
    ) ?' \' Y# I7 k& t0 N
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the. Q) d( _7 j+ E% {( ~- R7 _3 s
  22. * GNU General Public License for more details.0 o- s9 L+ |" q: [
  23. */& w4 L9 B$ B3 x7 ^/ C

  24. + G  ~# F4 ^& D9 L$ B
  25. #include <linux/module.h>% W5 p0 ]# u) B6 s
  26. #include <linux/init.h>: _0 m3 u/ m7 [- f: U" k
  27. #include <linux/errno.h>
    : B4 i: X8 i3 n: q+ A% z
  28. #include <linux/types.h>% t1 [3 J4 s! ?% v. ?$ w+ B  n
  29. #include <linux/interrupt.h>
    2 P0 C2 Z7 w7 \# k0 o) t" w
  30. #include <asm/io.h>) b0 j4 \3 s! J& q+ j1 [9 A* X# n" G  ~
  31. #include <linux/moduleparam.h>
    9 L- X5 I1 z# E
  32. #include <linux/sysctl.h>
    4 F+ k8 r3 j  v1 Y, X. F
  33. #include <linux/mm.h>4 y9 A* `, }1 W/ t) P
  34. #include <linux/dma-mapping.h>
    & S0 ^- K! J1 _0 a' A$ g

  35. & H8 x4 v6 I/ {4 o
  36. #include <mach/memory.h>- S1 u) _; L- H8 ]9 \5 Y6 \
  37. #include <mach/hardware.h>/ i# f& K: ]( Q4 A$ S/ Q- A- p- d
  38. #include <mach/irqs.h>
      J# u. d) C7 |8 V
  39. #include <asm/hardware/edma.h>% T1 W4 @8 _6 o+ c# _
  40. 1 l) {/ c2 d6 u6 k) J
  41. #undef EDMA3_DEBUG
    , p# c( G3 A  W6 k1 ^- ]
  42. /*#define EDMA3_DEBUG*/
    # q) d5 B3 D/ I) c) ^1 M; I
  43. ' a3 }5 j& q# u- `8 d, V
  44. #ifdef EDMA3_DEBUG" x. K' l9 b0 \9 B6 Q$ W
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    # k6 p+ Q, k, l$ s% h/ V+ \
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); u3 W8 T! ^( A
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    $ M6 @" h7 c0 L. j6 z; ?5 ]
  48. #else
    * ^( W0 A  J% \3 X  B' j
  49. #define DMA_PRINTK( x... )
    : N- L/ ^' {: g: u
  50. #define DMA_FN_IN! M: S4 z2 @7 e! f
  51. #define DMA_FN_OUT' h, k2 d( n, Z+ [) a
  52. #endif
    ) }7 t# b, T$ ?( v0 h

  53. + }2 z$ Y6 l5 R* E9 F! G
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    + R. L, R. N4 X, P$ K
  55. #define STATIC_SHIFT                3  q  ]2 n8 D+ a) E/ S! Q# G$ Q4 v
  56. #define TCINTEN_SHIFT               20
    ; T! K3 R1 j' g1 Q4 i9 |
  57. #define ITCINTEN_SHIFT              21  L. [- m0 y# U& w
  58. #define TCCHEN_SHIFT                22
    - |, ]* `; |9 _) {7 S- t- O
  59. #define ITCCHEN_SHIFT               23
    3 x! M  {) L$ z0 |
  60. & A2 O( U& f1 F( q6 b  x8 `$ ~0 J
  61. static volatile int irqraised1 = 0;4 E3 `7 v* f( p2 ], z' I
  62. static volatile int irqraised2 = 0;" [5 @* Z$ k- d+ z( H

  63. * r) J5 m5 C9 ^( t0 k9 O: D
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 x1 }, N* |8 s, z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! N. K+ _) _, X1 v: D/ V
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! E0 O7 G1 S* [4 P8 V2 s1 ]; n4 A* }

  67. / T, o( `) [) S, l
  68. dma_addr_t dmaphyssrc1 = 0;
    9 P' K3 p# Y( C; P- y
  69. dma_addr_t dmaphyssrc2 = 0;
    8 q7 {) c6 t( }  u+ J
  70. dma_addr_t dmaphysdest1 = 0;
    ' z' p6 ]! {& m' |1 d. v& ^
  71. dma_addr_t dmaphysdest2 = 0;
    ( l1 x& t$ A3 ]$ W
  72. # p0 Y- M1 F) y8 L8 @: ^4 Y
  73. char *dmabufsrc1 = NULL;
    3 q& @  w. C1 n1 U( m: V
  74. char *dmabufsrc2 = NULL;
    . Y7 x3 M9 h/ @4 C" C9 W
  75. char *dmabufdest1 = NULL;2 D  Z* L+ T* a
  76. char *dmabufdest2 = NULL;- T8 U2 ]3 C- p! P- G
  77. 6 [- P+ R5 Z+ {  ?, q5 o$ P
  78. static int acnt = 512;
    5 V% p6 `2 v" N+ m/ R; t; b7 `0 g
  79. static int bcnt = 8;
    4 T: e* J8 y5 m6 R. r  k( T8 S
  80. static int ccnt = 8;' b$ I' m- L& _- w: D
  81. 9 G: I* k' {, ^( @
  82. module_param(acnt, int, S_IRUGO);
    3 A2 Z8 y8 {7 o6 S8 V$ H
  83. module_param(bcnt, int, S_IRUGO);2 d! S9 \2 B3 v1 }- O. R3 m: I
  84. module_param(ccnt, int, S_IRUGO);
复制代码
3 L& I0 y3 g; N: C9 m  ]' R! {
  W8 F- [0 D. O0 x) d
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! f* G9 |' g+ Warm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ \8 V+ C8 R7 o( {
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 m* H" F8 e4 p! g; D& o

: p4 P' |. K" p  X, k  F
$ @% W0 x8 ~& V, Z" r/ P$ e
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-25 18:29 , Processed in 0.043755 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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