|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! j% f7 s7 Z% x( v$ s
- [code]EDMA sample test application8 E( ^: L" D! Y) x1 T6 d
- /*
2 K' ~! @, {4 ^- b6 B - * edma_test.c+ `3 {% V6 L) R" `8 w7 a8 o; \
- *% X" ]: I5 v t0 D6 p @+ b7 f. x0 c
- * brief EDMA3 Test Application4 F2 W) P2 E4 U/ z9 r
- *9 d7 H! y( J5 e4 X# K- s
- * This file contains EDMA3 Test code.
$ C$ q; o& P3 s9 s% O' F - *
1 f/ w9 j. R* f& t# ]' M5 u1 Q( v; F - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; Q2 W0 c' ~1 }( D
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" q8 Y7 O6 t8 i5 w+ o* b; x# E
- * TO CHANGE.
# \+ `5 `) H. b) b. W% x - *1 a: q; v) T$ k: _7 M7 T$ f+ E
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
% n8 ]5 M* Z D r5 Z - *
2 g4 k! S1 G; j0 P5 B - * This program is free software; you can redistribute it and/or
6 z& J5 `( j s& x - * modify it under the terms of the GNU General Public License as
. x! W+ r1 T) W v* l: H - * published by the Free Software Foundation version 2.2 t* _, o3 K" Z% q* P9 U9 G8 r, Q5 w
- *
6 Y% y2 b2 _( ~* p& B - * This program is distributed "as is" WITHOUT ANY WARRANTY of any' U) D# @* q+ }+ \3 n* w @
- * kind, whether express or implied; without even the implied warranty! i, E" _. o, w
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the, \1 D3 q* [- ]; H# v$ C; V e) g
- * GNU General Public License for more details.8 c- W- g* o0 k) i$ L8 v1 C" F8 {
- */
1 N$ x) X* D5 f8 B, ~
' c4 L; `' w4 C, A- #include <linux/module.h>
! R e3 d+ T# a) c - #include <linux/init.h>$ r" g: b H) @
- #include <linux/errno.h>
* W# L7 U. q$ c) J" e - #include <linux/types.h>. s, Q/ {8 P( T6 F, a; Y t2 q
- #include <linux/interrupt.h>
& B3 a8 _) H. U+ @! @ - #include <asm/io.h>7 B4 s' b7 P, G' \ F
- #include <linux/moduleparam.h>3 t5 J. Y* g$ s
- #include <linux/sysctl.h>$ h; g' z) ]0 V) w9 i
- #include <linux/mm.h>- o+ R; E6 |; `0 A p( i: L
- #include <linux/dma-mapping.h>
: J2 K W7 k/ Y" O
0 e- _7 u5 V/ V" S- R+ E7 b- #include <mach/memory.h>4 e7 G6 c8 n$ i; N
- #include <mach/hardware.h>; }" w4 X" h. p
- #include <mach/irqs.h>( `+ J, I- J7 B5 J
- #include <asm/hardware/edma.h># M3 _( B3 |& L2 v2 P
7 j5 N+ C7 l; J8 p5 @9 @+ Y" [: M- #undef EDMA3_DEBUG
4 l( C; P; A: j [2 N% Y% l - /*#define EDMA3_DEBUG*/# A. B2 }$ \: s; v, K9 s
& V q' {6 H2 D, I4 I% l& {! ^- #ifdef EDMA3_DEBUG, @; f# x s9 o5 F
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
6 [) r; P0 s% G' o7 \ ~ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
* N7 P! N5 G g9 u* S - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
4 F8 N- Y: K7 @/ [& B, i/ W) Y - #else+ j8 H& ^3 {! s2 }6 F
- #define DMA_PRINTK( x... )
' \4 z0 m9 [6 ~ - #define DMA_FN_IN. J2 P- W8 x6 v# s
- #define DMA_FN_OUT
( D" T3 y0 \( f% Q+ d, c% I - #endif, H/ ?) C( |. e7 g) n: [
! y. O5 U2 O6 d: \7 _2 u. ]- Y- #define MAX_DMA_TRANSFER_IN_BYTES (32768)8 V/ X- p3 k9 n# i) i+ ]
- #define STATIC_SHIFT 34 `# |) d' c0 p) P, ^! w2 m
- #define TCINTEN_SHIFT 20+ U/ f9 c( t7 h% ?4 M, O3 W
- #define ITCINTEN_SHIFT 218 R6 _% l7 @7 B6 H4 f9 c9 {
- #define TCCHEN_SHIFT 229 l5 Z& m- p5 C
- #define ITCCHEN_SHIFT 23( N ^0 f4 V7 S
. b+ H9 w- }: w4 s- static volatile int irqraised1 = 0;
# T% C/ l' c, x! Y: G - static volatile int irqraised2 = 0;! Z( L6 A6 s! _. t! b. G% G/ @
$ f' `% ]* o2 Z; Y: o7 v; l- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& D4 u3 B* ^ y - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) L z) h% ]% k
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); P T' a. S5 \4 U( W! l3 t
. |( G% n& t& D; T; Z- dma_addr_t dmaphyssrc1 = 0;
( d2 [: }' ?! j3 L2 F - dma_addr_t dmaphyssrc2 = 0;
" n. D" ?; P% r$ F) p3 S$ C! b% E - dma_addr_t dmaphysdest1 = 0;
, \* O5 @; ^3 ] - dma_addr_t dmaphysdest2 = 0;, g+ {& C; W3 b' q7 I
- 0 [& l4 i. P) n& p2 g; o; w
- char *dmabufsrc1 = NULL;8 Q- a* t1 R2 P* |# @% m3 J( s
- char *dmabufsrc2 = NULL;
. O+ i/ J( Q+ I2 e* k7 y - char *dmabufdest1 = NULL;/ W; Z- f$ ~5 ^+ c5 y
- char *dmabufdest2 = NULL;
, u$ ^, ?, W2 d( Q+ \5 y - n, Z8 _ y/ u3 z
- static int acnt = 512;6 z2 G w+ \& }# h$ G
- static int bcnt = 8;1 h7 l' D/ a# q- x! A" H- r2 W: A
- static int ccnt = 8;
. A* M2 Y9 B, |# U! x" w - * ~. c x. n/ Q% w6 W
- module_param(acnt, int, S_IRUGO);- O) d9 t0 K4 z$ H) `7 P- G
- module_param(bcnt, int, S_IRUGO);" u- X% |5 S7 \1 C1 U+ s& T
- module_param(ccnt, int, S_IRUGO);
复制代码
4 Z7 G: U4 V" H, [9 l
- ]: v3 y9 G8 \ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, f; F4 l! s! K6 n: l8 T
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 m- m) B9 _5 d+ b
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
g5 G/ }( ]: C
2 v8 }, _! |. Q f% i8 a5 ^( D* q$ ]
|
|