|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 S; y: \ g$ d0 ]( [) S* h- [code]EDMA sample test application
6 I$ c4 S7 l- F! N - /*& @ t6 v' H6 ~6 j9 Q/ ]+ G
- * edma_test.c; D1 A8 q1 V7 [# y; J) E
- *
6 E( H0 Z6 L# E3 h7 l+ A, a - * brief EDMA3 Test Application/ J v [- H4 ^# Q4 G1 B2 x6 Y4 H8 c
- */ M: F' }6 [- @
- * This file contains EDMA3 Test code.
3 d# v( S. S' U7 o' {9 C8 v - *
: ~1 d" F2 T9 [9 ]/ ~ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
% t# [3 i( a X+ n - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 w/ F& W% s5 @, J4 x
- * TO CHANGE.
; }$ k% m, q, I2 B, e - *
& ^: z1 T, `& U9 y) H2 g3 ` - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
7 |: K. J- q/ p. t- N - *6 o1 v6 @9 [; O% R4 o0 Z8 [) z! b# K, `
- * This program is free software; you can redistribute it and/or
# F2 ?3 Q. `9 I) v - * modify it under the terms of the GNU General Public License as. ~, c' i1 o- j; {- Q/ n$ m
- * published by the Free Software Foundation version 2.' N* U' @2 A6 i J0 \# }+ D
- *: u: c( ?/ m4 q; Y, o2 s. j
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
' P2 r5 l9 ^$ D9 n* k - * kind, whether express or implied; without even the implied warranty4 C! e9 G9 v3 ?8 W
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- L7 O3 D0 n5 t$ z* |, ^
- * GNU General Public License for more details.
3 B2 }9 Z: j- y2 B - */
! Q, d) K" X7 _: S$ f2 S6 ]# A - ) l. R% P2 Y* Z8 u
- #include <linux/module.h>
- H7 y8 o8 M0 h6 n+ W. M - #include <linux/init.h>
) J/ H; p: k0 g- M8 x! [ - #include <linux/errno.h>6 Z4 K. t# s+ m* z+ R* b3 _
- #include <linux/types.h>
, }6 i8 s: A( g" t3 v& G7 l8 G8 } - #include <linux/interrupt.h>7 Y/ g/ x- ^0 f1 N4 E
- #include <asm/io.h>
* [8 y. I( f/ T" D# q, `# _" Z - #include <linux/moduleparam.h>
! Y6 |, q7 k& u- O, L$ [ - #include <linux/sysctl.h>% q9 j; Y/ y6 L! y, D
- #include <linux/mm.h>
6 ~( {6 j2 S- S+ u0 Q/ d- [( x- @ - #include <linux/dma-mapping.h>
/ i1 d. `" B: P; ?- W- m) c
4 K/ I5 m# S, O& G$ ~( ]- #include <mach/memory.h>
+ {& R$ q y6 q$ Y; G9 f - #include <mach/hardware.h>) W; i I0 U P$ u5 o- @9 }
- #include <mach/irqs.h>
; m; Z0 C' x( O - #include <asm/hardware/edma.h>
3 J6 `5 K# t6 @) w! a- l# L7 {
3 L! ^2 I& v0 r. n! c- #undef EDMA3_DEBUG
& n+ \* i G' k - /*#define EDMA3_DEBUG*/
0 E8 R) v5 V0 }% D( G5 n( m' F, J+ i - 2 f& e4 S% N8 n# L1 m o, J+ }2 X
- #ifdef EDMA3_DEBUG8 ?" b8 t+ O0 \
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) X; q4 B, y% O! r; w! G
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
8 Z& L. N: Q0 C3 i) H& o - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) k, z5 q) |$ Z
- #else" r1 @, M' ]+ ], q! R1 U7 S3 x- q) y
- #define DMA_PRINTK( x... )& r- ]: n4 p# q: f( D+ Z
- #define DMA_FN_IN5 [3 ^1 H% L, }) Q- L
- #define DMA_FN_OUT0 V z1 s: H6 A/ |3 c% c
- #endif
3 c$ Z7 ~9 v+ V" }5 G$ I: N/ p3 W) \0 u
7 X9 a) `( X& t3 P" k8 {: @ P- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
- [& V7 Y, c7 |# p; e - #define STATIC_SHIFT 32 U. Y7 F, G5 P& ~, p: k
- #define TCINTEN_SHIFT 203 p! C( ?9 R3 j7 U
- #define ITCINTEN_SHIFT 21" W4 C! A0 p3 Y+ n& m2 k
- #define TCCHEN_SHIFT 22
2 i9 e8 A, w% K3 A7 k+ Y - #define ITCCHEN_SHIFT 23
2 g/ w3 n0 n1 t2 Q3 u* M% n. r* U7 h - 4 p5 ~$ M( A0 M2 U7 B, m) Z$ S) T9 W
- static volatile int irqraised1 = 0;) i# Q9 H% V" b3 B I, h
- static volatile int irqraised2 = 0;6 A5 R, X F/ [; I4 g
. C) F) u G" N( j- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) p5 V0 e2 x K; r, R5 Z - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ }2 f9 ?/ [4 V+ o0 l5 C5 T - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- Z) I0 g, K( x
- ) g) o! X5 D" S- c& J/ y$ P* P) ]
- dma_addr_t dmaphyssrc1 = 0;
7 b- g" S4 i) g - dma_addr_t dmaphyssrc2 = 0;
9 P4 o, S" Q& ~ - dma_addr_t dmaphysdest1 = 0;" ]9 g8 }* G- {8 R6 _4 L& c
- dma_addr_t dmaphysdest2 = 0;, y8 ^& B; J+ n
) i/ _2 F0 F0 c" j- char *dmabufsrc1 = NULL;7 z/ m" X2 l3 k: S4 E
- char *dmabufsrc2 = NULL;# Y" ~6 E5 Y: ^5 z
- char *dmabufdest1 = NULL;
8 n. T3 f9 v2 F9 | - char *dmabufdest2 = NULL;- L, F/ x) K) H/ k# Y
0 v* }9 B' X, E' w p, e& C- static int acnt = 512;
* l" g4 p: y- f, @7 ~ u# B - static int bcnt = 8;
4 d3 I) \4 H: c9 ` - static int ccnt = 8;& a# x1 i; G: y: e
- ) ?# B$ ^) f( U; z! Z; b! g
- module_param(acnt, int, S_IRUGO);; K8 a" l8 |" e% h) T
- module_param(bcnt, int, S_IRUGO);
( `2 |) l! ~; R- \ - module_param(ccnt, int, S_IRUGO);
复制代码
1 I) {, r( U; r' z: X% q, H" b5 @+ s: E0 d& f( ^
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 h6 Y: _* l* q! ?
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: Y* ~, _' C2 X T* v
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ b1 w7 v0 {2 b9 D
% N8 c! |) s- N- k5 r
- q; `, i7 ?) T+ \% k- c
|
|