|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) `% L& e F1 X/ Q% l- [code]EDMA sample test application
& F6 Y! G& Y4 i9 U7 R - /*
0 d, h, U. n- t" d" ~1 x2 p - * edma_test.c2 D# z# j) a3 S1 Q
- *! q6 g9 i8 e+ ?2 G, d, K) H
- * brief EDMA3 Test Application
3 k8 i d! F# P$ F% b/ ~ - *
9 R+ }" Y9 l( G( O8 c4 y - * This file contains EDMA3 Test code., H0 p: y. c3 P5 h
- *
/ u4 g) l4 ]6 R - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. G6 k) Z) w, e- u$ ~
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
9 B7 }( Y' o9 R) Q2 x0 L) [ - * TO CHANGE.
! z6 u- F' o T1 c, t& H5 a+ Q' J Q - *
0 ?3 ]) h6 q+ f2 ]5 S% z7 b: D/ _3 [ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
, R) A4 P& L: h& C: n5 T& e - *
( c. J7 i$ l. \8 ?3 `$ x1 e - * This program is free software; you can redistribute it and/or5 {9 x! j& T" N9 Z8 R
- * modify it under the terms of the GNU General Public License as
. D. h* j; }; Z2 J - * published by the Free Software Foundation version 2. K3 B, U; P1 ^) H3 p
- *7 |. L* i. [8 E% M, p
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ k2 |( T# b- Y: o1 e% ~
- * kind, whether express or implied; without even the implied warranty
0 ?$ C/ s6 j! l1 E* T - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8 j9 f3 q/ q2 K' A7 [& _# P - * GNU General Public License for more details.
; C2 t# T8 Q) D, \8 D3 N3 ~ - */' { ^) [" {" P8 ~
" ~, S4 M% o: r9 h: w- #include <linux/module.h>" v0 T; T" s( I# b7 k$ B! I/ s% r
- #include <linux/init.h>+ Z( e+ o0 C4 c* q6 U% I
- #include <linux/errno.h>) F, j! ~- r3 c M B& w* X& s1 `; ^) n
- #include <linux/types.h>, O0 F/ F, K; B! h
- #include <linux/interrupt.h>, O, I0 M) h8 n* q, ^
- #include <asm/io.h>
' D9 H9 d8 y) s, W O9 F - #include <linux/moduleparam.h> m* L$ _1 j( R6 k! W) ^: J
- #include <linux/sysctl.h>
1 G! [. ^* L4 c* ^6 M4 E) O( j- B - #include <linux/mm.h>
* y( y, ~7 e9 `1 ]9 I& e3 A0 |8 t - #include <linux/dma-mapping.h>
$ @9 H7 W. m) _- t3 ?3 J, _
; k9 r4 |% @# w6 D- #include <mach/memory.h>4 ^) g2 k/ [5 j: m: H
- #include <mach/hardware.h>4 D6 [/ ]+ A. B" L$ ]) {$ H/ D1 |
- #include <mach/irqs.h>
2 l# `4 L8 I4 S - #include <asm/hardware/edma.h>
7 k7 @$ \( o2 T4 m# g( s
. L4 F' c% y3 i- r/ n" Z- #undef EDMA3_DEBUG, c7 [; L) ?! K5 b" q& c; K
- /*#define EDMA3_DEBUG*/
, Y% _6 a+ V! r, W7 t
K1 p+ @4 }$ H* m( B/ T: y6 T. n- #ifdef EDMA3_DEBUG3 f J! x1 X( N8 e
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
. o3 [" d- G, @6 S - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 ?" N5 F# K. z0 A3 l* D7 c
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# Z7 P. z" h" n U5 a- b$ r: P% C
- #else
! y3 k) O0 U3 ]9 U+ g9 u3 r- s - #define DMA_PRINTK( x... ) K$ K! y$ O/ F: V
- #define DMA_FN_IN) {5 l8 ?- w7 k8 X9 u; t
- #define DMA_FN_OUT
A' F1 k2 l0 o# w) S - #endif
! b9 H) Z3 g5 F+ d
7 l H- M$ N s- #define MAX_DMA_TRANSFER_IN_BYTES (32768). J/ G7 F+ r. m' X, g
- #define STATIC_SHIFT 39 W/ J% t, \3 r3 t6 n2 F
- #define TCINTEN_SHIFT 20
. A: j7 U4 c' P g/ Y$ X - #define ITCINTEN_SHIFT 21
4 D8 K& d& a+ ` - #define TCCHEN_SHIFT 220 N" k5 N; A3 [) o
- #define ITCCHEN_SHIFT 23, [( h0 F# \ u: \, |0 o+ |
" e0 J1 s6 k! k2 ]+ a2 I- static volatile int irqraised1 = 0;+ C/ x, |( Y* q4 D$ |
- static volatile int irqraised2 = 0;# K% t+ }* S8 ]1 a8 ]. H: Z% ^
- 2 A6 p8 m& P Q, Z4 e$ H
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; J% _" y- `% i. z( b - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& z1 u! G3 _& B3 k8 E - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 k9 m7 }# W" D% D" l0 |4 O) T
4 P1 T0 n& a2 r, j/ n' u1 M- dma_addr_t dmaphyssrc1 = 0;
J: r# I" u1 H/ ]7 Z6 f: l1 j# l1 } - dma_addr_t dmaphyssrc2 = 0;+ U; z' A/ w9 m" a/ ]$ Q8 t5 c6 C. V
- dma_addr_t dmaphysdest1 = 0; m# U8 [: b& P" T% w
- dma_addr_t dmaphysdest2 = 0;
7 T7 L' j: q7 u4 \5 ^4 k' \; b - + d0 f3 D6 o" @# U2 v* b- p2 ~$ R/ g
- char *dmabufsrc1 = NULL;+ {% n5 i1 k; C) v! J( \' M
- char *dmabufsrc2 = NULL;
8 }6 ?' H+ i1 j" W - char *dmabufdest1 = NULL;
" k/ q. A' M: Y$ g3 T. V - char *dmabufdest2 = NULL;+ v, I* q6 C+ J0 C" B( E
- 6 ~1 Z! t1 t7 a4 d% e
- static int acnt = 512;0 W& j, ~* }7 x$ ` K2 W1 Y
- static int bcnt = 8;
0 q' b/ `; h0 L9 v! s) \; {/ k - static int ccnt = 8;2 @- u `) C) W; J. L
- $ G# t2 e0 H9 @1 s0 \ C
- module_param(acnt, int, S_IRUGO);
6 s4 W2 o4 ~" f - module_param(bcnt, int, S_IRUGO);! B$ m& `& h& z
- module_param(ccnt, int, S_IRUGO);
复制代码
3 a- B0 Q" t Z3 e* E, T- r; Y" m. z/ O" a& F1 x- j
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 I# S6 O# R) Darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 u- ]: T; b: b! o, y$ t" B/ v
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 U) b! h/ u F8 O+ s) \/ H8 T# U& F# a% I' Q# _
2 t/ Z/ x1 d. J; w0 [+ E |
|