|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 i: a# ^/ ], k+ L- [code]EDMA sample test application( a! n* U1 i! }
- /*
! d+ l t/ `6 f3 ~) Y - * edma_test.c* F( b( y! k4 @' {
- *
7 m$ g! ^, _! o! p: t1 R# {4 X V: q - * brief EDMA3 Test Application
, D \! @' f) { - ** T2 {9 o# p6 B( Q( R6 ]
- * This file contains EDMA3 Test code.$ Q) M4 ~6 h; Z/ |/ i0 a
- *
7 F- w# y) g* m( {' \ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
% G8 K0 j/ I0 W5 Y9 I1 j k - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
) B* `! M; }1 T( k8 J. g - * TO CHANGE.+ P5 u- s4 y7 V3 Z' K' V$ A
- *7 r! w& P/ o: p2 p6 V
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
% k# D6 J8 t3 X+ p! o" z - *1 z! C5 _+ [$ _
- * This program is free software; you can redistribute it and/or8 U% s* X/ R. P
- * modify it under the terms of the GNU General Public License as( H7 U4 n$ Z H8 R" i% N7 M# A
- * published by the Free Software Foundation version 2. U* k: I* K4 x w" ]
- *) L/ i9 B6 z8 f t! ]" g
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
: n5 F' E& s1 P2 r3 w, ^- B - * kind, whether express or implied; without even the implied warranty
" `. W& `/ s7 F: N+ F6 u, z& n - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3 V! O- j. X' S+ l4 i) H# y - * GNU General Public License for more details.& q! d8 }& M8 z* e1 @" H
- */' e* j2 Z4 x6 b5 T+ ?
- : p+ q' r- ?& Q! N1 E, @7 \
- #include <linux/module.h>
1 m1 R( J( Y$ ?1 c2 \' O* R - #include <linux/init.h>
& B8 }0 Q3 `: f+ _, c3 i* q$ E - #include <linux/errno.h>
H' [% s4 q G0 q+ K% s8 r - #include <linux/types.h>
9 R& W3 G* N0 f2 o5 S - #include <linux/interrupt.h>
- h2 L B) ^3 \" I - #include <asm/io.h>9 z" l1 H i( \" R# c
- #include <linux/moduleparam.h>! R& K/ ]4 q- \) K' C
- #include <linux/sysctl.h>" i9 q: E, \1 C; r P; B
- #include <linux/mm.h>7 v# j8 o0 `4 h8 h# L
- #include <linux/dma-mapping.h>
! y; m) ~, w6 U) v/ Y: g - 9 q& Q% ?* B, `! t: I- g8 A1 V
- #include <mach/memory.h>8 `+ ~$ m! o6 L( C4 T+ P2 k; O
- #include <mach/hardware.h>. P& g2 Z. i8 O7 Z( j: p
- #include <mach/irqs.h>7 p! D F; L( v; C4 ^
- #include <asm/hardware/edma.h>' Y& t, W! N7 s1 b ~# \* u
+ {) R8 s, [3 S6 U5 e- #undef EDMA3_DEBUG3 {/ `4 P2 f4 Z; _4 {
- /*#define EDMA3_DEBUG*/
: w! v3 T. j4 H2 c* T# R4 A
$ \- O8 J. q' A) ]- w: n0 ~- #ifdef EDMA3_DEBUG& \( H6 u/ M1 p" I& q. z1 M1 ~
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
' Y5 v( v( r7 F H: N) v - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" ~3 ]7 q4 h0 b
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 g1 T' u. m9 }0 |+ k" g/ {9 |
- #else6 @7 g3 k9 U, f# r/ A
- #define DMA_PRINTK( x... ). z7 X! M7 i O( o/ `$ f: x( Y) ]
- #define DMA_FN_IN
1 Q& o$ N# q2 d8 o* m3 y - #define DMA_FN_OUT) W& |/ c! r4 ?- a# o
- #endif
& [: h7 n! p. z - 4 Y% X$ z7 Q' x" m
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
! g/ `; H- p3 y7 |6 h5 J" m! A/ e - #define STATIC_SHIFT 3/ R+ j- `" O2 [1 [% A7 s. k
- #define TCINTEN_SHIFT 20
! S6 A6 W6 |4 T0 ? - #define ITCINTEN_SHIFT 21
3 M" l/ ]! a2 E9 v3 J; G - #define TCCHEN_SHIFT 22/ |2 c( V$ H2 r+ A
- #define ITCCHEN_SHIFT 23' L5 J! c2 Q0 m4 \* c& h/ |" U
! b1 s$ {; i ~9 ]# H8 Z% l- static volatile int irqraised1 = 0;& X; a, X" x3 L' y( Y( E
- static volatile int irqraised2 = 0;# p: I8 [" c j# a# s
- 0 `* L8 P7 @1 t
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: O6 P# @% V- l1 j9 G- v, J
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 m! f6 V( d. c; f+ s7 Z: S
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); @6 ~$ X6 W8 ^5 M) _
& x! m/ s9 t2 S# x- dma_addr_t dmaphyssrc1 = 0;
& g! A$ o# l$ `% D9 d( T - dma_addr_t dmaphyssrc2 = 0;1 O/ t& a# ~: c2 ~5 |! L' p
- dma_addr_t dmaphysdest1 = 0;
/ w: {3 q7 e- P* k - dma_addr_t dmaphysdest2 = 0;1 D: W9 ^* M0 r- f4 {
- 5 u3 L9 {# ?! E* W
- char *dmabufsrc1 = NULL;
1 f, a1 q& @0 C0 N! L6 ~ - char *dmabufsrc2 = NULL;6 H% s4 A( i+ J5 O) S0 E5 Q/ h
- char *dmabufdest1 = NULL;
$ J9 m7 I' F, {( a2 P - char *dmabufdest2 = NULL;' ~+ n" U5 j1 A/ b3 L
- P: b0 @" X( n) t1 m$ k- static int acnt = 512;
/ ^, \! m3 H3 ]' S4 X3 D - static int bcnt = 8;
5 a4 [( }" W( V' d - static int ccnt = 8;
+ Y6 F& L+ i+ ]
; U% g' m! s3 ~* \% {/ f+ J4 x- module_param(acnt, int, S_IRUGO);) C7 r/ Y# ?$ a" V" ]1 W9 P- @* r; P
- module_param(bcnt, int, S_IRUGO);
. F- B4 g% b! i7 n- C; _ - module_param(ccnt, int, S_IRUGO);
复制代码 1 f0 H0 V. j* P- A
: o6 s9 H# c# {6 M+ _; ?3 X
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用; O3 L+ {# U2 Q" a' J$ E
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 ~( x. K0 t e/ H, i! Y 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 @) E x4 R2 [# a5 D7 z7 d$ S5 x0 |
% I" y& \3 y* f9 p! S: d
|
|