|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 [: _ g, o7 |/ s
- [code]EDMA sample test application
* o# t# D# u5 t1 F - /*% m5 A3 t: |! ~( t# t2 Y" U: u
- * edma_test.c& Y6 t( j/ d2 P5 F& Z" ]( a
- *. d5 R& [: M* v) ]1 y( C6 {
- * brief EDMA3 Test Application) }, m! y( ~& K2 T3 D. R' B* l
- *
* X: g# E2 R% {2 R - * This file contains EDMA3 Test code.: h* E* [8 P( I
- *7 ^) U0 }% z4 V+ F% G# ^! C# u
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- k' l& }4 `1 B! A. A
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT y S; J* u0 P1 `6 f B
- * TO CHANGE.
$ z8 B0 U- Z1 O% f( J4 l - *
) M9 K1 l- J1 Q/ J+ |$ ~4 _ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; F" |/ Y% o( c2 P c# ?( {
- *
& t, i# [8 x" u9 N# `0 Z% _! F0 M - * This program is free software; you can redistribute it and/or
. z. J% {& i) t( F - * modify it under the terms of the GNU General Public License as& w, P7 c! b- Z: C5 W v' `' ]. K) d/ t
- * published by the Free Software Foundation version 2.
9 H* R* z! d- _$ ^ - *
! G: U) z& t2 I4 F - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
7 }/ W9 o# P$ V% w% | - * kind, whether express or implied; without even the implied warranty2 D* `# A8 j8 V: e5 y& u; q
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the$ w# w* Y% @% [$ }8 A/ S, o
- * GNU General Public License for more details.
0 T! l1 O, @. \2 ]. ` - */
0 o3 l& v; X1 W
9 R9 A" K! j8 c9 e- #include <linux/module.h>
' h1 \" S; ^: r - #include <linux/init.h>
& p: l" j+ D& l - #include <linux/errno.h>
8 t4 N" c% o+ f3 s+ p" W" n. x - #include <linux/types.h>
* r. v8 W' r) L5 s - #include <linux/interrupt.h>* |1 n8 Y5 q) ~7 S% C
- #include <asm/io.h>
8 B& h; x t' C( O" D - #include <linux/moduleparam.h>8 @- Q) e4 \7 N
- #include <linux/sysctl.h>) N! p2 l0 p3 }/ j6 h
- #include <linux/mm.h>
: P8 v: e; X6 y2 |- a - #include <linux/dma-mapping.h>
1 D" D* H f2 a v6 F8 b- v% y
7 {* o- f: B5 m8 Y1 y- #include <mach/memory.h>
" Y2 @1 u5 a. |1 L/ ~! @) s5 L - #include <mach/hardware.h>& z/ {* C& ]: F
- #include <mach/irqs.h>8 q$ Q, D# f$ n9 W& ^+ B0 J, P
- #include <asm/hardware/edma.h># m/ j+ ^7 h6 z- y3 n) T
- ! f' D/ g5 u Q/ u* t4 e- a6 j B
- #undef EDMA3_DEBUG$ u( f# a+ i* F+ B: t
- /*#define EDMA3_DEBUG*/
% M) v/ v# a6 ]' |
+ E1 o E& h1 k- P- #ifdef EDMA3_DEBUG
) ], ?( ?& m$ [& Y - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
: c6 r$ T Q1 r, C7 @3 C - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
, S' h3 i# b8 b/ ]- s( ? - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
% t1 N9 c1 P# W4 b) T, d - #else
, S s# f, ?% ` - #define DMA_PRINTK( x... )
5 t& `& a/ B3 U8 K! D( F) n7 s - #define DMA_FN_IN- o- r& M! L/ f( F. P' h+ o$ S
- #define DMA_FN_OUT
9 }! T7 F0 R0 ^3 }1 U: a3 n - #endif
( ]# R+ x4 A6 @ - V3 n" o6 L1 P( a6 p! J
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)+ L9 \, n! z& H3 H: X7 j% N
- #define STATIC_SHIFT 3
4 h Z5 ?) t% }$ Y) s7 c - #define TCINTEN_SHIFT 201 P/ n3 _' T7 o; b+ W: ~
- #define ITCINTEN_SHIFT 21) R# `8 u1 E7 [2 _& H& `* z9 b; E
- #define TCCHEN_SHIFT 22. _' a) G9 G ]2 R! x# m& e4 \4 f
- #define ITCCHEN_SHIFT 23
( D4 V' P% P2 b6 _) H0 } - - ^7 ~% r; U$ `! ` w
- static volatile int irqraised1 = 0;
9 k, R% N4 i# W& n- a+ a$ g/ S; E: y$ x - static volatile int irqraised2 = 0;1 {. q4 w% J9 T( K+ O: G1 S1 ~4 e( P% O
. n2 U7 j) o1 x( l) [- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& }2 a- I r* a# u - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( s0 y, s+ \+ {
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' k' f" [0 @ o$ j3 f- ^. h& l; R, F
7 K. z/ \' d; J5 P) t) o, |- dma_addr_t dmaphyssrc1 = 0;
- y2 ?+ Q1 ~2 s0 O' w - dma_addr_t dmaphyssrc2 = 0;
" d) R, Q7 L# x: s7 T - dma_addr_t dmaphysdest1 = 0;2 q/ A4 d W/ Q
- dma_addr_t dmaphysdest2 = 0;
. c( b0 q+ o" v; r$ _3 t - 9 v/ Q! l+ }9 e! I0 B7 a7 v! X
- char *dmabufsrc1 = NULL;
7 E' l7 \5 W3 R. m" T$ k+ r - char *dmabufsrc2 = NULL;- Z- t: p- L: O n2 H' H: u+ _. _
- char *dmabufdest1 = NULL;. I3 W) j$ h7 Y
- char *dmabufdest2 = NULL;) |; m3 T5 |0 }6 R/ U3 f
- % I# e i: q: i: r# s1 s* z! B- h
- static int acnt = 512;
" A. }* ? M" j8 H, i4 ? X - static int bcnt = 8;
) Y& @1 S# _, u7 O1 ^; }/ J - static int ccnt = 8;1 ^ i/ K! Q8 N3 F4 O/ v
+ G' u7 b) b% L9 A) [- module_param(acnt, int, S_IRUGO);5 ?0 c; {# G& [" X- y
- module_param(bcnt, int, S_IRUGO);
2 D6 b; V: I! a6 G7 y - module_param(ccnt, int, S_IRUGO);
复制代码 0 G4 [6 H' \; x `4 R1 Z
7 y% I. d) H: O3 \' f 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 J. u( e7 ^ x. o8 ~+ x ]( m
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) B7 Z$ C# I, Y% q. M 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 k) C: M1 O8 o8 Z! s2 @
" U8 v* } B5 i7 Z0 v1 p/ R$ o" y6 |% N0 ?- @/ K6 C- T6 g
|
|