|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; c7 M% g/ s) W- q1 q
- [code]EDMA sample test application/ I5 z- E, ^6 i7 t* ~7 B7 L
- /*% S8 u4 s4 F7 f. ]- O
- * edma_test.c2 ?6 R8 g7 J6 U. t4 w
- *
7 w4 L4 T+ C7 D& l* e - * brief EDMA3 Test Application. T% H4 E! y4 ]
- *" W c' \: M$ A
- * This file contains EDMA3 Test code.% C7 x# i& q: [% y
- * n+ l' L1 K' s, T! F# Z H! [
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 \5 |+ P# |. U9 f& x
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
* `. M" J7 F* `( c j/ P - * TO CHANGE.
- v H5 W: t6 m; N$ D* m: P0 ^& o - *: q9 Y* i& z9 y2 J% V, P
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( X1 i& R( G/ y; h
- *6 }5 ?, l8 F4 I$ x) w0 g" `
- * This program is free software; you can redistribute it and/or
: X! |+ N/ k- T/ o- ` - * modify it under the terms of the GNU General Public License as
; v# `! @" \- c6 z+ i+ O) J - * published by the Free Software Foundation version 2.
+ M$ @( D p6 M4 M9 {8 |, Q - *
5 D% i) y1 X$ J f4 y! t - * This program is distributed "as is" WITHOUT ANY WARRANTY of any, _1 W7 ~3 e j* m }1 x8 u
- * kind, whether express or implied; without even the implied warranty* ~ q3 b5 s8 s3 x6 @4 E
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! C- u& W% Y3 N$ i4 \9 Q& ~! a' v( I: D - * GNU General Public License for more details.
% ~ B7 G( q& U+ R0 g - */
6 M* j0 {$ X; l- e% L+ f - j5 i! |- W) e; s5 b# l/ y
- #include <linux/module.h>0 R8 G; ^# B; Y0 Y' d" ~& k' G8 c
- #include <linux/init.h>( u& X' d; ^% { k
- #include <linux/errno.h>; A4 N }+ o4 t+ N& C, i
- #include <linux/types.h>$ ?1 T1 w8 l$ S W. v, J1 R& g
- #include <linux/interrupt.h>
: r+ }7 d$ W. V - #include <asm/io.h>3 R) c% h. B6 ?4 A
- #include <linux/moduleparam.h>, R; Z2 r. S, T; F
- #include <linux/sysctl.h># w) N" t! `! R ~
- #include <linux/mm.h>9 ^$ d0 l1 U7 {; P( ]* n9 }
- #include <linux/dma-mapping.h>7 [4 p/ e! X' H+ K" G% g8 F. ~
" P9 z0 \' x$ }/ j% j5 {6 n- #include <mach/memory.h>: B; g! R4 W+ c j
- #include <mach/hardware.h>( r8 k1 }" P0 G- `5 m1 r/ i
- #include <mach/irqs.h>" v2 w x( i; B( t( J( r
- #include <asm/hardware/edma.h>
, l( K8 G$ X! B( j; r) R9 p
( \ @- q" D' T( {8 q- #undef EDMA3_DEBUG
1 r4 L& c' W* \" ?7 \1 D - /*#define EDMA3_DEBUG*/
0 [3 a& l h) j& I3 V4 w) c$ o
8 v/ Y" c% L, W7 h- #ifdef EDMA3_DEBUG
# @- P5 N, N; ]" z& h) ^ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
1 w3 e% ~, o' t/ n) a2 n+ _3 _ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
- Y1 N. I9 t# k: Z0 ^: z2 R& P - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" k% z+ I7 K) F) o
- #else
. D+ f. d& |; L - #define DMA_PRINTK( x... )
; F* d: y& ]. v9 A. N& | - #define DMA_FN_IN
: }) W) {& z \# l - #define DMA_FN_OUT
% O: R* b! S& `# [+ J8 B0 _7 ? - #endif% l; p( l' R; L2 L0 V. c" M% s6 U" c
- 3 s2 w0 t% C' N; G
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)+ {1 D7 J4 A1 @! [3 f5 I9 y( N7 t
- #define STATIC_SHIFT 3
# H# h4 c; s! ]; ?; m1 Q' K# l* i - #define TCINTEN_SHIFT 20
; ^$ L, L4 j2 k% Y. _4 \$ A - #define ITCINTEN_SHIFT 21' K; U" E' H; {
- #define TCCHEN_SHIFT 22
% W2 q6 h* t0 n6 G" `) c4 W4 c' I - #define ITCCHEN_SHIFT 23
- d- o# i' n' \: F* k4 E& y& U
& [6 J6 P6 V V- static volatile int irqraised1 = 0;
* N) T/ u7 j: J# ~/ S+ W - static volatile int irqraised2 = 0;
! Q. j7 r$ \* E( T5 M! Y: M$ P* l ]: [
" i+ o8 G9 J$ ]0 N- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# @0 `" s5 m; h5 o6 n
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 U) P3 _1 t% {: ~6 `
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% ?. e$ n% X3 [& [
# y$ I: d V T) I1 r- dma_addr_t dmaphyssrc1 = 0;8 @0 l% v* z; B. P7 j4 y0 \7 F
- dma_addr_t dmaphyssrc2 = 0;8 @( [4 l& r9 C. Z- r
- dma_addr_t dmaphysdest1 = 0;
9 @0 F0 c% }* h( N, W# W8 a - dma_addr_t dmaphysdest2 = 0;
. N# E% c) p) X) R$ v - / ~: M8 ~6 g! t: I
- char *dmabufsrc1 = NULL;8 T1 C& r [ D
- char *dmabufsrc2 = NULL;) U0 q# o* x G2 l! f+ t9 ^* }5 t
- char *dmabufdest1 = NULL;
8 N# J( A9 u& G# m% t, E _# m8 ` - char *dmabufdest2 = NULL;3 }$ W$ ], r% ]4 @
7 n7 w0 F7 |2 q- static int acnt = 512;
4 I. F$ O9 b' y- l& _/ Y - static int bcnt = 8;
# [6 ?6 s0 t( [/ U1 ^ - static int ccnt = 8;, A2 W9 v' p; u5 g, [
- 4 c! G' m! y3 T& E0 _& |
- module_param(acnt, int, S_IRUGO);. R5 L8 p V, x
- module_param(bcnt, int, S_IRUGO);' j, f' d. [1 j+ c& v
- module_param(ccnt, int, S_IRUGO);
复制代码 ) p; w& t( ^) o4 f
h& T- s3 Q' u 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用; k, z. d0 o3 ?& |1 z$ t& r
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。6 K( o8 X: J- ~* g
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 }2 @* \4 {1 p% b' Q! e- q2 F3 j
2 i/ A' X& P$ \/ U I; C& z- c
0 m& F8 b6 }6 w7 I7 t( h( @' O' B6 N |
|