|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 N {2 G- y; R0 A- [code]EDMA sample test application) G' I2 b/ ?; v/ M% Z, u9 Y4 T
- /*5 ]! p3 D; X, s# B/ D: L6 Y
- * edma_test.c2 a# p/ S5 l* |2 Y3 O( v# [
- *
+ \( j2 }* U% }: _' A' j5 Z - * brief EDMA3 Test Application3 N+ f0 n* ]8 G% u
- *# G% G! G& b% G3 K1 o F# a
- * This file contains EDMA3 Test code.8 P. r* T! X2 Q: h5 u1 @5 ?
- *
1 ^4 r5 c! l8 Y, P0 I5 c - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; e) Z* v/ B$ j7 h; \" y
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
+ f, l% e, ]6 E( N# v) k8 p$ q - * TO CHANGE.8 S" }9 f9 M- ]! O1 q9 ~
- *
) z4 K6 I- m- [8 M& a, F1 ~ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" \4 P7 X) @ c/ S" S& f
- *
* N& `0 B) {, K6 M. j$ W& } - * This program is free software; you can redistribute it and/or' n3 t3 }3 O; N- ~1 q. K1 F5 ^$ ^
- * modify it under the terms of the GNU General Public License as
& ^8 b1 z& V4 V/ J, ~( w3 ^' W - * published by the Free Software Foundation version 2.
3 W; c: }+ O& D I: Y - */ q% {- `. H+ B' S5 ?0 Q5 `8 a
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ x! l! l/ ~% r# N* L+ s+ y' C
- * kind, whether express or implied; without even the implied warranty
/ r* t/ Q0 S$ a) z( _ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the/ i: L7 E) r: X) Q
- * GNU General Public License for more details.4 r# @( K/ f1 g$ @; f* X- `
- */
X/ b; T; { y. i0 K
7 J- ?0 a0 Y( k p- #include <linux/module.h>
. I% w; b& V8 g. F0 K8 G - #include <linux/init.h>+ u! h: p+ F' c7 T; g
- #include <linux/errno.h> M7 p8 k! i# m3 |. w
- #include <linux/types.h>
! E1 g4 i8 c U, _9 Z - #include <linux/interrupt.h>$ t% f& |+ L0 R q
- #include <asm/io.h>3 }6 P" u$ W" {) ?9 m* R
- #include <linux/moduleparam.h>0 d: G0 l2 {" O% R; E3 A/ q
- #include <linux/sysctl.h>
" e O& Y8 Q7 H6 r - #include <linux/mm.h> a- e2 i- J3 [, R+ b8 Y
- #include <linux/dma-mapping.h>
7 H( A, c+ k; A+ y( k - 5 }$ S0 [) t* H f
- #include <mach/memory.h>
) `) y: J9 n4 Y% n1 U - #include <mach/hardware.h>9 l r) O$ j0 p9 x+ H) V9 q3 i
- #include <mach/irqs.h>
5 J" p6 `( j: E$ W/ g - #include <asm/hardware/edma.h>: r# ] B" B3 N; c5 Z
- . z- O5 v1 Q- z& F! r
- #undef EDMA3_DEBUG5 b2 @0 N% z, l }8 O
- /*#define EDMA3_DEBUG*/
! w# y* _. p6 h0 C - 5 U* p& N! V9 d+ W' E
- #ifdef EDMA3_DEBUG
# J0 w% G, l0 A1 a; z/ G. W4 n - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& i, e, B2 _1 w8 q% L" b5 o9 Q
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
) C- h$ g, U/ f( _: a - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
" D* b' T4 r8 G3 {% ]5 \( s - #else
" ^6 L. F# \' o% K# Z6 h - #define DMA_PRINTK( x... )% s0 q6 t' K9 {0 F6 H/ W
- #define DMA_FN_IN5 m. @5 J% O) A# Q% S3 Z/ H; L6 l
- #define DMA_FN_OUT1 s2 W0 l1 I5 j Y6 T
- #endif! [9 {0 a4 W+ K0 h
& x( G; N8 e! \4 W- #define MAX_DMA_TRANSFER_IN_BYTES (32768)6 {2 u* s* R% M6 @% S3 i
- #define STATIC_SHIFT 3
. G- r0 a" ]$ p7 } - #define TCINTEN_SHIFT 20( w8 t, a. v+ x1 @2 \# w7 C
- #define ITCINTEN_SHIFT 21
) g7 ?2 @( {$ c - #define TCCHEN_SHIFT 22% \. d! V) g; U) ]: G
- #define ITCCHEN_SHIFT 23
3 v9 Z, c5 M3 W7 B; \3 e - 0 W1 @, s3 k* b* V5 V, f
- static volatile int irqraised1 = 0;9 d6 Z, j2 o( \) ?- I/ K {
- static volatile int irqraised2 = 0;4 ]0 U7 J2 t: {- J6 E1 u
- . c6 r/ x3 [/ y7 S, `
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 A$ A; E- ~9 J/ O7 v7 _ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) Y6 j* R0 J, f& o
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) X3 e4 I) N' U
, \$ }! }9 i& g8 p- dma_addr_t dmaphyssrc1 = 0;1 v A& z9 f9 q$ E* E
- dma_addr_t dmaphyssrc2 = 0; v: P9 F- L5 ?. R8 P& ^- C
- dma_addr_t dmaphysdest1 = 0;+ x+ c. ~& v) O
- dma_addr_t dmaphysdest2 = 0;% {/ |. T. Z/ R/ t. t: ^6 I
- 9 I( w1 V/ g! p* g# [
- char *dmabufsrc1 = NULL; e* C D& ^ _8 S( j- }
- char *dmabufsrc2 = NULL;
5 I: t+ E, y5 N" {- [* x3 L - char *dmabufdest1 = NULL;
9 q6 S! b9 t. k1 e1 F2 } - char *dmabufdest2 = NULL;
8 { u6 {- }+ H4 e7 c8 L- Z - 2 |6 U1 d+ k3 X: \5 u
- static int acnt = 512;* b/ Q) } D0 P* M( e1 _' _$ p
- static int bcnt = 8;0 T& T. m5 a6 H+ m: h+ Q; u* m
- static int ccnt = 8;
' c3 E: f2 v! ?+ Y9 ^' _8 X' e
: b, e4 P' W% P1 K2 B- module_param(acnt, int, S_IRUGO);! o9 e' Y7 x7 I. c9 j& X
- module_param(bcnt, int, S_IRUGO);
4 \8 |/ s0 T2 i- C* E( W* { - module_param(ccnt, int, S_IRUGO);
复制代码
4 j4 o/ d; y8 M$ C: u2 \/ ~) A# u
/ g+ L& |- u6 J: ]+ W0 ^( M- t7 G 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' t- ~8 ^: u" r. `
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; o9 y' n( Q9 a% H1 v8 u
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( N ^9 T, ?5 o1 k! Q
5 p6 q- r* [. [( k9 R8 f4 J
. F7 @" W7 \6 U |
|