|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; u" F+ J; n- q2 W! A9 }5 r! X
- [code]EDMA sample test application
( B8 n1 X$ f2 s2 x6 h, y, @ - /*) X. L, E- z( t Q
- * edma_test.c
: x+ I7 p- u4 L( {! [& ? - *1 K5 n8 f# }# E- \1 Z( N
- * brief EDMA3 Test Application
% o- T4 n# n* M+ w9 A) t - *
) @) \4 H) E8 ] - * This file contains EDMA3 Test code.1 S7 u* R0 U! b+ v+ Y8 m6 w3 b
- *$ h- }$ T) R+ \8 v( C6 O
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
* f8 |# z& @0 ^+ q - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
& ]! Z% d; S$ a - * TO CHANGE.
. D( i$ o' w) n/ a# ~' f& J - *, M" O, Y+ C$ v) F& D
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 Z5 F/ K1 u7 o, u2 J
- *
- j- ~. {! Z1 y" y4 ] - * This program is free software; you can redistribute it and/or* \* ?8 }6 W C# I
- * modify it under the terms of the GNU General Public License as
' y' [5 y* m2 v# g5 b, L7 g - * published by the Free Software Foundation version 2.+ n. B. X, l& G! w: i
- *
. V# j4 h0 q( Y9 e- R; b - * This program is distributed "as is" WITHOUT ANY WARRANTY of any g3 J9 ?& x0 ~. r# V( b
- * kind, whether express or implied; without even the implied warranty
2 ?( S1 N5 q6 c/ i. ~2 k - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
$ O, Y. G- P0 F& p% o - * GNU General Public License for more details.+ c* s2 N- z& i" H: |* H
- */$ @5 e, \. J3 p9 y& _
: P9 ~# x) d& ?8 \- #include <linux/module.h>
3 w9 F( ?, P) ?) U3 G. I" G) W D; y - #include <linux/init.h>
2 P1 ^) f9 q" U# E( L( |) a - #include <linux/errno.h>+ Z, d: k; I u5 X) N& ]# Q1 d
- #include <linux/types.h>; y: C+ W' @8 J) X4 i( c
- #include <linux/interrupt.h>
* W! I0 `& v! E - #include <asm/io.h>( f3 a, w- A* [% u: P8 I% L( ^# x
- #include <linux/moduleparam.h>% z. v8 h; W0 B( f4 t
- #include <linux/sysctl.h>) k0 L6 v0 z+ e0 W. P. H
- #include <linux/mm.h>+ r9 \/ O0 l6 S0 v2 ]8 z* w; i
- #include <linux/dma-mapping.h>
$ P* z; K8 X, a' U( B! D* g/ Q - $ h( s# o' O/ N( | \
- #include <mach/memory.h>* R, j0 R0 e' }. u$ v$ ?
- #include <mach/hardware.h>1 l" ?' I! t" T: [# Y
- #include <mach/irqs.h>
6 W$ c& l$ j% L2 S1 _4 F9 a7 k - #include <asm/hardware/edma.h>
4 d+ X8 u# _0 b* _; ~" W1 B/ j- T - 6 |/ k. n/ H2 Q! a$ I$ Z/ G# [
- #undef EDMA3_DEBUG% I3 Z, i8 m- M2 |4 y
- /*#define EDMA3_DEBUG*/: t2 F8 o# ~1 L0 c7 ]
9 h) V3 T T9 H. H0 ?% q: X8 @% t- #ifdef EDMA3_DEBUG
5 F! B4 l& N% h5 O - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
/ S. R" W n6 M8 j - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
6 u$ i5 W- w8 {3 l - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( J$ o) U) M- b5 e
- #else. O4 n ^# T; J
- #define DMA_PRINTK( x... )6 u% V% Q2 ~2 X4 o) O, B7 [
- #define DMA_FN_IN% j) d( u! x" P4 K3 p
- #define DMA_FN_OUT
6 {0 s; M8 o5 h. | l7 K - #endif1 K, R+ f9 d9 k: V0 B3 V, D
2 {" I$ d; I! s+ \$ n0 O3 n+ r9 O$ r- #define MAX_DMA_TRANSFER_IN_BYTES (32768)$ l( ~/ ?' v& N: w6 G/ Q9 Y
- #define STATIC_SHIFT 3
" i. i4 x- \/ B, R/ s - #define TCINTEN_SHIFT 207 t2 ]& S# L4 E. ~/ K+ F ^; K) p# p
- #define ITCINTEN_SHIFT 21
' W' O( n1 W; x, S - #define TCCHEN_SHIFT 22
2 E- q5 x% M# B, U8 `/ R) R - #define ITCCHEN_SHIFT 23
) L3 l0 M# d) P: E- ~
' s' x6 Y$ @! }0 a) V7 I( W9 d- static volatile int irqraised1 = 0;: R1 B9 J4 n. r$ o! c: ?8 J
- static volatile int irqraised2 = 0;) }( H0 o8 J" Z9 r a) K! t1 e
; [0 V+ ]( g4 K' m. U- @" o- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. V7 S3 H. L% n0 y8 y
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# S8 Y$ E- z5 Z2 L/ K - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" U0 t5 k- A1 D/ V2 R
3 Z- w/ z; A6 s+ y5 H+ O- dma_addr_t dmaphyssrc1 = 0;
2 J4 X6 V/ q/ L/ n" P! q - dma_addr_t dmaphyssrc2 = 0;: h Z# E+ p! t8 C1 j1 ~# ?% `
- dma_addr_t dmaphysdest1 = 0;
: R2 S" K, @: b; R1 I! Y - dma_addr_t dmaphysdest2 = 0;# G- D( C+ [ u
- $ `" L: ]8 x. M4 M4 l- ~% { M, r
- char *dmabufsrc1 = NULL;
2 f( k1 X- S4 O5 y) X, W$ p/ L6 A3 ~ - char *dmabufsrc2 = NULL;3 U' c7 c a+ Q; D+ H
- char *dmabufdest1 = NULL;
9 i& e! M0 G4 v+ l& C2 z0 b# k - char *dmabufdest2 = NULL;2 @7 N7 G/ V$ I+ y
& {( {2 K+ l& {- static int acnt = 512;# n* a0 E/ W4 I; u0 A1 k
- static int bcnt = 8;8 l; g/ Y% r8 a# F. @
- static int ccnt = 8;2 ^. |; U9 F& B+ o6 N
: G# o1 x+ U$ k- z0 ]% u3 W- module_param(acnt, int, S_IRUGO);% Y6 q( Y- E+ x |! e
- module_param(bcnt, int, S_IRUGO);
/ a% H' R. m0 }0 v' \ - module_param(ccnt, int, S_IRUGO);
复制代码
8 p5 s+ V+ Y$ Y% ?7 X6 ^# B
% q8 \! |- H7 c1 k5 n$ P 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! j: U+ j# O7 H4 y+ k i. L" z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ R3 j3 R$ A; j- ]$ p. @/ l
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' F( d; w5 t+ S1 \7 t
) m4 D& ]8 r3 M& a5 | C( q' ^' l ~9 T/ I7 t* E4 B
|
|