|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; {9 T2 t6 {2 D0 \
- [code]EDMA sample test application, f! J; w0 Z' c8 G" o/ k) |2 ]
- /*3 r* ~( s S/ l# a6 q/ v
- * edma_test.c5 c( i1 w2 F5 n
- *" Y8 Y% L1 o8 _. ~& A. T
- * brief EDMA3 Test Application
4 }" U! D+ O. A - *
7 l( P0 F, E ?9 I3 `# S: h! c - * This file contains EDMA3 Test code.
+ ~) c3 s/ R0 ?- H6 k9 I. W4 n; A f - *
* F* j/ y# c. s' g& L - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& j) O5 O: G ~6 r
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
. O- K% p: e6 K Q; ` - * TO CHANGE.- Y; E i. J# e* B: q+ \+ P
- *
1 U2 E; C/ ~& R - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" }0 {" H: ~+ Q. f R
- *
, b. r% n; A6 N# F5 h - * This program is free software; you can redistribute it and/or/ Q- w; Z8 q/ E4 @. I2 f* \6 P
- * modify it under the terms of the GNU General Public License as
2 l$ ^3 E1 c. D - * published by the Free Software Foundation version 2.1 h, L- v b* e3 h- G( p7 W
- *1 Q7 R$ ]; ^2 Q6 P$ S
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any& F4 E( X7 v/ j! F2 M/ O" O" h
- * kind, whether express or implied; without even the implied warranty, T' ]' j8 Y m# ~- }* M1 j9 D
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the& o/ O0 L4 P8 e8 y) }
- * GNU General Public License for more details.
! |! F8 G' |/ s - */7 E q: J7 N1 Z/ ^4 E
- 1 ?1 M! g! ~+ q1 [& N
- #include <linux/module.h>
, Y0 O2 d: J) W - #include <linux/init.h>3 l! V7 x* Y6 ?% |
- #include <linux/errno.h>
6 _3 a) @) ^% S2 J/ v" B7 F - #include <linux/types.h>1 o# N: v$ a) ~8 V5 k
- #include <linux/interrupt.h>
4 N2 K2 Z- Q, z/ ]) ] - #include <asm/io.h>5 @) x; Z9 B6 I6 t2 C
- #include <linux/moduleparam.h>
) c' @1 Q+ U' p8 t3 h - #include <linux/sysctl.h>
- h( v5 j3 [/ s - #include <linux/mm.h>4 d _% d' _. n/ e
- #include <linux/dma-mapping.h>$ s3 q5 Q, a0 V0 i
( u' e; C7 K+ n7 O1 X' F- #include <mach/memory.h>) D6 w$ D% L: J$ h. x. y3 X! P
- #include <mach/hardware.h>) f/ H1 ^! ]& d- d" c, B" C( Y8 X
- #include <mach/irqs.h>
; r9 y9 V8 W' ~( d& ]) [8 Z - #include <asm/hardware/edma.h>
8 j6 q' y4 M/ F; F7 o - 6 H; S$ _5 g' v7 D
- #undef EDMA3_DEBUG
: X7 K& g% G+ b' q - /*#define EDMA3_DEBUG*/8 l5 n6 ?& t- Q* }: Y, r0 A
- 4 B2 B3 X" v# Q6 l; s/ _; q$ ~. T+ P
- #ifdef EDMA3_DEBUG. d9 Y& A: E2 x& q% L) Y8 }
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
) Z' i: j2 L9 N* e( C - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
; _" Z" _1 s) m1 D2 W+ f; K# e - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
/ F9 X' M' t9 G3 B8 c - #else/ F; F& u* [; j) n; I5 i
- #define DMA_PRINTK( x... ) I( ~# w5 A9 L! M- u
- #define DMA_FN_IN
" J4 P# T# G* j' `, s - #define DMA_FN_OUT: I. ]6 O7 h T5 r* e3 |( `9 E
- #endif( M8 n3 e3 i( A( H
- 6 P3 q* s* E6 u" }" U, s
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
; q& A1 R! A3 t0 z( K# a& J8 m. S - #define STATIC_SHIFT 35 ^' g0 R- ~+ ^
- #define TCINTEN_SHIFT 200 ^$ O% u9 I; }; ` h9 j$ c7 Z3 s
- #define ITCINTEN_SHIFT 21
" K7 t) J5 o7 y8 |4 t8 A/ Q! F, ]1 t7 W - #define TCCHEN_SHIFT 22
( Q) D9 x, ~6 X8 P- Q$ F - #define ITCCHEN_SHIFT 235 C" u0 c2 r/ @+ x" p4 J! N
" k0 F8 F$ Y4 }& q, P- static volatile int irqraised1 = 0;6 K$ w3 ~7 \2 q/ a
- static volatile int irqraised2 = 0;0 ~$ p! b. K' I6 u. @7 Q& p
- 5 f8 H" g. g+ W' x( f% {# D1 ]6 `
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- p9 U- _0 i+ [& l, A
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ D2 v) U/ T' b$ {$ B9 Y4 Z
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ K( o# d' I4 P, Z* G' [. I) `7 g
) Z; E c8 n' ^7 R6 x4 K1 k3 F0 F5 n- dma_addr_t dmaphyssrc1 = 0;' b2 T5 d7 p, [2 E0 |+ H
- dma_addr_t dmaphyssrc2 = 0;7 {+ k( J' ~" a7 s( _$ T1 E
- dma_addr_t dmaphysdest1 = 0;, O% U- z6 ]% ^$ E. }
- dma_addr_t dmaphysdest2 = 0; g& N% t. F! _ K) Q) W
/ l( P5 z6 o; m+ W8 a- char *dmabufsrc1 = NULL;3 b7 v) p! ^. P5 d
- char *dmabufsrc2 = NULL;0 R b% g1 D7 d" {) i% _9 g
- char *dmabufdest1 = NULL;
4 Q" g4 T' O9 U2 I, V( d% h - char *dmabufdest2 = NULL;
9 H& ^* S1 l1 Y# Z/ I* O' }/ e! D - $ H( }1 {$ i7 }# ]/ N8 D3 ?# ?
- static int acnt = 512;2 q9 _% e5 I$ a1 j4 T1 q
- static int bcnt = 8;# J; V8 f+ ?( ?- l2 h z; h! I3 a; m
- static int ccnt = 8;7 T: Z$ S$ R# V9 a0 b. v/ X
- O3 ~( G' e1 q
- module_param(acnt, int, S_IRUGO);# i' U4 A1 ^. J7 o+ Y
- module_param(bcnt, int, S_IRUGO);
. P1 n6 o2 u4 h: W" y4 L3 B - module_param(ccnt, int, S_IRUGO);
复制代码
( ]/ b' e. E, N4 J7 a; z( K* p6 l" Q2 u @/ d7 z& w c
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ `. f8 A+ g& k; D) `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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 A5 K/ E6 [4 @0 I0 \1 i 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) C* {. t6 e3 Q, U2 f
7 V2 C2 y* e! }' o& u/ T* D+ R$ [! W1 q W
|
|