|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
o7 C( v u3 K% v- [code]EDMA sample test application6 L6 p0 u1 v1 p, e
- /*
! M. x( n% v- e; a6 N - * edma_test.c
5 u* Z J* g% F) u7 a - *2 K1 a* U7 G1 A. p
- * brief EDMA3 Test Application$ _$ E1 \- e: F8 L2 }7 X, L2 C/ N
- *
! _2 G% c* r6 R4 D+ Q2 g. _7 Y - * This file contains EDMA3 Test code.
% k( H' i8 f* B: O5 x - *
- B6 V0 a$ Q, k6 u! d# y" } M - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
9 E2 x% \6 B9 z, q! O$ X. x. n: M - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
- N+ F K$ t% j& U2 W0 D4 |- ?0 Z - * TO CHANGE.
% S. ~# u7 d/ G8 M& C - *
+ h$ V8 q c4 D4 }, y( M7 R9 j - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
' d/ _. W2 ]' ]# O4 g3 G - *
6 Z6 s& G7 M' u% L! V2 q$ P' O& V - * This program is free software; you can redistribute it and/or
6 I: U8 a [- A6 ~! q; u - * modify it under the terms of the GNU General Public License as) _( b4 P! D9 I8 J( U
- * published by the Free Software Foundation version 2.
8 s+ X8 Y/ T; A# q2 q, M* i, _4 | - *+ S4 c; F" ~+ ~3 A
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any# O- @. f0 E- [ l2 @
- * kind, whether express or implied; without even the implied warranty
/ E7 P- H1 j* Z; Z9 \- u - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5 r( v- \: c! w& P- y+ F - * GNU General Public License for more details.
2 Y, ?" w2 p1 d# b+ w' i5 b& L4 } - */6 m2 U; j i2 K' s+ L- V
- 5 l0 s9 A; K: p! m E" ~* M
- #include <linux/module.h>
8 \! x' `6 W5 W* K1 _, l! H) K - #include <linux/init.h>
; F% R( g, X4 O" y6 {/ Q0 T8 U - #include <linux/errno.h>6 u6 S. h: K) V! j8 p ]! c, [* t
- #include <linux/types.h>
5 k4 \, ^( {* S, m* q4 i - #include <linux/interrupt.h>
7 ^9 R7 S+ Z5 a1 Y& G, D - #include <asm/io.h>
! [, |) e9 z8 ~ a; u" v2 T( N0 S0 M - #include <linux/moduleparam.h>8 B' ]9 _0 `" y6 W" C
- #include <linux/sysctl.h>3 \3 c" ]+ a8 h u/ F
- #include <linux/mm.h>* Y# e" H( _ B2 n/ P
- #include <linux/dma-mapping.h>
- X& w* g$ Z7 B5 {) o4 i0 m - 4 `. [. h5 [! V% P" a% V
- #include <mach/memory.h>
0 L4 D/ k. L" O5 e8 S- b - #include <mach/hardware.h>
7 e8 D/ [: [$ h: [% I8 Y6 Z - #include <mach/irqs.h>
/ Q' | K4 ?! t2 A2 b0 [; G - #include <asm/hardware/edma.h>
8 C5 t) b) U' h ^+ S - , k- }0 Z2 E7 w) ]* _$ k
- #undef EDMA3_DEBUG9 C# I8 \& Q2 I& x, ^
- /*#define EDMA3_DEBUG*/
3 Y, u1 x0 H& _$ s, z - 2 W3 a0 S% v& b" `0 T
- #ifdef EDMA3_DEBUG1 F Z6 ^1 o% K
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
: Z6 r* |7 { q4 y& } - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 X0 t: Z5 F" [9 S+ o
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
4 D1 j$ |8 l; e$ R/ K) e% P$ P - #else
0 `+ ~3 ]5 f) x8 {7 ~, A - #define DMA_PRINTK( x... )& W# Z% c! C. H
- #define DMA_FN_IN
6 s3 H: J* z% x6 N - #define DMA_FN_OUT) U0 h7 X; k# L3 \
- #endif9 p; [ a# W0 ~' \. E8 i7 ~
- 2 r0 c }" A0 t0 t- p
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)6 Z! X( B5 x4 v1 P! q' W
- #define STATIC_SHIFT 3
6 U* _/ W% |( @4 V- ~ - #define TCINTEN_SHIFT 204 [: U8 }2 x- w$ x. K% F @
- #define ITCINTEN_SHIFT 21. Y4 M ]$ ^ H) d1 E4 t O
- #define TCCHEN_SHIFT 228 K" U, s# U! h, [4 `4 a0 \
- #define ITCCHEN_SHIFT 23) |3 X1 g4 {( o) Y3 a; k, j% t
- / u$ M, T5 R- A( M
- static volatile int irqraised1 = 0;" m2 O" y6 o9 Y- s' K
- static volatile int irqraised2 = 0;6 l( V- k8 w8 Q* o5 k$ {
- ' h* T, L( Y& h! R, l; ^( i, s
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
v. E2 y4 H" v9 d8 H+ d; H/ e - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 d+ b6 N8 l( p
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ p1 P2 r: W$ R# m. u& l! d( `
3 j5 ? L* B/ \% n5 a, d- dma_addr_t dmaphyssrc1 = 0;
9 e+ |* m" u( S0 P5 |* I! l - dma_addr_t dmaphyssrc2 = 0;; U3 K" T& @( P
- dma_addr_t dmaphysdest1 = 0;% ^" T/ C5 A2 z0 q4 _$ b& m
- dma_addr_t dmaphysdest2 = 0;
2 O0 j* b% h) w5 ^: d - 3 \* n7 C/ ?$ w* z- t0 c
- char *dmabufsrc1 = NULL;
$ V1 D( y# G* ~$ p3 k& { - char *dmabufsrc2 = NULL;
5 x- ?8 ~0 J/ w* Y: H* K - char *dmabufdest1 = NULL;& c( P0 p$ w9 }% W5 H' D
- char *dmabufdest2 = NULL;
Q: `" k6 K9 \8 X* L9 Z - % W ~! U7 I6 S7 O
- static int acnt = 512;
& ]) v1 C6 l& X9 y" U* p - static int bcnt = 8;. `7 [! D2 \' [4 z% e) D
- static int ccnt = 8;& Z& K( { z N" `
9 N% q# T2 H/ D) j3 q- module_param(acnt, int, S_IRUGO);
- T/ O) J: F- @9 ?$ [# \1 \ - module_param(bcnt, int, S_IRUGO);
: y( C- a- `! {6 G9 E4 ~4 R - module_param(ccnt, int, S_IRUGO);
复制代码
0 y6 P) C3 I% o$ _4 h: d) ^7 o x# ^) ~: p( F( C& J
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 q ]1 ^7 M, \+ [3 M1 E
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& b8 L+ {4 T" p+ z- X4 K
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 m! Q1 l- j# {5 }1 U3 n- Z
8 C' F- e8 Q$ D/ J8 j
5 k2 k; {5 @2 c1 t; F |
|