|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" U4 n3 j2 `7 V1 t& i' ` P- [code]EDMA sample test application
2 U3 U- r* s) C" U1 o - /*
) a. @" b0 C% H# ~8 f) x" r1 z- V - * edma_test.c
o }# ?/ n2 N: l" Y! E( A4 K4 l' c - *' p% t% E$ V& x6 f3 S
- * brief EDMA3 Test Application8 u R0 ?5 ~: |" X& R/ d% i+ i
- *
9 d# d; n9 |% l. i/ A - * This file contains EDMA3 Test code.
& z8 r8 g, ]/ r7 A- a2 F$ O - *
]* {0 P0 b" q5 S" l - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: [" p' s- E/ v: r: c0 M
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 \, @6 ?* Z/ j+ k6 N8 F
- * TO CHANGE.
! }. Z: P0 s7 B* t7 W - *
$ q, u' c4 Y2 W) Q. t& I/ ~ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- m5 y/ s i* \
- *4 R i+ u" v6 O- W% G
- * This program is free software; you can redistribute it and/or
8 i6 e- ~5 ~" t. K - * modify it under the terms of the GNU General Public License as* c! A/ N3 w, `+ g. N( Q* F# t
- * published by the Free Software Foundation version 2.
/ R9 R8 j6 M! A: l - *
R# p5 c3 g3 `: l* n" V5 _ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
& Q2 v/ V# g, S8 j - * kind, whether express or implied; without even the implied warranty
" [8 f" E4 b9 y# v: T - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7 m# K) s$ t1 ?: I2 O) m$ O# I - * GNU General Public License for more details.
" r7 c2 z9 M# Y7 A5 U - */) k' P b# T$ K# q2 C5 Q' q* p
( F) N; m* g9 p4 A- #include <linux/module.h>
1 A- O/ R( V3 r% h - #include <linux/init.h>
- i7 y# M, K. k3 x5 F - #include <linux/errno.h>' p/ ^6 U7 Q) `
- #include <linux/types.h>
7 I g% Q* m3 S n0 i8 D% s - #include <linux/interrupt.h>
, I& ?. M/ |+ n5 R0 f( c; w1 J - #include <asm/io.h>
& r+ w8 c5 K0 |# P) ~ - #include <linux/moduleparam.h>
2 N! s& {3 N% K2 U" y9 Y1 A, A - #include <linux/sysctl.h>6 y( e' u1 v5 a# {! ?/ a
- #include <linux/mm.h>" p' |0 L3 |' X
- #include <linux/dma-mapping.h>
1 ?( f/ { l% m$ ? - 9 p P9 V3 b' V. i! u5 g
- #include <mach/memory.h>
5 P1 c2 x) J0 x- \( O4 p' b& G$ _ - #include <mach/hardware.h>
- b; c# s! a% I6 b" P - #include <mach/irqs.h>, E+ F( T# e% b" g
- #include <asm/hardware/edma.h>0 ?! u4 t# |# p& t0 b
$ ]3 _. L7 K; U& o6 V# w- #undef EDMA3_DEBUG
6 m' F& w/ t, S C- L7 ~ - /*#define EDMA3_DEBUG*/
5 R+ H- E1 }- o5 {# H; _4 e - , ~) r, }# {& u
- #ifdef EDMA3_DEBUG
) e/ _7 u! V# n - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 B; \2 b7 E& J# c
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
" I$ z& M6 s& B8 E - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
$ ~$ K- ?7 t. k, l8 ?$ A* [ - #else; J: Y! U2 H" O, F
- #define DMA_PRINTK( x... )
( I% z8 y8 T, G" M- l+ G) t" j - #define DMA_FN_IN
3 ~3 q0 u. Y# E. ?$ Z - #define DMA_FN_OUT- Z h2 @% v. ? C Z* C
- #endif
8 T3 \: I. x) k: x, I - ' O: O/ ]+ \/ u6 G* O+ Q
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
* p1 d9 P: y! v* U - #define STATIC_SHIFT 3
' o3 u L/ t8 |2 T: B D- o7 Y - #define TCINTEN_SHIFT 20
; S: o0 _5 ]' ], m4 p - #define ITCINTEN_SHIFT 21
" d6 ]9 w! `: C% K, k - #define TCCHEN_SHIFT 22
+ _1 W) u+ d: ]: j( X. ` - #define ITCCHEN_SHIFT 23
f7 ?6 n" K/ X0 y# S% p: h* g - 9 E6 y* O# c, _) e. j2 V- R
- static volatile int irqraised1 = 0;
( Q9 L% e! E6 y - static volatile int irqraised2 = 0;
. v4 [4 [' }, [& x - , Z5 ?6 _4 H) w% K* ?
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 ]1 u! w7 q$ B3 c4 } - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 q/ N. p$ v4 ?' d9 B- E/ h& i4 M - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 x" B3 R, Q6 x9 n* {; ~0 I
- 4 ~3 @; P0 L% `! o
- dma_addr_t dmaphyssrc1 = 0;. Q7 T1 H$ O8 h" L$ |/ |- w" a
- dma_addr_t dmaphyssrc2 = 0;
" s. M7 v) Z+ V8 W$ V* ?, Q6 m - dma_addr_t dmaphysdest1 = 0;+ M; Y L1 n9 g" T7 @ B
- dma_addr_t dmaphysdest2 = 0;' X2 N) H- F q" H( l) U! p. l
& e6 ~1 {- w. c m. _' d9 }( y- char *dmabufsrc1 = NULL;
7 W' I z H. N& n: M# e: s8 { - char *dmabufsrc2 = NULL;
4 g! I& ]; Q( l' i8 @ - char *dmabufdest1 = NULL;
. c7 Y# Y" e9 f. f6 o - char *dmabufdest2 = NULL;
2 \5 W& |! m& ?3 [* O W' h7 S( d9 j
7 x! {$ P* D7 o# j- static int acnt = 512;# v- `% F- L( P( j: @/ }
- static int bcnt = 8;6 r+ E: f3 W" z# n; `( i% f2 L2 |
- static int ccnt = 8;. y# }& }3 A& {/ A6 l* p
- ; Z+ }9 ^3 r7 K' K; ~+ J) U
- module_param(acnt, int, S_IRUGO);
0 |( {# k4 [4 I& M5 o - module_param(bcnt, int, S_IRUGO);
, A/ P# O' D- f - module_param(ccnt, int, S_IRUGO);
复制代码 ! V, `1 w7 D6 L& v
$ y# x- |0 b8 d( G- r 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! z) C) R' y, C f; {5 Parm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% H& e: A( Q. F) b 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。# }+ ~+ W2 v/ {5 H; C4 h) y
5 p! p$ a d# R" h. w! k
. ]+ S8 `; [5 ^# j. T
|
|