|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# t2 S3 o. k; p6 |5 |- [code]EDMA sample test application6 W* c' W ~; Y5 c" R7 V
- /*
, I7 }' |8 Q6 B V3 U9 w2 o/ d - * edma_test.c
# R) s! p& C2 R1 n8 i: k; p% I7 }2 x - *
8 ]2 ^" T2 E/ l% ~, p - * brief EDMA3 Test Application
3 V5 X9 a: k8 f( k1 U) W - *5 q9 _; O( n4 G/ X
- * This file contains EDMA3 Test code./ n" _+ z+ H, b7 F9 [ V, a
- *
1 M0 I& F; M' N! h& E2 @ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 X6 x6 i J* q& i
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 S. g. Q g1 B0 J6 i' @
- * TO CHANGE.3 t7 [9 I8 x9 |# l4 y4 p
- *
( M9 K3 U5 w5 V" E! z1 [ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
- S5 x7 [: b& L% C% R- w - *
9 j+ c! ?* {( V# ] - * This program is free software; you can redistribute it and/or
0 F9 ~3 a7 l# M5 E( x - * modify it under the terms of the GNU General Public License as
( J2 q4 S7 J( }% l+ |7 P6 {: u - * published by the Free Software Foundation version 2.
% g% b0 Y3 K1 b$ y) M( k - *
9 F9 k) q) N: ^+ } - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
8 F' a0 G6 I# }# D. e6 Z/ \+ I - * kind, whether express or implied; without even the implied warranty
! |, l6 J7 L/ i; h - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the" Q! L$ n( {: b6 h$ }
- * GNU General Public License for more details.; \3 C8 ]; h% N7 ?3 [9 w- {1 l
- */7 F T% Z5 M- m. A9 d
- 1 q- Z% ]- e! M
- #include <linux/module.h>$ D4 [1 u7 d% J
- #include <linux/init.h>7 C. V- t5 K& F0 Y
- #include <linux/errno.h>( v }: n& s# p0 Y! e4 |# d( p* ~
- #include <linux/types.h>
- h9 d9 M& w1 b( `+ h! z - #include <linux/interrupt.h>* R& I2 K; F& ] x: X) C
- #include <asm/io.h>9 v9 T% m, C3 Z: c4 f4 B
- #include <linux/moduleparam.h>
* n9 a5 w; F- c2 E3 O, L - #include <linux/sysctl.h>1 R( B6 n# _6 y0 p
- #include <linux/mm.h>4 M0 U/ T. y) w1 G
- #include <linux/dma-mapping.h>
3 A5 L" h) v& W) z8 Y! i' v
F) H# n/ J9 u3 r/ V# a5 s3 s- #include <mach/memory.h>. Y, v% P; [& U) k- b1 X
- #include <mach/hardware.h>
+ |5 T' P% Q( ]% H - #include <mach/irqs.h>+ j# G; A( P- a8 E
- #include <asm/hardware/edma.h>* G# K9 O' G0 v& H/ v
- ) P5 z! z2 n) F% z* t- U9 x
- #undef EDMA3_DEBUG5 r8 [* B; t9 ]! P
- /*#define EDMA3_DEBUG*/6 K* f' z9 _3 n0 f- l4 r+ G) w5 {
~) |, {0 N1 y3 _ @9 M+ X. w6 _- #ifdef EDMA3_DEBUG
/ ?* \% q" S" b$ Y! V - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( e9 i0 U N- W& O* n! S% j
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 A/ x; q0 X' l: m% b! s, c
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
- {! g! S4 K7 i* h1 t' T3 b - #else4 Z: N2 ]/ b2 t3 T7 j" K% }
- #define DMA_PRINTK( x... )
3 V* `7 s2 y8 W# K! Z1 K - #define DMA_FN_IN
! y( l7 |9 M4 E ? - #define DMA_FN_OUT) K! W. ^. \' g9 M/ O$ f
- #endif
: y& _+ G1 j! P$ w" @$ M) G - ! P$ Z) N- |* c* [' f& e
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
) b, f1 h4 t# _+ J. ]' I8 U2 M: K - #define STATIC_SHIFT 3; H+ R6 T, t4 X, j1 q
- #define TCINTEN_SHIFT 201 e; b: G" J0 F5 }1 N4 [+ z3 E
- #define ITCINTEN_SHIFT 216 ~) w( d( r0 t
- #define TCCHEN_SHIFT 22
; a& x) m5 s7 l; m$ F& h' V! Y - #define ITCCHEN_SHIFT 23) y1 \* u& i! O. c5 r/ P" z
\) D9 m: W/ T- static volatile int irqraised1 = 0;
5 U% p5 M$ ?1 V - static volatile int irqraised2 = 0;
! a0 n+ P i% t7 h% v - # P9 v9 H/ ]+ _
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* t( J' ?( K u5 P& A4 y
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! c \5 N3 m8 F3 C" v' A* G% ^ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 `/ t. Z7 {5 K
- # n5 s. P$ @6 \( [/ h1 I" v8 O
- dma_addr_t dmaphyssrc1 = 0;
% q6 p1 y$ [! U* r( X j - dma_addr_t dmaphyssrc2 = 0;# @" M% Q/ u( y& @- e/ Z
- dma_addr_t dmaphysdest1 = 0;' l0 `. j) T# \/ p0 w$ ]( N
- dma_addr_t dmaphysdest2 = 0;+ B, N2 j3 L _ a
3 a! q1 d5 S* v% P- char *dmabufsrc1 = NULL;
7 m: s# |/ U' T. C5 R9 \ - char *dmabufsrc2 = NULL;
( b4 W& M8 V% c9 o3 i# {+ L - char *dmabufdest1 = NULL;
( T; j7 O6 p( F! U! r - char *dmabufdest2 = NULL;
" M; A$ q9 N2 k! }3 \
0 T8 \/ W- K1 U% s6 \- static int acnt = 512;
% w7 Q: s6 R$ q H - static int bcnt = 8;
4 z5 K- J1 ^! r) A- Q - static int ccnt = 8;4 j" c, y& Q& P: C$ V7 i
* K; l0 C. t: W/ u+ Z% j- module_param(acnt, int, S_IRUGO);( L# a3 {" m4 P4 t4 T6 \
- module_param(bcnt, int, S_IRUGO);9 _8 T/ ]# w3 A9 w" D' l3 v1 n
- module_param(ccnt, int, S_IRUGO);
复制代码 - o, s9 B! R' c/ Y: f8 v. B, S
4 x5 |* `" V7 f4 U$ L 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& t: g4 q4 L* j( Z) P% M/ ~1 |
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 O- Q8 D3 c% v4 v; d
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* `9 p1 b. t! P) ~* H
* `/ Z; w" m3 M3 W. K6 T
$ q/ _- w; }( n# T1 |2 }( h3 v3 ?) R
|
|