|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + B5 C( o8 ^" _8 H5 |/ y/ j+ }
- [code]EDMA sample test application1 e8 z1 f0 _$ P, G+ o
- /*
& G! S. j0 ]1 x2 g - * edma_test.c
- c/ E* `8 m" }0 Y" j6 c/ l - *
- M7 x) d F( N - * brief EDMA3 Test Application3 ] C& B c2 [, h
- *5 q% H7 W) z- N5 c" A9 h/ f2 M. H
- * This file contains EDMA3 Test code. I0 c. K: I d* B$ Y- Q* r
- *6 F2 C1 I) h4 u0 p) n1 C; [
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 M$ O) f1 ]2 ?/ ]& S
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
4 b2 \- m& M" ~1 l1 ~! N - * TO CHANGE.
' r2 S9 i4 L6 \1 o" u5 [ - *# e/ s4 l F# ^# p$ k' i% m$ X7 J
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) j8 d2 u0 p, `# l- _- E% M" a
- *0 C6 ~0 T4 t8 \
- * This program is free software; you can redistribute it and/or/ {6 I, s5 G# Y2 K5 d, `, R8 h8 }
- * modify it under the terms of the GNU General Public License as9 P; |/ G' L0 C5 m
- * published by the Free Software Foundation version 2.
, G, f8 p& {1 o6 K6 X - *
! X# v4 Z, k: P% B - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
- ~) Z% B! J: A# t - * kind, whether express or implied; without even the implied warranty
1 i5 a+ W$ I) I - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the: C, R- h, S% r5 Z @. w, n
- * GNU General Public License for more details.
6 P( {# |$ j i - */
3 I3 ~8 `) P! V5 z6 g; ~ - 2 t: ~2 d1 |; X4 w2 F0 |4 v
- #include <linux/module.h>; Q7 z1 F2 X. q! l! ]/ m: w% |
- #include <linux/init.h>3 u% e- y" K4 F
- #include <linux/errno.h>& y F0 \( G: }' D
- #include <linux/types.h>
; Q% p) ]2 ^- G, f7 G1 l - #include <linux/interrupt.h>/ }% i5 e( W% D( v3 Z/ D# x( p5 `
- #include <asm/io.h>" [' ?" Y w3 K" v( T
- #include <linux/moduleparam.h>6 d- e$ u, Z) }7 [) e5 h5 e
- #include <linux/sysctl.h> h5 H6 D6 q+ A/ \
- #include <linux/mm.h>7 E" [: k; ~* y! f, D& z: r
- #include <linux/dma-mapping.h>
9 h2 }: E' c: }0 j) b" Z
, V9 a7 l3 p. F9 ]- #include <mach/memory.h>
7 R1 t. e: E2 i5 C8 [ - #include <mach/hardware.h>3 T# c I# g) i
- #include <mach/irqs.h>
0 S$ K/ f4 A- i O - #include <asm/hardware/edma.h>) f3 M. R# s; J6 p9 c; u- l
- $ H4 I' M! Z" N- ?4 \: k
- #undef EDMA3_DEBUG
' X6 z d! h3 ^% U" x - /*#define EDMA3_DEBUG*/. q9 w P/ F" z# l3 u' X* m
! w/ J) W3 h' C( h" z/ }% T- #ifdef EDMA3_DEBUG
" ^+ `1 Z1 H% j6 H - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
9 K0 j3 r* ^/ i2 c; h - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 D+ \- @( T8 m5 Q
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! k/ @ B+ H6 N2 {, X; ~' c0 V
- #else
2 B4 V' g' B# i- k1 L6 V - #define DMA_PRINTK( x... )
7 W& q Z5 \* y) C; J: H - #define DMA_FN_IN8 P- H+ z* \+ G% O4 Z+ d/ u
- #define DMA_FN_OUT
! ^. m$ F4 v h - #endif o, v6 J( E& F8 r) g b/ d
$ m4 e; u6 `$ J3 v- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
, U( ~; g& b3 x - #define STATIC_SHIFT 35 J9 u: e- A3 `. K# {
- #define TCINTEN_SHIFT 200 D1 Q/ G' E! G4 f
- #define ITCINTEN_SHIFT 21
/ J3 e; Y8 {3 S0 C4 c - #define TCCHEN_SHIFT 22
$ r4 P, H$ v2 |( K - #define ITCCHEN_SHIFT 23
' Y! v9 ], ]" B5 v+ n - & F8 T' b( ^5 y, ?& |( C2 D A
- static volatile int irqraised1 = 0;6 a9 }& U$ D/ L: z
- static volatile int irqraised2 = 0;
; h& }+ l/ }3 ]5 q - ' w' U$ f; t. }8 R, u
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) L/ F6 g$ w4 g' r. q1 y - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- n# i* L6 X: Q5 y8 {8 a) Y* j - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 a+ ?' O1 M9 j1 s) v, F, a - % ^' D" ^& x/ r* X
- dma_addr_t dmaphyssrc1 = 0;7 D- S" k, W1 l7 N
- dma_addr_t dmaphyssrc2 = 0;% Z g% C# R; J& T6 Y8 t7 ?
- dma_addr_t dmaphysdest1 = 0;! p6 [2 T' H: y" }: b& d2 a' Q
- dma_addr_t dmaphysdest2 = 0;
7 K7 P7 A/ T! T8 j& U
, h! y9 M% m( Y- char *dmabufsrc1 = NULL;
! S8 u9 m# C, t, q" n. Z/ n( G - char *dmabufsrc2 = NULL;% r5 H* R+ i8 K* e
- char *dmabufdest1 = NULL;' }7 j7 i4 l& H8 X4 V, p
- char *dmabufdest2 = NULL;
5 k) p% i0 P- ?+ o! \/ u6 A - $ s0 Q4 g& @9 I) t( Y: F: W2 q( y
- static int acnt = 512;! P Q3 I! Q) R) x- I. d
- static int bcnt = 8;
" n& Z6 E3 g% R - static int ccnt = 8;$ _( K( q6 [- `, R. i
- ( F5 |7 U) f7 n5 v+ A
- module_param(acnt, int, S_IRUGO);
6 H( ]; i9 K& l( M. k - module_param(bcnt, int, S_IRUGO);
0 t. k0 x7 _& r; W0 |/ {4 } - module_param(ccnt, int, S_IRUGO);
复制代码 - D% g* N* E2 ~+ a* j& W
& i( E, C: o8 i- j/ @ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. ~6 H7 p" U- b* T: w! F
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
: K* u: m: B' b& M3 u6 g+ c 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 [9 x% S7 _/ h# g) H9 E0 e4 {) b8 y6 g' ?! m
+ t" J0 {5 \& q/ Y/ R |
|