|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 e8 l w6 _: Z! {- [code]EDMA sample test application
# _' }9 N+ J+ Z' R D/ ?# v - /*9 {3 k" ^9 d0 ], D! O R, P2 z. n4 @
- * edma_test.c' _. W) ^- J: S; @, `# Z
- *
0 z* M! ^' }0 C0 h0 m$ ~ - * brief EDMA3 Test Application
' t! g2 l4 U: |7 X" J: k - *
. I+ o6 h e3 H - * This file contains EDMA3 Test code.& Y+ w, J/ o! h# j* r
- *
( G) |. q5 ~, y+ b4 B - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
( U3 q( l# g D# e - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
6 t* S, \2 H2 ?# X& [' t% M$ m - * TO CHANGE.4 A6 I* c" E/ V q4 _( k
- *4 ~9 N0 @( p0 O* g
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! ]+ m! k0 d" G, h
- *
" _$ p6 e6 `- q0 y - * This program is free software; you can redistribute it and/or
! F: j/ J1 @6 r$ G; F" M - * modify it under the terms of the GNU General Public License as8 p# }5 `- H& x/ D$ z4 s7 e2 }. Q$ I
- * published by the Free Software Foundation version 2.
& V1 m) x: Q6 l) s8 i1 H - *
4 {7 \; `: i' q3 w! h% \ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
3 k2 {5 k9 ~* x - * kind, whether express or implied; without even the implied warranty
8 t# x+ N& \, f8 v - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the6 M" w$ C0 g$ T: I4 c' U
- * GNU General Public License for more details.
, [( g' @9 G! q - */
& r6 _3 i& v& t2 O - & Y4 d* x O) D9 _
- #include <linux/module.h>
6 ]7 l0 V- _9 D2 \* f0 e& U: C - #include <linux/init.h>
$ f$ ]9 E) ?- O% K/ o5 o( U - #include <linux/errno.h>, a* d8 O) k9 E' Z! j9 p
- #include <linux/types.h>
+ m1 m# i5 ^* m3 |# y - #include <linux/interrupt.h>
! M8 s+ p1 j) m2 Y2 A @6 `, O0 j; a - #include <asm/io.h>
" U; P5 E" }; ^! ?# n# D - #include <linux/moduleparam.h>' K8 k6 q9 a; }. I
- #include <linux/sysctl.h>) G( M+ D6 }- ?% R: t+ o. P2 w
- #include <linux/mm.h>3 m5 B* ?9 Z& c: [0 Q
- #include <linux/dma-mapping.h>
$ s# [( }8 i- S - 0 m) e: a& u; @7 V7 Y, l
- #include <mach/memory.h>
; f; K& z, I4 A% ]. P0 S - #include <mach/hardware.h>
, u4 J3 K- l$ [2 @. q K2 i0 K - #include <mach/irqs.h>
, O, \; X, |0 i* o# ~: J - #include <asm/hardware/edma.h>3 W# V6 f0 m/ X3 |5 i* W6 B/ J% F
! O1 t8 z( ]8 g1 T& m- ~9 z- #undef EDMA3_DEBUG3 }. n' O; w9 d% L5 p
- /*#define EDMA3_DEBUG*/
0 j0 v' G$ X5 v [( e. V - , m- F0 e" ~& k+ N
- #ifdef EDMA3_DEBUG: f' @: l/ |0 e& z7 K
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 f3 q5 i, ~! q G
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). r5 H0 `5 ~. Z& p/ F
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# g* B( n/ i6 \4 S- k
- #else* g/ Y" H% g! U6 R+ I9 t
- #define DMA_PRINTK( x... )
% s4 I2 G5 ~1 E1 ~3 a - #define DMA_FN_IN
- H+ z c6 s" P - #define DMA_FN_OUT, F. N9 Z$ x: J1 g
- #endif8 o9 O* q7 o+ c E A- `7 Q
: d) X/ `0 i9 c" M2 N& d; \- #define MAX_DMA_TRANSFER_IN_BYTES (32768)8 ^1 Y& P0 _. @, |' f6 }0 _
- #define STATIC_SHIFT 3
) {3 O( o3 l5 S( M3 B0 z1 I - #define TCINTEN_SHIFT 206 u% _- @4 s- K
- #define ITCINTEN_SHIFT 21
* j/ l+ a6 t, H- w9 _: ~$ r - #define TCCHEN_SHIFT 22
3 \4 B; U, U5 m% A o& b - #define ITCCHEN_SHIFT 235 [; h/ ~, r) {* e
- ! G$ f6 y0 Z4 z6 {0 E/ ]
- static volatile int irqraised1 = 0;/ t" _! s- E$ j9 w6 t; N, K E) N* \
- static volatile int irqraised2 = 0;
- o% _' D% a3 L( u1 L
) \4 E" ?8 E, _+ y' R( g( Z- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 p: F% u' Y4 d" ^0 F; i# D
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; b( \3 K y9 i% A, F# B& H% m, l+ H - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 l* b4 S; p, a: S* K
4 K8 x6 N; g! Z* E; y- dma_addr_t dmaphyssrc1 = 0;
0 G' j, s x1 A - dma_addr_t dmaphyssrc2 = 0;" {7 {' _! o8 t! `& _
- dma_addr_t dmaphysdest1 = 0;! `) R6 g9 D9 s6 n* F1 m
- dma_addr_t dmaphysdest2 = 0;* q& j2 E/ O9 t ]: R4 g
/ u5 `8 y1 _, v5 u$ ^7 x N. W4 b- char *dmabufsrc1 = NULL;/ Y8 i5 A7 I3 M: t
- char *dmabufsrc2 = NULL;* c$ Z/ {0 k- T8 v1 |, D2 S
- char *dmabufdest1 = NULL;
3 [: d* m# v) z; C: |* j2 K Q$ v" f - char *dmabufdest2 = NULL;& ^. {; R9 T. x% O
3 e: ^/ w: Y' i: Z" W- static int acnt = 512;9 S! P0 r1 q# e" x$ \, @
- static int bcnt = 8;2 M4 F9 |' Y H) S7 E
- static int ccnt = 8;" C, j" f( s. r5 f8 @- U3 w
- 3 Y. v3 X7 M$ G' x0 j
- module_param(acnt, int, S_IRUGO);
; Q: }2 w- q5 [- _! E# M. H - module_param(bcnt, int, S_IRUGO);1 @! ]" r! V* W2 d" H% L( w/ s
- module_param(ccnt, int, S_IRUGO);
复制代码
& Y, X9 w$ v3 n, d" T# ]& ^ r' l: K6 }( F2 y6 E6 M; ~, Z
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 g' k6 i7 A7 U! e! q1 { farm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 h0 g1 ~, n& ~( E! P/ r
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( Z! J7 P2 f+ }1 H
! V% W- a- a% d, c# p' {) i5 {, Q+ [2 f
|
|