OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
0 U8 y1 z& K! {( o% a: }
  1. [code]EDMA sample test application
    - |' q9 I% P3 s, a; D/ \3 @4 {5 h
  2. /*2 A! l, J' o- V! O/ o9 M* R
  3. * edma_test.c2 E1 W- h7 o4 Y* T
  4. *5 T1 c* e& b, C" A, Q  O( Z) C/ @0 \
  5. * brief  EDMA3 Test Application7 ]( v4 _$ o, D; F- F+ i' r
  6. *
    % t7 }' L# C3 C% z  G6 ]
  7. *   This file contains EDMA3 Test code.
    . ~6 v5 ~4 d" u" b5 g7 N, z
  8. *
    $ p# Q! n, R0 {/ F) d- g
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 T, y3 a. f/ m! C: c! p* ^
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 D0 M/ f4 E5 z! I7 b& q
  11. *         TO CHANGE.; x; O1 A5 \! D) v9 W+ F
  12. *
    - `6 q  O1 g- W" c5 e2 J
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% O0 S; |9 b) a/ q0 h, U9 e7 G. W! S
  14. ** p+ u& g( A2 D- C  C9 C" q
  15. * This program is free software; you can redistribute it and/or6 K" X6 q% y* l  L0 z2 G
  16. * modify it under the terms of the GNU General Public License as* {( m* I5 B" ]2 \6 E4 M9 ]
  17. * published by the Free Software Foundation version 2.& t& c# M0 w: ~- X
  18. ** ?- d, _7 \+ Q  B/ T
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any, H0 P5 O! o5 r1 e( j) o
  20. * kind, whether express or implied; without even the implied warranty
    ) Q8 `+ ~) _) g) c3 b
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ) y7 y) w; S' O  j* g
  22. * GNU General Public License for more details.
    ; d' h" K& D" I* A3 y9 N
  23. */; u" |5 s. f6 }4 M

  24. 6 f0 B  d" m3 x4 J5 J
  25. #include <linux/module.h>
    ' ?6 {" _4 B% y6 X9 Z3 q
  26. #include <linux/init.h>
    $ K+ ^  m1 ]0 o9 ?1 o/ Z) O9 A* P
  27. #include <linux/errno.h>1 p) r- l9 P5 y0 r0 ~( R1 j$ w
  28. #include <linux/types.h>* w7 y8 v. D6 J3 k' v
  29. #include <linux/interrupt.h>
    & `5 \. D  Q1 G7 L* I' t7 V
  30. #include <asm/io.h>; C8 H' M" I( k' U
  31. #include <linux/moduleparam.h>
    8 w. F0 F$ m" g: ~! r, J: j2 P
  32. #include <linux/sysctl.h>
    + O( R% l  B$ d
  33. #include <linux/mm.h>: a# v$ z+ m: O+ Y7 a$ ]  c% g
  34. #include <linux/dma-mapping.h>3 b2 Y" t  |* b. \1 h

  35. ) w# p# U9 W, n3 u
  36. #include <mach/memory.h>* F, M! S. [! ~* i7 d0 e. I
  37. #include <mach/hardware.h>
    - Y7 G# e4 U" q2 ?5 Q; p  C, u# \
  38. #include <mach/irqs.h>
    & s$ T9 d1 ]4 O+ I8 o* N& k' n/ Q
  39. #include <asm/hardware/edma.h>' ]/ q( _% R1 ]( c
  40. 4 c% p4 x& X0 O2 p9 u4 y- H
  41. #undef EDMA3_DEBUG/ g# t) |% I2 q  l! K) i$ a1 a
  42. /*#define EDMA3_DEBUG*/. y' s2 i: w; N, w1 s+ M! l

  43. , p; s! W. K+ S( T
  44. #ifdef EDMA3_DEBUG3 O1 c6 h* n7 t5 O
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    0 S, {# p: X" Z  C
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ R+ p0 }$ h/ Q0 A/ s( a/ G; I" o
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ! ~$ o' i! u4 f3 |+ t
  48. #else; S* p8 }! ~  O, R+ T3 C( Q6 l5 Z
  49. #define DMA_PRINTK( x... )
    # y. X2 K+ H. A0 x
  50. #define DMA_FN_IN
    & E9 |/ D& H7 k% V$ r- I; r$ t
  51. #define DMA_FN_OUT
    : Q" x3 K) K8 G+ C/ G) o7 _# `2 ~
  52. #endif
    4 H. J4 ~1 m, h, J8 m. a

  53. / C  D6 X2 G7 q) C; u( U
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)2 @# q% E6 |! q5 [- y4 S
  55. #define STATIC_SHIFT                3
    ' I' }( x. V$ ]8 e) s. w
  56. #define TCINTEN_SHIFT               20' _; s/ F+ l' w2 u- {  u* d
  57. #define ITCINTEN_SHIFT              214 L" ?0 f' E! d* F
  58. #define TCCHEN_SHIFT                224 q) J7 x9 |* i4 X- U2 E4 W
  59. #define ITCCHEN_SHIFT               23
    % _) h1 Y: ?& V. L
  60. 0 H: j$ l& e) D! z- a5 K
  61. static volatile int irqraised1 = 0;( O3 x( W) o! D" E7 r4 d
  62. static volatile int irqraised2 = 0;
    1 p, F. G7 A" }3 e9 G2 v& w( S: O6 U& O
  63. 1 K/ V$ L  P( h7 N3 {0 h  r
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! ?: T) V' q* h" Z! o- `  f) V
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! e% _, m+ C6 M" z  V/ `% X6 @8 n
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 o: N* U- W$ ?+ d: A
  67. - m  p) @; E# }) a& Y( W
  68. dma_addr_t dmaphyssrc1 = 0;+ j3 p' x7 H. z/ Q8 c
  69. dma_addr_t dmaphyssrc2 = 0;
    % [  c5 q% C  j0 O
  70. dma_addr_t dmaphysdest1 = 0;
    - X) C0 s( s3 }) D
  71. dma_addr_t dmaphysdest2 = 0;/ z) \0 s; s7 S

  72. 6 M, W5 F0 A% b& f
  73. char *dmabufsrc1 = NULL;
    & ~1 E. @: K- y0 u" k) q
  74. char *dmabufsrc2 = NULL;
    3 H6 I7 R* L3 B
  75. char *dmabufdest1 = NULL;
    8 [3 L( Q  t* n/ G
  76. char *dmabufdest2 = NULL;  j/ P  w* x" b( m" w9 N& M; c) ?
  77. 9 N0 `! P/ U8 {" J; k+ M: j
  78. static int acnt = 512;
    7 Z0 |/ c2 I) r) W% |
  79. static int bcnt = 8;
    3 Z) F9 X2 \4 P& @; z" r9 k* ?& Y5 @9 o) I
  80. static int ccnt = 8;
    1 @9 P% X" X  S& j7 I& H
  81. 9 e; B  Q" n# H5 P1 w5 A$ U" Z! }
  82. module_param(acnt, int, S_IRUGO);3 |$ {- G6 l0 B8 a
  83. module_param(bcnt, int, S_IRUGO);
    : B6 Z, {8 H; g6 U( {' h7 G
  84. module_param(ccnt, int, S_IRUGO);
复制代码
, s. |+ O' J5 ^6 w' F. U: q
: F* t1 }* @6 b( J& ]# ^: \$ d
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( O, s* h5 ~/ b7 ]4 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ u8 f2 C' s" ?" `) E, M
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% |* |- `3 Y' b
- _  L* m- K1 X" ~6 M* \! |3 A

0 I0 [! R( c7 `: V8 q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-3 07:14 , Processed in 0.042101 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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