|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( U" E/ a. q9 s; b" p J7 W5 Y
- [code]EDMA sample test application
2 A" h& E, x- |9 ]2 o1 b$ l" K' \ - /*% c9 Z3 W! m( ]3 Z0 n2 g
- * edma_test.c" B$ H% d. c7 T& K9 E/ j3 d, n; v
- *6 L% B% P; Y K3 h0 B$ Y4 I' Q
- * brief EDMA3 Test Application0 M* I* B; a1 v* y
- *
7 H( {' u% t2 u/ Q, j( d - * This file contains EDMA3 Test code.
; C9 F6 q7 g6 P& J. `$ \ - *" K9 n' ^& f! U8 T) y
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, j( A2 t" H5 M. I) E
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
0 {) t& d2 `% ?6 Q/ }# u - * TO CHANGE.5 R5 N5 b( D/ w: G. o# N
- *( u2 J7 \: r I, F& H. X. x. ?3 J
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
" |9 @$ E+ x* K5 L: { - *
2 F7 t) _2 V4 m: g8 J - * This program is free software; you can redistribute it and/or7 I0 V2 F) @) A( u; K j
- * modify it under the terms of the GNU General Public License as" z: i3 Q! e- \, [: {
- * published by the Free Software Foundation version 2.
- c* D5 I, z y, }! ] - *
: `' I0 R+ ]9 N' E - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
: @3 w3 s% i( e - * kind, whether express or implied; without even the implied warranty/ s; ^. {* u$ H. B
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the7 D u( ?! Q# J+ S4 ^1 h
- * GNU General Public License for more details.
+ v; N! E( H9 r J( P$ \$ P9 C - */: n& W. @( @! J5 M! R
/ }. ]8 S3 C8 ?% N- #include <linux/module.h>0 s8 e0 c2 H5 C) j+ j
- #include <linux/init.h> C1 M, }6 P' Y: \5 p, Y. d4 w+ i
- #include <linux/errno.h>
7 j R% Z6 S0 H, |' A - #include <linux/types.h># W5 C# }1 @" [! y* V" @4 N2 U
- #include <linux/interrupt.h>. q- K, p8 [& H; i3 t6 F
- #include <asm/io.h>
& L% j% Y v/ W- U; K9 k8 w - #include <linux/moduleparam.h>( t: b6 S4 X: Y9 S2 w
- #include <linux/sysctl.h>
4 `/ G% p7 @7 W3 E6 w9 C1 G& C - #include <linux/mm.h>
7 b* ]& r$ v5 m* P4 B @ - #include <linux/dma-mapping.h>. h/ c+ s7 t( F7 C; p4 I9 z
- 6 o4 y$ Q2 O; s
- #include <mach/memory.h>
0 [( x$ q1 T! ]- B3 C: A+ h3 m - #include <mach/hardware.h>
- I) I/ j9 J w+ c4 W/ G - #include <mach/irqs.h>
% y2 F4 }+ f6 }4 W% { - #include <asm/hardware/edma.h>
2 K- C5 p% M0 e' @* V* o2 l+ X5 m# j
* F5 Y* q5 ]: |+ r, g- #undef EDMA3_DEBUG
9 L& N' K5 v; E* D1 B9 r - /*#define EDMA3_DEBUG*/
3 u4 p- ?8 `4 z6 K9 @8 z - 8 d7 d# { ]9 T
- #ifdef EDMA3_DEBUG: ^* N2 `4 [1 `/ E' M' {
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
! q$ ?1 v# h7 m6 y3 E5 N C; \) C - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
! z) f- ?3 ^# c- t. q6 t - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
4 G$ z. `9 f3 `( M% E/ L4 w - #else+ O1 d* X4 ?- |0 K2 h1 L" B
- #define DMA_PRINTK( x... )4 e, A# r+ O, U& n5 M7 W# U
- #define DMA_FN_IN
e% i' o, ?6 N4 b8 W6 [6 ] - #define DMA_FN_OUT
; Q" |, z5 @% D - #endif
" a1 N; b) a3 E4 U6 j3 S9 v
A/ H9 W7 e7 ~- ^, Y2 S' n- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
4 I. @" E6 c6 {0 W; S! V - #define STATIC_SHIFT 31 o% v c3 k4 n2 U4 O8 P3 P% @% U: u
- #define TCINTEN_SHIFT 20
, K& S$ v4 t, p% U4 ` Y0 Z - #define ITCINTEN_SHIFT 21% Y( w7 ?9 e# H$ d5 [. U
- #define TCCHEN_SHIFT 22
' N2 @ l$ a8 V- |1 T: F - #define ITCCHEN_SHIFT 23$ O4 z% h( K4 h0 o! F3 d/ N# V6 v
- 0 q, y2 r0 B& N- @( U
- static volatile int irqraised1 = 0;' K& B* j3 w) k# t$ H
- static volatile int irqraised2 = 0;
2 Y1 F* K. m& B F; w: F - + s) Y% l/ K" B$ j
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 P# z" U6 f, N$ J
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: [" K0 f( p$ [) c' p1 m - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 j' w7 g; c1 [" A - 6 f. A/ i& g" b/ O+ X( Z3 H
- dma_addr_t dmaphyssrc1 = 0;
) h, y5 l0 W7 e - dma_addr_t dmaphyssrc2 = 0;/ N2 F9 N% P1 s
- dma_addr_t dmaphysdest1 = 0;9 [9 V; {1 Z/ [" o3 J* n0 f
- dma_addr_t dmaphysdest2 = 0;
/ z M; b- `# s - ) a$ r, b J* Z5 `$ Y
- char *dmabufsrc1 = NULL;* N, c4 W, A: y* d' q
- char *dmabufsrc2 = NULL;
- n! `8 A. T3 a8 C - char *dmabufdest1 = NULL;
& y( R2 {, q7 ?/ \7 D% ]* J! W - char *dmabufdest2 = NULL;3 u; w3 Z! [& F$ [
- o$ T) \; c* V5 y4 s
- static int acnt = 512;
2 F' l0 y% y! I( U! }% E - static int bcnt = 8;: @. R4 p$ n. y; E$ N" ]& Q
- static int ccnt = 8;
- k8 x! h2 v- x" i. E* x8 p! x! A; K - 0 `% W7 @6 F; C4 e% o: O! o
- module_param(acnt, int, S_IRUGO);2 N/ T+ O4 d+ ~' D( D( J
- module_param(bcnt, int, S_IRUGO);# H" l( d" u" t- ^; D7 I1 o9 y7 n
- module_param(ccnt, int, S_IRUGO);
复制代码 , a* F% g2 v* e q$ i
4 j' F8 ]4 v7 z! T" w) [) S: k 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, q- n+ Q( z5 L* n+ N5 U* barm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 W! x9 T& a* E5 V* G$ P' d
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* a6 F1 e J) ?) S. `! \
6 h( r2 m$ H9 Z2 w
( ?- p7 f [8 F, J" r4 @, e |
|