|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 x) g3 i1 D+ Y- h, O; U r$ g- [code]EDMA sample test application# B7 Y1 @! D5 x0 \
- /*/ y/ k# G% ?5 w$ A$ U, j! ]: o
- * edma_test.c
, ~& {+ n4 k8 b; k - *
# ~% V* ~! y. I4 X# D( ?( i2 r8 T - * brief EDMA3 Test Application
. j* f5 L8 |- x0 F9 \ - *
5 b6 j, O6 `( T5 i" J) g: G& C. }+ x - * This file contains EDMA3 Test code.6 s8 I' H6 u$ W. L+ P, v" z+ P
- *
! t1 Y+ U% o- G* V2 x - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
; h% z/ Z3 o$ X. K - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
8 X- E1 l- ^1 R4 A9 U' U1 f - * TO CHANGE.- F4 b8 H w8 k+ O
- *$ o$ k2 A: B* ]- P
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// U: A. }6 I1 U/ t3 m0 R
- */ [2 o" w6 @0 t7 ^! N) {2 _ n0 H$ P; R
- * This program is free software; you can redistribute it and/or( e2 X* r3 w( k0 ~, p7 @) e
- * modify it under the terms of the GNU General Public License as
( `2 g' R1 @/ K! c% x - * published by the Free Software Foundation version 2.( |* _1 d4 g* a9 \, O' `8 d
- *
5 c& `0 g. c" U* i( N - * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 G5 z# ?) u, N+ F/ d
- * kind, whether express or implied; without even the implied warranty
9 z+ a+ i% s N% [/ J - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the. y" G4 c" [( U+ \5 \/ }) z4 I
- * GNU General Public License for more details.
5 @$ ?7 h1 M, \, a, d2 ^5 Q) u5 ?$ r - */
$ w; c7 A1 O" D4 ^, x$ ]: { - " X# N6 V- }+ ^
- #include <linux/module.h>
# e, V/ Q. b! a) N8 o - #include <linux/init.h> t9 O& Y+ u. J% |; i" Y
- #include <linux/errno.h>4 I8 n$ C0 u8 z6 i# j
- #include <linux/types.h>
9 t2 h" Y; x- n4 f9 Y( | - #include <linux/interrupt.h>! j/ e: P! u8 o
- #include <asm/io.h>9 V. S/ [4 U; p' N8 G" @2 n
- #include <linux/moduleparam.h>7 T/ v( n7 g+ n, e9 a8 H
- #include <linux/sysctl.h># s3 v9 T5 x( ~: x: {2 a3 k
- #include <linux/mm.h>$ {4 {' u- W e* k5 s
- #include <linux/dma-mapping.h>- _9 |4 ^4 A9 a/ y. s0 K4 L! J
- 6 Q; n% n1 c0 k' f. j
- #include <mach/memory.h>
1 \! l0 I0 C' s. O$ p2 k! j: O - #include <mach/hardware.h>9 j, x! k f, _
- #include <mach/irqs.h>
@, a# X. Y* o; w: d - #include <asm/hardware/edma.h>
4 y7 B) v( d# w* V1 |
. w$ K& N+ w! n k9 l1 M- #undef EDMA3_DEBUG
1 w8 V4 G4 G* B6 z) u! @0 o - /*#define EDMA3_DEBUG*/
`6 Z% k( ~* n" V2 ?+ D4 e
+ n" f2 o, O7 K' f# u, X5 J- #ifdef EDMA3_DEBUG
" r9 l5 J7 P) e& V - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
7 i% R4 x7 t, v/ o9 h5 f u - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
3 v7 s; D/ P0 o) k+ ^ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): V* N1 L2 _/ I; f1 ~0 D
- #else, S, r" _1 H8 s2 ~! |0 |
- #define DMA_PRINTK( x... )" n7 F) u$ z! \
- #define DMA_FN_IN+ j' }! Z, J9 x. \5 Y
- #define DMA_FN_OUT* O5 o5 E. N A; | e
- #endif9 p. {) I- E9 f3 G+ l
+ ^/ l+ F% x* n) m1 r3 N: s- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
V4 M) b) Q% ^$ M0 T) t* m1 ` - #define STATIC_SHIFT 3
( ]; h ~& n$ {4 h/ V: B o/ d7 N - #define TCINTEN_SHIFT 20
+ ]' x y) c2 z# \. l5 Z - #define ITCINTEN_SHIFT 21
0 \- |0 Q- R! L( Y3 q5 Q - #define TCCHEN_SHIFT 22+ @4 G0 {" `" Z9 z/ j
- #define ITCCHEN_SHIFT 23 `0 p) F. \9 n: S9 A E7 d- N
- & @6 O! O) R5 L# Y) M
- static volatile int irqraised1 = 0;
. U: e H0 S, l: {7 y+ H0 @7 d7 a$ x' B - static volatile int irqraised2 = 0;
3 @/ Z0 J8 k5 B) P
3 u8 C$ _/ u: g6 q. y; S- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 P- e. [( x1 l" e
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 d9 C& R5 S7 R6 A; o - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 {0 v- {1 L; t: k4 j! V- b* g% ` - 0 U, @& \; h- W- g
- dma_addr_t dmaphyssrc1 = 0;
% Q# ]) f6 g0 }3 v* C' K - dma_addr_t dmaphyssrc2 = 0;
6 G9 A0 w' g& ?) a( R: a - dma_addr_t dmaphysdest1 = 0;& {' K0 V* B3 ~8 n% j B! C
- dma_addr_t dmaphysdest2 = 0;
+ o* \0 _9 H$ y/ s - % \) ]" ?% j, o- M7 Y9 q
- char *dmabufsrc1 = NULL;
: I# [" R7 g! l7 [. p3 m! @4 g C - char *dmabufsrc2 = NULL;
/ w/ e2 W# Q Y6 B" u1 l - char *dmabufdest1 = NULL;, D3 [0 r' t) o3 m2 p) w6 o! f- U2 O
- char *dmabufdest2 = NULL;
# {5 s1 F2 n) Z4 ]) k4 l/ e - 6 L, E* Y& e6 d+ \0 l
- static int acnt = 512;
e/ V8 b( B: ?% R( c, j0 v - static int bcnt = 8;0 b7 |2 n4 g) n* S0 }$ ?
- static int ccnt = 8;$ p0 u: x* ]" T6 }+ _ |
- 2 G' z. w( D. E ^( z2 D" R
- module_param(acnt, int, S_IRUGO);
2 a, G2 `% p2 i2 c8 T - module_param(bcnt, int, S_IRUGO);9 `' V- y! N$ Q" W F
- module_param(ccnt, int, S_IRUGO);
复制代码
9 Q( W% ]+ t' |7 y1 I( W
6 ]+ z2 W8 ?9 e# { 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 L* y9 b5 M, A7 }' a
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 j! B6 @2 c' x! B L# ~8 d' d) d
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 h( }, z x7 @/ Y, }! X% `
% w+ l; G; u8 I& z7 U
@1 x; E6 N; _! j
|
|