|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: p- `6 K0 ~& e y( q0 j7 X( z- [code]EDMA sample test application
* d& v9 r6 C& z! _" i8 W1 C - /*
g6 Q. s$ V# _8 s$ X/ T+ ~ - * edma_test.c6 x$ P/ Q8 N! D2 ~
- *& D! D% u4 U' B% Z! _! |% O
- * brief EDMA3 Test Application
9 `2 z0 @8 ]4 L3 Q" d. I1 q - *4 N- V% J/ | ]" ~1 g: _
- * This file contains EDMA3 Test code.
% n! R1 t2 G; `1 u' L - *$ g8 a0 U5 X6 z. I
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
& [% v9 L r3 {2 C - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
2 S) o% p; K" Z" D B - * TO CHANGE.
, k2 f. T$ L! N+ a6 e O - *
# U$ `* F0 Q* T1 T. I# u2 _ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
x2 d% Z% U; s: {+ v, T" U - *
3 o, a3 K. P' x - * This program is free software; you can redistribute it and/or
! |! ?# R9 N: y, o, x5 C, z5 O# s - * modify it under the terms of the GNU General Public License as
- J8 A0 [/ w, D- D* g. R - * published by the Free Software Foundation version 2.% M2 P! k6 Y7 ^' C
- *6 O" v. T, ~, K
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ M0 b, T! m* V! ^) D
- * kind, whether express or implied; without even the implied warranty1 @8 x# p9 T4 b3 |* r
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the3 @6 p0 W, U6 B; l5 D7 v. b
- * GNU General Public License for more details., M! a, i4 n/ w: F* y8 [
- */9 V- q A4 |$ h2 u
{; z; h+ a2 V* m- Y& n, S- #include <linux/module.h>
6 m- q( @ G4 _2 i/ p- b. A* V - #include <linux/init.h>3 [' Q+ ?) \) C8 u$ \
- #include <linux/errno.h>
$ g }& [/ s! C& b8 ~ - #include <linux/types.h>
: g% T* O% L- | r1 t% B - #include <linux/interrupt.h>& |2 s/ \- `* T" I, o! q, g( r
- #include <asm/io.h>
/ r8 f L5 G4 a- T, f' w1 u$ N - #include <linux/moduleparam.h>
/ ^* C1 u! E1 t6 B7 k' [9 `" Z - #include <linux/sysctl.h>
# X/ k1 m2 |. D. m; M' c0 T7 o - #include <linux/mm.h>
0 T) X7 F3 p2 C* b - #include <linux/dma-mapping.h>( K) T5 t$ I. J: a1 a# o/ \
- ' Y. c. e8 }! @( n- A& ^
- #include <mach/memory.h>) j% x' c6 d- c: f# w5 a7 g' }9 `, p
- #include <mach/hardware.h>
1 E( C: i7 K& ?% v+ O1 E - #include <mach/irqs.h>& R8 \5 {: D9 d. X' i } j
- #include <asm/hardware/edma.h>
8 F2 ^& T+ s: y$ X% S
* y* W2 \6 H- g. O ~7 V) I6 S2 r- #undef EDMA3_DEBUG$ k, y# m0 T! w! B+ S
- /*#define EDMA3_DEBUG*/, b6 L& d2 ^0 M: u A) ?
- - V( S" z& g+ H7 M
- #ifdef EDMA3_DEBUG
" D$ c7 y1 D0 i* j) S8 d1 p# G+ \ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& @4 z! G# E& D
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
+ {+ o/ p2 p/ o. ?0 p - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
3 W( n( e1 o. J4 s. @$ l! @% K+ _ - #else
8 X' t L1 ?# C5 E - #define DMA_PRINTK( x... )
4 f; S: \- m9 \4 i5 | - #define DMA_FN_IN& Y; _0 L; I3 ^0 ^" i( Q) o& e' K$ E
- #define DMA_FN_OUT1 q) o% M& {5 J$ G$ j# ^2 U
- #endif
$ _: K6 J ?5 l2 d* i - + J% q) @( v4 I
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)* Z" R: T1 {, e9 v4 k# ^9 i
- #define STATIC_SHIFT 3$ S% M3 o* B( [1 D, j
- #define TCINTEN_SHIFT 20
( E& c* g& d9 {6 @1 k - #define ITCINTEN_SHIFT 21- }. _9 v- p. w5 `1 q" K- s
- #define TCCHEN_SHIFT 22
# w' m4 c% O! F) G/ S - #define ITCCHEN_SHIFT 235 e. Z2 s+ o9 j' `
s) f' _* \, a L( L$ j- static volatile int irqraised1 = 0;
3 f3 S8 f7 Q; P( K, E - static volatile int irqraised2 = 0;' b7 n" `: }5 F: b! b6 _
- 4 U i1 r/ v2 T
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 R/ w; s' _0 {3 R$ w8 |0 Y( t2 Y
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" Q/ m0 Q4 _; ^2 c2 J9 `3 h# ?5 {
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" @! K4 U8 V9 v! `7 z - * J; [. o3 ~- A' n- |* ~+ Z
- dma_addr_t dmaphyssrc1 = 0;/ y$ O9 ~+ q' b6 c8 U( U" t. c5 W; x
- dma_addr_t dmaphyssrc2 = 0;1 j! D t$ v/ V$ I; y
- dma_addr_t dmaphysdest1 = 0;
+ F2 b0 _0 v( e" o; j- y6 L) F - dma_addr_t dmaphysdest2 = 0;
/ \( L& m6 o* N& r% K" v9 I - " I d6 c0 A) V! v. B
- char *dmabufsrc1 = NULL;$ ?3 I' x2 K. v/ g' M% u
- char *dmabufsrc2 = NULL;
, C; d. v7 }8 c, d% |" l0 k! l - char *dmabufdest1 = NULL;
7 R( A( Y3 X7 `. n - char *dmabufdest2 = NULL;5 C/ ~0 ?1 K/ a! c/ y
9 n2 z) P% {* x1 p7 r- static int acnt = 512;* e$ C2 f4 a9 u7 [4 D+ `' m9 S
- static int bcnt = 8;; @+ G9 t; h4 B& j7 h: j
- static int ccnt = 8;
; ?( A- O q* W% I
$ y7 _% Q5 T4 u- r4 p, U- y9 a+ {- module_param(acnt, int, S_IRUGO);
- |, w! ~" T7 o! ^3 m0 { - module_param(bcnt, int, S_IRUGO);% m4 t% r" w1 i+ I
- module_param(ccnt, int, S_IRUGO);
复制代码 # }) D) T' ~9 M
2 H% _" U% v \; V
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! b. b6 q; [- e& A( c8 x, n. M
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。% o1 m# l* G7 H M$ X! d3 i$ V
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% x+ p: ~9 S# t8 s B3 L, D+ G
0 q+ }0 p7 C6 C: [
6 m$ Z, c. ~( j! u: Q/ ^ |
|