|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, B( i' H5 c$ ~* R- [code]EDMA sample test application' ^$ [3 j2 U* a7 q3 ?
- /*8 h3 I/ p) X* n) H# Z9 a& ]8 x
- * edma_test.c! T4 B+ W: x% m. ^2 }' Q
- *& c$ A1 \. Z8 o `1 V3 _4 R U# e
- * brief EDMA3 Test Application
6 N X- q% n" \, t - ** G* H4 u+ ~& S
- * This file contains EDMA3 Test code.
* X$ h2 {9 G- E+ i; c - *
* b4 `& {, [, U3 g7 F% d - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ t+ ~! Z& a+ \7 o; ~
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
: {, s7 r: T5 S y4 ~% o3 Y - * TO CHANGE.
4 n& ?9 j( ]) n, D - ** }( Y& \4 q% a+ a. K! u% v: P6 Z
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* O/ X: `& L) t: O# ^! ^# w1 V* K' j
- *
/ N: o/ E9 _0 v$ d% E) l" N - * This program is free software; you can redistribute it and/or1 e( u" R/ |: Q. D2 @/ V7 u* g
- * modify it under the terms of the GNU General Public License as
& t: g% Z, ]9 X1 M9 q: Q& u1 ? - * published by the Free Software Foundation version 2.
+ Z- U- R9 N+ O) Z V2 \ { - *0 `. @; K3 {5 \8 w* C: p+ q9 e" P
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
W# ?0 ~* ] D) b3 A/ ~ - * kind, whether express or implied; without even the implied warranty
/ F7 X2 c' N; R) X j* z - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
$ j) a+ `- s. X) X - * GNU General Public License for more details.8 W+ _. e9 S7 s2 q
- */
$ @. N- K8 Q4 }+ |% j# o3 \
: F; t; ?1 q7 Q3 D4 n5 s* m; r- #include <linux/module.h>
% `: D( G4 R' Y0 m - #include <linux/init.h>
9 Q' |! A( T. s* V. H; N" y - #include <linux/errno.h>
( r% N( P) @6 C6 h5 q; q6 n - #include <linux/types.h>
2 N8 e: \- T: o - #include <linux/interrupt.h>0 ?/ P9 d7 ^% Q. ^
- #include <asm/io.h>% Q' }- k k1 f+ B+ Z7 Z9 L
- #include <linux/moduleparam.h>4 |/ j$ S1 K% o# w& |
- #include <linux/sysctl.h>
% P4 ?# C* P+ t - #include <linux/mm.h>2 y; _1 _0 E3 \# B. z9 |7 `
- #include <linux/dma-mapping.h>: f! q8 p4 g! y. r5 j
- # p' Q' ~" w$ Y0 @! {+ Y
- #include <mach/memory.h>
6 ^8 _5 x/ ]% p z. O - #include <mach/hardware.h>: r3 p! q/ ], q( m E$ j
- #include <mach/irqs.h>
( _' |$ O+ F; x" _' I' l - #include <asm/hardware/edma.h>
/ n- U0 @) q" \7 |# K- V - 0 Q% n" f0 K4 P7 c* ^% p
- #undef EDMA3_DEBUG
; h1 Q* \% Z8 M: Q' a, ?5 X9 j, ? - /*#define EDMA3_DEBUG*/: M( I9 _' o* ~
/ v# i8 g( b5 ? a' Y: p- #ifdef EDMA3_DEBUG
) m+ {2 W0 y, B* a: h) o- J - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
2 _' j5 ~+ j0 Q! R! i" G - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- ?# k! \) L. ]+ B) F2 t3 o8 x
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 Q2 i+ ?/ n' }) u, c. U5 T
- #else* ]1 }0 Y3 `$ d, }. G; z- u
- #define DMA_PRINTK( x... )
+ w% c/ p9 V k$ ]5 F/ I# Q - #define DMA_FN_IN, F4 w* w8 J. y+ _3 z0 q, x8 E
- #define DMA_FN_OUT
8 X! l, D" C( C& A- N2 ~7 i. K - #endif) j& D0 _8 \& N `% K
6 K7 T0 J+ L8 a7 _" D" k: u- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
, }' ~+ f7 f" ^) r - #define STATIC_SHIFT 35 l9 R/ s O2 s. j& k' j- G) P
- #define TCINTEN_SHIFT 20
/ r: f' v1 B0 Z- f6 F - #define ITCINTEN_SHIFT 21. B B, g4 o& w. f
- #define TCCHEN_SHIFT 22: m* ?3 o" u$ f
- #define ITCCHEN_SHIFT 238 x2 r/ [, Y+ ^. K3 u
- # N0 s) j; A2 w q" ~' y. ^6 P$ f p3 D
- static volatile int irqraised1 = 0;3 \+ R( @& @+ { T% l* l. W! v
- static volatile int irqraised2 = 0;
: k" |' ^9 \, ^5 K3 E
5 T3 b ~0 B3 W2 \$ W+ |- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: D1 R; w S, m: p - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ Z% x) x3 I/ U
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) W2 t* B. ^+ ?0 s- I( ? q& b - 2 A5 E. n: @, l+ i; Z% w8 F: y2 k
- dma_addr_t dmaphyssrc1 = 0;, J1 C" |3 C+ O6 b" p) Y, P
- dma_addr_t dmaphyssrc2 = 0;" m0 j4 d. p. G! N! Y
- dma_addr_t dmaphysdest1 = 0;1 @% e& Y/ c" l1 a5 {& O* d
- dma_addr_t dmaphysdest2 = 0;
7 p/ O" B h, B: x0 j - - u" y4 I/ V6 w$ Y/ m& w
- char *dmabufsrc1 = NULL;
& N0 T" w. ?+ p: I - char *dmabufsrc2 = NULL;+ h, X, w7 a* z- e6 Q8 V
- char *dmabufdest1 = NULL;' A5 k- t- W, I* o7 k$ Z0 }
- char *dmabufdest2 = NULL;8 {$ x! h2 F2 t' }, i
7 r! y# P/ E I% |3 Z" G- static int acnt = 512;* x7 f7 R' n0 o. j8 o
- static int bcnt = 8;: B" z) U8 F7 Q' w5 y( C7 A
- static int ccnt = 8;
& F0 G; n" i; s8 h- I8 ]! u) q
! n9 k* X, {9 ]; \+ I: N- module_param(acnt, int, S_IRUGO);# A: g$ r4 e6 v8 X5 @
- module_param(bcnt, int, S_IRUGO);
! a7 }" X7 A) c - module_param(ccnt, int, S_IRUGO);
复制代码 . x2 d; Q9 n& s& `
2 y$ |6 o9 D% O V t
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, x6 w5 x9 u' v8 r8 r
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ N5 u9 j I; p) Y3 Z
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ [' ~# |% ^5 V( v# T3 X* P
) `0 A. Q `9 D$ N
# ^2 c& R7 E. s8 P( o* \ |
|