|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ q9 [& V7 b" U; j x4 I- [code]EDMA sample test application4 B( `: Q. s1 e3 y
- /*) v3 R& M" ]- j p/ Z+ o
- * edma_test.c$ w3 e- T- k! \3 _/ d& P" G! l
- *
' n* u5 ^4 z$ _ - * brief EDMA3 Test Application. ^% [6 v( Q& |' R# w
- *' Q# ~# m" K5 R. x* s
- * This file contains EDMA3 Test code.
8 c: t! Q0 s, o! t/ E6 q, v - *
) w' B. z9 ^% [! n! [ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! V! k9 a! w6 W3 D6 U* u+ @
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ e0 O6 A- X9 J% G) i: _3 C. M
- * TO CHANGE.
+ ^' G/ p3 k6 e" {- A+ |" U' k - *
5 r5 E0 ~1 ~; `4 `! R- v6 U - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* Z* i5 \+ a, a( H. @
- *5 l: N( K/ x( g* ~4 K! b# o3 `1 Y
- * This program is free software; you can redistribute it and/or
1 I* ?. |% K m4 J& W - * modify it under the terms of the GNU General Public License as
8 s4 H4 O" H/ Q/ v% z8 g - * published by the Free Software Foundation version 2.
: U7 B( f( |" h. p6 ^: n I3 f9 ~ - *
* B' C2 E2 k) S - * This program is distributed "as is" WITHOUT ANY WARRANTY of any; X; s" R. @3 F: ?
- * kind, whether express or implied; without even the implied warranty( _! D _$ Y- g) e) a9 L. _
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 I" {) y6 }9 @6 `2 m - * GNU General Public License for more details.% Y7 R2 w( _' r4 @- p9 U2 K( Y
- */
! F. _7 Y6 L" n
+ L/ b" H5 \7 F- #include <linux/module.h># O8 _- ?3 W8 z& v1 N6 M
- #include <linux/init.h>
* r; `& ^* r; | C( c( T4 l8 `4 f - #include <linux/errno.h>" V: T* l, v" T
- #include <linux/types.h>
; s- O& Y b D: q - #include <linux/interrupt.h>
( e2 \" i. ?' g- ] - #include <asm/io.h>6 W* `4 @8 P- T G/ k
- #include <linux/moduleparam.h>
% O" Q, ?9 T% E# ]: V$ j7 K$ _- l3 n - #include <linux/sysctl.h>
, W: R0 [& t. U3 ~ - #include <linux/mm.h>
! g8 x4 W) @ h, P8 ^ - #include <linux/dma-mapping.h>
- i: W8 U/ F$ n$ X- d; `
% \/ A& ^+ j4 H- #include <mach/memory.h>1 z0 m0 ?0 ~( R" Z J& p H
- #include <mach/hardware.h>
" p6 u# N+ u4 W7 } }: Q - #include <mach/irqs.h>
1 ~; E/ [, I# C8 D: t - #include <asm/hardware/edma.h>) f9 L/ v+ M1 `
- ' A5 _6 O7 O$ m% x# G7 D0 H' i0 R
- #undef EDMA3_DEBUG
% v8 d+ g, r; x+ b( w - /*#define EDMA3_DEBUG*/ i9 Y: s/ _# \% g. X
- $ S# s) A: n2 z, D6 G( p
- #ifdef EDMA3_DEBUG
0 `9 B7 H: T3 \' k" x: @ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! t+ q7 i7 g* N4 P7 d( v" B2 g
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
# a" N" ^% \' d$ _ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 ~+ J- I1 E# {7 p1 x
- #else* ?' V; F) b( B0 V
- #define DMA_PRINTK( x... )9 x% a/ K2 e& e
- #define DMA_FN_IN# D; Y. G) J9 B6 L2 ]7 }1 o" u
- #define DMA_FN_OUT* W: y- n; N5 n: R
- #endif
4 y4 ^8 Q5 o6 U2 E0 }
: o$ j+ I2 }0 u/ P" t, S6 O( ^8 m- #define MAX_DMA_TRANSFER_IN_BYTES (32768)4 E; o, p8 w" ?5 ^0 w. O3 |. }7 g
- #define STATIC_SHIFT 3
# d/ J' g, w$ E N/ S1 | - #define TCINTEN_SHIFT 20
: n) H4 Y( f4 w4 l - #define ITCINTEN_SHIFT 21
0 m& `, b# d1 K/ C8 A% C4 N - #define TCCHEN_SHIFT 221 X: b* b- J; m% B( {1 H" m7 }: U
- #define ITCCHEN_SHIFT 23( v9 ]: b; z/ i$ A4 S
- # E, d7 L& P* |
- static volatile int irqraised1 = 0;
6 U) g7 {$ o; B - static volatile int irqraised2 = 0;7 E" S3 j4 Z; h& r
; X& e. _& a1 m4 e- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 m9 t0 a, z9 L5 O; H% E& e
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
v$ J, N) ?. j& J# ~# b - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ q7 G9 z8 V Q$ ? - ) \3 L; j" _% V2 _8 Z% N6 z
- dma_addr_t dmaphyssrc1 = 0;
5 C/ o# z3 Z7 i - dma_addr_t dmaphyssrc2 = 0;
| U. Z0 |1 o) G - dma_addr_t dmaphysdest1 = 0;: q# F5 ?% W0 k: k
- dma_addr_t dmaphysdest2 = 0;- Z8 ~& V! i( C2 o) m
7 E" q0 W/ H2 r4 W- char *dmabufsrc1 = NULL;
' \4 g" v- b; } - char *dmabufsrc2 = NULL;
; l, p' W5 ~9 o, S3 v& g - char *dmabufdest1 = NULL;
8 `, l8 k% D3 t( \0 k6 x - char *dmabufdest2 = NULL;& h% X& x) C( u, b9 k
- * X7 H1 o# U$ `3 Q# y7 g. w" p
- static int acnt = 512;
- M9 [ t1 n& {* u% \% x - static int bcnt = 8;
' D: r* v) O) \7 T# c- C @ - static int ccnt = 8;
- I0 Q/ c+ j; s# L$ K- C; U - " R+ U$ J* F n2 m
- module_param(acnt, int, S_IRUGO);
+ k7 s8 h E! G - module_param(bcnt, int, S_IRUGO);8 {9 H* b/ G% N. W
- module_param(ccnt, int, S_IRUGO);
复制代码
. y& |! c3 Y- |7 h! P& ]: U
6 N5 Z% S: [0 E" q2 [ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( z4 x9 {& W* marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
5 M0 ]( l' l; Y% H$ B: u 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% l! a% H; ]- [3 B: T+ p3 b ~; O2 h
8 a4 c# k3 |+ C$ O8 i( k+ V" B* b
/ x5 P' G) O/ ~$ Y+ t- \0 ~ P
|
|