|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : X' S/ E0 ]- k! w4 }1 ?$ b
- [code]EDMA sample test application
! _7 t3 Z( v: {- ?4 e% ? - /*( O) g$ T6 a" A i( V- D
- * edma_test.c
" s2 b" X2 s# e1 t" p: d7 C9 n - *
' n, x L( X2 ^ - * brief EDMA3 Test Application
& c7 D! p. P: ]8 [, Y2 u# z! k# N, ` - *
' n4 \" _: ~* o! g - * This file contains EDMA3 Test code.9 B7 x+ J5 p8 T7 ?! ?- q
- *2 ?$ r7 j$ G4 o
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
* G% n- Q1 G/ M/ K! W/ Z! c c - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
7 I6 c- y5 x9 m1 |& X* ~7 S8 K - * TO CHANGE.
) @, [ F4 U! n" ^) N - *) l, ]: `5 [# v; R \8 t8 M2 H
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 w7 |$ B( x `: s+ H6 _- a
- *
+ ]9 C1 m1 K) r" c7 x - * This program is free software; you can redistribute it and/or
6 V0 k' F' _) M" c! n$ { - * modify it under the terms of the GNU General Public License as
" `' h4 L+ ]0 n2 w5 _ - * published by the Free Software Foundation version 2.
R$ m2 Q! C% R6 I, J4 W! s - *
$ ^5 d& t, F. t3 Q- w. a - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
, }/ S+ `" N$ t- ?5 k0 `! }: A- T - * kind, whether express or implied; without even the implied warranty
+ l' P* m# L! e- P# u, o! Q/ A% F - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the9 r" O# G3 }1 h( N. |4 J
- * GNU General Public License for more details.
* L7 |) a, g7 \2 X% Z/ N - */
: p; Z7 G1 E& b; z$ |5 s z - + Y5 n, N$ G. d; K
- #include <linux/module.h>
( e4 T; N2 w# {5 V* e* M- ~ - #include <linux/init.h>
. s9 {" s, G5 F5 H( Q0 k `5 k - #include <linux/errno.h>
8 G! g X$ i9 c: U. E. D+ o/ F2 y - #include <linux/types.h>4 ^3 U9 b) f+ y
- #include <linux/interrupt.h>
; I* a# |& F. A; L" h - #include <asm/io.h>
1 u3 g7 m7 U+ y% J1 [5 K* t7 Z7 N - #include <linux/moduleparam.h>
& @# g8 z# ?2 w" M& Y- I, K) T j' x - #include <linux/sysctl.h>7 M0 u. z5 y3 ~" i, I. Z0 q$ t
- #include <linux/mm.h>+ H$ Z# g: A: o
- #include <linux/dma-mapping.h>: _6 g" l5 A H' b
- z5 h- d+ l+ c) ^, o% u( i- #include <mach/memory.h>5 \1 c0 Z& }- w1 d) q% V. g
- #include <mach/hardware.h>
$ ?. N0 \- P( M/ n - #include <mach/irqs.h>" T# A6 V# i# X% T1 ^0 O/ {
- #include <asm/hardware/edma.h>
- p( Y) }. f! ]# D
/ G6 D( t* m- J6 }; [+ R! y- #undef EDMA3_DEBUG1 Q- {( P$ D, A& c7 {; N. B+ J9 G
- /*#define EDMA3_DEBUG*/1 k: \" I8 V" b
7 ]' n" {2 {- t- #ifdef EDMA3_DEBUG
2 G j2 s! w0 f$ Y9 j - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( B) p5 P3 K8 `7 R( F( t( P- `
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ o5 K( a$ o/ p+ l; m- o
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 B& q. y: |2 O- u1 Z6 Q" a
- #else
' _/ u* G8 e0 Y B G - #define DMA_PRINTK( x... )
* ]1 W; l& F* Y - #define DMA_FN_IN5 H9 m; C5 X8 E! z. [+ m# V
- #define DMA_FN_OUT
8 O- K& k$ Y) p1 o4 u7 x* w - #endif
; |0 E/ g: e' ?; [7 y* ~
; Y. w5 Z7 G& s+ R/ a& o8 f4 j- #define MAX_DMA_TRANSFER_IN_BYTES (32768)3 E7 ?9 V) q( j# R Z
- #define STATIC_SHIFT 3
, j* z! Z% v2 z* ~: D - #define TCINTEN_SHIFT 20
7 y; ~; r3 ^# Y/ n6 Z% I6 X9 D9 ^ - #define ITCINTEN_SHIFT 21
2 U8 e' y3 S& Z1 M, Z - #define TCCHEN_SHIFT 22, L. f2 d1 x0 t/ a- _: J" q
- #define ITCCHEN_SHIFT 23
3 _1 O$ v6 O [
" e4 g; J1 L0 _3 t. W- static volatile int irqraised1 = 0;
' Y% V! @+ g% x$ i' P/ B - static volatile int irqraised2 = 0;0 G8 A( O9 B9 f1 v% q( `
- 4 g% f& J- g# ^4 L, D
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, O, l- E6 ]+ ]* q" M9 ^ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 i- C1 @. a) g8 s
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- ^. J e4 J) v' q( P
- & b( r7 g$ G' Y5 ]. d0 [! R' a
- dma_addr_t dmaphyssrc1 = 0;" e! U' t4 d: F- K$ e+ E
- dma_addr_t dmaphyssrc2 = 0;! ? ? }3 E$ V( F. i4 L `
- dma_addr_t dmaphysdest1 = 0;0 j9 |% v$ h9 N [9 k
- dma_addr_t dmaphysdest2 = 0; E% w7 y# s. M7 p5 B) f
$ f8 K. X+ O2 v& C- char *dmabufsrc1 = NULL;
% E! h! e9 r2 H3 c7 J0 ]. I; L - char *dmabufsrc2 = NULL;, m; B+ _ C) L: K ^6 z5 M
- char *dmabufdest1 = NULL;
& e+ x$ G8 W6 x - char *dmabufdest2 = NULL;
+ _1 i, g! @, E0 q) N4 P1 M8 w
7 C# x5 a8 Y L' d2 s3 `* A: r- static int acnt = 512;
$ L6 w6 O I0 A+ \ - static int bcnt = 8;
2 C9 R% ]+ ^2 f2 X! v" ^ - static int ccnt = 8; l" A" I1 _; j/ d! J, t5 l0 X8 v" t) L
- : C# d6 m' p0 E& h9 y" V6 E
- module_param(acnt, int, S_IRUGO); e6 k: H1 V [( R$ m/ D' e
- module_param(bcnt, int, S_IRUGO);: @. m. P* T) s% N. l- T
- module_param(ccnt, int, S_IRUGO);
复制代码
3 J; M x' g8 I% P1 x( X1 K$ f4 c) K6 r6 O7 _
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; z% q" S) p' c/ u* W( sarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' f8 s0 |/ r& F7 q2 L) p
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* F; V0 D: ]9 Q0 M' L& q" \& a3 e4 [0 a0 ]- x5 q
) q+ f/ Q5 T' Z; ^6 S0 h- ]
|
|