|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. y& n9 o4 [5 \$ L! o0 N, J$ j- [code]EDMA sample test application2 \5 q: ?! @+ v) Y( i B8 O3 O& F
- /*
0 P9 j5 m+ ]! A1 t# y S) S7 I - * edma_test.c
6 w; o# `6 v/ O. |, j5 Z - *
9 T& k" s; c0 H+ h v8 E - * brief EDMA3 Test Application/ n* [8 ?* w) t- C( M+ E: _8 @
- *
' ?0 B% U3 |4 X; g( O& D - * This file contains EDMA3 Test code.
( X1 E& e# j" O) D5 P7 R" }" x - *0 L2 m+ G R% ^+ d Z! w
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 {$ P2 V( h# g" ]' o, n9 n
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
, w7 t, d" P+ ~+ { - * TO CHANGE.; X* t6 e" L. d& A2 u; i: J& t! N
- *8 y) N& A& l* g/ E' G9 @
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( o- ^" k8 L! V$ P0 l V
- *8 F$ s) f7 S' R+ X
- * This program is free software; you can redistribute it and/or
4 U( g, z, b: L& d; r2 k0 ~" P - * modify it under the terms of the GNU General Public License as
2 N C- F4 z( Y5 U - * published by the Free Software Foundation version 2.- R; t# f5 ]; V+ N5 a
- *9 @/ a& H4 u: m3 F$ ]/ ]/ @* R
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any: |( i8 }! {# ?" J; ?2 X% ~ ?& B
- * kind, whether express or implied; without even the implied warranty
' x+ Z/ Z$ }9 l2 ` I6 H - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the; X% l4 N) {7 O# Y8 \
- * GNU General Public License for more details.: c1 R5 x& U! c; @
- */
3 }! r/ L4 E7 v0 T8 J
9 q0 V* m m6 P" q/ Y+ D- #include <linux/module.h>; I" @& T4 Q# Y( g v- Q7 e
- #include <linux/init.h>
' z% D4 S' [9 U' L" e - #include <linux/errno.h>
9 Q' {4 S: s5 N' f- I& p) }2 z% W! q* t - #include <linux/types.h>& c2 W% g8 Y0 f+ ~; e
- #include <linux/interrupt.h>0 M# T: q/ N( H% V9 d6 i& Z
- #include <asm/io.h> D' o5 Q! F# ], h" g c
- #include <linux/moduleparam.h>
/ p) T5 ]- D C. F; A - #include <linux/sysctl.h>
" ]6 \. R. k p% K D - #include <linux/mm.h>7 v' v) c: \' e* ]' D, A+ x8 U
- #include <linux/dma-mapping.h>
9 E2 j6 _& g, p
+ p) ~7 z( w H0 L( ^- #include <mach/memory.h>" n: U* A4 F& o" d' g( B) g
- #include <mach/hardware.h>
3 D0 A0 n$ u! J5 `& B( Q, G% a5 A" V - #include <mach/irqs.h>. y* u9 }0 ^; P. T @ L- U
- #include <asm/hardware/edma.h>
8 ?5 {3 P$ P( ^: s. { - . q$ H+ r& V' l" B2 u$ z
- #undef EDMA3_DEBUG
6 Y* O* Q8 ?( [" v& I - /*#define EDMA3_DEBUG*/ n1 ~& Y1 j+ D: u+ j
- ' o+ s T$ U+ F" U% G
- #ifdef EDMA3_DEBUG
+ n& ^4 `: _9 ~6 W4 X - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
/ f) Q* C1 Y& Y* O; [" g8 U r0 y - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 K0 S) z& t- m+ ^# K" R
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
. `" w1 Q( m6 _ j4 u9 j4 f0 f - #else. M; W3 S2 H2 G. n
- #define DMA_PRINTK( x... )
/ }6 E- w& F- ^ - #define DMA_FN_IN; U r# l! p9 S5 d- N
- #define DMA_FN_OUT
3 M, f8 i8 z h/ m5 ]) c b7 Z+ g - #endif' x- V+ [* {$ \* E- q3 ~6 G" V: i
- w: V- n8 q! }) G4 x
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)2 T( E8 r7 r$ k4 N4 N" ^8 x
- #define STATIC_SHIFT 3" @8 }8 x, E7 ~! l: w
- #define TCINTEN_SHIFT 20
( }; z9 L/ f: w1 w2 N9 k0 V - #define ITCINTEN_SHIFT 21; Z7 G* A& f$ k5 Q
- #define TCCHEN_SHIFT 22
$ T3 N9 z M7 {9 `5 [ - #define ITCCHEN_SHIFT 23
& n% K; [2 c; b+ a" {
! n' g$ t/ f, o( c$ z+ f- static volatile int irqraised1 = 0;0 }1 |5 k- j5 v( T6 i# ?# I% V. ]
- static volatile int irqraised2 = 0;
- }5 r, [& [, J( e% ]6 F5 F( p0 P
; D, r# Q; D- n' j3 k3 Y9 [; i4 u" Y7 _- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 k. G; a! M0 l: g - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. S# k3 B2 V7 a- Z1 n. t6 V - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' b" `* [* W# m9 W5 u' `
U5 @) v. B5 g" ?) U- dma_addr_t dmaphyssrc1 = 0;
/ Z/ ^. z# Y; r! d: }4 g* j( v - dma_addr_t dmaphyssrc2 = 0;" M% ^2 M# ^0 ^, F: C0 a8 A
- dma_addr_t dmaphysdest1 = 0;4 |1 i" n ]# P$ Z; b7 h. {8 W) b
- dma_addr_t dmaphysdest2 = 0;) ]3 a- ?5 d8 b9 X- R
0 w5 j- c) u& G) F- char *dmabufsrc1 = NULL;4 v" _( ^ y( x7 p; J
- char *dmabufsrc2 = NULL;& a- O E: G+ Y- Z" @
- char *dmabufdest1 = NULL;
# l4 l. b1 c4 g6 R5 M7 [3 C8 ` - char *dmabufdest2 = NULL;
- A6 i( @7 T Q% {4 ?" X: x; V7 A2 u
3 j6 j" @/ d9 J% K. H- static int acnt = 512;2 ~" d. B. |6 q E5 z/ c1 M
- static int bcnt = 8;& e E1 o3 P* U+ u+ J
- static int ccnt = 8;) e' \& L4 o: X8 _0 m! E
- 7 r, A$ u5 Y' m) V( E2 M0 o, v
- module_param(acnt, int, S_IRUGO);9 X% |6 n# }; r4 }
- module_param(bcnt, int, S_IRUGO);
6 v* v. R$ z7 E$ ? - module_param(ccnt, int, S_IRUGO);
复制代码 # O; l# g7 D/ }$ F
* W7 F" ?2 Y8 Z3 a1 V* ^ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" o+ l) ^' j+ K0 {1 K
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: c6 B4 K: F; _8 L+ {. L* I. a5 A
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- K% g, c; _2 ^+ }3 H
& P, K" F8 b, v8 E3 [9 o, \! O
7 C7 o' g( [! C& t* S$ Z }
|
|