|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' h7 o: ^- E! v% N- B5 S
- [code]EDMA sample test application" E0 @6 K0 k7 d# [6 z# O
- /*
6 I; n3 Z7 I& N( Z9 N( B O - * edma_test.c
, m* h$ E' n/ B0 ^( s - *
J6 }, V- O# ]! ` - * brief EDMA3 Test Application; q: f5 I# b, F
- *, I; O5 F- b, R, }# m3 S% Z/ b! g
- * This file contains EDMA3 Test code.
) C5 ~4 p8 v* C! j! e - *- i% x; ^# `" V6 h% X+ i& m
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
) |8 a; V# A5 b7 G5 { - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
1 @0 w+ y# v4 d8 m( D - * TO CHANGE.
/ @- ?) h0 W, |/ n6 j3 L9 O$ d - *
- z- X$ P) U+ O& G - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 K7 n* J1 s C" T( W- Z' A% V
- *
- N6 w: @% d u - * This program is free software; you can redistribute it and/or
6 t: H% X4 u& C3 O( ]" W+ i - * modify it under the terms of the GNU General Public License as
' C8 j/ G$ \4 m1 X4 u* g5 k5 y - * published by the Free Software Foundation version 2.$ S2 |7 }/ V$ ~* s. ]
- *
; M( ^5 P% |' E0 [' J8 { - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
4 j& Q+ J8 ?9 o4 u- _ @ - * kind, whether express or implied; without even the implied warranty+ L* J- y% J* S2 \
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2 u' d+ P& h1 v! D- _& p - * GNU General Public License for more details.1 K6 r+ Z" `3 J, [7 b+ Z
- */
. ~6 y ? h5 O2 k9 `, A
- R- O% o* Q7 U% G. n! D4 M. u9 f- #include <linux/module.h>* J- H7 B7 [# j, I1 Y
- #include <linux/init.h>
0 t- I9 k! d. f8 a, _4 r, Z - #include <linux/errno.h>
) x' t; J @/ h# d - #include <linux/types.h>
( [: T' @! h7 @% O# E6 r - #include <linux/interrupt.h>
7 e- M. }+ x$ S* s- [ K - #include <asm/io.h>! n' U5 \' }& a0 d! k& O0 ]+ v! X
- #include <linux/moduleparam.h>
r+ I) J/ ~; R# q - #include <linux/sysctl.h>7 `) `% _0 U5 b3 [& L) w
- #include <linux/mm.h>2 G& G/ `: M+ k9 G# P
- #include <linux/dma-mapping.h>
" [& D B2 M. s* g4 \
; {6 s7 r! ?1 {- #include <mach/memory.h>
8 t! F/ u2 p5 \7 w1 `. |9 @ - #include <mach/hardware.h>' e( u# \9 C+ l: R6 I, {: f9 x- ^7 c( P
- #include <mach/irqs.h>
9 H: y& z( i+ F/ r' v5 s9 e - #include <asm/hardware/edma.h>2 `: k( o: G \( r! C( \0 p& F
1 t7 ~* K/ W8 v" G8 [- #undef EDMA3_DEBUG3 U; w; J. K( W* r. C
- /*#define EDMA3_DEBUG*/
! [$ B0 x& S( L
( ?3 c* a, s0 v p4 o$ u1 b- #ifdef EDMA3_DEBUG' x1 u$ S) I% u) U2 ]" E3 Y
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' p3 u4 O( [* X4 ?1 T" y$ M
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' l2 [3 ~+ k; C( z% f) f- S% V
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ U3 l1 x I; l1 Z' |( s
- #else
5 _& t ?" O( H0 r0 R* K# M - #define DMA_PRINTK( x... )$ F8 e6 a; Q2 y3 ~' ]8 Z
- #define DMA_FN_IN- f0 d5 b$ J7 I1 p. v" T
- #define DMA_FN_OUT# y$ r3 ]: ^) z2 ]' @' |0 f
- #endif+ G! f& X" X3 _9 K: U, B" A
3 G( f9 x3 `- x+ h7 c7 E& U- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
( x5 P- P4 }% N B - #define STATIC_SHIFT 3
4 Z. J" c) A$ ?* H( q2 o - #define TCINTEN_SHIFT 20
& ^2 ~. _) U# E - #define ITCINTEN_SHIFT 219 o9 J9 m9 N/ i& z
- #define TCCHEN_SHIFT 22
$ W. v: H& A2 U - #define ITCCHEN_SHIFT 231 ] s) F _5 a
- 7 Y& x/ r0 y7 Y6 [& _8 p
- static volatile int irqraised1 = 0;4 ~6 y6 O5 H! }) Y6 e4 ^/ |
- static volatile int irqraised2 = 0;
" p+ L" X6 k$ W1 z! J7 w - ( R+ e* |5 O( W1 k
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 y" w4 Y1 H$ j y - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- l, P- p. F# B2 [ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& x' C0 v5 v+ E - ' R; u7 `: I& ~( x, J
- dma_addr_t dmaphyssrc1 = 0;- N y# Q8 z2 d4 S. `
- dma_addr_t dmaphyssrc2 = 0;
" F+ G6 l! j+ b# C - dma_addr_t dmaphysdest1 = 0;
5 v/ d4 z$ ]% q, C- J( X - dma_addr_t dmaphysdest2 = 0;/ L' w) |8 K8 P
- 9 H- m5 W2 i/ D( l5 n0 E% B# b5 o
- char *dmabufsrc1 = NULL;1 q/ h) ~8 B( N/ |6 k( C/ n1 n
- char *dmabufsrc2 = NULL;) D$ U0 L! g$ b) {! Q0 ~% m7 D; e8 P
- char *dmabufdest1 = NULL;! y8 G3 d ~5 C* K1 A# r
- char *dmabufdest2 = NULL;2 r z+ C. w7 q
- ! J. \3 Z* Y. u0 \6 ^ e
- static int acnt = 512;
) e) B3 B; i7 C; f$ E - static int bcnt = 8;
, a1 l/ `; n4 l2 S: h: u& Z8 k3 r - static int ccnt = 8;, h) l0 k8 x8 O4 y( H) ^$ q
- 8 L5 l4 J8 A5 Q( q2 j
- module_param(acnt, int, S_IRUGO);
$ b/ l# I) G( k6 z% w - module_param(bcnt, int, S_IRUGO);
4 _/ C7 Z: `6 F J% S( r1 w - module_param(ccnt, int, S_IRUGO);
复制代码 1 k% ?9 x8 F; L9 j% @! |4 a; @
/ s$ T! {' n) E( u
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 H. i! ]& L' e9 aarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 ]# ]3 r4 p3 a6 q
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 d# U+ } F3 \, _
4 v( _" H( I( {: a. n
5 W" @3 b0 e$ |7 P3 S: _( q2 W |
|