|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 q- U4 a! x3 K7 k1 Q/ x. r4 c- [code]EDMA sample test application, y8 S, K9 m% ~% y
- /*
& h- T7 h3 i- c& l- k2 N - * edma_test.c
* d% ?* P# |8 ^* Q% }$ e - *% C2 D) b! b1 b: ]% ~3 q
- * brief EDMA3 Test Application
: W- ?0 [5 z2 s M3 h - *
/ w4 Y. g* d7 C; H - * This file contains EDMA3 Test code.8 l8 ]" {, O& ]; V d, V
- *
* j, {8 a: p6 E( b- \9 l - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
+ S8 V6 g. K/ y/ B5 C: \$ \6 S4 x - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
2 l9 c5 R. [% X3 @* R - * TO CHANGE.
. }( F5 F/ w3 _, L - *9 m7 P5 b, E! @" I. q# V
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' c) O; [3 C9 j8 D W5 Y
- *
' y4 W& P6 K6 y" c! d2 ` - * This program is free software; you can redistribute it and/or6 S; M5 t0 C9 l1 H- s
- * modify it under the terms of the GNU General Public License as; w) ]8 g; G, t5 g& @
- * published by the Free Software Foundation version 2.
% v* l3 M+ o5 a - *
}( g8 C% M% ^5 [ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any T- o; P$ `) z% P
- * kind, whether express or implied; without even the implied warranty6 y# q- I1 e4 q: x* k/ I
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% j9 q1 w" P7 z5 y4 S J7 v) q - * GNU General Public License for more details.
% v- p/ C- T0 Q* l. T+ p4 ^ - */
8 y/ d' r; h. r: `* J - , R/ T# e. W& k8 k
- #include <linux/module.h>" ?, A7 O; b$ r9 |# R
- #include <linux/init.h>
8 [3 U& }1 m* S" f - #include <linux/errno.h>
9 l$ q( H6 r7 ?# H - #include <linux/types.h>1 a/ J) F' f- t& H8 B
- #include <linux/interrupt.h>
. j9 P: a% T+ a6 g* {9 S5 E - #include <asm/io.h>
* J D l" |. L7 G# i - #include <linux/moduleparam.h>
. g6 k4 F* z$ s( T - #include <linux/sysctl.h>7 N, o6 ^( h5 C6 [; U
- #include <linux/mm.h>
9 o$ [' v* g+ a+ U: _1 i - #include <linux/dma-mapping.h>
) j/ m- P$ ^* G3 I) G/ B
- R9 ~$ P. w) S- #include <mach/memory.h>2 j& ~+ O: P- W l
- #include <mach/hardware.h>
8 |1 }) z1 \# {2 z - #include <mach/irqs.h>3 p* m4 B) ^2 {
- #include <asm/hardware/edma.h>
$ ^: T& S A% T( J5 k; N9 t- T - ; M, A' _ t I d
- #undef EDMA3_DEBUG
* T3 I: Y' w/ e& f6 N4 D - /*#define EDMA3_DEBUG*/
9 g0 C2 p; _! H' E) J3 ?5 \1 y - 1 ?8 f8 t) y+ C& q' N- D+ B. i( r
- #ifdef EDMA3_DEBUG
! {& J0 @0 E( O+ y9 N0 I4 u - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
' j2 f; r6 Q5 L' ]. F# y% @8 o$ j' M' n - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
0 z+ x! u9 S. g" n - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& ~1 s8 }& C R! C+ w; ~* _
- #else
2 }. ^% P/ W$ i# p' M: Y! M! R - #define DMA_PRINTK( x... )
5 o. n7 f7 l% w8 Y - #define DMA_FN_IN2 q0 U; J( Y# }& a
- #define DMA_FN_OUT
1 P' R* [! V: O. u* {0 V4 l - #endif
% M3 G' s2 D. `$ J. P. ~ - % n X1 a5 }5 i% e
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)5 l \- B; h I Y! Y
- #define STATIC_SHIFT 3' V8 V% D+ L g
- #define TCINTEN_SHIFT 20
9 ]! y# m( c! ^4 Z F - #define ITCINTEN_SHIFT 21
: @8 @: ^6 X- ~1 q( J$ M1 k8 f }1 k - #define TCCHEN_SHIFT 22: m2 [# p0 w* I4 A4 Z; W$ P
- #define ITCCHEN_SHIFT 23
. r1 T1 k3 k7 @' E9 |: N - 0 Y( V! G, U" e) C0 n7 F) b
- static volatile int irqraised1 = 0;
2 r- `$ |' E8 N* N* k* L2 _8 |# r; R4 ` - static volatile int irqraised2 = 0;" J% D5 r+ _2 g5 o3 W1 Z8 c: p
- 8 ` B% M6 q1 U' ] Q) e7 G
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( q* A$ K( \7 e- K, C! g0 e - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 Z0 k$ _8 o7 X5 b% u; Q9 X
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% s& `, \" R7 R7 w! g4 P, ^
- # S! b% D. A* W
- dma_addr_t dmaphyssrc1 = 0;/ j7 m! t: p! M3 ?3 s7 @7 i& m5 _
- dma_addr_t dmaphyssrc2 = 0;3 k" k& x- s- g! `7 Z
- dma_addr_t dmaphysdest1 = 0;
7 b5 K2 g( ~! W1 { - dma_addr_t dmaphysdest2 = 0;3 m `) i4 f. q# n/ g
+ U3 ^6 V3 T% J3 {9 _; Y" d4 a- char *dmabufsrc1 = NULL;" T! d0 w( o/ z1 Y9 B
- char *dmabufsrc2 = NULL;
6 C: Y0 t& m% C - char *dmabufdest1 = NULL;
7 E2 Z9 S* Y8 k9 B" z% W" {5 E - char *dmabufdest2 = NULL;; g% d+ T, ~, V% g T# l. [
/ _, C0 S# I: s$ F9 F/ G5 [: W6 t- static int acnt = 512;
1 s6 U. ] u+ @. E7 N @ - static int bcnt = 8;/ e1 H: y: \6 X7 a. Z# d8 Q
- static int ccnt = 8;" e# K0 d h! U
- ; N( {; J1 q5 `
- module_param(acnt, int, S_IRUGO);
; ~5 U- `; `8 A! m# b! e1 ] - module_param(bcnt, int, S_IRUGO);
7 D$ w+ C( J5 m - module_param(ccnt, int, S_IRUGO);
复制代码
. \4 M9 g; U3 j8 i6 S
" `* k8 K7 s4 u0 m9 j9 A( M+ n6 H( h 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 {/ d3 p! P- Y- e2 O1 S
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# ^1 Q* |2 v+ f0 K# }* G
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 Q2 K6 L r7 Z! a O) W/ b# a8 E+ L
2 ~6 \. |* _+ m# R: F2 K' j) o9 a1 R
|
|