|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 O) J0 G4 H) k- K$ a: {
- [code]EDMA sample test application
0 B+ `# Q# J* L: i* Q J& j - /*
* @9 r0 F$ Q, n4 J8 W! k - * edma_test.c
8 T! T( b% V: |6 u, B! h% U - *
, q- J4 b- p% }# }; c: w - * brief EDMA3 Test Application$ z5 S% g7 n \. t1 x& N7 C
- *( Z2 E6 p8 N* [
- * This file contains EDMA3 Test code.( ~- U6 f+ T* k4 j; P& m; Y
- *
; S- M, C* q8 E" l+ g8 p0 f% Q - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
. D- o5 b" e2 F5 F# s9 m - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- }$ R8 K" H4 ^8 ?! r S4 v
- * TO CHANGE.+ `4 J* y: _/ F1 v
- *
E7 H/ u, P- |+ M1 M. k8 T6 P - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' m( v" N# ^* Q: A# P7 I: T
- *) F7 b+ z* o. H* C( O5 C
- * This program is free software; you can redistribute it and/or
( S3 w4 o# s; e, ?+ }7 N! `$ u - * modify it under the terms of the GNU General Public License as
" E7 ^. A6 N8 |& q - * published by the Free Software Foundation version 2.+ y% f- O& Y; T" Z' I9 X0 g9 {. o
- *
# o3 x/ @/ W6 g6 B7 s - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
2 n5 A, D. R. ?' L3 P5 Y+ [ - * kind, whether express or implied; without even the implied warranty2 i! e' ?4 y" b" |' ^1 P
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
) L. h8 d* B y; E& X5 y+ Y8 x - * GNU General Public License for more details.
" E; c6 F, k* f2 t1 f# p+ N - */0 ], T4 o' Z& ^, J
3 l9 d& {: ?( U9 x; ^9 ]- #include <linux/module.h>* O- V$ B! q' F9 G2 S; V- Y
- #include <linux/init.h>
/ o, u, _4 J4 {% S1 ]5 c4 `/ X- g$ ~ - #include <linux/errno.h>, Y! H7 ^$ \# n
- #include <linux/types.h>
5 y( S, I' P5 S2 }4 B1 e7 F - #include <linux/interrupt.h>1 U/ c6 w7 ^( y$ {
- #include <asm/io.h>/ m/ V0 C# w( V" M' i
- #include <linux/moduleparam.h>" g0 F" Y. Y; @4 v) ?5 ?# S) T
- #include <linux/sysctl.h>
, r+ S/ m6 Q. F/ F+ c! ` - #include <linux/mm.h>. K" b( q( Z( [ x$ J% t2 T
- #include <linux/dma-mapping.h>' N( D+ J! R: P
8 E3 B% s! V- a6 i( L- #include <mach/memory.h>
% n+ G L! [9 Y - #include <mach/hardware.h>
' o, P$ N. y' K) _, ` - #include <mach/irqs.h>
6 Y3 K( Z' v% c8 m5 v8 T5 o# [ - #include <asm/hardware/edma.h>0 s: d+ a+ j) T5 }: Z* m+ B8 B- Y
- 0 K- Y2 H0 E" T- u$ ]& b
- #undef EDMA3_DEBUG) o B R/ ?% r
- /*#define EDMA3_DEBUG*/
z, p m) X9 o: |
0 A5 w& Q& a" l4 {: ]( Z0 x- #ifdef EDMA3_DEBUG
, e' X$ E# b) P - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' O! ~. }( `% f. O" W; H
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
& }, r) s+ h l6 a1 ]5 m# B - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
9 W9 p, R! N; X5 R6 O. c, c9 [- e - #else# v7 F" j% _" G/ W/ A+ h2 O* ?$ ^7 A
- #define DMA_PRINTK( x... )
( v0 e3 Z n. ] - #define DMA_FN_IN
# T9 @6 D- _5 _3 A& Z - #define DMA_FN_OUT
8 f3 ~' {$ v# ], s3 I - #endif7 t% t1 z7 S' W" n; y L
- 7 }, T# [2 A. t3 r& `
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
2 K1 U/ O/ S' w i/ X+ Y - #define STATIC_SHIFT 3+ m/ C! x) r8 O4 B$ H2 D
- #define TCINTEN_SHIFT 20
& [, @# y' I5 \7 t8 P6 U - #define ITCINTEN_SHIFT 214 x6 u, ]5 r% p( {; n
- #define TCCHEN_SHIFT 22
L+ E6 b% M$ C; x, O* x - #define ITCCHEN_SHIFT 23
' Z9 z2 a4 Z1 [( x( r( f
% y# n9 x; { \8 x8 x+ r% a8 u- static volatile int irqraised1 = 0;) h2 K+ c& d" B L8 d
- static volatile int irqraised2 = 0;
' z; v& |( e0 r9 L0 `
7 k+ q4 \1 M( U- L5 E* I- q0 N- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- U4 q0 v; d/ P) h9 M5 i
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 a( {! |2 R$ L9 o - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ b- A3 \# c/ G
5 o' R. ? b( v* g1 `* \- dma_addr_t dmaphyssrc1 = 0;
8 S* |; m# F0 L; K* N" q. z - dma_addr_t dmaphyssrc2 = 0;
# ^2 X9 m. \: ?' x' a/ C9 h4 J - dma_addr_t dmaphysdest1 = 0;# p3 ?) w% O0 c7 ?4 K
- dma_addr_t dmaphysdest2 = 0;. o& y( O; ~" A8 T; T( ~) Y/ @2 }
" L1 i0 ~$ [9 s$ {- char *dmabufsrc1 = NULL;
" |/ l( Y/ o7 Z" [& g' K7 l8 P - char *dmabufsrc2 = NULL;
: D" Q4 V4 P, k - char *dmabufdest1 = NULL;
3 U5 R3 i: _( V5 c& f8 z7 K - char *dmabufdest2 = NULL;. c, l- w6 O& \3 h( ?# N! Q
- * e- L' q# u/ O# X n8 I6 r) f
- static int acnt = 512;. [, v0 }. y3 t. }* I* [7 ^
- static int bcnt = 8;9 }9 i6 `8 Z2 ~3 L* b
- static int ccnt = 8;
, u8 e$ J# n: q- W+ {
, N; B- t6 F* ]0 F+ k" i! o) I- module_param(acnt, int, S_IRUGO);/ _) Q& U* i) m( ?( K7 n0 W6 {
- module_param(bcnt, int, S_IRUGO);
( ?! X3 X7 X6 @0 j% ` - module_param(ccnt, int, S_IRUGO);
复制代码 7 Z9 y/ X7 v4 B! F9 M) q$ B
* @& I4 E, M2 Y! ~/ O/ n3 k 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ H: q, p7 N5 P# n) W% Uarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ z+ R/ H$ f* E2 o+ \7 H% Z; J 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 v- a: s! B9 S2 B6 z8 Q! \
' P* c! w- D; ^$ w1 R9 U6 n) w! s- }: ^
|
|