|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& z: d. E) s% K. I, b* T- [code]EDMA sample test application% L: }. P9 Z2 J X
- /*5 \; ~2 G1 d5 y- F9 R& H* I
- * edma_test.c# [' c/ N8 _' T! S. Z& a1 X
- *
1 O6 Z' W. v6 b+ i. w. q) T" J - * brief EDMA3 Test Application
9 g8 r. j) H J3 q( G5 ^ - *
# ]4 Q, R1 g0 _' H0 z8 q8 b9 x% l - * This file contains EDMA3 Test code., O$ s+ Q- ^# }3 t) t Q5 c1 G
- */ J2 k$ R5 D6 F( Z4 d
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
* c( ~5 I; |1 O1 V) ` - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 d3 a# I4 y& T1 M. h8 C$ a
- * TO CHANGE.
) J; W" j/ d$ R% @3 ` - *
; `& j7 l# G4 `2 b - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
( D( B, O6 G6 W4 g* h- n - */ ?+ R3 z4 v) ^
- * This program is free software; you can redistribute it and/or
* j9 o7 ~. H+ b) Z, ~: {8 G - * modify it under the terms of the GNU General Public License as
6 X& x" L3 \, T+ F3 D+ G - * published by the Free Software Foundation version 2.& n' W8 t1 ]" Y J* s. `( N& p) e
- *5 w8 G1 ~& I) {7 W c6 y& |4 G
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any X' A5 V) U9 [, A; o
- * kind, whether express or implied; without even the implied warranty
b7 c! `9 T- M# S- F2 O - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the6 h3 O9 i! u5 v5 s* D# M- S
- * GNU General Public License for more details.9 {+ F5 b" S* A; R7 e
- */
, T( O" y' ^$ r) {& l
) ~# s1 s( _ i% G) a" L- #include <linux/module.h>
+ u+ y! U- H% X( W - #include <linux/init.h>
6 z0 P7 g1 z7 E* _* M2 ^" y3 m - #include <linux/errno.h>
% w( R! m$ l) U, l& z7 g - #include <linux/types.h>
- H8 N% L k- q1 n - #include <linux/interrupt.h>4 |: n* }" m- l7 Z7 M$ z$ N
- #include <asm/io.h>
1 n9 v ~- W0 d# R# @$ | - #include <linux/moduleparam.h>
$ m! ~, V0 V5 B7 X1 t - #include <linux/sysctl.h>5 Z3 @8 T# P2 q# ?* E1 E/ o& x
- #include <linux/mm.h>
# U! Y% H% N8 f2 C$ N6 ] - #include <linux/dma-mapping.h>
3 a, _7 u' A: K6 ]; Z+ s
/ B" ]- E2 \2 P# ]5 a8 h& P8 c- #include <mach/memory.h>2 Q6 ~+ F1 P0 J% R
- #include <mach/hardware.h>
, n/ s* F, `4 I7 q8 ? { - #include <mach/irqs.h>
" c! K* A" i3 O A7 s - #include <asm/hardware/edma.h>: {* D; z/ D! x! t
- 3 c Q7 c2 ?# M* W0 u. N5 a
- #undef EDMA3_DEBUG t! y( I8 S' L3 c
- /*#define EDMA3_DEBUG*/
4 l: O, u2 J( g1 x4 Z4 T - 0 {5 A2 K1 P+ s
- #ifdef EDMA3_DEBUG
6 \) Z( V$ H( W* p9 o1 B/ i. ~ B - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
) x2 J" O& a q - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
D8 ^$ {- w0 U k - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
: p0 _9 G8 ~, a - #else
6 B7 ~! O5 t/ {* \ - #define DMA_PRINTK( x... )) J6 a. O0 n7 g; f. C3 t7 J) }) x
- #define DMA_FN_IN$ H! g9 A0 M5 K8 w e
- #define DMA_FN_OUT
0 ~, _4 Q" c& X8 ]/ `8 U8 W - #endif
8 I/ V* z0 Q6 G! B - % l( U0 E) P4 u, n
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
! F0 s/ h- n0 `8 I8 o+ U - #define STATIC_SHIFT 3+ V+ ^) j ?' J* r2 [
- #define TCINTEN_SHIFT 20
5 k$ V- d+ a5 F+ S t# p - #define ITCINTEN_SHIFT 21$ \7 z, ?$ E& I6 ]# Q7 p
- #define TCCHEN_SHIFT 22, q3 L) d1 l4 o. Z2 C0 ~. R
- #define ITCCHEN_SHIFT 239 Y$ F+ m5 j+ |6 c9 B, y
! [" E+ a1 W+ H) d" g: d- static volatile int irqraised1 = 0;
, q6 s( d" E% o. p+ p. _ - static volatile int irqraised2 = 0;
y- e( K& U0 o4 f; N% y2 M* l$ j, }
8 H1 c7 U5 g3 X2 `- M( Z9 r' Q- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' U3 d& ]* H: `/ ?" v& U6 p8 O
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( \# T# j7 [" o" _; ]" c9 B - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 n r& h6 g7 O8 y5 h: G - " Z8 V! U; q/ a" U" P) A/ r
- dma_addr_t dmaphyssrc1 = 0;: l9 H6 B& E) w8 B! K
- dma_addr_t dmaphyssrc2 = 0;
- n3 k8 D; \* F' d( o - dma_addr_t dmaphysdest1 = 0; j! n; l, p+ P
- dma_addr_t dmaphysdest2 = 0;; j p, d" o+ h
! w: A7 P1 X- V: o- char *dmabufsrc1 = NULL;
" S2 B! U$ ^9 m& B - char *dmabufsrc2 = NULL;
w- f1 i% M; }2 k$ r' K - char *dmabufdest1 = NULL;
& R& n, H5 C1 T6 C - char *dmabufdest2 = NULL;
+ N3 z8 E) Z6 }7 L5 K! r/ q) P8 ^2 ] - 0 u7 s$ K+ G& J& l( ^$ y/ P
- static int acnt = 512;
9 o$ G, |- b8 K* b% m$ l6 \ - static int bcnt = 8;
+ D$ p# T& L) z/ w - static int ccnt = 8;
9 }0 L. s8 J$ _9 d - * D8 {. N& }* u! S. L$ T5 @2 M
- module_param(acnt, int, S_IRUGO);
, E0 p' v+ u+ I, k! y8 w, g - module_param(bcnt, int, S_IRUGO);
( H' Z& v- m* I; g% ~. z6 M3 P - module_param(ccnt, int, S_IRUGO);
复制代码 5 V+ c: K7 q3 f w% I
/ f4 q: o. Z- m! ]4 M+ n$ ~ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) \# q6 B& I+ T/ f0 ]0 b0 p6 d
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- @" z" ^: k6 w3 G8 l" i
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, v w) T8 }$ U( }! j& ~; B8 R- q
( y' a3 |* e; B: m$ r* ]- ~- u# v' U8 ]* X2 U4 X4 j) l0 a
|
|