|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 B6 D. a" M% R; _- [
- [code]EDMA sample test application
5 R/ }1 h0 h+ i) D/ R - /*
# I! k. w% k7 l: j& S6 }+ Z7 p$ |) U - * edma_test.c9 F0 I8 D* O7 `3 m1 N
- *! P# i. `. E3 B& b# j
- * brief EDMA3 Test Application
6 ^" [1 p2 A- s" o0 C7 v - *# r) C$ B+ R! ], I' h! s) F6 Y
- * This file contains EDMA3 Test code.# b9 a# ?. g+ G: o7 K; s. M7 A4 N
- *
# L0 o( I+ `8 ?8 a; z, @( L7 t - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) W2 r+ }4 x$ D9 `2 O Q
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- o7 z' O0 i( L9 |+ P
- * TO CHANGE.
1 t3 z/ s9 v8 O5 O& C - *& ]# d5 a% D) i
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
5 _; d! L1 D. M. b& Q2 Y% ~ - *
. P; {5 p) z0 s: W: x7 u - * This program is free software; you can redistribute it and/or
% W! \; n: _6 u1 ?$ C - * modify it under the terms of the GNU General Public License as
- I1 v, z+ H+ Z- d* n2 x1 | - * published by the Free Software Foundation version 2.. N/ v5 ?7 Y. `" p9 ~$ X3 Y
- *
$ ~% g, b- a w3 d - * This program is distributed "as is" WITHOUT ANY WARRANTY of any" n8 w; v& p l7 ^+ l c
- * kind, whether express or implied; without even the implied warranty! |( k7 L2 u- a' O% k- s$ d
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the% P5 j: D4 l3 o
- * GNU General Public License for more details." M# Z0 Q" {# D: d" C$ Z
- */" C/ o }/ U" |0 P E
- J( v* x, g6 G! W' z5 U+ r1 Q- i+ Q
- #include <linux/module.h>9 X/ i3 C9 j8 w1 N E$ B
- #include <linux/init.h>
) |- p- n0 i1 v S - #include <linux/errno.h>* v" X$ s. l% p8 o# h/ ?- I% w( ]
- #include <linux/types.h>) b# ]' x: D. T0 F3 u9 R: N F
- #include <linux/interrupt.h>
, G8 e- I' N4 J1 u: w+ M5 P - #include <asm/io.h>3 g2 ^8 F W$ T6 e
- #include <linux/moduleparam.h>
( D* K- M) e- Q4 B; C, ^# @" P0 I - #include <linux/sysctl.h>
- i/ |3 P1 x/ C2 m/ ~; V - #include <linux/mm.h>
4 D/ D5 W C& f8 v0 W4 _ - #include <linux/dma-mapping.h>
" F6 I, g6 Z$ O' f, d - 1 x, h l0 X1 ?+ T5 G T
- #include <mach/memory.h>
% h: V* b. \3 _( ^ c - #include <mach/hardware.h>, t. t5 O- d, ?8 @
- #include <mach/irqs.h>+ o1 k+ g" E; U; D+ o
- #include <asm/hardware/edma.h>
6 Q, f5 A6 x6 v, k+ B& x% S8 M - / M1 {. t ^0 P- k. j9 p: n
- #undef EDMA3_DEBUG+ c+ j. Z- H* E1 R' a
- /*#define EDMA3_DEBUG*/" k' I, K, B1 x K
" i$ L0 W' x# m; P! A- #ifdef EDMA3_DEBUG$ @8 D* a6 l- v( I& g) ]
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 y% A" w& u" I4 Y5 [, @! m
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* Y& W2 S- D4 L$ F# I! p- y
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) S* Y' t9 ? p, k0 N$ P
- #else. o8 y3 f) C- d! ]% I" F. J
- #define DMA_PRINTK( x... )" m2 A" O4 w: _( h) H& R; U+ ]* {
- #define DMA_FN_IN
: e. W+ E7 ^! c- R# @4 c - #define DMA_FN_OUT$ w h+ s! U- |2 `# A: d$ h, n
- #endif. K( `, a+ c; x" m/ N
- 4 m" T! l9 q0 B
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
$ w5 i1 R2 g2 b2 |- z. W+ t3 G3 y - #define STATIC_SHIFT 3
7 f6 Z+ V, R3 g! a. k, t- W+ T - #define TCINTEN_SHIFT 20
: X% @9 C. T. E9 ]2 s" @ - #define ITCINTEN_SHIFT 21
7 Q- K+ d; T# m6 [( C# T - #define TCCHEN_SHIFT 22/ u/ D1 y" @' a+ ]' h9 ?+ N: D4 Z
- #define ITCCHEN_SHIFT 23
/ U) L' F/ e) n s* v5 c2 l - 4 a* J" `: M# U( w. l
- static volatile int irqraised1 = 0;
! V/ o- w9 o1 O0 n - static volatile int irqraised2 = 0;
* T$ |" x3 y" N3 U8 N - & ~' C! p& V$ M! v- U& D2 l
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, C; u i9 z5 t+ [$ ^/ `$ l
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ g I4 P+ R- ?5 q - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) v, F$ t4 Y& ?) _" K
' B0 ?" Y$ g! x9 }; \/ S5 }' }8 m! Y- dma_addr_t dmaphyssrc1 = 0;
$ C( _/ u4 K* m0 z+ w0 K - dma_addr_t dmaphyssrc2 = 0;
+ {; j) C3 d5 d+ a - dma_addr_t dmaphysdest1 = 0;) z5 z m! {. X- g+ P( H: g
- dma_addr_t dmaphysdest2 = 0;
+ n- l7 b$ Z1 c4 v
8 F( v5 L" `5 K5 `- char *dmabufsrc1 = NULL;
: X7 h, J) I, J: N1 i - char *dmabufsrc2 = NULL;
$ ]: m0 r$ m* G" \( ? - char *dmabufdest1 = NULL;8 e1 g) i3 w: e- z* z& P
- char *dmabufdest2 = NULL;1 O/ I# R. E* `+ n$ ]+ U0 y& ?
0 h; x* L+ b& ~! a4 {/ f1 g% x, P- static int acnt = 512;
" @) ?$ `* A8 L- e - static int bcnt = 8;
3 d8 u- M1 V- u' j M! z - static int ccnt = 8;, | l. i( D3 _( \7 C
- ; v6 A* ?+ }, _
- module_param(acnt, int, S_IRUGO);, [, L5 c: }8 @# F
- module_param(bcnt, int, S_IRUGO);! h5 H' Z0 }4 g: [
- module_param(ccnt, int, S_IRUGO);
复制代码 # S1 R# m7 ~: S0 J$ I( c) ^+ f2 u% ?
) S9 g' n8 v% @, k% @ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用; }+ Q5 @/ e4 A$ c0 a1 e7 }. p! h9 H6 K
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 K. c; X2 J/ M9 n6 \/ @& I
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" ]7 Q- \% @$ w
, A' M- N; X2 n% ^1 a4 [- g) l4 O3 I" k9 U% K( |
|
|