|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : \8 V: D; D9 A2 a8 K( H
- [code]EDMA sample test application
& ?: ^4 ~! A8 | - /*; Y4 `5 q" o; c
- * edma_test.c
; |% k/ O2 R8 w3 `7 t, z9 i8 I - *
. Z4 f* @4 [9 }# r$ } - * brief EDMA3 Test Application% y2 s- f+ m1 i- o
- *9 d: B" z( c1 @+ W1 B- i7 T
- * This file contains EDMA3 Test code./ o5 k6 T/ G6 D
- *! I& [. T6 v2 [% u7 e/ v5 Y
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
T( X* z' p( H, P& p - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
# V* k% ?* J: L4 d. C' c" O8 g - * TO CHANGE.
! S7 t7 f; |& A) Q q8 m* N* ^ - *8 c; A7 R' q3 u5 C9 A
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
& X' Z2 k6 l0 X - *
6 ^! w% {" d' ]0 f; g# T( P! O - * This program is free software; you can redistribute it and/or4 P2 U- Z$ l3 N: e( P( I
- * modify it under the terms of the GNU General Public License as- |7 }5 J1 z1 E" T
- * published by the Free Software Foundation version 2.
1 }0 F* X7 ~* [5 k P) U6 Q( Y# z: R; { - *# f; {9 w! n$ ?1 E; p5 @2 k0 m
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 V0 v E( j/ `# H2 ?$ ?: r
- * kind, whether express or implied; without even the implied warranty0 D3 O! v& m5 k" k" v" I4 v
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ g# i/ R& T# L" Q, x; d
- * GNU General Public License for more details.4 }( L# l& ~5 ?2 @$ u
- */
n; E) l% L% [" N
. h) ~ S' n0 b# [- #include <linux/module.h>
* m& M7 x$ j& h) ^: W+ s3 v - #include <linux/init.h>6 u6 {* L1 J; y1 J u5 v
- #include <linux/errno.h>
- T ?/ O% o) i) L+ g: `1 F - #include <linux/types.h>
: U4 a( p4 \! S3 J+ g+ q - #include <linux/interrupt.h>
# ]( C; w" L2 ?8 ]5 c O - #include <asm/io.h>9 |( W ~! t/ l X$ _$ M. ?
- #include <linux/moduleparam.h>0 y0 M/ v; o% L$ t/ Q
- #include <linux/sysctl.h>/ {( K7 ]6 p6 \+ s) [" i" `
- #include <linux/mm.h>
4 x+ g+ [$ J/ M" z- b$ J - #include <linux/dma-mapping.h>
4 M+ i/ T9 ^( H! @1 _7 s5 T/ n1 q/ F - 7 k+ d: B; a( z) b' p
- #include <mach/memory.h> A7 o3 t n. [) B% ^; q
- #include <mach/hardware.h>. s! \4 H- s, {
- #include <mach/irqs.h>" ]0 A3 Q2 P1 c8 v; D$ c- b9 N
- #include <asm/hardware/edma.h>
. j" {4 u- N' R8 s! k& Q$ q- x
2 J) f( M8 g' u- p; q8 I: I- #undef EDMA3_DEBUG
2 E1 [+ ]4 H: A7 i5 R; y: { - /*#define EDMA3_DEBUG*/; g0 J7 W- c; O5 p' T; J' u: A
- 1 v% M& R+ F h% U
- #ifdef EDMA3_DEBUG j5 {& k# {" b4 l+ X% h
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), W1 Y- _0 J" @( L
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& }* `/ M5 ~7 [1 @% b7 i! B
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): {6 I$ j' y* H2 d! \
- #else2 v" u' }4 q z ]+ L- F
- #define DMA_PRINTK( x... )5 |% }4 x' M! X# y
- #define DMA_FN_IN
; r" {3 J, r' f0 M - #define DMA_FN_OUT% z$ ]- A& ]4 D8 b% q0 O
- #endif, G* a% _. s: J, s; ~7 {
1 O9 |# h+ \) R( }3 x- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
, o7 i3 |: ~5 j. N3 { - #define STATIC_SHIFT 3* U Q8 e9 V7 b( ~
- #define TCINTEN_SHIFT 20
& o' ?5 S) U( z/ X" C - #define ITCINTEN_SHIFT 21
6 a+ s, G1 a/ w( m - #define TCCHEN_SHIFT 22
- y$ w3 C- ^! t5 m. ^ - #define ITCCHEN_SHIFT 23
4 Z+ \' w* i3 _" ^" @( A
N/ q$ `( {# E* ~- static volatile int irqraised1 = 0;8 w% C K: ^ N8 i. o5 {
- static volatile int irqraised2 = 0;
! N! r3 p. l+ q* N' z" C8 B
7 r( c5 L- S$ }; S) a5 U- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ n0 b! L2 x X- Z* b0 U. ~1 l, F3 X - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 ?2 \$ `' s* J; S - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& n% a6 A2 r* o( _% }3 ^3 z
$ L8 W/ h2 w' P- dma_addr_t dmaphyssrc1 = 0;4 X) q4 C: w( }" j( |
- dma_addr_t dmaphyssrc2 = 0;2 f: J' [( x0 I! I0 D! W0 M
- dma_addr_t dmaphysdest1 = 0;
/ @% K0 \5 G6 ] d, j - dma_addr_t dmaphysdest2 = 0;
; I/ u7 A" |$ p: M0 G4 T - . ^0 h" T( a% i
- char *dmabufsrc1 = NULL;( R5 X8 A! F$ G
- char *dmabufsrc2 = NULL;" a) L6 C: }8 ^3 z$ W
- char *dmabufdest1 = NULL;
! U6 w; I1 X: E7 E7 c - char *dmabufdest2 = NULL;
1 N% ~& Q" B; H" t- Y
8 }9 F5 F) W1 q# v6 h- static int acnt = 512;' J+ P; o- C5 j4 J) T
- static int bcnt = 8;
3 a+ T2 R7 H- a, a# I! \ - static int ccnt = 8;
7 ?5 I7 C$ K7 p( S! V
7 ]6 P6 s0 @ x" M3 e- module_param(acnt, int, S_IRUGO);, Q7 v/ o' t; E: \2 @2 H( E3 b
- module_param(bcnt, int, S_IRUGO);; w F) J# j6 O) E1 G- ?
- module_param(ccnt, int, S_IRUGO);
复制代码
2 ~. R) |& H2 J) f: a0 v8 x p/ p8 x/ D7 ?+ [% _9 j: m0 W1 C
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# w$ ?: o- B0 }) z, Carm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# E/ o) ~) V% i7 @5 Q 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 g4 O- q4 |) \* U7 ?2 e
+ k8 P5 E A2 V ]+ U' C4 I: Y" @0 f+ l1 c! [* A
|
|