|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" @ O9 K. Q7 L$ T9 v v# F0 y- [code]EDMA sample test application
$ s3 H+ U& X6 P( Y/ f/ P) @2 ]1 f' r - /*3 D) h' ^$ G! V; }: s
- * edma_test.c
. n* Z) D+ e3 F - *( E" r* C! ?6 e* J& I' f0 j& E
- * brief EDMA3 Test Application0 u& `% z. A. g0 w; s/ u
- *' I) b, F4 V& h5 k6 M* [
- * This file contains EDMA3 Test code.
! v; e$ t7 }3 P/ n4 M% n2 ] - *
' ]) @5 x* V5 S3 {9 B' }3 u - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
2 W; U1 K; o& i1 }1 P, S - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
+ {( H2 G2 S, X- g - * TO CHANGE.$ U5 o# P# d, s
- *2 y1 C5 h& {3 a) \2 M
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
: e @# f& P2 S8 _7 A" v; Z, [6 [ - *8 t i6 g$ l9 n3 v: ?
- * This program is free software; you can redistribute it and/or$ {- t* P" `+ @" R; k4 N7 c6 }
- * modify it under the terms of the GNU General Public License as) J4 m" b& e. P& q
- * published by the Free Software Foundation version 2.
# k( U4 X5 s D/ Q! b' I2 s' q/ g- ^ - *5 A. F& i1 }7 C4 {
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
' _% {8 H" a9 K- H1 I8 U0 a - * kind, whether express or implied; without even the implied warranty
* c0 \. R7 n# ` c - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the! O: u6 ^- Q K; ]" q, N( n* K3 S
- * GNU General Public License for more details.
2 z* R* g% V- Y - */2 B! S5 |# ?6 F$ {3 L
- # T0 p8 O. `4 ~7 k9 ]) b/ v
- #include <linux/module.h>/ g1 y- b9 ^/ |* E3 y6 [
- #include <linux/init.h>
6 a1 l; r, f: y7 \8 Q1 _- q - #include <linux/errno.h>3 k; [: C6 ]' H7 |
- #include <linux/types.h>5 H2 |( k6 Y3 B! l& B( r
- #include <linux/interrupt.h>
* L: m* P% L2 | k: ~' U - #include <asm/io.h>4 Z" q8 ^3 J% S& Y2 F. e; ^
- #include <linux/moduleparam.h>( h& u3 c! a! q6 Y
- #include <linux/sysctl.h>
' X1 R- g* N9 Q - #include <linux/mm.h>8 f, K) g9 h# z& [( T
- #include <linux/dma-mapping.h>
. X1 ?4 M( u+ H5 c2 I0 \2 z8 `" i - , L, x8 Z! o: t% y6 \
- #include <mach/memory.h>
/ T& I7 M" b4 U$ e. g - #include <mach/hardware.h>
7 a& }1 I. P. }1 r( j. v' c - #include <mach/irqs.h>
& U- U4 ]8 R" G - #include <asm/hardware/edma.h>
: w I! [ s& b0 g: P3 v" k - ; K0 U3 \$ K2 c- e5 o7 ~4 B. B. Y0 h
- #undef EDMA3_DEBUG
/ T0 D/ T( Q, d; W2 i! J4 ^ - /*#define EDMA3_DEBUG*/
* y% A1 ^$ g, { - / O' ` T7 ^5 T. a
- #ifdef EDMA3_DEBUG
4 h2 f8 K4 n8 A2 c* M( R - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), p- z, y9 Q& V/ r' Z) K
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
3 o% v6 w, S. q8 b - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
0 O" W* @! P) }1 E2 ? - #else
+ g2 v D- r( t( Q - #define DMA_PRINTK( x... )1 V/ G6 [* o; _1 ]* f3 b$ d2 M
- #define DMA_FN_IN5 Y2 x0 ]" N5 o$ H- v3 k$ D# T
- #define DMA_FN_OUT; H O/ v. m$ U5 ~4 e
- #endif
) S4 Q6 @5 B& P4 L8 V' K9 Q. z( e
7 M& i6 F4 X4 E' G" Z- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
0 o" }2 A2 h9 \: b5 O - #define STATIC_SHIFT 37 ]% ]3 s! q6 Y' z
- #define TCINTEN_SHIFT 20+ E3 o% j6 P' s7 Z" h& q# V7 L/ w. K
- #define ITCINTEN_SHIFT 21# q; }4 [. ^9 O1 z# Y
- #define TCCHEN_SHIFT 22
' F# U$ W7 e' i - #define ITCCHEN_SHIFT 23
# m) s! O* ]* ?, l8 w7 [
% x [8 k5 w- }$ x4 A- static volatile int irqraised1 = 0;% b, ?9 b. g" I3 c$ w9 ]! R) U! s
- static volatile int irqraised2 = 0;+ H1 ^( f& D$ I$ N Z6 Y- ?
- 2 F. w7 P8 R9 x' N' q' z5 D; ?
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 A, A4 b7 ]$ t @1 v - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
B0 m' Y+ w. B. ]+ a. X - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 j! d( @3 G& N- @$ r) f2 F
. d: T6 {7 W: D# [- dma_addr_t dmaphyssrc1 = 0;
2 v8 [& e8 S. }! `1 o - dma_addr_t dmaphyssrc2 = 0;
: P, ~6 `* S, ` - dma_addr_t dmaphysdest1 = 0;" o( d$ g' t% P t
- dma_addr_t dmaphysdest2 = 0;# n# m$ I" e. `1 ^7 b
- " Q5 C; v0 K4 h$ ~! u& D! I2 C$ @: U
- char *dmabufsrc1 = NULL;
* W3 p2 V4 R* y* f2 p& w - char *dmabufsrc2 = NULL;
# g, ?& ~: T$ h4 v) s) n - char *dmabufdest1 = NULL;4 L; C# E% B0 i4 J
- char *dmabufdest2 = NULL;
/ ~7 E9 H0 Z M0 M
0 I6 l/ B5 s( L. Z- static int acnt = 512;
8 Z) C* M6 c6 D8 _" J! M - static int bcnt = 8;
$ s; {" ^. A. L - static int ccnt = 8;
( @( D3 v: i C% K- H6 \
* g& |& A6 A& [, J' F9 }- module_param(acnt, int, S_IRUGO);, B/ Y! k% O, m7 Q) s% V
- module_param(bcnt, int, S_IRUGO);* S4 x. C n+ E( G7 W4 v
- module_param(ccnt, int, S_IRUGO);
复制代码
- S' u1 b8 K8 J# c$ P# s* q* u* o" J2 X5 g/ G1 s4 ?! \: P
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" F. U- ]$ y3 v, i- L
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 s$ Q. m) `2 Z0 O* O0 B" q. r 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& z' U6 v# {* \1 l) h, I
9 \9 I) g0 |. x0 k
0 y+ p# O& ^# g+ C6 w/ |, o# Y
|
|