|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , ^7 n& _8 |, z$ v
- [code]EDMA sample test application+ {8 T% I0 m$ b# y
- /*% N+ v+ ^9 [+ u* E! A* h7 }
- * edma_test.c& G: i) Z( n8 r. G# r
- *# ` h; n0 I- \* D2 `: Q5 B
- * brief EDMA3 Test Application
- b; `- ^$ `! Q0 c - *
; q1 N& M- @! c% S) w - * This file contains EDMA3 Test code.
% ]* [$ r; e) H- s - *
6 X; E3 u3 C( \, G+ v2 C2 ~ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
/ B" F7 ~. c2 Y* d0 [ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
4 o+ i4 I3 p" j2 r; P" `8 c7 N. Z - * TO CHANGE.
: t1 T) H- A# F) R - *
3 T8 F t- r/ o3 A6 d - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
; `+ x# n, o: V3 r% q# }' { - *
0 v9 N" Z: { b, a- E% U, U. E% L - * This program is free software; you can redistribute it and/or! v! j/ `( _6 u
- * modify it under the terms of the GNU General Public License as# }! j' E9 |# L3 w: q9 Y2 I* Y
- * published by the Free Software Foundation version 2.- X$ A; X& p6 e+ Z! j
- *
- \" C2 j L3 q4 w" s L: s& T& A - * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ W* s9 J1 f9 R$ f! @
- * kind, whether express or implied; without even the implied warranty( q0 ]/ R4 ]7 F, \2 h
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3 n, w7 v' L& E: v, d - * GNU General Public License for more details.
: A: R: u- C) f7 R- y; l( K - */
5 `, e8 ]# K- q8 }( Q4 r7 W, h4 S - 8 X9 `0 K+ M. `4 h' d9 ^
- #include <linux/module.h>) P) o, }" {' U
- #include <linux/init.h>5 U$ X" b1 N- @
- #include <linux/errno.h>6 K2 H" y; r q7 J: A& S
- #include <linux/types.h>
9 F1 ]6 @4 f2 h x g: o - #include <linux/interrupt.h>
' ?! [3 v8 e: M3 a+ ? - #include <asm/io.h>
6 R# ~7 m+ D4 X- M% j% a2 Q" c) Y" h - #include <linux/moduleparam.h>. c3 [' t- `) J9 s1 I8 R
- #include <linux/sysctl.h>
' m% a! s' _3 \7 \ - #include <linux/mm.h>
; g8 _6 Y A) a2 `& H- i - #include <linux/dma-mapping.h>' q, z; V" G* J
- \; J% N6 R8 g0 k- #include <mach/memory.h>3 X5 _( K2 A! t6 N) d( S- P" G5 t. F
- #include <mach/hardware.h>! \$ d1 F; `% j5 k- _; a3 D
- #include <mach/irqs.h># r: Y6 Y: r, Q/ P
- #include <asm/hardware/edma.h>
# U; q0 n# U( K
, Z. }% c! s* p0 J- #undef EDMA3_DEBUG! U) s# S" i6 s$ A
- /*#define EDMA3_DEBUG*/
7 ?% H% ]1 `: y7 H - , Z2 T' H2 q* L- ?2 C
- #ifdef EDMA3_DEBUG
M2 V+ b, s2 }4 M- @' k - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 v$ [- k" B& x1 `3 Y
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
; W7 S- t t$ O! w' F3 Y - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ o; R) g" c4 y+ k6 x7 D
- #else+ M6 O6 k) U% X# T! M2 O3 S
- #define DMA_PRINTK( x... )
W9 W5 C6 Y. ?1 a - #define DMA_FN_IN
# Z* J4 L$ q3 C) X- S1 Y* I$ X5 q - #define DMA_FN_OUT0 ~, m& E* d9 F& c" k# z
- #endif
1 ]4 z. r" _% Q, l) U3 d' v - # Y; H7 l5 }: ]- e! ?* A
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
- d' [3 Q, r- ?$ J" @) R - #define STATIC_SHIFT 3
r: B: ]: O9 S: @9 l - #define TCINTEN_SHIFT 20$ V4 v( ]% H F
- #define ITCINTEN_SHIFT 21
6 P5 d+ E: j& j/ e4 D2 \- ` - #define TCCHEN_SHIFT 22! `" v G. l+ V: R% e; V- g6 j+ ^
- #define ITCCHEN_SHIFT 23 L3 \7 D J9 w; T
; c, g% ^: z. {) i8 ~- static volatile int irqraised1 = 0; M2 C! {1 t2 S$ B7 R: t
- static volatile int irqraised2 = 0;% X$ \7 p' a% v k, P6 K
) x* c1 U, p, e9 f* Y b: O- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; R w! |1 o& ]' M$ G, N - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. U3 J8 e- K2 r- C' t o1 c- R
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) Y* @. K4 @0 [7 B, P
- / j+ u0 t p, E. y
- dma_addr_t dmaphyssrc1 = 0;
. g9 d9 S, Q, u( U& V, L! G - dma_addr_t dmaphyssrc2 = 0;
- Z$ d" C0 C3 b% s6 H: J9 ^6 M - dma_addr_t dmaphysdest1 = 0;
; p" o- c% h& Q+ e% e7 C3 ]; @ - dma_addr_t dmaphysdest2 = 0;
- Q7 |$ l7 O3 R& v$ L - 9 {' b- h3 Y, J8 w
- char *dmabufsrc1 = NULL;3 a- r: s/ ^/ A" Q
- char *dmabufsrc2 = NULL;
, a3 i' \6 w7 _ - char *dmabufdest1 = NULL;) c5 `) L" b7 w' ^
- char *dmabufdest2 = NULL;/ ]( a. e& j1 d) C
2 b8 G. R- m3 M! b- static int acnt = 512;
3 ~" W# b$ q7 w' L, _ - static int bcnt = 8;
- b! D, g. ?$ z) v% U% e; Z - static int ccnt = 8;" B( T2 m2 M2 V- V6 G7 p3 l
5 u8 S: R- g% O2 n- module_param(acnt, int, S_IRUGO);& i. } Z( c0 q3 o
- module_param(bcnt, int, S_IRUGO);
" D" \' L* r- {" D2 D9 k8 A1 ~& O - module_param(ccnt, int, S_IRUGO);
复制代码 1 R1 a( H5 V* ] f* l
& J; N7 n6 c- z) n4 g7 k, c0 o 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 q; y6 [8 A- E* H# E+ ~. j- {
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. y4 S& d1 h6 q! e1 U
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, ~ q! z+ i' `8 {7 ?" k2 @& m
; c: \% Z, Q# K; Y' j
( L6 C/ g j' ?- y8 M |
|