|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& A& i. c/ h1 a$ X- [code]EDMA sample test application" l9 b$ |3 q% N! I2 L- A4 D
- /*
+ e4 v3 I; A9 v# Z! D - * edma_test.c
9 H2 w& s* O( j - */ G1 a L) [% A( E( M7 `
- * brief EDMA3 Test Application
2 J5 ?5 C$ ^9 o, K1 y# P - *
( G, E( ^8 F" m+ s, M - * This file contains EDMA3 Test code.; d+ l% A+ R" e- z' ]' O
- *
9 U6 z/ v6 i' y1 Z7 c7 ^8 ^ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' T7 r3 n: v6 I$ y
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 I# d! n5 t1 y2 p4 h6 X0 g
- * TO CHANGE./ j" ~" q) w1 I: E- N8 F
- *, e+ B) K* V9 b& ?' r
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
* V- X& g" J, ~ - *8 i$ U. l6 l X0 |9 @
- * This program is free software; you can redistribute it and/or
" k# n- }5 U8 B: F( G+ V q - * modify it under the terms of the GNU General Public License as
7 Y9 K l$ I* B1 l1 ? - * published by the Free Software Foundation version 2.& ]2 z1 P. E1 [* ~% A9 z) k2 \; S
- *
+ R% p5 N" A, X3 F% w - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
% M7 ]8 V4 _; e* h4 h6 z7 W - * kind, whether express or implied; without even the implied warranty9 ]( B5 x4 g3 _5 f; o
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the9 ]+ z5 U3 t! h
- * GNU General Public License for more details./ h# Y% R% Z" T. A& H* i* l
- */
/ C; H3 i' y% h: L - . V2 `/ ]1 L4 Z1 Z6 A1 \
- #include <linux/module.h>
0 ?8 |: h* S9 U7 K: |. _6 B - #include <linux/init.h>9 O# A7 D: w4 [3 v* ]" A g; r# z' H* \- O
- #include <linux/errno.h>
9 F6 g, |5 a6 m' q" O9 g$ p5 ]: y# a - #include <linux/types.h>
, y8 _' g7 S5 T# v1 ^ - #include <linux/interrupt.h>
" o8 I% p7 X! ]) U* t( n. v - #include <asm/io.h>6 I" h- I" [, ^" c6 f) C* I
- #include <linux/moduleparam.h>" j9 b3 u) A& `3 W; f
- #include <linux/sysctl.h>
+ X& A% Q1 H5 L) z+ x - #include <linux/mm.h>
4 ]4 G9 L8 q6 n+ o, T0 N - #include <linux/dma-mapping.h>) P( w9 @) k+ X3 ^8 M* i
- ) M, _8 Z0 l9 z1 o! x' O( z% @* d |
- #include <mach/memory.h>
0 j I. B2 b4 Y [ - #include <mach/hardware.h> i8 T( |. s6 d8 A4 O' P( B2 B
- #include <mach/irqs.h>& W0 d; ]. i% o! ?6 U
- #include <asm/hardware/edma.h>
# ?9 L) z; x5 `( s$ @5 w4 k9 S
V1 W) S4 }* n3 ~- #undef EDMA3_DEBUG
( i& ?9 ^( B8 P2 r - /*#define EDMA3_DEBUG*/. p' f) D: k. G" k; v: i6 B
- & T/ D# ?# b( Q, y& [2 F
- #ifdef EDMA3_DEBUG2 V* b; M) `6 S9 B4 w
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); S; P8 c9 v6 \% @) o
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" n. T, O9 w, B7 r$ j1 }
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); j0 t9 X' f. m; Y1 j. f; N5 u# Z; q
- #else
: k; @; s1 O: t1 h' d - #define DMA_PRINTK( x... )+ \- N0 r) k5 Q: t5 x: n' V) v
- #define DMA_FN_IN% X2 l7 J o$ T. u; _- |& ?0 p- w
- #define DMA_FN_OUT# e1 I4 {2 r( Z6 ^+ h
- #endif
6 \& e6 [+ i& S - 2 ^8 I1 X" g+ K; E
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)& F4 V/ m6 V4 ?, b i: u6 n; N7 y
- #define STATIC_SHIFT 3) l3 O/ e) n( b' T' x# V
- #define TCINTEN_SHIFT 20
5 `+ H) H2 m5 M7 ^ - #define ITCINTEN_SHIFT 21( r8 g/ |8 {! N" O/ M1 C( Q
- #define TCCHEN_SHIFT 22, Q/ a2 E# {. y9 R, F
- #define ITCCHEN_SHIFT 23# j% w7 p" E8 q: W1 M
4 T+ a: x/ i* h) K' G- static volatile int irqraised1 = 0;" \5 v& L" k$ ~5 f2 Y& p# ~
- static volatile int irqraised2 = 0;
' h/ B5 @& H( Q
$ P% ?, T7 o* o$ ?- |* E2 x$ m- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" \; H4 D' y4 c5 k! ]9 S2 v - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 F9 a" B) g. \) T# P, |- ^8 Z - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 `( ^4 H5 K5 K) X" d% z1 p7 \' _
- Q% P& N3 h' h% F' [4 z( h- dma_addr_t dmaphyssrc1 = 0;
& ]( U' C# S- L( Y - dma_addr_t dmaphyssrc2 = 0; D5 ^2 t1 h" E. q7 {6 R- B
- dma_addr_t dmaphysdest1 = 0;
- v, H: L. n$ R* M( t - dma_addr_t dmaphysdest2 = 0;
9 j! e; C1 U. q/ d3 s: D0 ?& y/ i. P - 7 m% r: u) X* h( j* |0 T6 N! g
- char *dmabufsrc1 = NULL;
2 |7 d* g5 ~5 v* f' _& i* | - char *dmabufsrc2 = NULL;
: ?7 |, j6 k9 r: B& H - char *dmabufdest1 = NULL;
- u7 Y0 [% t5 e* l& }% Y$ F5 V - char *dmabufdest2 = NULL;
: s, E( ?; A' G/ J) c - 0 m9 d, s' x' _+ b' x+ C
- static int acnt = 512;
$ u6 c( s- B6 h# g& B0 f* Z( k - static int bcnt = 8;
n) ?( |1 w& b2 W( b. W" P3 v - static int ccnt = 8;
! o: b' |- d W" `! L+ m$ I - : s3 Z' j6 G F5 d$ F" o2 G
- module_param(acnt, int, S_IRUGO);% a; W7 v) x5 ]" w5 x2 B
- module_param(bcnt, int, S_IRUGO);
) h- k0 C# A4 ~4 N3 s7 K i - module_param(ccnt, int, S_IRUGO);
复制代码
, ]8 o* r6 U! M- n: \6 {: D
* [5 l1 T9 D W9 A 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* Z0 Z4 X' @! i* Karm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ u- E6 c; b$ e- S# A5 p2 M
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 J! A$ K4 ^( m6 w1 Z1 k. ?/ L' Q0 M& B! X& K
/ M8 m* y s) _- Y4 u |
|