|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' C2 n, R3 ~9 E# K; G- [code]EDMA sample test application* P4 z' }4 L4 U0 J6 [! I1 a- ~
- /*- w7 y7 I z$ A1 ~
- * edma_test.c
8 C6 g' ~ x3 P a7 [# J c5 x) G$ Y - *
) H6 E1 a' q% M* n/ B - * brief EDMA3 Test Application
Y1 I5 b/ {; Y# C+ F6 Z - *3 |# C( T* y2 h; c+ _' I
- * This file contains EDMA3 Test code.- H4 @( t6 Q% j- o5 E) q0 t$ g% g$ v% q
- *
8 |. d/ M/ c, T$ b7 b - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
& g" O" ?+ @9 r# J2 Y* T - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
. s7 @- v5 [' v% H4 \; \% s, m - * TO CHANGE.
: a3 C. i6 b2 [. C2 o - *6 V2 _8 e* H% `& a' D4 ^" t4 v
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
# m2 `' c) d, ^4 o - *
+ g! v( y% o7 d% x# y1 Q2 a% N - * This program is free software; you can redistribute it and/or1 d% d0 u; Y0 S0 N M4 B
- * modify it under the terms of the GNU General Public License as" T" A" d$ |8 h! d/ H
- * published by the Free Software Foundation version 2.& d# |5 H1 v0 y6 N5 _
- *0 S8 |& q2 S/ E! O' y; e2 e
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
9 t$ i/ \. F" z/ [5 A) X3 j6 ` - * kind, whether express or implied; without even the implied warranty6 z7 L5 o3 `/ ~( R' D
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the& I9 \, w% x3 o$ H k. u
- * GNU General Public License for more details.( b" a" g8 Z0 N
- */
/ f2 O3 {* r+ h- U& y, s# w
4 k) l$ g8 y# B I' n$ E+ O- #include <linux/module.h>
& N @0 p$ e9 n, V: w - #include <linux/init.h>) t( A) @8 [" D7 b( }4 I
- #include <linux/errno.h>
1 S: B% ]5 A1 \: N* X# U i5 _ - #include <linux/types.h>
8 y, w% {, H; h! b+ b( Q0 E - #include <linux/interrupt.h>' I# A, Z& h0 S* F- ^) C1 r# ~
- #include <asm/io.h> Y& P, F: R1 \# B) o3 N
- #include <linux/moduleparam.h> K/ l) Q& s( H) ~) O, [) L! t2 J
- #include <linux/sysctl.h>
- u2 d: I6 s& ? - #include <linux/mm.h>
& B( R7 K6 B- l) t - #include <linux/dma-mapping.h>
- ?8 ~2 h( k' L- Y A1 q) R! {7 a
) a! ]2 x8 T! K& T- #include <mach/memory.h>9 F3 z" j8 v' H
- #include <mach/hardware.h>
* `. _, Z: |" F$ V - #include <mach/irqs.h>
" ?2 r3 p/ a; Q! o5 V5 t# K - #include <asm/hardware/edma.h>
$ `+ M5 }% h7 ?- c G - 7 j: S' q7 Q' i- F. l
- #undef EDMA3_DEBUG# J/ ]9 l- P* B. u
- /*#define EDMA3_DEBUG*/
% H5 f! _# y( f4 M/ R - ) n' e/ k C# ]* G0 t& c, k; r6 g6 q
- #ifdef EDMA3_DEBUG% W2 |4 G, L; x$ h8 f* v7 \
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! H& D+ O# w( a( |9 E% M
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& _: v: ^& h @4 K/ q% G$ C* M
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
c# s% d g; D0 V6 u- S# @2 m8 y6 q - #else
5 b/ j; A& V; _$ i+ z2 {0 ] - #define DMA_PRINTK( x... )
# _- a1 T$ T6 v - #define DMA_FN_IN
5 {2 l% V+ b! M ? - #define DMA_FN_OUT
E: m& S& V3 ]4 e+ M0 z - #endif1 j' {; I/ \- P6 B
6 M8 z; ]0 z8 J$ P- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
* v2 k$ C4 h# X, V. i3 u - #define STATIC_SHIFT 3* x* I. g% f/ Q3 e, ]% x. M) R
- #define TCINTEN_SHIFT 20
L+ }' p. N! } - #define ITCINTEN_SHIFT 21/ I% a3 I4 v" o$ |- x, r$ d1 A- L
- #define TCCHEN_SHIFT 22
8 ?) f% I" B, P, t! l" y5 C+ P - #define ITCCHEN_SHIFT 23+ N6 |+ y% b) W0 r9 w. }& {
8 c4 {9 H U! R! m% i- static volatile int irqraised1 = 0;
+ w, ~5 ~; c$ W- E$ j - static volatile int irqraised2 = 0;
) J/ ^5 }$ \* X8 O: P% r- [4 a; t: P - ) f3 ~( f/ B- ^1 t1 ]& E1 Y
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, z" j/ k4 d8 z# g0 }5 H
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& {" \0 a# D4 ?/ j, I - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 r2 \; X3 Q) p0 L, G- A2 u
- ! l4 M" ]% o8 _7 B% Y
- dma_addr_t dmaphyssrc1 = 0;
L. l+ G0 t1 h* I H - dma_addr_t dmaphyssrc2 = 0;: I; @$ {4 M% s8 q) F
- dma_addr_t dmaphysdest1 = 0;8 v, J' _5 n- b; N& e
- dma_addr_t dmaphysdest2 = 0;
" Z z+ ^# O% P5 F" k; G+ ] - ! C) E) K# L% v) @
- char *dmabufsrc1 = NULL;
3 c( g$ J2 v5 j9 k - char *dmabufsrc2 = NULL;
' Q* |. [( e4 e+ q - char *dmabufdest1 = NULL;
7 H; z, }* t6 }- g# L - char *dmabufdest2 = NULL;! \$ h/ g& L6 }) I' O- T2 l
- % ] ^/ L4 F7 Y+ _1 k
- static int acnt = 512;
$ x- L1 D! X5 M { - static int bcnt = 8;
% K3 y J( X' @) b: ~5 X/ A - static int ccnt = 8;
6 U2 u# K f t: O, I2 S* ` - ( @+ E* H+ M3 d L3 X
- module_param(acnt, int, S_IRUGO);
3 Q7 [: v6 O7 O2 X) L$ _2 [2 l1 ^ - module_param(bcnt, int, S_IRUGO);
2 a+ t& s8 x$ F+ ^) M* ?9 R& ` - module_param(ccnt, int, S_IRUGO);
复制代码 # k, F* B( u: P" ?5 i
! G& e; W6 ^) X0 L& K; ~; P+ R
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( J) F' [1 P/ {: Y6 Karm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
: g% K! v! l, }8 H7 n. Q- `4 H 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。 h/ f; b/ C* H6 _5 z% B' X
% @1 m! s! E* g' ~
, V) B% d1 d0 d$ n# B: Z; q# u9 b
|
|