|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 F3 o# {9 b" Z+ v0 J- [code]EDMA sample test application
- B9 _. a! m* t) K v - /*
, o2 Z) ^5 ~4 Z( e4 `& Z - * edma_test.c
0 }' U% }- F, p; l! X9 { - *
( B' U3 q4 J) E; N - * brief EDMA3 Test Application
% R4 E5 Y& W( J" e! ]9 [ - *! i& f6 S$ Z" s- z/ @3 ^4 l3 O$ a
- * This file contains EDMA3 Test code.
- ^5 }) ~1 h) P9 H. @* d - *9 e: R& r7 T: a
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
% @9 u* E% S7 J! b$ C - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
; |2 F9 N0 T, `1 P, ^& A! ?& j5 g - * TO CHANGE.
, q1 | o2 J. f' G! {4 n2 l% j0 ~ - *
0 ]( n" F4 ~& d& x - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
- [3 U/ g2 x: I4 X& h) X8 z - *: i; G. \4 r# b, w3 o0 M
- * This program is free software; you can redistribute it and/or
5 r; f4 i% j4 L5 ] - * modify it under the terms of the GNU General Public License as
2 P7 b, x9 ^# V$ N6 V - * published by the Free Software Foundation version 2.
) y' q) r3 j# k2 {* `6 m' ]( Y - *' K3 q. V) c% j% G+ n7 U8 T
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ k+ ^' S$ X! y5 }
- * kind, whether express or implied; without even the implied warranty
8 w. o% o; `# y6 B0 \/ q - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the2 H. ~# T9 ]% V. z
- * GNU General Public License for more details.
7 n% ?/ ]+ \: |( K9 t* Z& o9 ? - */7 h6 y. T7 K" I- T) K
- # ?# n) Q% d7 ?$ a' I
- #include <linux/module.h>
- Q r: U& v7 B" U$ U - #include <linux/init.h>
1 n% l5 ^2 Z& j8 K$ w6 ] - #include <linux/errno.h>5 G6 G4 y5 `- @; r
- #include <linux/types.h>' B* H7 W$ s& z3 B; Y& X# y
- #include <linux/interrupt.h>1 v- M H2 }; O" _% T* a8 L D
- #include <asm/io.h>. e; ?+ \/ R' m) w* }
- #include <linux/moduleparam.h>
" ?, R0 \! g# b3 ? - #include <linux/sysctl.h>
' U6 W# T2 e- n - #include <linux/mm.h>0 P, k- m$ |, y! r
- #include <linux/dma-mapping.h>
/ B7 I& e! |+ |4 N7 d1 A& M1 q
f5 T9 H2 z4 ^& e1 D, D5 `- #include <mach/memory.h>2 T- g0 ~; @3 w+ i
- #include <mach/hardware.h>$ }( z6 j& l* M- E: d
- #include <mach/irqs.h>$ }. k; E( e) Y( p) V0 g/ [! n
- #include <asm/hardware/edma.h>- F7 @1 P p3 `7 m% f- V
5 p0 x7 T* t) e \4 D& w" m- #undef EDMA3_DEBUG
$ l3 l* V4 B! ?6 } - /*#define EDMA3_DEBUG*/
+ O& u* O' t1 y. A
9 s4 S( y$ E5 l" ^% E9 v! @- #ifdef EDMA3_DEBUG8 P- S* E$ ^, {: H; M" a/ D( K
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( S5 g: j6 L# N1 s# r
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% b3 U |! t3 L- d9 U) e; s
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 }, E! C% }1 u: B, ]5 N8 y( V
- #else
4 o6 O1 x& X, D) B# j% k - #define DMA_PRINTK( x... )
# \7 X; F) u3 q9 @ - #define DMA_FN_IN
" ]6 g6 {# r4 C, d0 M9 j - #define DMA_FN_OUT
. c5 v& j% T2 W% h - #endif
3 T4 m; J7 O0 a: m. L - / ]9 d5 F3 L! n2 j7 o8 Q. Y5 n
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)! X) Q. n& R: E% F/ q: w
- #define STATIC_SHIFT 3' i$ M* `4 z8 x. t: N
- #define TCINTEN_SHIFT 20
* E K$ `) y3 N7 {; {: b - #define ITCINTEN_SHIFT 21
$ M- m O6 J% m/ K5 O8 s - #define TCCHEN_SHIFT 22
9 Y! W3 c9 D3 T$ Y - #define ITCCHEN_SHIFT 23- R1 @* j, v1 G5 {( I+ c" B& G
- 1 t! {' E4 a$ p* q3 I; M
- static volatile int irqraised1 = 0; B: ~* q7 U ^0 [
- static volatile int irqraised2 = 0;
" K( U" J% q3 E6 A9 A* t; o - ( n2 S, G1 l* S& w* J3 ]
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" f) ]5 ~. b# ^3 n& n - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: P4 u, n3 X; i) I# b - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' c; O$ {3 V3 @( j
$ K9 s0 |7 v" \+ k, i/ U. k: i- dma_addr_t dmaphyssrc1 = 0;
2 f! @: H( ]3 h* _! O: z* ^9 \ - dma_addr_t dmaphyssrc2 = 0;
/ @" o, `" f+ Q- K - dma_addr_t dmaphysdest1 = 0;
8 p& W; f+ J' ?9 ` - dma_addr_t dmaphysdest2 = 0;) E# T3 h _' I" g' { I
/ k9 V4 W2 a5 e- char *dmabufsrc1 = NULL;( Z$ O1 n4 {+ w+ f2 |9 h
- char *dmabufsrc2 = NULL;9 |( H. \) q2 V8 t, T, i
- char *dmabufdest1 = NULL;" @$ M, f7 L! ^0 A
- char *dmabufdest2 = NULL;
- r% M" O- q5 d5 k8 c. c7 J: f
( l0 t7 F# @ _1 H. N+ R/ @* ~7 _4 \- static int acnt = 512;! N1 C' ^1 }2 t
- static int bcnt = 8;( }' |2 v3 g% |& k% o9 V
- static int ccnt = 8;
" I% j6 c2 T% T' O- P- t
& g% o& Q4 ^8 X: R3 l9 r0 D- module_param(acnt, int, S_IRUGO);2 Q6 Z8 Q& z. n9 F% d1 l) M
- module_param(bcnt, int, S_IRUGO);4 P, Z% i( F8 x5 D% C4 L
- module_param(ccnt, int, S_IRUGO);
复制代码 , f; y) l7 |; K# ]# J
' e; T' z% X: w" A; @9 N. r* }
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, W& ^, f& ~8 c& r ~9 e( u$ 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. L# o% v! \- g1 [7 J6 h
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* K5 }' s0 c/ |1 D4 P( l" h4 ^( A3 r* e: z1 a+ u
+ Y- G! k! X5 z$ q- h# p, C: D/ v |
|