|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ v$ M P+ e: ?, W! _
- [code]EDMA sample test application" p% ]0 U; Y3 [" l% Q- ~# y" d9 |
- /*
5 e6 C; y% {7 h) u0 r/ c* s - * edma_test.c
) V0 y4 E2 g$ Y - *
" |9 o; t9 E9 K" c M" F$ n - * brief EDMA3 Test Application
( A. p3 l! F6 t8 [ - *
5 `; K1 h; A' p- y; T/ n - * This file contains EDMA3 Test code.
* E6 @; B; b& v) z R. G' T - *
, C1 {, Z+ O, q0 U' T: g4 Z. Q - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 z' k/ [+ s$ Y) y
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ B3 y' e2 P y) J4 x/ f
- * TO CHANGE.
$ `$ X4 x" G9 r/ U - *
9 W" {" I+ c2 f% t* e) W, C1 p2 o- j+ Y - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- s+ O; t6 z' b' F$ i
- *
7 z0 [3 p4 k& O; C ]0 l- Q - * This program is free software; you can redistribute it and/or: _( J- T" `5 {0 x: `( V) f
- * modify it under the terms of the GNU General Public License as
& D' B$ S! g' C0 G - * published by the Free Software Foundation version 2.* x, U& `/ d. B
- *
$ E2 l: M+ g. t* w8 ~- _9 g - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ T& w/ J( @' Y/ P$ m - * kind, whether express or implied; without even the implied warranty
+ {' H T9 V9 C: F - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- O1 [$ d$ u, V$ E- L* X- M
- * GNU General Public License for more details.1 e2 W" J9 _! \9 q) p* o
- */1 G8 s9 b `( x, M9 U
- - W- D) n+ L5 g I
- #include <linux/module.h>8 f" g3 D0 t" T
- #include <linux/init.h>9 k- b' _, Q- }2 D' v; j
- #include <linux/errno.h>
) v, b Y6 Y* n - #include <linux/types.h>
0 N) P, ]0 S1 R. p- K; H - #include <linux/interrupt.h>
/ [* P$ w/ A: b' E* w - #include <asm/io.h>
9 ?# D7 }- [/ T - #include <linux/moduleparam.h>5 ]: f! [2 g" x" p: Z' [, X
- #include <linux/sysctl.h>
/ d, q' h! p5 [% J) W - #include <linux/mm.h>
( W* ]. r' Y/ r: n, r5 v+ ` - #include <linux/dma-mapping.h>
: i: v% s u- F5 T5 e, N6 R3 A
% F% S6 i* v) H/ L; L: J- #include <mach/memory.h>
. S+ l- D; A1 k- ^ - #include <mach/hardware.h>
+ h2 B6 j* _$ Z& Y$ q - #include <mach/irqs.h>. ?5 e: s7 o: H' I7 \
- #include <asm/hardware/edma.h>7 f0 F6 `' P ~
- 7 V* h5 c- e% v
- #undef EDMA3_DEBUG: ~' l/ l( U+ s9 H, B
- /*#define EDMA3_DEBUG*/: c- I0 E: O# W+ c) E W1 W4 N
, t' a* u9 |: d" d/ G& t# P: o- #ifdef EDMA3_DEBUG6 [: s, V7 i1 t8 B' q. W/ S4 e C& Y
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! J/ E( X1 f6 V' ]4 Q' \! m! G
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); b2 e' |, l7 U9 q/ c" L
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
2 {, z# v, m: O- D - #else
, q1 A3 [: I% m4 S7 v9 ? - #define DMA_PRINTK( x... )
5 {# Y3 P4 l) v' V; R$ g6 j% T - #define DMA_FN_IN
9 j$ ~4 L+ r9 x1 B5 s" F+ @ - #define DMA_FN_OUT3 t0 R5 b% k9 Y s
- #endif9 K5 y7 H# t8 o
5 h; L3 V8 _$ M+ z$ |! F, h- #define MAX_DMA_TRANSFER_IN_BYTES (32768), v3 Q0 w9 E: @2 H
- #define STATIC_SHIFT 35 _7 _$ V" ^) r" w. ~" V$ e1 A& v2 d
- #define TCINTEN_SHIFT 20, k& c1 a, B# T- {
- #define ITCINTEN_SHIFT 219 @4 B; F1 ^: w, H3 d% F; t! D
- #define TCCHEN_SHIFT 22
5 E9 q3 y9 }6 A' ~5 g" E4 e- Y - #define ITCCHEN_SHIFT 23
" @! ~; b0 `) x7 L* O: g: F0 `* S
1 E( E7 e7 e7 U0 Z5 n7 g- static volatile int irqraised1 = 0;" c/ M) o2 j8 }5 @
- static volatile int irqraised2 = 0;
/ `5 Z$ e$ Q/ q - # j U- V# o& u4 n
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 L6 U! H3 o. ^! y
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! {) A! k' N' a+ { - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 M8 z. ]+ @6 F! e8 P, D% R
- q# d3 u) |! A3 z7 U; a% o1 u$ X- dma_addr_t dmaphyssrc1 = 0;
) x6 a+ I7 P& ^& R2 B+ b5 l/ E2 x - dma_addr_t dmaphyssrc2 = 0;
- T! R: c# w0 E - dma_addr_t dmaphysdest1 = 0; C$ o$ F/ z0 S' d
- dma_addr_t dmaphysdest2 = 0;5 X; T, h3 S- P4 o$ [
# f4 L$ }3 D* F6 k& P+ F- char *dmabufsrc1 = NULL;1 M5 M2 b( |, J) Z
- char *dmabufsrc2 = NULL;/ Y+ k% s6 x* J, |) Z
- char *dmabufdest1 = NULL;
/ A# o4 m5 d" {( ^* c - char *dmabufdest2 = NULL;
& \0 r3 ?" L4 q; E: J* X/ V' F- l H - # Z) Q3 r; v' a
- static int acnt = 512;" D. c+ L! z/ |( W- A2 W0 X/ m. m/ j
- static int bcnt = 8;
. U! ?" ~7 c/ a" ]; _ - static int ccnt = 8;
/ t5 J( C9 \2 H9 ]7 g2 T/ T
" s; B3 R3 K4 t$ Z* X5 D+ n- module_param(acnt, int, S_IRUGO);
. n: K& O* V7 m" I+ }: \ - module_param(bcnt, int, S_IRUGO);" X# d, B9 U/ K1 ]1 d6 t: f6 A4 {
- module_param(ccnt, int, S_IRUGO);
复制代码
/ O1 G; f& v% X/ @* r/ F4 ~
" Y( f. S$ \1 x) J; k- K j 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% u) R3 `( Q2 U* O: i8 [' I
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 ?: u% n+ x; ?1 H6 L
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: l- y& s0 I4 l* q, O
% I9 d% Z+ M( ^% ~1 Z& E
9 z) V5 @* J- R% _! T' Y |
|