|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + Z1 _, Y4 ]+ |" f" Q9 ?7 Y
- [code]EDMA sample test application
6 Z" j* M& c7 i* q+ X - /*
- k; u1 L' {8 n6 M - * edma_test.c4 S8 f6 N4 m/ s1 R% y
- *+ O+ \7 }/ x: L+ W9 M
- * brief EDMA3 Test Application
# i7 K' [; P! Y& s/ l+ u6 `$ r - *" i Y9 P6 c1 y5 O$ h; L; h0 D# ?
- * This file contains EDMA3 Test code.
$ u% F( x7 a& {" z - *8 Q! A+ _1 P' m, j5 P. m6 H) o
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
8 X" u2 S3 g* a% K6 f - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 r# h: N4 Z- ~: a5 v% M
- * TO CHANGE.' F: w* E F' E; X8 X
- *( C: p+ q/ n& ]3 K" u+ n7 V" E
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" h9 s* M' p* Y# \
- *# R2 J& @) n# f/ s
- * This program is free software; you can redistribute it and/or
7 O6 x ]+ s3 v3 \- D! g - * modify it under the terms of the GNU General Public License as
$ o3 i5 _! \) a( C" t7 s5 B - * published by the Free Software Foundation version 2.# ]8 v0 C, }8 p
- *7 J8 P. o9 `' w9 c) o0 k
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
9 Q7 }- i i% E7 z3 y. {5 ` - * kind, whether express or implied; without even the implied warranty
* u$ e M# d/ C% }/ a6 y g - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the# |) g' F1 K U
- * GNU General Public License for more details.* A% h( F+ X E
- */$ _& ~, M5 s! A0 E. K
- 5 t! S% e X! x# m k
- #include <linux/module.h>
. \4 g+ R6 C& Y* L, H3 q* ` d2 d. S$ w - #include <linux/init.h>: _7 w* S; }; b) @
- #include <linux/errno.h>0 M2 y. B5 B3 U7 G7 l( F* D' U
- #include <linux/types.h>
2 \" k0 k/ { U& a3 Z: V' N - #include <linux/interrupt.h>( c! e) j$ d7 D0 `
- #include <asm/io.h>
- T, l7 n6 B) O8 b3 y' Q - #include <linux/moduleparam.h>0 S' K. g' ]; z
- #include <linux/sysctl.h>
Y8 C* F/ h p% ] - #include <linux/mm.h>8 ~; g4 B& l2 [9 Y& {$ K( D
- #include <linux/dma-mapping.h>
8 \ Y1 j3 W y0 f, S8 \
8 L) f; H3 r8 o# W& q- #include <mach/memory.h>* }5 _; @ c& }2 Y. T
- #include <mach/hardware.h>
. }0 {9 w% C, W% e$ x# d - #include <mach/irqs.h>
& W( M/ S5 \* d( ]0 q - #include <asm/hardware/edma.h>) z/ E5 E( W- k3 S* j
- 7 G7 A& I# S* G# q* v% z3 l
- #undef EDMA3_DEBUG
2 H5 }2 g o- v- {* j. d - /*#define EDMA3_DEBUG*/
4 M; d3 Q: X' I1 S
, h' j/ I; g( Y- q- #ifdef EDMA3_DEBUG& a8 M0 Q) m( C. g1 r4 i
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 o; @4 u" H1 H2 `4 z
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
2 d. C% m* p3 D. h - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ e0 x6 n% }8 W U
- #else' [, q6 S; f3 N0 X( B4 F+ m6 K+ d7 P. ]
- #define DMA_PRINTK( x... )0 y, R/ x }- t4 }1 n$ D' |
- #define DMA_FN_IN
- J# C% z/ C0 H. m& ~& N2 m; e6 t5 x - #define DMA_FN_OUT
$ D6 ~% T' t' z9 ?0 F# ?# ] - #endif, c. c! ^/ M2 Q
7 M2 {+ N, Z4 Y- #define MAX_DMA_TRANSFER_IN_BYTES (32768)9 F; \% {: G; G8 O
- #define STATIC_SHIFT 3$ C" \5 O/ f" j1 o! j
- #define TCINTEN_SHIFT 20
2 i, _6 Y! w% W a+ V - #define ITCINTEN_SHIFT 21
8 I4 o- t2 r& N - #define TCCHEN_SHIFT 22
9 b" T- ~7 t2 m) x$ l - #define ITCCHEN_SHIFT 23; V) S3 N: X: |
' m9 S8 H: Q @, h: t% y- static volatile int irqraised1 = 0;8 T# v- a2 \/ Y0 U+ r* i
- static volatile int irqraised2 = 0;
$ A3 N/ G6 \/ G+ ?) [0 Z/ J% a
a8 M* ~: _3 P* U z- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 J; j: [! l! J. d4 J+ R - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 }- g' b" S% R; e8 Y( ~+ ^/ E - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# |& g) w9 ?# A& S1 a - - K1 p# }! i; t% P3 Q5 i
- dma_addr_t dmaphyssrc1 = 0;% P: o( j x- V4 D
- dma_addr_t dmaphyssrc2 = 0;3 ~: I+ i+ R9 r1 i8 _
- dma_addr_t dmaphysdest1 = 0;& T- `. l" R2 V2 z8 d
- dma_addr_t dmaphysdest2 = 0;" ]4 ?. C' T! A
2 x# w+ m: N; A0 W3 x- char *dmabufsrc1 = NULL;
) H5 Z$ u$ P8 ? Y" A! i - char *dmabufsrc2 = NULL;
% P" e* Z/ M- h/ Y3 h9 y% t - char *dmabufdest1 = NULL;" |8 a+ r7 v. E
- char *dmabufdest2 = NULL;
/ \3 g5 h" E) U4 M" y0 T
! ~) a# D! u1 _- static int acnt = 512;
* G( u; ]4 w/ l: I' {1 W8 n - static int bcnt = 8;
# a& T1 s3 c3 y6 H1 t& C - static int ccnt = 8;
( j1 G1 w* d: d - ! `" t2 G2 n2 K: n' q0 R, n- R
- module_param(acnt, int, S_IRUGO);
0 x5 e: \$ i+ T3 z1 [& r" `6 l - module_param(bcnt, int, S_IRUGO);
5 q& v L+ `! Z; Y( {+ K - module_param(ccnt, int, S_IRUGO);
复制代码 1 d$ N) K2 Q3 H6 a9 X
$ R3 r. V( }$ f: c
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& c5 s' K' L$ R7 o, S/ ~8 P# q) 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 y5 X+ q' R. \. V
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
B* J6 N; |* ^; J+ y! }5 l: W
. G* P4 }1 j7 N* I1 V9 \1 g0 Z% W" t5 k: v' i
|
|