|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( g. p9 ~: g' J* y) n- @+ X$ H
- [code]EDMA sample test application
2 Q6 ^+ |; [9 s2 _ - /*
p- `+ E7 U Q/ z; U- z - * edma_test.c
8 b& W, D4 ?1 l1 Z' P6 k - *
* j. q1 @+ L' D5 r9 b5 Q - * brief EDMA3 Test Application, X4 A4 M; g3 ^* i. M% Z9 k: e
- *6 \+ S9 T! Q- Z- `# _! I& R( ^4 Q6 q
- * This file contains EDMA3 Test code.& r+ Z# V8 ]8 }; d
- *
; E: M- R* h% v4 D; p! w - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" |4 R+ A# {) n
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
# k5 d* Y- t8 K) A, N* l ` - * TO CHANGE.
8 n& Y2 X, [4 D$ a: O - *# H8 w+ f; l, D* O
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 g) N X9 ^# P; `/ O8 K9 X
- ** L3 F- p t; ~# \
- * This program is free software; you can redistribute it and/or. y# A& t2 X) T/ p' w
- * modify it under the terms of the GNU General Public License as4 {6 _% L5 S& i; G
- * published by the Free Software Foundation version 2./ N) v: w# u+ j+ ?/ O
- *
0 `) I$ z( `; h @! v3 \+ }7 C6 c - * This program is distributed "as is" WITHOUT ANY WARRANTY of any( Y3 @- q* C1 {
- * kind, whether express or implied; without even the implied warranty
! }! E8 f& V/ U6 } - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# u/ F6 \, x: u! J - * GNU General Public License for more details.
) ^! x- Q- X. j8 U- S% E8 S - */
( b$ d" c3 N0 w9 i# m3 o3 Y - . d& _( d) |$ n7 p. ~7 u
- #include <linux/module.h>: q3 l$ d" D5 E: e0 w. R
- #include <linux/init.h>8 e @4 }4 q% y1 N1 Z) D3 S6 q0 w
- #include <linux/errno.h>
8 @2 E% ^1 p" A+ A, J' j2 @ - #include <linux/types.h>
0 m; c; U! H) Y/ G; ] - #include <linux/interrupt.h>
2 e2 D( F# o9 x! ~2 r# s( q - #include <asm/io.h>9 L9 y$ s2 K# g( C7 m
- #include <linux/moduleparam.h>; h( d( D) s9 u
- #include <linux/sysctl.h>4 B+ q& ?1 _# a. b3 P
- #include <linux/mm.h>
V/ L0 C% B( x8 G8 m+ ~3 n - #include <linux/dma-mapping.h>' z- F `3 Y: ~" m8 i7 y
9 W1 Q6 _# u X G- #include <mach/memory.h>5 P4 o2 M& u( h7 ^
- #include <mach/hardware.h>
* t3 o. \: B) _1 z5 ^8 g$ r0 r- a - #include <mach/irqs.h>
" p& B) x* m5 t - #include <asm/hardware/edma.h>
% Q$ _) w1 o' e) U& \ - / G: q* y3 m o3 Q4 ~0 J* u" j+ S6 t. \
- #undef EDMA3_DEBUG9 V1 t& R7 q+ x0 s" _
- /*#define EDMA3_DEBUG*/
2 g$ W O$ h1 o
: ?& f$ f5 m* h+ i- #ifdef EDMA3_DEBUG8 A- H3 Q6 l$ h: G+ t% `
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
2 g2 m5 v( P4 y3 l$ v" q; i5 d) H - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% l6 C) m& M. D: E- e
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
" N" a; u9 E4 L2 A( H - #else8 t4 `5 O# C: N. X0 ?
- #define DMA_PRINTK( x... )
# v* N6 S3 i7 \: }' [, s - #define DMA_FN_IN& F M7 _' K8 s" G/ y
- #define DMA_FN_OUT& X) }2 {* N+ ~8 i# {- N( B
- #endif/ G0 U" c# P6 h+ M1 Q* L
- 7 C! b6 u/ h% K
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
$ Y: w# Z. ?" Z" o& Z - #define STATIC_SHIFT 3
! s# p) `; ]" N" ^; n, }1 H - #define TCINTEN_SHIFT 20
& z6 i2 B( a) B* }' P' V - #define ITCINTEN_SHIFT 21
. {% M6 a5 P. @ - #define TCCHEN_SHIFT 22
: i, Q v3 e7 f2 N3 ` - #define ITCCHEN_SHIFT 23
, |( m2 E0 o* g+ Z# E2 d k
+ \0 M: o$ a7 j- j, N- static volatile int irqraised1 = 0;
& y! |, A8 ]$ K7 x# U - static volatile int irqraised2 = 0;
$ K4 D q7 s$ k) u% x2 @- ~7 F- J
4 a6 `) K4 q: i5 _& C$ c! o; X- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# V0 k4 S$ C+ J6 e
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& b0 J! A* g. V2 `# H5 J% Z( y0 I9 k
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ d4 z' y# }6 x. } @4 A
; s5 L) ^! |$ d" H5 H$ l- dma_addr_t dmaphyssrc1 = 0;( b G1 S, w( T2 H/ c* b$ ?
- dma_addr_t dmaphyssrc2 = 0;6 ?( t: ?4 M9 x8 Z
- dma_addr_t dmaphysdest1 = 0;
8 Q# g4 Z8 O* _6 E - dma_addr_t dmaphysdest2 = 0;! Q! B! }8 c7 x4 w
( s) w) `! ^/ A+ e+ ]- U. d, f- g: T- char *dmabufsrc1 = NULL;) b* w- o' f" E, s% @" \. _
- char *dmabufsrc2 = NULL;. w% [6 R4 F0 j+ H( G$ m: S
- char *dmabufdest1 = NULL;# D" t2 e5 b9 A5 T
- char *dmabufdest2 = NULL;' _+ Q( I. X, S: @
9 f: `; |2 S4 a0 t% M: w) T- static int acnt = 512;
" ~" C0 k0 H4 v! X - static int bcnt = 8;$ R7 I" R/ Z1 m3 }( n
- static int ccnt = 8;- `6 C3 S5 b$ n; E
J" x4 e" p* g0 T8 D% u1 i. }- module_param(acnt, int, S_IRUGO);
0 K4 D- @; w2 u& R - module_param(bcnt, int, S_IRUGO);4 p$ s7 B( F9 E. A2 Y! \; t
- module_param(ccnt, int, S_IRUGO);
复制代码 , `" U6 ]! T# j7 w
4 d$ N$ H3 {4 W 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. d: V4 v5 [* b' qarm-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 c9 i0 K, o) S7 Y: m 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- c: w6 O+ ?4 m$ _( }) s' _+ @. i; i; K
- @8 \7 @% `' l! v5 ~
|
|