|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& U9 u1 g2 ~; U- [code]EDMA sample test application
, a+ o; @0 A) l6 \+ a4 e! B/ l - /*
+ ]- s; k) E! X* [ - * edma_test.c: y% k9 ~/ m+ {/ K
- *7 y- j0 P% J% J8 Z* h
- * brief EDMA3 Test Application
& i1 i1 j2 q. ^/ t/ p$ u) u - *1 J, D0 K6 ?& g( f& h& L( B3 C
- * This file contains EDMA3 Test code.
( u6 e* B# o6 H( \9 Y - *$ u& U- X$ Q/ @! o* Z3 \7 H
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE W" S: z. u- G, {) j2 [
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
# E7 q& n* S3 ^; e: x% H) _ - * TO CHANGE.1 b3 J2 i# V6 \1 C" h
- *; E+ B; a! b9 A% ]
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( p, n1 d6 {7 g0 `! i z0 [" u
- *1 C# v" v: m- G! r# A+ J
- * This program is free software; you can redistribute it and/or# M: r' e0 f) e% l# R' P" b' W" }" N
- * modify it under the terms of the GNU General Public License as
: W) J5 {6 n6 W$ h8 [/ t - * published by the Free Software Foundation version 2.3 t# Y: {7 [/ i
- *6 {# ?1 @$ j7 i* a( c
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 l% a& f( Y. a5 b8 J6 S! ^! |
- * kind, whether express or implied; without even the implied warranty4 w& D: d0 C9 V* w) r y2 D
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the, z- W& J' G5 S, k; r1 y; C* [
- * GNU General Public License for more details.- L9 ], t% T6 E4 ]) Q8 t8 m( @
- */+ \$ M% T' g- F' |/ v
" Z" G" q% v- z0 h7 ]& P# t% p1 k; K- #include <linux/module.h>2 _0 P$ [% ^# G1 x& t1 n
- #include <linux/init.h>
! W* {& L9 a2 @) Y - #include <linux/errno.h>) E; [& t: |- \8 v7 p
- #include <linux/types.h>
* E$ \: i; O+ y* a" z6 \ - #include <linux/interrupt.h>2 @1 m9 A& }8 j* B T, L/ e4 F' Q7 Z
- #include <asm/io.h>
" M) P# X' F: E0 G j# D) q - #include <linux/moduleparam.h>7 m8 b9 g' G6 K( S$ @9 Z
- #include <linux/sysctl.h>
: s9 K1 d5 n: m+ |/ @0 D( e4 u$ M - #include <linux/mm.h>
* ~" i+ u/ }! ^! ~ - #include <linux/dma-mapping.h>9 i+ S$ N4 v8 H
- # w3 a- c: B7 ]1 {8 U
- #include <mach/memory.h>" m6 S: F7 ?! q% m! ]
- #include <mach/hardware.h>
: I& p) j4 a5 y - #include <mach/irqs.h>
& I, H! L9 R' f6 ^& S1 L# m9 I - #include <asm/hardware/edma.h>6 j) l, j6 }" U( P) G
2 ]2 K8 y2 m( r$ ]8 f- #undef EDMA3_DEBUG% R2 E2 p; B. L6 Z3 [! M; Z
- /*#define EDMA3_DEBUG*/
/ O, \3 w& d6 n5 T4 ]# S- c) ^, U& [- Q - ( y' A! Y- g. L2 X; |, A- c' b1 `
- #ifdef EDMA3_DEBUG. v: R+ q5 o# Z1 v+ e/ t0 {
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
/ S: _# {+ Y! Q# q A5 V: t1 e - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
' G0 D9 a' X% d+ ~- G - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# Z4 x/ v- ^1 P- R* k1 C
- #else
" _+ {5 e9 ~- x5 A- m - #define DMA_PRINTK( x... )6 L4 v! }- S* [9 |% H
- #define DMA_FN_IN! L; U7 y$ v# R8 @* o
- #define DMA_FN_OUT
3 i1 |. y( s- e - #endif
: s( W* ~% G& U/ {! B
v$ K6 D& W( O, n; }4 T3 o/ j. {- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
* W6 s) q& b# l6 H+ V+ i! D - #define STATIC_SHIFT 38 j- p+ I, k: L7 Y' p: T
- #define TCINTEN_SHIFT 20
. o0 h4 b N- F0 E2 `# g% M - #define ITCINTEN_SHIFT 21
/ H- c) I+ S9 N3 t. ~6 O$ Y - #define TCCHEN_SHIFT 22# z2 m3 {- V7 M% d+ q3 l3 J
- #define ITCCHEN_SHIFT 23
+ s0 V3 S4 T, S0 |$ d - 9 ~ U, ^+ a/ h+ p2 N
- static volatile int irqraised1 = 0;7 E( A# I2 v1 Z2 P* `3 ?. L/ _
- static volatile int irqraised2 = 0;& k) X) t1 \" Q9 V/ Z. z h; ?
- ; F4 ^2 E' k4 I' g& ?5 V% {
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& ? Y9 ]3 \$ g' R4 s, o2 k - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 f' s: C, i4 L- _ H* w# H
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: h7 p2 q$ R: n Q - - H: {5 I$ I9 V1 ~2 O) y) l
- dma_addr_t dmaphyssrc1 = 0;/ A& k4 w' r$ H, N: p
- dma_addr_t dmaphyssrc2 = 0;1 z% ^9 k6 P+ ]- s
- dma_addr_t dmaphysdest1 = 0;+ M7 o, |& b# [5 S
- dma_addr_t dmaphysdest2 = 0;5 _1 [3 Y2 O3 G1 b( P
# p* Q$ ~& ?& Y; c9 A" o- char *dmabufsrc1 = NULL;
* a! _7 F2 ~% O9 X7 l: j! ` - char *dmabufsrc2 = NULL; D% j9 g3 M2 U8 N5 Z" E
- char *dmabufdest1 = NULL;5 X( B. z! ]7 N
- char *dmabufdest2 = NULL;8 f$ v0 y: j" y8 p, V5 ~
- 3 H* R. ]9 F7 l' M; q
- static int acnt = 512;( J% l# c) V' u0 m5 Q" g
- static int bcnt = 8;
2 z) P2 o W- o- p - static int ccnt = 8;
) C7 X! X: q* s
$ b# L u- z, R W; {# K- module_param(acnt, int, S_IRUGO);
8 b7 B Z; P8 z% s% X2 i7 m) Q - module_param(bcnt, int, S_IRUGO);
7 z, ^1 i9 l. q" S q: Z9 f - module_param(ccnt, int, S_IRUGO);
复制代码 * i3 y) }: ^9 p: o I! y
- M! w9 t9 m; |# z% z) K0 A& m& P
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, r: [0 o. S [( x) X% X
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 Q) c9 i* \& g! l* Y
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( C) N9 V- N! d: _8 J: }/ A5 a5 L
6 t$ l) w' D5 V! K |
|