|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. ]" G5 }. o0 ?- O- [code]EDMA sample test application. x! e" q* u, g7 F7 J4 w3 e+ A
- /*
) }, _9 m2 m2 q/ G6 E! k1 q - * edma_test.c
! B* @9 v1 x7 T, b2 G+ Q - *- d0 n; n# P+ j. e2 T
- * brief EDMA3 Test Application
Z8 S" P0 W" J. |5 ` - *! [& I/ D( v1 g8 R9 b
- * This file contains EDMA3 Test code.2 H; k5 q4 p& f2 l5 f) r; f7 r
- *+ }4 E8 I+ \: S" D1 o- a
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE c, f; b9 a7 j0 ?- ~
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* d6 X. I: \% o+ M; f
- * TO CHANGE.
+ H& \ V* w1 I - *9 r) |7 o& L; H' {- }6 c* S/ p
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
. t/ F' k$ U( k( m; j - *$ u, w. W( u* }; ]$ t
- * This program is free software; you can redistribute it and/or, `1 ?1 q0 ]) ]9 |( H! e) N& _5 r
- * modify it under the terms of the GNU General Public License as
! i0 R+ K) |1 {8 G - * published by the Free Software Foundation version 2.1 F( C2 l; t' C3 R$ _) B. u: W
- *
/ B' M h2 u) X: w& X4 q+ I8 ]1 s - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
* G1 F6 ]( N# j+ j- i! ]$ A - * kind, whether express or implied; without even the implied warranty
! s1 y+ x K' p( {4 S5 t2 p - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the" v6 O7 j: S1 B9 s
- * GNU General Public License for more details.$ T( l/ n# z# C6 }* u" {6 Q
- */# D. X4 v& n) y( m
8 v* q" G9 Y. q7 {! B4 c% y- #include <linux/module.h>
7 B3 s9 P) B, B0 ^+ p1 n - #include <linux/init.h>
+ j; u8 v( H/ z# e6 B - #include <linux/errno.h>) Y9 Z6 w, R7 I2 V, d0 P7 Q
- #include <linux/types.h>/ q7 Z3 B k/ ]) W4 z0 ]
- #include <linux/interrupt.h>
; d8 ~* P4 S2 Q - #include <asm/io.h>; p/ M6 Q! {( L+ ]/ d
- #include <linux/moduleparam.h>( o/ w' A: c% ]3 l% x
- #include <linux/sysctl.h>0 D, D) {" x0 ]5 g6 ^3 s% K
- #include <linux/mm.h>% H; G: ?+ X, ~7 |' V
- #include <linux/dma-mapping.h>& q& T7 T3 h# e' y1 a$ t( m( Q
}" r( k+ g @" b" }. t- #include <mach/memory.h>
. @: q7 L! a O* k' }, t' Z# H; k - #include <mach/hardware.h>
+ j+ M/ L# ]$ ~' p( _ - #include <mach/irqs.h>- B5 b0 |/ [4 l( i
- #include <asm/hardware/edma.h>! |) m, | k8 O+ i. l! R+ W- Y
- 7 s8 k; Y6 p/ S& F; G9 v1 J, `, p
- #undef EDMA3_DEBUG
B/ [1 } v9 l - /*#define EDMA3_DEBUG*/" t9 x4 X! O/ j8 @) q
- 1 \0 {. C; w7 H/ t6 L; s
- #ifdef EDMA3_DEBUG x/ d% B1 }9 J# ], z4 `
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
0 ^, O/ L* l- E6 } - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
! _8 }: D+ H/ m# {" _7 b2 d9 B, y - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
' x* G1 F, E8 v - #else
# I, {; w* L3 n - #define DMA_PRINTK( x... )
5 [+ _$ |, l: q: }! L! S - #define DMA_FN_IN2 U1 z ~! _& o& S+ z" g
- #define DMA_FN_OUT1 \, L2 H% o1 o
- #endif8 g- f. O; l2 d, M' K
- ! K# Z1 Z. H2 e# F2 Q, r
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
7 U: K/ J& k7 K6 |$ [ - #define STATIC_SHIFT 31 _1 A) N* D3 d# _3 A$ C+ Z
- #define TCINTEN_SHIFT 203 F. ^' y$ a/ o% C* \; G# a
- #define ITCINTEN_SHIFT 21
$ h3 e! B- [) K# \7 O - #define TCCHEN_SHIFT 22
. j+ x% P+ c/ F" A - #define ITCCHEN_SHIFT 23
3 @, c4 }' m5 h5 @4 V/ w. o
$ d8 r( n. f5 |6 M6 B2 h! f' M0 ~3 D- static volatile int irqraised1 = 0;
8 t* m% B5 D" { - static volatile int irqraised2 = 0;: ~2 [/ y7 S3 X5 v& S
& |! }! ^2 `; q& T4 Y5 d& o- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" u! k2 H; {) p
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ G/ |) A" _+ Y0 p5 _
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. g$ T* i K7 l: N: x
- + s/ a: o! x& ^2 e
- dma_addr_t dmaphyssrc1 = 0;( ]: B$ o$ {$ z/ i; R
- dma_addr_t dmaphyssrc2 = 0;
8 w# v- t# R5 |) e' ` - dma_addr_t dmaphysdest1 = 0;
, d. \' _" T% M3 N" P; y - dma_addr_t dmaphysdest2 = 0;" h4 U8 q. Z5 o% J0 ~
- & o9 u+ b, c; F$ R2 i0 j
- char *dmabufsrc1 = NULL;
2 B6 k7 `( P9 T" k1 i - char *dmabufsrc2 = NULL;
" W/ }) \5 I1 w8 a( p - char *dmabufdest1 = NULL;
! [- E) l+ f& l5 m* v - char *dmabufdest2 = NULL;9 Y" e4 y$ ]1 o) t$ x; [1 ?( S2 `
- & \, K7 o/ F* q% a5 Q) c W- O" i
- static int acnt = 512;
- W2 V1 n: r2 i( J6 G: T! C+ y - static int bcnt = 8;1 C( K: f/ H: ?
- static int ccnt = 8;
8 o- L9 V, Z' K3 T - 8 E. Z2 y& g1 U) L( n
- module_param(acnt, int, S_IRUGO);6 p4 c5 I0 L- C) t2 Y ]
- module_param(bcnt, int, S_IRUGO);
- ] @# r, P9 v - module_param(ccnt, int, S_IRUGO);
复制代码
- F/ M4 e/ l4 W: C9 ~7 A! b( c. U" T: b$ C9 H/ C7 I" Q
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 E3 }' s1 h& _- B/ I; }+ ]
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; F5 U8 H% B! @% R z, A5 L 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 i. X0 K( q8 U: q) ^* ?6 w- x& l' X+ o5 B
% n1 A/ b# `+ S, W% E |
|