|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' }/ @9 ]1 j+ @4 A- [code]EDMA sample test application5 Q5 e* `1 t8 T/ U g6 K
- /*
8 F+ R/ F6 A- ~7 i, r9 \2 t - * edma_test.c9 m, c3 E$ r4 C0 W7 ?
- *, k5 ]8 Y! z9 P( S1 A& K3 o
- * brief EDMA3 Test Application& @* N4 W4 V9 v$ \9 T
- *
( j- c! a! j# t - * This file contains EDMA3 Test code.
+ \' T! a! F: M/ N' }/ B* o! l - *, P6 O, n% L7 O9 O8 \, K' f
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 a3 H5 G& i) F9 A4 b% v0 C
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. T7 ^6 `2 W/ N0 f
- * TO CHANGE.1 S4 q t: h$ D
- *
+ y: q, u G5 K6 X' M4 a - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
; {3 u5 Z. f/ {) R" l5 F - *# k7 V& U2 u% v* g+ ?
- * This program is free software; you can redistribute it and/or
: b; p, ^9 W- n5 ? - * modify it under the terms of the GNU General Public License as
- [7 K/ Q9 K0 d' C3 ^ - * published by the Free Software Foundation version 2.6 g( @( o& e3 F I/ v! g
- *
6 e1 t' R R" m6 L8 ? - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
/ g9 q, G( N# w- m4 M0 Z% X - * kind, whether express or implied; without even the implied warranty
7 C$ A; e" J1 Q" ]$ z! c - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
, A9 q: h& o% w J - * GNU General Public License for more details.
) Z1 H. M* X n& U7 w7 ` - */" y2 h& Y, H, `# ?/ N/ ^
- U8 e! L6 l1 ~. ?* e- #include <linux/module.h>
, [9 r1 w3 H9 b/ D4 k% b - #include <linux/init.h>. q8 P9 h+ d W% @: J/ S! S
- #include <linux/errno.h>
+ @8 {6 i% T. ? - #include <linux/types.h>0 j; F) |- j8 T1 O
- #include <linux/interrupt.h>
- m7 Z( v; y) E4 v* a$ t - #include <asm/io.h>0 m' `) q4 M+ p0 S2 j4 M
- #include <linux/moduleparam.h>% ~" [/ }1 A- W J0 B- i
- #include <linux/sysctl.h>- p$ ?' A4 e" [ l- j$ J& w" `5 P
- #include <linux/mm.h>( R, W0 I) W* {/ {5 @+ j
- #include <linux/dma-mapping.h>
( @5 u; e6 }/ x* ?3 D+ c8 n9 @
* M+ h2 E0 G% I2 q& J1 I8 q- #include <mach/memory.h>
3 e. E$ |8 h$ D( P8 C( q - #include <mach/hardware.h>% o) u8 m, _2 B9 _
- #include <mach/irqs.h>
- r2 r' N. p' V+ z3 m; f - #include <asm/hardware/edma.h>' O+ ?+ V8 W7 h- o5 X
- Y7 n2 J4 c0 _0 T- #undef EDMA3_DEBUG
9 B+ z% @$ C% I! G/ F L - /*#define EDMA3_DEBUG*/
. V( c0 Z% t) U# x0 n6 R
/ h& U$ c9 Z( b; A2 c8 D4 n/ I- #ifdef EDMA3_DEBUG
# a. H: ~/ c6 C, ? - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# C# a+ h% A7 |/ j( @8 A2 c e7 u
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% ? C% b* \+ F1 w
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
! E) e6 K+ X) B0 Q/ O4 C - #else3 q7 k/ S8 K+ p) C! n& S' L8 N
- #define DMA_PRINTK( x... )# h$ N& `% v( @
- #define DMA_FN_IN* i/ d* L% f2 i6 N0 _
- #define DMA_FN_OUT
8 l+ U& U9 g$ s' L1 T7 O# @ - #endif2 q, f/ B) D/ K! R, s* ?
- , x3 b! `) _( g* K+ x/ o
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)1 M1 R1 } H) N6 z6 {
- #define STATIC_SHIFT 3
1 _% O* |# ~1 A" M" T. T - #define TCINTEN_SHIFT 20+ @6 |2 D8 I( @, t2 K; t5 q
- #define ITCINTEN_SHIFT 21
# d( E' A: I6 s - #define TCCHEN_SHIFT 220 K. `8 i) G2 h
- #define ITCCHEN_SHIFT 23+ t% [8 D! s/ a6 A5 a5 O9 G" a
$ i' a/ L" M: D g1 \" X( J0 t1 `- static volatile int irqraised1 = 0;- G& o! |3 G% F1 @" @( F
- static volatile int irqraised2 = 0;2 I+ O' ~7 A: P' J! P* O" _3 Y$ B4 c
5 S/ d- L4 h5 O: [, j" y& N- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 Y5 K; B$ `7 U1 z! y @6 D - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 b' i( Q* w7 ~. q5 `$ O" r - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! [. F+ {9 K6 y }* }& c* _& f
1 @4 Z7 _; F/ y% n$ L3 H- dma_addr_t dmaphyssrc1 = 0;
4 k- ~ ^4 e, T - dma_addr_t dmaphyssrc2 = 0;
; b! t, w" i: p& S/ _ - dma_addr_t dmaphysdest1 = 0;( d2 C# \# G& Y2 _
- dma_addr_t dmaphysdest2 = 0;' g6 ^- d/ H1 m" Z5 d
" d; s+ z/ `1 W- char *dmabufsrc1 = NULL;
A$ o$ V2 @, a4 q. f - char *dmabufsrc2 = NULL;7 Q( l: O+ n+ _; e* H) ?
- char *dmabufdest1 = NULL;: i/ u; o6 S# k9 K7 |% n) s) n
- char *dmabufdest2 = NULL;$ V7 x G: I- a# R/ P* Z* o1 o
- # K+ a. i7 c$ O
- static int acnt = 512;
0 \4 {/ y% `' j3 x - static int bcnt = 8;( y& n, A/ N* Y) b7 \& H
- static int ccnt = 8;
! @; F6 ~& @' @8 k2 H
- d2 a$ `5 s: S- `$ L m; s- module_param(acnt, int, S_IRUGO);, ?1 ~8 \3 C7 @+ V8 V8 N1 d8 w" c
- module_param(bcnt, int, S_IRUGO);7 \. `7 O" p4 ]! M) @' E
- module_param(ccnt, int, S_IRUGO);
复制代码
* {/ @1 J) a9 ]- b0 d' w8 e. Z
& @8 T' t: ?1 l: W% H 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% w; h! s; ^$ M0 T# M
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
: G* E% n" \3 [ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* m' q9 Q1 D2 f# C4 |
- o1 W+ V5 r- t- Y0 N! j5 f0 V6 b1 m3 G0 [ f6 G1 [. I: {6 ~
|
|