|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 \7 t7 C! j0 Z% r; _
- [code]EDMA sample test application: D7 {# ~' r4 @
- /*
* E. |; z2 E. g1 f5 l$ J - * edma_test.c
1 j1 X' x" {+ B5 i7 ^ - *
3 Y2 R1 C2 K6 Z3 ` - * brief EDMA3 Test Application
) h! r: `+ a' O' Q V. u. Z - *
; Z$ r" ~. _ B2 y' M7 h* U0 l - * This file contains EDMA3 Test code.
5 O5 ?# E$ N0 z6 S - *
- o A/ M+ i }1 Q8 b - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
" S8 i* U5 y0 t - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
6 Z- b) i- I- P, \8 o) b: r1 e2 N - * TO CHANGE.' M' h) ?& u5 @9 p b7 o; ~
- *
' ^ K. e# U6 X: L& o - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
: Q: |8 ^8 U K5 R' g9 Q - *
; r- K Y- T* v( g - * This program is free software; you can redistribute it and/or3 \9 D7 Z' R! \# l- E9 B% Q% R
- * modify it under the terms of the GNU General Public License as4 L0 U0 g" T# \+ f- T j* k
- * published by the Free Software Foundation version 2.! k0 d0 u6 u) Q) g: ?
- *
5 A$ Y) g+ h# d/ a+ m - * This program is distributed "as is" WITHOUT ANY WARRANTY of any: c/ \. f4 H8 z/ ]
- * kind, whether express or implied; without even the implied warranty% l. {- s: Q, j, G6 k; t' h# z4 Y( J! J7 d
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- u6 r! w/ t+ a- B7 r6 B5 f - * GNU General Public License for more details.
, ]& x, ~/ v2 j* Q7 \ - */
( e. A* F2 _6 s* R+ b- O# g2 b - 3 o1 _& ^) K8 ~7 c7 Z$ w+ V
- #include <linux/module.h>! r! r9 c( v' _$ b
- #include <linux/init.h>
# J8 f: S# k7 z1 V% n* ~2 V# Q - #include <linux/errno.h>
! A9 A, z. w' s- d- g+ ? - #include <linux/types.h>- n! E1 s8 P" C$ C' b
- #include <linux/interrupt.h>
! R8 [3 s+ G. j/ l6 }, E4 q - #include <asm/io.h>
P2 p% U- {% f8 U$ f% ^ - #include <linux/moduleparam.h>
# T5 u6 ]% _$ h$ ^0 @ - #include <linux/sysctl.h>) q9 q! t7 \+ _( u# Y$ [
- #include <linux/mm.h>
" F P# B/ s6 H4 f9 J - #include <linux/dma-mapping.h>$ W1 @5 D5 ~+ q, e D0 X& ?8 S3 P
1 @( B# M5 C0 d! `# N' d" D0 t. @- #include <mach/memory.h>7 L f9 S5 d5 [: M# `' M
- #include <mach/hardware.h>+ G' e- ]/ G; f$ L! I' b
- #include <mach/irqs.h>( [' x& u( d+ f; O
- #include <asm/hardware/edma.h>9 w! n- c C- O" O
0 D5 \2 y# H5 x7 _ B- #undef EDMA3_DEBUG4 q i9 Q, p8 i( @2 U. Q4 z* }
- /*#define EDMA3_DEBUG*/
2 ^* |" m2 |* R K3 P6 `8 P - 2 N1 v0 A0 Y5 n5 i9 a4 B
- #ifdef EDMA3_DEBUG8 N2 R( b0 s( ~3 f6 `
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ k I- B8 d7 v4 F& B; e: B# @
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ l* I5 Y) n- N" X6 Q
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): Y5 p" i6 Z t. ^, T
- #else
# g% n2 h* ]; h8 ^9 o - #define DMA_PRINTK( x... )
. J& g0 {' H* Z0 M5 E0 n' `& Z - #define DMA_FN_IN
+ }& `8 {2 }: v3 d( H S' d) Z - #define DMA_FN_OUT% z" y$ P- _3 d6 t' S. Z+ Q
- #endif
3 ?5 U( b7 i1 w0 |/ b7 Y$ v
6 I+ X3 H. g0 d5 Q5 M* c6 q- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
0 x6 o8 A6 L& u4 d2 y - #define STATIC_SHIFT 3+ p) ?3 @* v t1 Y, v' K3 L% X" C
- #define TCINTEN_SHIFT 20
3 R3 f" \& m/ t2 M - #define ITCINTEN_SHIFT 216 n$ U/ D1 D: T- G! f7 S
- #define TCCHEN_SHIFT 22
4 x. M$ Z I S6 O% o( T0 J$ F% X: Y - #define ITCCHEN_SHIFT 23* Y' L) U+ V1 s/ Q: k& {0 D
- & `+ r9 p, C+ q9 e5 Z2 c
- static volatile int irqraised1 = 0;3 m; d, L; `/ V; f
- static volatile int irqraised2 = 0;) C; W+ B) _! H: N' s% Y2 e% O( A
- - ?+ h1 Q! V) h Z
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 H+ O; U: ?7 _: G; T! j7 |+ |
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" c! C9 t7 F1 H0 t* y! x# J
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* S' e" a, |1 I! e, Q1 w1 o& X
, f( X5 C' | b- dma_addr_t dmaphyssrc1 = 0;' ?% S6 R# |0 R1 x
- dma_addr_t dmaphyssrc2 = 0;9 s( }; t$ M/ _! Y' Q' z. W0 ^, s" w' m* S% Y
- dma_addr_t dmaphysdest1 = 0;
/ e$ I% n; D8 }5 r- @; P4 x+ E - dma_addr_t dmaphysdest2 = 0;
- R; A7 u9 U5 q: B6 b& o+ S: w$ R - 4 p7 L8 P/ C' |5 N
- char *dmabufsrc1 = NULL;3 t, _6 Z5 p: {* ]
- char *dmabufsrc2 = NULL;
- H. w5 \- R) B- A5 D6 g/ H' E; L - char *dmabufdest1 = NULL;$ ^/ D: A& @, }
- char *dmabufdest2 = NULL;
3 x0 }' R$ I) p/ Q
" v" n; Q$ `8 j2 D/ m+ { m8 G- static int acnt = 512;
& Y& h0 W4 `( A+ { - static int bcnt = 8;
7 @+ o h0 b' y g* ~; D - static int ccnt = 8;" B6 w$ M" K5 @9 l
$ s* p& L0 H3 I" F2 p$ a- module_param(acnt, int, S_IRUGO);) L7 y! i% u* [- U1 Y- W
- module_param(bcnt, int, S_IRUGO);; t8 Z# p5 u/ @( }+ ~7 }- W
- module_param(ccnt, int, S_IRUGO);
复制代码
9 R& o3 ~( D& q: o# U/ Y. h$ t
) Y' J2 a0 l! x$ o, h+ U; [% j) p& { 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用 {- `/ C1 S) e, ^
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 ]3 I. y9 d T# w 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" U& g1 ]2 w# S8 ]) t; G. t, B j1 }- U/ ]+ E8 O8 r9 y7 B5 }
' N/ v& z- G1 |* r; f |
|