|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
E4 a! m6 q: M8 b* A- [code]EDMA sample test application; `3 k. h# u6 u: v5 O3 R: L- Z
- /*0 W2 r1 _( [+ D/ c) a8 w2 m
- * edma_test.c
" I/ H& D/ }1 h8 K+ `& N - *
; n8 ], ^! ^4 q8 N% p, |+ P - * brief EDMA3 Test Application! b6 [9 l4 D+ `) r! F y
- *# I/ \1 A/ Q9 s/ u0 ]4 [ ]4 ?
- * This file contains EDMA3 Test code.
) g4 W8 Z- P3 P - *' Y. y6 C& I7 o% ~0 k
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
5 M8 [+ j8 c2 N* q - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
$ F& a: p) Y) h2 d - * TO CHANGE.
0 B% C7 H$ E- x7 a/ y$ Y - *
, p5 b. W. c$ Z" Z0 Q - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
' C& L2 x# L7 b1 T# G: U& } - *
2 W# H$ a. B1 |' \; L: P, E$ J - * This program is free software; you can redistribute it and/or
4 e/ `( G) J: c) N. E - * modify it under the terms of the GNU General Public License as
$ t( X7 ~2 r( M; g - * published by the Free Software Foundation version 2.
0 x; D2 \4 S. } - *
/ C: e; O" z8 X( c - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
9 j4 f: G& r4 k, `+ [4 O: w4 d - * kind, whether express or implied; without even the implied warranty, e" `1 F X2 G" Q. m
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the( F# F& U+ T" h+ i. R* m7 T+ \
- * GNU General Public License for more details.4 l. I& ]8 W! c ?( | z
- */ b6 i5 e! z. E- r; m; u& h9 Y
. `) R8 W d1 B$ c- #include <linux/module.h>
0 {! P& y5 X `& D - #include <linux/init.h>
% I. \/ C" m2 n% z. o - #include <linux/errno.h>5 p* L; ^% ?5 i. \
- #include <linux/types.h>
; v# |* E8 Y* G! w1 t/ P3 d+ V - #include <linux/interrupt.h>
' C0 m3 W# w! Q8 r- q - #include <asm/io.h>
1 C8 N* R/ M$ D$ F1 X - #include <linux/moduleparam.h>
9 r# { [: K' }: y( ?$ o) ^ - #include <linux/sysctl.h>. D; c" L+ E% l0 b. w' f, I
- #include <linux/mm.h>
* c/ A1 H- o" X1 v; t. x$ S- V2 B6 F - #include <linux/dma-mapping.h>! n: g" r; T& C) H: }( l! K4 F2 F
- ; ^# ^2 D' Q' S+ Y0 O2 t( r/ F0 [
- #include <mach/memory.h> F4 O5 ^. S8 H
- #include <mach/hardware.h> P, o+ I l- J$ G$ o H$ e4 ^4 R
- #include <mach/irqs.h>
, {; B& X# x! X0 K# L - #include <asm/hardware/edma.h># B- M: s( t3 b0 v
- # Q6 h j/ K3 Z$ W* R3 Z+ A* _) @
- #undef EDMA3_DEBUG4 j* z- {" V% Y+ v3 C, X
- /*#define EDMA3_DEBUG*/; C* t4 [; n' H& V6 N" e0 q
; z0 D6 O: ]! `; U, K- #ifdef EDMA3_DEBUG' i4 o! D2 Z& c' C; i* d
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) g7 p8 \' M# {, [9 A8 I) S5 W
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
# a' T' ~9 F3 K. s3 }1 i - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
! o) W w# ?# ^ p4 K/ | - #else' m5 f8 N3 Z1 M5 k6 ~
- #define DMA_PRINTK( x... )! W5 f! K: R% ~( S! v" \* t0 B
- #define DMA_FN_IN
@0 O8 a% J7 S1 P - #define DMA_FN_OUT6 [! g+ u& U, L* w, [
- #endif
7 t1 }% N# ] k& ?9 e/ W) L/ K - * x5 W4 {9 [; n2 }* G
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
6 X7 G" a) Y, [. v/ C - #define STATIC_SHIFT 3
& C: D6 b6 O9 t2 Y' o. I5 C$ v - #define TCINTEN_SHIFT 20+ O& v* l# ^) x: L9 G0 E7 N7 B2 ~
- #define ITCINTEN_SHIFT 21
" Y D: u8 C0 G - #define TCCHEN_SHIFT 22* O5 w/ q& U' @- o5 J: I( k
- #define ITCCHEN_SHIFT 23
. \" g& _! N, j, B: c* K! M5 E
' O- u4 P0 b9 x- static volatile int irqraised1 = 0;
7 l$ ]# T7 E$ D# X7 ?& I - static volatile int irqraised2 = 0;* ^. T, B0 ]) I
- 7 R; X# k9 q* q; b* b* d4 c/ G
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* O; l9 e W) U% V
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 @- I8 J" j* G4 t* b3 w
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; W+ q* U* V" F ]8 a - ' @( F, A; Q& R1 c+ D& W
- dma_addr_t dmaphyssrc1 = 0;* }% z# }. V, }. I
- dma_addr_t dmaphyssrc2 = 0;
; r0 a* O9 Y* @1 ]% j* S3 A - dma_addr_t dmaphysdest1 = 0;
5 C' W; |# \) n4 w5 E0 D - dma_addr_t dmaphysdest2 = 0;
4 n0 r2 n/ A+ c! s1 A) y - $ D: x/ f! A9 @
- char *dmabufsrc1 = NULL;
4 b i; a. M+ l+ b! H, P ~ - char *dmabufsrc2 = NULL;
( ~$ Q6 H5 @+ U P4 w2 q4 _, c- c - char *dmabufdest1 = NULL;0 S8 n4 V8 x8 ]
- char *dmabufdest2 = NULL;
" j, J" M" L( \& ]/ G$ p/ K! q7 M - 0 f2 A! g) B1 D: n% E* ?" s
- static int acnt = 512;
- X; i' ?5 z3 P - static int bcnt = 8;
1 J2 X/ S" i4 I7 m0 d3 _6 d* i - static int ccnt = 8;! ]$ z3 @* y0 T1 A9 i
" R2 A6 ]7 C, w1 |- module_param(acnt, int, S_IRUGO);9 K' i5 G5 A( z. S
- module_param(bcnt, int, S_IRUGO);8 J" E& H* v, c6 Q# x2 e# M
- module_param(ccnt, int, S_IRUGO);
复制代码
' I( Q K' W1 Z( K
6 i& g/ {6 k2 s. {0 @- s% W 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& m2 m) M& u o: p1 [6 Y# w$ f
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' w& O3 Q) {* P0 J; }. G 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: S" A, `# }0 N
# {2 {" h( A4 r i2 |2 M
& H4 Z# x, q# F) d& _" p
|
|