|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 u, m6 d: D& f% s- [code]EDMA sample test application
$ l" g t! ~8 `, v - /*" L# q3 B" W, C* T m7 y
- * edma_test.c
9 ~% W% K( H7 ? - *1 p, \! y0 t G6 F( Y
- * brief EDMA3 Test Application
' T9 M$ H4 [& q8 V( K% o r - *! l; J6 ?0 D% ]* o# n3 K
- * This file contains EDMA3 Test code.
3 O* N i4 [* G2 C% [ - *
# w. C% \. t* M1 S/ i - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
4 K( g$ g, U8 q - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
% \! E1 a% V' E: ~6 T8 \! I: i5 a - * TO CHANGE.2 f1 A; V5 z2 {% Q1 J# I2 ~& Q! q1 S
- *
! J6 \. o O+ X0 P8 | i - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// V+ }/ \% W8 i. d, F
- *
5 P# F0 V( @" f: D' e - * This program is free software; you can redistribute it and/or0 K* g# ~9 r2 L5 L, r5 B* L, r
- * modify it under the terms of the GNU General Public License as
+ h' z% @' ^* j6 V% m - * published by the Free Software Foundation version 2.
4 ]9 C n0 C% V1 |5 i3 c - *
3 M3 B* V# j/ h. n0 ]# O1 S - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
/ T6 {. O+ b, A - * kind, whether express or implied; without even the implied warranty1 G& t& |+ c; ~0 L8 a5 w( k
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the( A) G* a& x$ F9 k! C% ~- c* a
- * GNU General Public License for more details.+ i7 n8 G# z# Q3 q# n
- */; I! ?5 q l0 x: b; s; h5 b1 r
- ?$ Y3 I$ L/ }0 v4 S
- #include <linux/module.h>3 A7 ~4 z) B2 Q1 q% j4 P& }
- #include <linux/init.h>
$ W \7 x. L/ A - #include <linux/errno.h>
$ Q- T* ?: h& V. C4 V. e- U: }! O - #include <linux/types.h>
" x H0 V1 m& C9 u - #include <linux/interrupt.h>
5 V, O8 O- j, t Z - #include <asm/io.h>/ u$ U" c0 J) b, x
- #include <linux/moduleparam.h>' D k! K+ \. [, @1 I$ `- Z
- #include <linux/sysctl.h>
8 }& H; p( ?. X' l& _" w - #include <linux/mm.h>
, _6 j6 Z. }) h; z# A - #include <linux/dma-mapping.h>( ?+ s- o; B5 X, K( b0 ]
2 ]! ?) N! S% d0 ~7 s7 T1 z- #include <mach/memory.h>
7 p, X5 V2 ~6 T/ p - #include <mach/hardware.h>; Q/ s& p9 [ \' J
- #include <mach/irqs.h>
: t$ R8 O- R% m* C8 s - #include <asm/hardware/edma.h># T1 T7 {& g x0 t
8 n! I$ F5 `& G- B- #undef EDMA3_DEBUG4 i* U" C4 e2 l( Y2 D/ s
- /*#define EDMA3_DEBUG*/* S0 H0 V, }" H/ c0 s& p
- * f# w. b8 D0 `7 g& X' P8 q+ y$ D
- #ifdef EDMA3_DEBUG* K- N4 m5 I: I5 [
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
8 B( ~- u5 T& ]- z8 }/ q! i - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% v# u e7 \/ |6 g. c- i. n# q
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
^- ]5 `% D4 ~. T# V T/ M$ P - #else3 F1 k" Q( |' y8 K
- #define DMA_PRINTK( x... )1 q3 t* Y) c; v& ~3 b! K
- #define DMA_FN_IN
& t; k. ^/ j3 o8 U& b4 B. @ - #define DMA_FN_OUT
0 a0 }3 l6 t1 b - #endif
4 D) W; X. f( O2 T - ( o* M& M- D5 S$ r. |
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
q1 Q7 h8 b. x; r5 N2 s - #define STATIC_SHIFT 3" M$ B, K* b( Z% j
- #define TCINTEN_SHIFT 20: L6 K2 A+ L+ E5 |" b. g9 B9 Q
- #define ITCINTEN_SHIFT 21) @4 d7 Q. q+ A( t+ {3 k4 V
- #define TCCHEN_SHIFT 22
& Y7 |/ e: \ @+ S - #define ITCCHEN_SHIFT 23; i, ]) ]# o: c, u
- ( e/ i, k0 ?! w' l
- static volatile int irqraised1 = 0;7 C% J2 R0 m- q. K+ y
- static volatile int irqraised2 = 0;
- L5 s' i a8 z* y
3 ]2 ~: t3 W0 _& m- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ X$ L! D8 F4 Z& U- i/ j0 m8 ^0 A/ b& @
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 d: K/ r! d) h F8 q7 j: B8 o
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 v5 q9 l5 ]; X I
2 j( u2 n7 Q/ \2 q6 l- dma_addr_t dmaphyssrc1 = 0;
* v- y2 o/ w8 o [ - dma_addr_t dmaphyssrc2 = 0;
) n w" ` m4 b2 ]% |, p - dma_addr_t dmaphysdest1 = 0;
4 _% }" e8 |. e% y9 w - dma_addr_t dmaphysdest2 = 0;
6 g+ v$ t/ `- r2 H! O - 6 O1 _! J$ Q, e/ m
- char *dmabufsrc1 = NULL;2 ^: T% H( n$ N
- char *dmabufsrc2 = NULL;
1 c+ \1 i; i D) H - char *dmabufdest1 = NULL;
4 K. `( r& k$ ~) q - char *dmabufdest2 = NULL;' B. X# Y& n0 f! z) L, }; x
: Q9 q! T, [; o, H. W2 s) S6 ?& B- static int acnt = 512;
1 f0 L9 k7 ^( D7 l8 p0 I( ]- X6 X - static int bcnt = 8;4 Y+ D% T& d5 [
- static int ccnt = 8;
2 @1 f/ C: s( A" r; z8 \- G
' C: [$ t6 u* ^/ A/ U5 K- module_param(acnt, int, S_IRUGO);
\; y4 t |- F# U; S+ ]; R% K1 r - module_param(bcnt, int, S_IRUGO);5 k$ O& x7 U8 D7 F1 G& T$ ]. I7 e% J9 q
- module_param(ccnt, int, S_IRUGO);
复制代码 8 o+ `7 I8 y1 k' h5 U
3 \0 c, T$ h% ~4 g3 A( d
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- ~& f0 I6 \9 ~: xarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, I( e# ~( {$ @4 a- r( x
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 p; D y6 P5 J* N
$ t- X( K" s) q- D3 b# n7 ^
* |3 a( A; E. \8 {/ |3 c& i. O |
|