|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) o& n: G8 z$ U4 {- [6 i! H X- i
- [code]EDMA sample test application! J9 j0 @: a/ O( p1 u3 v3 }
- /*
- M2 N4 M+ ~* Q$ V/ O( P6 v0 E - * edma_test.c; t( a( j) Y. }$ b/ S/ d
- *
! n* u3 K5 e% r$ B, w# r. m; h1 U - * brief EDMA3 Test Application4 `+ q* I3 l; \
- *
8 q- W8 N2 ^+ ^* J1 ~ - * This file contains EDMA3 Test code.
0 _+ J, @/ Z1 C) O3 `1 k - *' Q6 F' R. S8 E, f& b5 [
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 F( l1 {# V8 ]$ @ B& R0 W& \4 ?; A
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 Q X* B$ w; L! f; F
- * TO CHANGE.
4 f/ K/ Z0 Q4 H - *: Z/ `' ^) G. F7 k$ Q* k
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
: C2 P; s6 `: s# e0 c - *
5 s# N; H- @# C- F" a- v, P - * This program is free software; you can redistribute it and/or8 p3 S, e- Q2 l$ p. Y) ]9 u
- * modify it under the terms of the GNU General Public License as
+ {3 O! a- s b- J4 y) u5 S - * published by the Free Software Foundation version 2.
+ d, h+ ]. }/ v; K" X - *$ \: h) @- `! [: o d$ [
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
- y. a: K: @0 @# w. r3 V. E7 Z - * kind, whether express or implied; without even the implied warranty
/ Q: ^) _, j" e0 N0 w - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the) D( [ Q' B# [5 [* I \, {2 P
- * GNU General Public License for more details.2 h, s* v# W6 K1 c5 W
- */
; z' {9 b, V D* R7 q+ e
( Q3 N: ^9 Q! }5 _# E" {- #include <linux/module.h>
( q4 O: {2 H6 h+ o$ F/ T. r3 n - #include <linux/init.h>
3 w; F, |1 ~0 f7 v5 j- F3 c - #include <linux/errno.h>0 r8 F5 p% L" V9 `
- #include <linux/types.h>4 W8 ]) f6 S- ?) {
- #include <linux/interrupt.h>5 m* f9 ]( v2 ]: j
- #include <asm/io.h>1 m" S5 a/ h4 }& H r: P
- #include <linux/moduleparam.h>0 s h, y/ { {8 E; ?( |
- #include <linux/sysctl.h>9 A2 g- f" u; S* t6 r3 D
- #include <linux/mm.h>1 z/ U/ ~/ ?" f: o8 ~
- #include <linux/dma-mapping.h># L: r. A3 \: B+ V0 R4 L, v
0 a4 ?: t9 k9 h4 a- #include <mach/memory.h>) }- A3 n/ |' k5 d5 {
- #include <mach/hardware.h>
: Q& a6 I" p6 ] - #include <mach/irqs.h>: w, N! b3 \' V3 f- j* n: ~2 S
- #include <asm/hardware/edma.h>
: E3 E) K) P& j* z - " l: g" j) Z0 r6 b# y; ^
- #undef EDMA3_DEBUG9 W" B! o; L6 A. F! \5 V' E+ E# y1 p. s
- /*#define EDMA3_DEBUG*/9 Z* a0 H2 U/ z* ^; a7 F( m# ]
- ; }$ F9 \ A/ z0 P+ h
- #ifdef EDMA3_DEBUG3 l1 J, W. J4 I c3 k& a
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
9 e" V" j/ V6 ?0 t7 k - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ e8 ~8 ^# R5 Y- V
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
. W7 }. m6 H0 U, Z - #else: y4 U. L. L% y# Y& X8 H, n) _
- #define DMA_PRINTK( x... )
8 a6 _* P9 G$ |. w, E, H - #define DMA_FN_IN, r/ }. R1 J0 m- W! X1 b5 Q1 y
- #define DMA_FN_OUT$ M' G* \: J, v0 |8 J5 F
- #endif6 v5 m8 P' I" X$ {0 N4 U1 r |& d
- 5 j, z* I& |% m+ H5 D* Z" s7 @
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
- ]" V9 n3 v3 e# P; A - #define STATIC_SHIFT 3: T5 C. N3 ?" p7 K
- #define TCINTEN_SHIFT 20
0 _0 t: i, x4 |; R/ Q - #define ITCINTEN_SHIFT 21; s" b! n- G: K- F- I
- #define TCCHEN_SHIFT 22
; W, x; O; R% Z1 N( o - #define ITCCHEN_SHIFT 23
9 ~( A* M, a! T: s- t8 L - " @3 H# k+ q9 w, N
- static volatile int irqraised1 = 0;7 {4 z3 O6 [$ H; l% n
- static volatile int irqraised2 = 0;2 ]7 ^$ W: p/ V+ r" p$ H& v
- 6 W; j1 N5 b0 j7 b) q" m
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
[/ V/ q5 }& m+ o - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 O6 X H% d9 L' v$ r* Q6 P
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 z; O- V1 v- l& G
1 K" n' X, v' }2 l7 _+ I+ |- dma_addr_t dmaphyssrc1 = 0;) P/ o/ l- S M8 g; `
- dma_addr_t dmaphyssrc2 = 0;
3 O5 ]" d3 J5 s3 ~ - dma_addr_t dmaphysdest1 = 0;" u: u8 l, z3 o+ ?' m8 ]
- dma_addr_t dmaphysdest2 = 0;1 |9 ~& i! f3 P0 C
+ Y7 J+ g2 q# R5 y' \5 q- char *dmabufsrc1 = NULL;
2 ?* R- U( t i" H% a - char *dmabufsrc2 = NULL;
$ z; i; [, d+ d+ l: e/ ~ - char *dmabufdest1 = NULL;3 G i* t' {' Q1 e5 v, `
- char *dmabufdest2 = NULL;
! O! f& ]/ o( t" M
% p$ P5 Y6 H6 \' R- static int acnt = 512;
: W! J2 L9 E5 a& x2 y - static int bcnt = 8;" p( z: F" {$ o/ u
- static int ccnt = 8;3 d, @# F1 I( E% l, B5 l
; t, k1 O# j0 w4 U( m" x8 s- module_param(acnt, int, S_IRUGO);" l+ V6 o& M" [9 L7 D# {
- module_param(bcnt, int, S_IRUGO);
D. g, \' y1 o0 N J, z; C - module_param(ccnt, int, S_IRUGO);
复制代码 , \: j! ~8 @, m
. t, j+ N) Z1 f- p2 g
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( [4 S/ S( X* @4 a2 S- B( Barm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' }" A/ B2 S) ~& k i
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 o V* N5 @7 X9 o V6 B
3 g9 t+ P( K& c% y }0 u
7 ~3 P4 g% @5 Y5 h$ J% Q9 E4 L2 A& n/ v |
|