|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 K8 b6 @( o4 T- e' ~3 I
- [code]EDMA sample test application' e( g6 H, {- [
- /*
7 t- R: w6 P& Q( L) `& h. ]# a - * edma_test.c
0 {3 C. _* d& C% N+ O1 E' D - *
1 B6 W# I4 y; u: G) c( ^1 e' q1 S - * brief EDMA3 Test Application+ V; I! d0 p( k9 J9 G4 J3 \
- *
8 r( u1 d& B( I) ^ - * This file contains EDMA3 Test code.
L- o% u% M J- i5 |% @ - *
; n4 s2 p2 H0 n* [+ _9 p - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; m' Y. L1 Z: x0 Z
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
/ Z" i7 V. N N. c2 m1 i/ b - * TO CHANGE.( h3 ^. M6 D8 ]6 b- P7 G% w& Q
- *
- D) r8 M4 _. n6 {" {& }6 M - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* t) m7 u/ }- r: y0 {6 z2 I
- *
+ h" j' r. H6 s0 m8 s - * This program is free software; you can redistribute it and/or, ^) v) q+ h3 `' o! k$ A' N) g y
- * modify it under the terms of the GNU General Public License as& S5 r- [4 L; ?' w9 Y5 }( u
- * published by the Free Software Foundation version 2.$ v& v' z2 F" x" P7 e" l
- *+ J, T% S# i- B* [' t
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 |: J3 p& |; V4 e& A6 H1 G
- * kind, whether express or implied; without even the implied warranty
+ c+ |& U# b0 R' @7 i- D9 @0 C - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the$ {/ \9 W/ r% _. Z
- * GNU General Public License for more details.) m2 j7 W* O6 T8 b6 V# D) C
- */
2 W0 R1 g6 [- _9 P
: o9 w* b( q2 d- #include <linux/module.h>/ m% x7 h: o# L4 N) Y; y6 _
- #include <linux/init.h>
6 O/ v' b5 K y* S - #include <linux/errno.h>
2 d9 M& \& e/ C, J - #include <linux/types.h>3 }' I# _: {3 n/ q* t% H0 r
- #include <linux/interrupt.h>
; r ?. \8 O9 M; E" o - #include <asm/io.h>
. ~9 G N' Z) n+ _& ?1 V - #include <linux/moduleparam.h>
: V* e3 b2 P ` - #include <linux/sysctl.h>" L6 I& a5 m( ?( j
- #include <linux/mm.h>
. I- F0 _, @+ u/ _ Y9 q3 g9 [$ n - #include <linux/dma-mapping.h>
, Z7 z. O3 w& Q8 ], K% x
& h/ B a! V' C* D. c- #include <mach/memory.h>/ o6 L4 F, P; Y8 }* d. J5 F+ p
- #include <mach/hardware.h>
/ N7 D1 N# m) Q% ? - #include <mach/irqs.h>
1 x. U0 b; l+ Z; s& v. Q - #include <asm/hardware/edma.h>
5 ?* v1 P4 W1 Z; R# J9 [5 b
+ a0 y3 O6 m! T* y# h9 d( u* @- #undef EDMA3_DEBUG
/ ~2 |9 S5 q5 e3 G3 J- { - /*#define EDMA3_DEBUG*/
: ^& |4 j" z! ] z1 C$ P% n# C! \
1 z. M5 V- @+ v3 J. Y- #ifdef EDMA3_DEBUG( Z) S/ Q4 r; n+ X. W( i3 L9 ]
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 A! Q& N* E/ S
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 c `" w; X1 s% t
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
4 a8 i# w5 }5 L+ g9 s" X z! J - #else$ ~) L. j9 A! S/ E
- #define DMA_PRINTK( x... ) ^6 d, U# x. I
- #define DMA_FN_IN5 s% `7 A2 }! a. X9 a
- #define DMA_FN_OUT
) c0 I8 d! B* ]1 W; U8 w - #endif- e5 R1 ]& G t; {7 c
: S; I6 `' S) O& q$ r' c- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
: V9 o9 ]. b4 }% G y - #define STATIC_SHIFT 3$ w3 S9 q# K- U. N. w" _5 R, I
- #define TCINTEN_SHIFT 208 X: n) \' e, j; q) x/ V! W1 o/ r$ H
- #define ITCINTEN_SHIFT 21
3 I9 q. ^: e5 f5 F2 F) w - #define TCCHEN_SHIFT 22) y5 i" _ {0 s9 Q& j/ T
- #define ITCCHEN_SHIFT 237 n- G& H+ g( F. j& d: |- v
- " w r* ~4 N6 b" [8 ^$ e5 u
- static volatile int irqraised1 = 0;
3 V3 e- Z8 h' v8 b - static volatile int irqraised2 = 0;
: k* o7 q% [3 B
/ |: E% c7 v- u t3 X% [- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, G0 K; s3 R o. J - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 U w5 Y0 T# o8 V4 Y - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( D9 i; m8 ~5 o1 V - " m/ O( U9 k" S5 y$ N
- dma_addr_t dmaphyssrc1 = 0;
8 ?, Y5 y5 B2 R3 _% Q/ \6 J - dma_addr_t dmaphyssrc2 = 0;) Z& C6 z7 [& }: @6 X# w/ `" A
- dma_addr_t dmaphysdest1 = 0;% X% L2 ^. e, g% n! {: J
- dma_addr_t dmaphysdest2 = 0;
1 a! w @; n2 p5 z X4 x# t- _& ~
$ C7 s$ }- p! q( j- char *dmabufsrc1 = NULL;
% I! V5 g) I& h - char *dmabufsrc2 = NULL;
, W$ b% [' [: }( ` [. n) s, C - char *dmabufdest1 = NULL;
. [4 m0 Y, L! _5 o! b# ? - char *dmabufdest2 = NULL;
/ ~1 _9 A6 O8 v {0 P- m
0 g% W3 n3 ~4 k, r3 h- static int acnt = 512;
K3 j! Z8 U, \ - static int bcnt = 8;
6 ~5 X: `8 N/ {8 z. B% i- S2 U- {" D - static int ccnt = 8;3 l3 D' g, P( _2 E! W1 s) f5 g3 S3 s8 q
6 ~) Z1 f1 w# O" T! R0 P( x4 j9 I8 F- module_param(acnt, int, S_IRUGO);( o! e* [* f7 k. F; M# W
- module_param(bcnt, int, S_IRUGO);1 N$ }; {, p+ y* L
- module_param(ccnt, int, S_IRUGO);
复制代码 6 o7 {6 |2 a, F$ \
/ k- g! z3 o- V" } 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
9 U0 {# x5 H1 harm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! `9 [' R4 E J# } 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, _- F) N0 y4 ?* ~* W
% J0 j: _- P9 W
7 u0 h4 h! |! B) r' ^8 {* y |
|