|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
+ J, P+ C+ }+ o/ n* M8 U$ n- [code]EDMA sample test application
5 H5 ~; @7 w1 }" o4 u m6 P, k; w - /*+ Y- `! x! Y3 {) T
- * edma_test.c
" p" W* Z, z; E& d& ? - *
p) X! z$ M" l1 \9 [ - * brief EDMA3 Test Application- c4 z9 H6 D4 T; I; Q$ u- y/ H9 y7 d
- *
. w/ }& g& z c1 C$ O; _ - * This file contains EDMA3 Test code.
8 s$ ?3 f) D+ L: o" d - *# U0 n: k L6 }' Q9 H& Z
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- u b, P% _% y' }3 \8 n: r
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
5 A2 Y P0 z: M$ V% t - * TO CHANGE.
3 l J" @/ ]( @/ |) a - *$ Y$ g( x" s. Z: |8 r6 I4 P
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
?$ Z/ P3 d2 S: h" k - *
3 n$ V, K p; b. h( p - * This program is free software; you can redistribute it and/or) m- y3 N `9 c
- * modify it under the terms of the GNU General Public License as8 T$ J' v3 i! C9 i, Q& ^" x
- * published by the Free Software Foundation version 2.
- v5 V1 l' F, `3 T1 ^) T! B$ Q - *
1 A, W- g# a5 w$ M" z - * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 `* a8 G- c9 v
- * kind, whether express or implied; without even the implied warranty
+ k/ [# Y7 p( @* C5 ] - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the$ y1 ?3 M6 z6 O* o
- * GNU General Public License for more details.
! a! H, N1 o! p/ D# J6 }3 o3 m! o - */7 T. T* c' [: ?! V3 x3 X! h' c7 |
9 ?3 ?# k1 t$ Q3 R8 L6 |4 T$ P- #include <linux/module.h>
3 y0 l9 @7 C% l - #include <linux/init.h>
4 T6 k7 O* i6 j, I* v8 v - #include <linux/errno.h>3 N. m9 z* [2 ]6 T( o
- #include <linux/types.h>
7 j* |5 B- M' C+ z - #include <linux/interrupt.h>9 p2 U1 j F2 S1 D& o) i1 m
- #include <asm/io.h>: [( m1 Z. ?2 y4 |9 Q q( H0 k, G, g' e
- #include <linux/moduleparam.h>
. `6 I9 _0 T q- t6 d - #include <linux/sysctl.h>
2 Z, [" x* b: R3 p! f2 `; F - #include <linux/mm.h>4 o" d0 ^. x- X- J
- #include <linux/dma-mapping.h>
9 }: P5 r: w% o' M% [# I - 3 v) o2 M9 R4 L& z
- #include <mach/memory.h>
6 n/ ]3 E1 c3 s, A# |7 W% N - #include <mach/hardware.h>
" m; w' g' Z' I" D$ s. O - #include <mach/irqs.h>
) d; r2 z8 S( V$ F. ~! y; X% y) n - #include <asm/hardware/edma.h> v8 \" Q. j& {7 ~! D5 J
8 a% [ _; H/ @! e- #undef EDMA3_DEBUG
0 \5 O: e# V' q! [& i1 {. M - /*#define EDMA3_DEBUG*/: f: _, U/ Y6 u* y! s) Q9 q; {
+ W" i; M( S/ e2 c5 |' H/ i$ n& [+ v- #ifdef EDMA3_DEBUG2 H2 Q) ~% u3 L( W" V& ~8 B- H
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
' m, X' F L6 X! h - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 @1 u" P, O3 e; ?
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- N7 k" y8 J- @& x% P
- #else, @; [$ C5 y8 i; M* d, P9 {
- #define DMA_PRINTK( x... )! B" {* ?) u$ `+ H7 C
- #define DMA_FN_IN/ P9 F" C6 e' @9 O% t
- #define DMA_FN_OUT
- J$ F( X% K ?2 v. Y1 z - #endif5 V: g1 h$ h) Z5 D% d
) d" F+ j; J; z e( H; C- #define MAX_DMA_TRANSFER_IN_BYTES (32768), g: i) B1 J5 L% m
- #define STATIC_SHIFT 3
- e; {. c* x4 d. @ - #define TCINTEN_SHIFT 20
* e8 L4 W5 F) B& l - #define ITCINTEN_SHIFT 21
4 C0 b" A$ H; t - #define TCCHEN_SHIFT 22
, I& K6 X& q: N - #define ITCCHEN_SHIFT 23- H- l0 Q/ ~- m3 B6 R
- 1 Y; ^0 e+ m# i5 r& ]
- static volatile int irqraised1 = 0;; a1 \! k* C) v* @- k' _
- static volatile int irqraised2 = 0;
" m+ Z V0 Q r& y - # @9 j" a7 O. Q) |- t0 ?1 }! B5 w6 j
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, x2 H7 U6 M1 _& T+ {7 d
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; _4 A, B i" {* j - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 i( w* P5 t) x7 A - 1 k8 O/ N0 e' A% n# t2 T, E
- dma_addr_t dmaphyssrc1 = 0;
( ` ]2 V/ }/ G& Y; m9 T - dma_addr_t dmaphyssrc2 = 0;
& S4 @, N* i- g. l% v% ?* A - dma_addr_t dmaphysdest1 = 0;- Q* |5 o5 w# P' h$ Y
- dma_addr_t dmaphysdest2 = 0;5 L& Z f7 Q7 B. z3 I
7 G& ^) x' r V0 v0 b- char *dmabufsrc1 = NULL;+ ^' @% B0 q: K7 N) b' [
- char *dmabufsrc2 = NULL;
- |$ [+ {0 i9 ]; m$ n - char *dmabufdest1 = NULL;
% h) E2 k0 w$ [! Y7 p0 O1 O - char *dmabufdest2 = NULL;
6 P' ^+ u: Q/ {; m# T& B4 S - 0 U, i3 `1 X. C! X! n4 v& ]! T
- static int acnt = 512;* N( p2 m' f4 n2 ^" e
- static int bcnt = 8;) |2 ^5 J9 D9 f2 A. u
- static int ccnt = 8;
$ O: ]- }# A' l' W+ L" u - C; a; l& b! U( U' k2 A8 i8 `
- module_param(acnt, int, S_IRUGO);9 e. W/ p; P E4 ?
- module_param(bcnt, int, S_IRUGO);
- s: u7 K, Q: x/ p3 f) h - module_param(ccnt, int, S_IRUGO);
复制代码 # T' V2 q3 I0 }! Z/ r! @
4 K& {/ m* s% q4 z+ a
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 h5 p2 K1 q/ n* N8 w4 Y+ V6 n% j
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 Q: [" E1 |# T" d. k7 T& Z# y2 c( V 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ v( y( C2 ~! ^
8 c% U+ C6 o7 D- L8 @9 }6 R
! f2 t* ^+ z. s& G2 n |
|