|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 u2 M5 M+ L% F) q
- [code]EDMA sample test application
* g9 p+ S2 ^- M3 | - /*4 d+ B9 x: e a( M* Q
- * edma_test.c0 S1 G$ K" l' H9 j
- *
! K% S* {2 d# _5 U! `- \+ Z - * brief EDMA3 Test Application. E) V, L. R0 y
- *: Q" A, P2 ]! _9 N! X0 @
- * This file contains EDMA3 Test code.
: Z7 V# S& n, O# U - *
. s# _$ X7 G6 S: Z7 M - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
9 {) Y! r- D2 c* y7 P - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ y& C d; x, s- Y$ s5 S% I$ w
- * TO CHANGE.7 j, Z7 {5 n' u4 D
- *% t( s) _" l* |
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
7 A% U8 u7 d8 H' ^2 [& E( ~0 _ - *
8 ]: q' N7 H# _8 t" A6 b - * This program is free software; you can redistribute it and/or
% K3 i' v9 @. N6 s - * modify it under the terms of the GNU General Public License as% _8 M9 P% z+ D6 H5 @
- * published by the Free Software Foundation version 2.7 R1 N/ t4 s; X% B3 y! E
- *
2 p# w1 c4 h/ G( {; T: v2 M# E( q - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
1 H( X5 e2 U" k3 z W5 h0 p - * kind, whether express or implied; without even the implied warranty
! N/ o" ^* M1 h1 w5 O - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the' W5 b% |9 K6 O. ]( {
- * GNU General Public License for more details.) i& H1 w# V! Z7 ]* ?
- */
. B1 ?' M% `. L: P9 r - . r' e: A& q3 A* e( U
- #include <linux/module.h>
9 A- T2 l* a" ` h- f - #include <linux/init.h>
7 i* @- X& b) ^+ W5 z" C - #include <linux/errno.h>
) d7 S& T( I, B# P* t5 Q - #include <linux/types.h>
8 H4 I/ d: j. x - #include <linux/interrupt.h>) m6 a; d' v5 e6 m7 U: w1 R! J6 q! m
- #include <asm/io.h>
1 s2 o9 K* M) M4 Y9 m - #include <linux/moduleparam.h>, m/ p h9 \' w4 J' X4 i$ v3 g2 o
- #include <linux/sysctl.h>9 n n' v8 n( U( _4 U) `$ f6 ~
- #include <linux/mm.h>( V; M. [; H( U a6 u7 u
- #include <linux/dma-mapping.h>
0 ^1 w D1 f s8 w; @0 q8 y+ C - 7 Z/ I% U# ?. r$ X# t U
- #include <mach/memory.h>
/ L- k+ R( r1 C d0 W - #include <mach/hardware.h>4 b m. F. F/ s* L! Z- u4 Z
- #include <mach/irqs.h>
) P1 Z1 b+ k: @8 | - #include <asm/hardware/edma.h>
6 t; D* A4 _- _5 p& `
: f t& n$ B8 R6 x- #undef EDMA3_DEBUG
+ H* P% i- {7 H1 b9 [ - /*#define EDMA3_DEBUG*/
, O+ Y) y8 c0 g; l9 J0 W+ v1 q
s) l; V( p& U" @6 \( s- #ifdef EDMA3_DEBUG
2 \/ u' ~5 v) v' j0 \ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- l$ O, G2 ]8 X6 v
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
* H2 Q K1 I' h8 u9 n - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
7 V+ ]7 v0 `" V - #else5 l, u6 i2 u; u) ]5 f9 x. E
- #define DMA_PRINTK( x... )# x% S, G5 f# S. ^2 W1 W& G
- #define DMA_FN_IN
9 K2 B3 f# \! E' X0 [) O | - #define DMA_FN_OUT
; C+ U3 ?0 F$ p, i9 j - #endif
' s- G; O* D5 D" A9 z
7 N; d( y! P, b/ c3 Z7 h) d- #define MAX_DMA_TRANSFER_IN_BYTES (32768)$ }; ]9 T- Z- p2 ]5 n0 Y4 I
- #define STATIC_SHIFT 32 i$ N6 c' z4 m O- W/ M# _
- #define TCINTEN_SHIFT 20: D7 g9 F% u0 x$ R+ g/ ~
- #define ITCINTEN_SHIFT 21
& F1 |6 |: @5 S - #define TCCHEN_SHIFT 22& K& {, p" |! I \! E p" q* U
- #define ITCCHEN_SHIFT 23
$ N. E( W5 B5 U, Y# O" G! E# U
* u: D; q3 }; F2 C- w# i" i2 C- static volatile int irqraised1 = 0;
5 T: h* i$ V4 }( N - static volatile int irqraised2 = 0;
& O; a+ L' @0 u - ) P3 O3 h3 s5 y3 R# f
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 w% ^' l! W* m) `3 i( O - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 ^# V$ h. N# Z - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% O c `% |5 W8 S' K7 N# |. T, a
- ! H' T2 S! c. m( }0 `; O
- dma_addr_t dmaphyssrc1 = 0;; q3 P4 V) C9 Z) @6 k# O3 t5 ~
- dma_addr_t dmaphyssrc2 = 0;9 ~: [8 Z6 R' y- i( {5 I) B5 ~
- dma_addr_t dmaphysdest1 = 0;
! W5 Y- O( r7 g( Q+ \4 b - dma_addr_t dmaphysdest2 = 0;
; x& B. }* `, N6 _$ B! q
1 ?7 J0 J' n, h" v- char *dmabufsrc1 = NULL;0 K: L2 G* F. B4 z" x7 J5 @, [
- char *dmabufsrc2 = NULL;- _. }1 A: Z- q3 p+ v
- char *dmabufdest1 = NULL;- C& G- l0 l4 E
- char *dmabufdest2 = NULL;
4 U9 C$ z& k& {- U - ; B7 V# r# Y; J ?
- static int acnt = 512;2 m# e5 T1 N7 d. G O
- static int bcnt = 8;" A* m: l b/ {- s4 D
- static int ccnt = 8;, C9 d3 g2 o+ V6 r0 {
- & o; a: W" m, }8 a9 q
- module_param(acnt, int, S_IRUGO);$ J4 m9 V( f, ?7 p5 N% A" g
- module_param(bcnt, int, S_IRUGO);) t, n! E. t, @+ C; V/ E v" @
- module_param(ccnt, int, S_IRUGO);
复制代码 0 L/ B5 r( x3 ^ n4 h3 u
x, z$ t b4 A 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# F7 g" O( \' {: d2 T4 ~
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ ^0 F2 r k K7 k/ `, \4 u+ h& C
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 ^6 _" t2 s; O# }8 o% h# l4 s) o
6 y6 r3 Y. E) P: d& e
4 o: `5 l8 v$ J5 M2 n( P |
|