|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " r5 u+ A" O7 C/ {0 E3 G
- [code]EDMA sample test application8 |4 i, J2 [9 f4 R6 L0 L
- /*6 T' B4 k: z$ T- F- @! T1 b
- * edma_test.c: L& N' H9 O) c. J! m$ G5 Q- ^
- *# h8 e6 c1 A8 M6 J: \- W* o# w9 F
- * brief EDMA3 Test Application* q; |! J2 ~1 p' p `+ V- W
- *
. W" w5 m1 R5 ~ - * This file contains EDMA3 Test code.3 \ S2 q6 x _' n2 \2 ?- O' V
- *+ X0 X+ w0 ^, u* B1 i* G3 c; P/ v7 N
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
# n( E8 G r+ A5 z - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
6 D" c# u/ ]) s0 I - * TO CHANGE.& _" m3 ^* h* ~& k
- *
( b) H ~- i( e7 E1 { - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
" P* a/ h% o& h t - *
' \$ C! c3 A; {. Y) i O - * This program is free software; you can redistribute it and/or: F+ R& p. ]* m+ {, c4 Q& s
- * modify it under the terms of the GNU General Public License as4 L& w5 k7 \ N' Y
- * published by the Free Software Foundation version 2.
0 [4 t5 g( [8 v" i: R! j - *
4 H$ ]7 ~5 [) M7 f) L - * This program is distributed "as is" WITHOUT ANY WARRANTY of any! K& G3 N# f8 V' S; b1 c; m {
- * kind, whether express or implied; without even the implied warranty
, W# S, ~& [) M - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
' F3 x1 B' Y! \' K9 r - * GNU General Public License for more details.
5 B1 @# u5 }/ ?7 N8 j% g - */$ g' U2 ]; Q/ `: u4 K1 ]. E
# K! b1 k7 H2 L/ x. A- #include <linux/module.h>/ }8 r C5 A* |% q; j
- #include <linux/init.h>/ p3 B* \/ S8 w( n; B- K+ {
- #include <linux/errno.h>
' {8 e" {5 p& Q+ c - #include <linux/types.h>
7 k: P4 N5 \# ?- U5 _ - #include <linux/interrupt.h>
* l4 D% c6 U" n6 h - #include <asm/io.h>! {7 c/ S( t, E" L5 D' K- W
- #include <linux/moduleparam.h>
- P6 f0 Y2 F! e0 U+ _+ o - #include <linux/sysctl.h>- j; c. A5 j7 O5 N$ e; v
- #include <linux/mm.h>
4 M3 w: k/ b4 C- p1 V' D' T - #include <linux/dma-mapping.h>
, Y, E& f+ |0 n% [) F4 w - " |5 J/ a2 n9 X% c% _* \
- #include <mach/memory.h>
2 W) \) ?. e7 m/ w% I6 w- R* ^ - #include <mach/hardware.h># r/ |* Z9 i: g( G+ v
- #include <mach/irqs.h>+ U, Z, ^0 u: I. S% Q
- #include <asm/hardware/edma.h>6 ~, x' Y9 r; ]3 b, l4 O0 D% s
- {/ f, J0 W0 w( m0 e$ s% {
- #undef EDMA3_DEBUG' u4 ?- J! ~2 d
- /*#define EDMA3_DEBUG*/: ]0 N4 _# S% I- i ^7 S, j9 E/ G
D2 D* e& ~0 j& P9 a- #ifdef EDMA3_DEBUG0 N; N2 I7 i' S/ {- `3 w7 |
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
, ]! @5 t! R9 P - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__) y% Q5 K2 Z0 s( ^( z1 T
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): H$ @) C6 |7 O6 U2 K5 B6 x) G& I6 E
- #else0 O" z0 B2 S' |: f9 m
- #define DMA_PRINTK( x... )# Q# H: }' N) G6 n1 a; F- B
- #define DMA_FN_IN
* X1 j& o: F+ W4 Z* W1 d - #define DMA_FN_OUT
1 G9 b5 V" K2 _- `0 t1 R$ o1 ^) F - #endif
& A4 Y, Y" A" @3 t; E. k
* k, J3 F& E- M: t) \; `4 j6 z; W' u8 k- #define MAX_DMA_TRANSFER_IN_BYTES (32768)/ m' L5 g7 {0 W9 K8 I4 Q" J& p
- #define STATIC_SHIFT 3( E/ U9 @: t. E1 m8 J- S% G
- #define TCINTEN_SHIFT 20$ Y( O1 H S* s' y( Y+ s$ ]" ?& d2 E5 u# d
- #define ITCINTEN_SHIFT 21
; ]% P# T2 b. ~( s# r - #define TCCHEN_SHIFT 22
F4 Z- V# ]" [. @ - #define ITCCHEN_SHIFT 238 z" G) a) d9 Z9 s
- 9 X: r8 y' m, g# i9 M
- static volatile int irqraised1 = 0;( j) q# g, q& e( {
- static volatile int irqraised2 = 0;8 l% i, R6 L, [) u: }
- 5 V1 W: t6 H+ {% n/ z+ B( U
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& N8 B! e" w8 W! h" `! | - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( p- c. @" i# _. g# G0 c' {4 R' v - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 C6 h! x6 ^/ p0 h3 @8 Z
- * T- L& v% U2 O O5 y$ n, X6 M
- dma_addr_t dmaphyssrc1 = 0;9 U5 a$ O! X" x9 {9 O
- dma_addr_t dmaphyssrc2 = 0;
& _1 J- N7 O, R+ H* f7 ?- L - dma_addr_t dmaphysdest1 = 0;2 Q# W9 {$ M" ~) V% c
- dma_addr_t dmaphysdest2 = 0;8 w* _1 V# H9 \
- 3 {. O2 y4 u. v2 m* c
- char *dmabufsrc1 = NULL;/ ], L2 ^' O$ S# ^% o
- char *dmabufsrc2 = NULL; G+ J9 W ^: y: c4 B {' |. k
- char *dmabufdest1 = NULL;4 Q( \3 p% Y2 z8 ]4 m9 f b9 H' x
- char *dmabufdest2 = NULL;$ A8 s4 Y$ C* O( J; _: x
- . F/ |1 T3 W4 F Q
- static int acnt = 512;8 K5 d$ I, M8 o. x! i; z4 ]# s* U
- static int bcnt = 8;5 \* Q8 Q! n+ |- q
- static int ccnt = 8;. j1 @% Z2 w/ r' l
( _2 i+ l3 d, q9 c- module_param(acnt, int, S_IRUGO);1 v! [0 P) J( E" T& u
- module_param(bcnt, int, S_IRUGO);
5 w+ u0 }2 o) { W+ b5 A - module_param(ccnt, int, S_IRUGO);
复制代码 / e/ ~6 j. L, M/ u8 E
; n+ {% X" B) x2 a9 c
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ i5 u/ G! Y9 F3 Z: O' G
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" c' g4 m8 l- N3 r
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 l1 \# S5 R& A+ q& o
+ w% f: ^6 U$ r, ^
1 |' g0 ?/ c" h- ] |
|