|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ d# }% }' g7 O' j# u- [code]EDMA sample test application
3 Y% M' o7 Y" R: \% ?8 x - /*
8 n6 c' V# h6 } - * edma_test.c
5 e9 q: h5 N9 D) ~4 ^( A6 d - *6 k0 f+ O9 ]! F( b! M
- * brief EDMA3 Test Application
$ ?7 e# y) O6 }& Y8 u- Y - *
& C P5 _" G% h8 R7 q7 S$ e1 ? - * This file contains EDMA3 Test code.8 R% j3 c& f& b9 o; H
- *8 h) `* l o; D
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
# k8 p% `1 _* V3 u! Q1 ?7 [ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
1 }6 W) U6 ~3 i7 d5 P! a: J- j - * TO CHANGE.6 c5 L" I2 ]7 Q' k$ Z: e0 i
- *0 Y! Q2 q. O( Y4 h# R2 D
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" b+ }, u$ N' q# `
- *
) x; g/ J) u2 ` - * This program is free software; you can redistribute it and/or
- \# w7 b) \- M( L - * modify it under the terms of the GNU General Public License as
) z5 e, P% n$ ^% G+ [, K1 \, w - * published by the Free Software Foundation version 2.
: r) o' ~; e6 ~( S8 @. V5 I% h, O - *
4 O& {- k& b! Y- a - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
8 [; V, R. \9 e* m - * kind, whether express or implied; without even the implied warranty
2 P2 w8 B8 Z# O+ ^1 x, E! ^ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/ u7 |: S4 N! m( Z - * GNU General Public License for more details.2 U4 `. R; @& S1 Q
- */
0 c0 z! `" E2 Y! I
1 P$ V+ J' _, e$ m# ?5 o4 t4 _0 S+ y3 e- #include <linux/module.h>
0 o7 |6 [) o; k, J: H5 W - #include <linux/init.h>6 B P$ B, z% }. V
- #include <linux/errno.h>( F0 @1 P" O: f) N7 i& F8 V/ J* {
- #include <linux/types.h>
0 z: T9 ^9 i( I9 ?9 u0 f s8 a - #include <linux/interrupt.h>
~1 v, s1 Z w E, H - #include <asm/io.h>0 ?! d5 Z# z0 K6 J0 j/ Y
- #include <linux/moduleparam.h>% f- V/ o: Z) K `. ?$ D1 H9 J
- #include <linux/sysctl.h>
6 ^( A# u, P: ?/ P0 y4 W E - #include <linux/mm.h>
5 k" J- p2 V4 \. t. C* m' R# X1 J - #include <linux/dma-mapping.h>
( N, _+ ^2 X4 N2 R6 M
! f; z" Z8 p1 k, a( n- #include <mach/memory.h>
7 p ? D+ O" J) M4 z - #include <mach/hardware.h>
: A% _9 k0 M% V, ^; L& h+ E6 Y - #include <mach/irqs.h>& z9 f& }/ M J
- #include <asm/hardware/edma.h>+ _' M: ]2 x- I' h
* `2 n+ |' F" D- #undef EDMA3_DEBUG+ J6 }' V! A2 m5 R, S, q
- /*#define EDMA3_DEBUG*/, A0 h0 g. Z5 `" W# R: d
- # H5 U+ n0 @1 [- S( ]- D
- #ifdef EDMA3_DEBUG, I' H' |, c) H9 v$ }9 _9 }6 C
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
+ Y# k k) `$ i5 i+ N, _" u8 w( W - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): K J; V) U2 r/ q7 Z
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
: k, M, |! p7 ?; J" f( x - #else
9 k2 ?3 D& G$ ^' }( x: T3 d - #define DMA_PRINTK( x... )# s6 D3 g; |" `8 T# v+ [
- #define DMA_FN_IN
+ t2 H- a& Z# u8 d0 l, F - #define DMA_FN_OUT7 U9 [$ c: P+ b9 }- z/ N
- #endif
]( C5 O- i3 r. a7 R& Y- X+ b3 l - 2 \+ T' c. m% h3 X
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
# ~9 a' {" `( V; K' }+ D - #define STATIC_SHIFT 3
: {3 r* V- m6 e t - #define TCINTEN_SHIFT 20
& P( V& Q* m/ k6 B5 E - #define ITCINTEN_SHIFT 21
7 l# g* v7 K8 T$ K% q+ U6 X6 u - #define TCCHEN_SHIFT 229 D i: m% p& @0 \# {
- #define ITCCHEN_SHIFT 23
) i3 O( G1 V" ~: v _ e# ?
- n- f, j' a% V. }: b# e- static volatile int irqraised1 = 0;
/ n. K @* P" O, ] - static volatile int irqraised2 = 0;
5 p7 D1 }8 b) s3 R9 Y
; |( G6 d( Y" g4 T+ L# Y0 @- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* j% Z& g0 A5 Y% D, z
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 f! p# D1 l% A( Z( g1 s, J9 T - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ k( P& d, ~( V, s - ( W A" w1 |+ D+ y
- dma_addr_t dmaphyssrc1 = 0;) t8 Y" o! J; v2 G2 p/ c
- dma_addr_t dmaphyssrc2 = 0;: o' z- _2 t% w/ ~0 Q/ ^
- dma_addr_t dmaphysdest1 = 0;/ b' U3 g+ D: C+ x& J3 g
- dma_addr_t dmaphysdest2 = 0;9 f9 S0 r" \9 a) s6 k" P
- & o4 F* x9 D6 e% v" d0 f
- char *dmabufsrc1 = NULL;* @% M w0 w7 Q1 R( B( ~9 U. J( n
- char *dmabufsrc2 = NULL;; r a% P. N" w; E e& ]3 D
- char *dmabufdest1 = NULL;: i2 v* S0 H# N/ ?8 I
- char *dmabufdest2 = NULL;
( {( S! Q& A. _# u. o6 u: M
% l7 b- m u% G# g0 Y* p- static int acnt = 512;( p( J) Y2 E( T5 r% E
- static int bcnt = 8;/ U# c$ _- W3 B% G& G6 E- B* n4 D
- static int ccnt = 8;
* |( M% r) p5 C! Q: O1 A
8 a% o; b! v4 b$ u4 {. E- module_param(acnt, int, S_IRUGO);0 Y9 E8 C4 S- t$ M, u# J
- module_param(bcnt, int, S_IRUGO);! r, g3 Q) B8 v$ w: k
- module_param(ccnt, int, S_IRUGO);
复制代码
L: J! C) @- Z6 q! i0 \% `5 b
6 Z4 i1 I7 n3 G* v5 e- H 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ r* J2 _9 N% s2 P/ \ j* Q
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; g1 E4 \; V8 m
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 g/ d; J/ X f% [0 n- Q
- P* ?0 ~7 ^; v% q1 X: l. K3 A; ~5 a' y* _& M# ^3 S! q
|
|