|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 F& n, q& L1 `' N" ^" U0 C& f- [code]EDMA sample test application9 s( H: w9 {; \
- /*
& m9 \+ j- t. J; R- c' ~ - * edma_test.c
1 P9 k/ |5 f0 F& ^6 f - *& ?$ Y0 k* o6 z* n' m( U# p
- * brief EDMA3 Test Application2 ~" w9 B/ l. t! r
- *4 ~4 C9 @' C; x6 X/ s
- * This file contains EDMA3 Test code.- c# C" ?0 K. B2 }
- *+ H* Y- {4 b6 |+ g
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
. v' S' W0 B* W. x5 v% @) V - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
5 }" d) H6 s& i4 q6 G/ A/ l - * TO CHANGE.
2 w8 ^& ~5 ?3 }/ A4 Q - *
* |' E1 G% V& g! \) h% i! O - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
: B& H( y1 s4 F0 D: ~5 a - *( O* Q$ V& q0 |: O4 {* A8 r( v9 Y
- * This program is free software; you can redistribute it and/or
( o I5 i: q2 a- n - * modify it under the terms of the GNU General Public License as
* f5 ^) A* b B1 \ - * published by the Free Software Foundation version 2.6 S9 E! F' ^- g1 o3 y$ H- u
- * V$ Q5 V' J6 R4 I, C. C
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
% S+ p1 Q* |$ m5 S - * kind, whether express or implied; without even the implied warranty
- |6 \5 R7 Z# y/ D3 h6 W n7 m- E - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1 ?6 G+ f- N0 {1 V
- * GNU General Public License for more details.
0 B7 Y* r9 [8 n3 r% {' T/ f - */) P$ w4 N# h! U4 I! D
2 `$ Y) G! I: N- #include <linux/module.h>2 B. Q7 j3 A9 R$ q. ? m# H0 Z6 E
- #include <linux/init.h>
9 ]. }7 F, M& v- i, y6 ~- N _ - #include <linux/errno.h>/ G; d( T2 S8 _
- #include <linux/types.h>, D9 d) U% G) S/ U( r6 R* u
- #include <linux/interrupt.h>
* Q6 P, s) g6 Q' [8 t9 ]6 n( e - #include <asm/io.h>
3 K+ |# x& _( Z2 f% Z- L: Q' {1 @5 d - #include <linux/moduleparam.h> S- p! r! [9 J% w) @( h* j& L
- #include <linux/sysctl.h>
* f d& ^# l+ H+ m- O: { - #include <linux/mm.h>
2 E; }3 `8 Z t: X& v! A! D( }$ _ - #include <linux/dma-mapping.h>
: v- Q% N X$ e* w% }" D& C V
g) w K! v" n8 \- #include <mach/memory.h>
! b/ q0 G" w" H! o8 O6 D - #include <mach/hardware.h>$ `2 ?3 q9 ?' b2 Q& p/ D0 A' D2 `
- #include <mach/irqs.h>
, @+ w) `7 A8 f - #include <asm/hardware/edma.h>
( R& g: `1 W% R/ ]" Y, _ - $ O2 u, M( B& J/ u8 u% N
- #undef EDMA3_DEBUG
6 r' q+ d$ P& B9 ^/ q' Q) L - /*#define EDMA3_DEBUG*/& f2 q7 l" |! Y( ~# W
- & s. B8 o n* F2 Z( o: n+ _
- #ifdef EDMA3_DEBUG
) ~+ J3 X- b7 H* Q - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
- @6 D1 L+ z" {' u - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
5 R1 D) `5 S: y: z/ T9 o' Z - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): w U- v; K1 }; V9 ? ^
- #else
2 n2 H7 h5 p% S) k# _ - #define DMA_PRINTK( x... )* z- ] L' B1 {+ }# C
- #define DMA_FN_IN
6 O+ Z! T/ x* |: i9 \% u! |; g - #define DMA_FN_OUT
, N. l3 Q4 E0 V) A0 R - #endif
1 ^3 ?* q# U+ ] - + z3 D8 K1 n- L
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)1 w4 T' d; E0 H
- #define STATIC_SHIFT 3$ S1 p5 s' c; m m7 L9 R5 t! `: e
- #define TCINTEN_SHIFT 20
2 k1 M$ x5 z q6 d) w, |8 q9 V - #define ITCINTEN_SHIFT 21
. W1 P) R9 x- {* I6 Y' Z; U. V - #define TCCHEN_SHIFT 22
3 t; C9 Q5 I- e) f' I - #define ITCCHEN_SHIFT 235 C1 R! G0 I8 B( o% B4 q, I% u; g, ]
# s( x9 z7 I' {- u) P4 S e- static volatile int irqraised1 = 0;: B- _4 N+ X0 S+ N; ~
- static volatile int irqraised2 = 0;+ c( f" x/ T# a/ e" _5 N
- 8 `$ d" m% j& @- T* c
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ I' H& K, U0 {. s V, @3 F% }) M
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& D1 _+ D/ F! h0 i) T! ` - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- Y1 z/ p1 i/ I6 Z# ]
- 7 X' a- n) E( [, H& i. b
- dma_addr_t dmaphyssrc1 = 0;7 U. s4 j4 ^5 v$ O- P! W
- dma_addr_t dmaphyssrc2 = 0;
; ]$ o* \, Q$ q0 K: S5 j+ W - dma_addr_t dmaphysdest1 = 0;
9 ^; S/ V% Y5 e9 ?. L4 _ - dma_addr_t dmaphysdest2 = 0;
5 x& g& [7 L* M2 _& l
4 i$ {. y3 o6 z. U6 m- char *dmabufsrc1 = NULL;8 ^" |6 X E n( I
- char *dmabufsrc2 = NULL;/ f \/ k( n- Q7 e4 d8 r7 H
- char *dmabufdest1 = NULL;- a$ Z1 [: p$ z6 f. T
- char *dmabufdest2 = NULL;
; R2 `( j! H) K, T' o- x' F6 F
. b0 L6 [3 C- U3 N- static int acnt = 512;1 H% O7 q& N* ?0 _1 a1 i
- static int bcnt = 8;
) k5 I% ^+ p; K( [* @5 Z - static int ccnt = 8;
X9 M1 s. A0 u0 J - ! R! q. S9 C8 o$ t# r. ^6 D
- module_param(acnt, int, S_IRUGO);4 o) r+ Y, _- v
- module_param(bcnt, int, S_IRUGO);* U% \- v0 {5 {' e( k
- module_param(ccnt, int, S_IRUGO);
复制代码
9 `$ E {4 ~5 c' u, |5 w! H! B0 a- q5 M" b }. _6 X1 E
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 i! r) C4 E7 V& ?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 `9 ~3 d+ T9 d& c" [+ O% J
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ i5 j& i J$ Y; r$ K3 h& z) y
# L h4 a7 ]2 a# n! ?. u& p9 V' f
|
|