|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ j, o6 `- \1 V' h, _. D- [code]EDMA sample test application1 h$ ~& `- i9 w7 T8 F
- /*
3 v* y+ r" L: ^- {7 e - * edma_test.c. v0 m& i6 T! v3 B; h: g
- *2 O: k! `& y# z# y. m& F6 f. E. I
- * brief EDMA3 Test Application
& l: `& @7 H1 [+ J5 h - *# m% {$ Q2 S! z3 Z( U' G2 r+ u
- * This file contains EDMA3 Test code.3 V6 m' G/ ~3 e! B' g6 C8 ]; T( y
- *" p9 v$ P# A6 z, f7 d" f
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( \. Y+ p5 E# h8 v
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ t g* u. ?& o. y
- * TO CHANGE.
. E$ t5 b- D& v2 R- S& w+ p - *
, a( i2 ]) H2 ~8 Y, P0 ~ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 s" H# k i/ F( X7 q! R P$ T0 V
- *
( S. s1 y2 P+ I0 a: m - * This program is free software; you can redistribute it and/or
m) ?/ E" e! A6 I# Y4 ?5 j - * modify it under the terms of the GNU General Public License as
( `% C* Y& o' E5 h2 j$ W+ o# A3 O - * published by the Free Software Foundation version 2.
$ Y4 o* K- j0 a - *
0 g- Q, }+ J# N2 k - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
$ _/ K' [8 s- V) D - * kind, whether express or implied; without even the implied warranty
) t* `1 G6 y- A% {* N. [/ Q: T - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
& W8 b6 h6 ` X( m6 @ - * GNU General Public License for more details.7 u, X" ^# t' E! v8 @
- */
4 U+ u9 R7 c7 F
( d. T8 B& c- Y- #include <linux/module.h>
* W, e* G' u9 z+ Z1 v+ B- b - #include <linux/init.h>
- R+ q$ U k+ C. c0 U" p/ W - #include <linux/errno.h> X' a ~3 B0 J3 u) \
- #include <linux/types.h>
9 c E" D) m; X4 P/ `5 Z - #include <linux/interrupt.h>7 f+ f( R i& q1 F- m$ ^* n
- #include <asm/io.h>
2 b: p+ G% {6 D( S* }' u8 T - #include <linux/moduleparam.h>
) }! e2 G! `* ^. q- L+ x4 l - #include <linux/sysctl.h>/ w! x* \ S* r7 u2 H9 q# f
- #include <linux/mm.h>( F* h5 ^1 g6 w
- #include <linux/dma-mapping.h>7 a3 t: y' Z& w8 O! [4 t* m
1 B& o5 z% D. ?" l' E: @- #include <mach/memory.h>
6 q5 Q0 x3 \$ \+ E3 O - #include <mach/hardware.h>
& ~4 ~0 E1 u, ~% e K - #include <mach/irqs.h>9 D& Q6 ?* L$ R
- #include <asm/hardware/edma.h>+ I3 p$ B3 |4 m4 _: e. H* C
# ^* i9 W x8 u, E& Q Z- #undef EDMA3_DEBUG
4 X, d, y3 T+ ~7 b - /*#define EDMA3_DEBUG*/7 }% Z! v0 K3 N2 s& \ Q
+ C1 x) Z u0 b- #ifdef EDMA3_DEBUG
, V! a- I4 K+ [8 i, l2 B+ ?% t - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): z0 H1 M: K4 q
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
% `! W2 l4 E* q; P3 V& Q ? - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
" j; \. Y3 I8 d% `1 ] - #else
" V+ x1 u( q5 ~; H - #define DMA_PRINTK( x... )
( K: u* M! A$ h - #define DMA_FN_IN; j3 u6 F+ B9 J% P- i9 |. U+ O
- #define DMA_FN_OUT) @3 `. p5 o; }7 | Q
- #endif2 a. m* c9 b! x6 y7 [: f
- ' h7 o8 X& b: z, l0 L
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
5 Q) _0 C1 x+ r# q* k% H: L - #define STATIC_SHIFT 3$ b! G% N- \" e7 o3 f9 [ y' V4 @* `
- #define TCINTEN_SHIFT 20
( t" W$ D3 G! r/ x' o - #define ITCINTEN_SHIFT 21
; v7 `: A. Y9 o7 I/ K/ ] - #define TCCHEN_SHIFT 223 |3 `, d9 M5 C8 L/ R2 b
- #define ITCCHEN_SHIFT 23
4 ~/ y3 D7 w3 s6 c( D6 s3 k
0 ]3 O- Y) V; F9 ?+ b- static volatile int irqraised1 = 0;( ^; d* L! N% ?3 v5 }5 G9 E
- static volatile int irqraised2 = 0;
5 X& r; o( c2 P) n0 u/ u
, L" s4 A4 I9 C9 N9 f$ r& K- o+ ^- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 U2 w* @* i6 A/ B1 e y( ?
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* e$ W. G6 a! H2 s" h: g1 }
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' Z. X5 q, H8 R9 Z- u: a
. v/ q" p: z) ~2 G- dma_addr_t dmaphyssrc1 = 0;
9 Y9 {4 i$ d, W. V - dma_addr_t dmaphyssrc2 = 0;
9 [% R1 }' i z$ }/ }0 ~; A ~ - dma_addr_t dmaphysdest1 = 0;
A6 v2 ^1 C! A& O - dma_addr_t dmaphysdest2 = 0;
5 a% J, y! V" A: x
/ b: U5 `: ]2 r+ Q% y2 q- char *dmabufsrc1 = NULL;0 a7 y. n6 \/ y; s4 Z( X
- char *dmabufsrc2 = NULL;
# t0 U2 C8 Z6 y8 n - char *dmabufdest1 = NULL;
- e9 ? d4 G7 k0 \- M - char *dmabufdest2 = NULL;
/ B- p$ E a" N( m: O
1 C0 _5 k, i& R# M- static int acnt = 512;
2 j2 b! M5 d6 {( X2 ]% i# T - static int bcnt = 8;
% x1 z4 D, K s! A0 V# i: W - static int ccnt = 8;/ Q b/ F2 K# Q- S6 ~
- 7 I, {4 k2 Y; x. R) J# {
- module_param(acnt, int, S_IRUGO);( M7 ?# N2 @. }
- module_param(bcnt, int, S_IRUGO);; K6 K" w( \4 N8 Q1 i
- module_param(ccnt, int, S_IRUGO);
复制代码
# @' C& V% W3 o# w2 V h
/ A1 r8 d8 c5 T8 o6 f, t 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ W: Q8 w2 k* B/ ], V+ [, b
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 v) v8 m$ Z3 @, R B, _1 \ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* m* G, F$ X) o# f0 C. N8 A. J$ \8 b! @/ {# {7 W: P
( T2 f) G- d$ n$ z3 u6 _- c
|
|