|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* Q6 ]4 w1 h Z( V9 C( o$ e3 Z Y' r- [code]EDMA sample test application& g* L0 t* T" C& P. n& D% ?, j
- /*9 V8 B. ~7 p& X- y7 C6 J5 y1 }
- * edma_test.c* b; @, Z: Q. T- U4 e# ]! M
- *
7 w+ V* W1 F, Z k5 k+ b9 Y - * brief EDMA3 Test Application M. Y6 I( W' F, v4 F3 L
- *3 l+ v7 R9 W# c5 h# [" c( S
- * This file contains EDMA3 Test code.
3 ~0 P& n( N' z+ w- ]( C - *
( {1 G# \% k- K8 J" k" | - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# a; _1 C% W) V& ]! g
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
$ K3 L6 x5 K. k& N, r( J- I - * TO CHANGE.
+ P( z w x$ J8 Z% t( X( q - *1 o$ w* F3 v* P- V, K9 j( g5 T
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! c# f& v, N1 v% y
- *5 [0 F6 `" g% B, ]
- * This program is free software; you can redistribute it and/or' u9 S, Y. G3 P
- * modify it under the terms of the GNU General Public License as
* y6 W( q7 h8 ]6 O( q" q3 A - * published by the Free Software Foundation version 2.
0 v" {4 p' c+ A2 J7 w# V# N - *; d6 N* c. P: f. s- M. P! b
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
- W0 f3 G$ c, K9 n' [, [. E& e. Q0 k - * kind, whether express or implied; without even the implied warranty b- L# v# R. Q( g v# o B
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
$ w8 ~, k N5 l: c4 i, ? - * GNU General Public License for more details./ R' T* Q+ e! d B
- */6 n7 K+ {/ G3 U' U/ E1 n( S
- 9 k, U1 q. r4 [% I1 [& u7 n
- #include <linux/module.h>* o8 @. j9 B3 v+ O$ T( T0 e& f- o
- #include <linux/init.h>& T+ Q/ H3 g# G6 t
- #include <linux/errno.h>, b; a. C0 ~( I! {( Z; d
- #include <linux/types.h>
- l2 K+ ]4 Y9 P* H0 r - #include <linux/interrupt.h> `% l) }- R& |0 [* B
- #include <asm/io.h>6 k! K" j; B7 B. r% T7 X% j
- #include <linux/moduleparam.h>6 h1 G" x# W# n: v9 k
- #include <linux/sysctl.h># o$ P, f- _. x. M
- #include <linux/mm.h>7 |1 |4 i8 E% g
- #include <linux/dma-mapping.h>
3 ^1 t! O, Z; H" k2 @8 o - # }7 ` h# t% C' d! T- i
- #include <mach/memory.h>: A" f4 v2 M" T' c9 b
- #include <mach/hardware.h>
+ C7 M8 `0 \4 b1 r! [" T1 { - #include <mach/irqs.h>" @ w0 R8 R7 R, _7 t
- #include <asm/hardware/edma.h>
5 |& c" [* q6 {5 u/ U( H
- i( z1 i5 l! C3 T3 P' b: x" j- #undef EDMA3_DEBUG
( P7 W0 G6 \1 ^. B' d' B - /*#define EDMA3_DEBUG*/
+ d8 t, |1 e3 @7 R/ N2 }
4 v& J# ?* \ |8 @1 N* y9 o- #ifdef EDMA3_DEBUG2 J2 S$ g! i% }) w$ e
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), D+ n4 Y, Q1 p; H3 s* P
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" `9 C6 |$ f2 L6 C4 R1 `
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- V/ Z* ~6 M% R
- #else/ ~( S" s0 l- S$ ^
- #define DMA_PRINTK( x... )
5 O3 W5 {8 j+ | P - #define DMA_FN_IN
7 }; ^, L( ~+ H% v" o - #define DMA_FN_OUT
! H- R; `, o/ z3 [; L: n) e+ ^ l - #endif, o! S1 k* Y3 t" @$ o5 D
5 \7 R" N5 J4 o- j& t5 Z- #define MAX_DMA_TRANSFER_IN_BYTES (32768)$ R+ Y0 r0 w+ h; u( `- N
- #define STATIC_SHIFT 3. \! d0 h; Z6 W( q+ v3 N! G7 _' a
- #define TCINTEN_SHIFT 20$ {2 D" F9 R6 f5 a9 L9 Y
- #define ITCINTEN_SHIFT 21& K# H4 M- |+ m2 h
- #define TCCHEN_SHIFT 22
) p0 z3 P3 ^6 s* J. O8 W! S! V - #define ITCCHEN_SHIFT 23
$ x% b+ P9 P4 T7 ?. A
( U# E, g$ i1 k$ b9 V j( x5 N- static volatile int irqraised1 = 0;1 @! A( [2 S8 C# o
- static volatile int irqraised2 = 0;
! D8 R2 b) U$ v; Z9 c! q, c
4 i7 }. H z* z3 a- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. O4 f9 e" B( I/ w - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( y6 K5 |; Q+ A7 s5 ~; W, P* `
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); W% X, _( ^6 w2 l9 P6 i
/ w* U8 `/ Z' b7 g0 q- dma_addr_t dmaphyssrc1 = 0;
4 n# D8 F2 I- J - dma_addr_t dmaphyssrc2 = 0;
8 d1 r/ C$ m3 M4 Q& Y - dma_addr_t dmaphysdest1 = 0;
2 Y. O7 ~( G$ T* O* o/ Z - dma_addr_t dmaphysdest2 = 0;
' B# g2 B3 E9 _/ ]5 y
" A. d8 _( C4 t- j- char *dmabufsrc1 = NULL;2 O9 ?- F/ d$ f9 m' C
- char *dmabufsrc2 = NULL;2 a# f; M- ]- n( h9 k) l9 k
- char *dmabufdest1 = NULL;2 y9 s' q! [2 X" P
- char *dmabufdest2 = NULL;& X; W% ~) w8 y1 e" c) r
- ) q# p* ]3 g7 l' Q
- static int acnt = 512;
# a$ W0 S' n( R2 k; B2 [& h4 r x0 d" f - static int bcnt = 8;
2 d0 m* |3 B% Z: V+ Z! r3 M - static int ccnt = 8;
8 ]4 k5 w7 T4 W) q; X2 m - ; p. k8 B S. T% y2 }
- module_param(acnt, int, S_IRUGO);
8 I! K' r# F1 G& B* ` - module_param(bcnt, int, S_IRUGO);
' m5 X ~* a1 s- W# X. A: M - module_param(ccnt, int, S_IRUGO);
复制代码 8 O' f" O6 q# ?9 |5 l' T
. q' I) f$ F# X- `. n 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
W% I7 e( P2 ]' f! w2 Q* h. yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: l f8 w( Y) |, }( y
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 M& j1 r7 d! t' H
( P9 M4 ]- c: V1 p" l( L) j- w2 `" n7 c7 `# c1 _5 b# m
|
|