|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & S) f/ a8 g R6 q
- [code]EDMA sample test application
( J$ E: z* W ~ - /*: l9 e. I" P U: E8 b
- * edma_test.c# T6 ~% b2 @* o/ t; R
- *
7 J) b- v }" u' a l - * brief EDMA3 Test Application7 `0 f3 }! L3 C5 |- X" ~5 k
- *
* R6 T+ H7 F7 t3 [0 C! Z - * This file contains EDMA3 Test code.' T" v' g h2 v! }0 Y& G# j
- *
$ q' E3 ]! K1 y* ?7 g - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
. r. F4 \! o* ^# ^! K( ]( W - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 |6 E: O Z$ `% }+ D) K
- * TO CHANGE.
: v0 Y! ], Y% b - *
) ]. o J& z; ~' Z: g q - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// t2 j5 P+ n% ^5 j) m
- *$ a4 I- H* P4 E# q. ]) v
- * This program is free software; you can redistribute it and/or+ t- O" p( v4 Z6 e
- * modify it under the terms of the GNU General Public License as
# t) U; i: S5 s! W+ a) [( U8 K - * published by the Free Software Foundation version 2. }' M; w; f* R; f U. n1 L5 Y* Y
- *6 E+ ^. X% b* m
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 M3 d; B0 ~' f' }( x* ^8 [- \, n
- * kind, whether express or implied; without even the implied warranty$ \/ _$ h; `- R7 e
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- j, X1 ?9 H, a* T# ?) c& H8 p& U
- * GNU General Public License for more details.$ r5 R( T, a, {. {- f: l
- */
5 R; l( _& W& E9 M- E. C - % p+ R( U# T7 ?. \; Y L
- #include <linux/module.h>; ~5 p+ X! a4 Z
- #include <linux/init.h>
/ W$ v' p* d$ Z9 ?2 v7 { - #include <linux/errno.h>
) m" _ h$ @) C, p$ F5 h3 t* p9 Z4 y2 ^ - #include <linux/types.h>
* W8 ?. l X+ {& N2 ^ - #include <linux/interrupt.h>
3 t: K& L- g0 W4 d! s - #include <asm/io.h>
. U+ }& U) k' }6 f& [! ]8 F - #include <linux/moduleparam.h>% F% o: `- S: Q2 N
- #include <linux/sysctl.h>! s. t) X2 g) c* J
- #include <linux/mm.h>: h: J8 ?8 z/ u5 E9 b4 O
- #include <linux/dma-mapping.h>" N0 J( i) @! H: M8 ^
- * F# R& ^7 }* h. K
- #include <mach/memory.h>
/ d* k& n( ~7 y- T& t2 K - #include <mach/hardware.h>
$ r& Q! |+ [- o/ C: ` - #include <mach/irqs.h>7 v$ d; K) ^+ T) V+ ?0 {+ r
- #include <asm/hardware/edma.h>
# G3 z, H: {+ W/ Q8 {" d - ! ~! y! ^6 }8 X, s( s9 O. B I) w
- #undef EDMA3_DEBUG
. z( A/ Y/ F3 C7 c$ j - /*#define EDMA3_DEBUG*/
4 F0 b; F. j; h: m7 Y
0 }% `* P* h- t- #ifdef EDMA3_DEBUG, ?2 y3 s) N) t# O k6 @- ~
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
0 t! V- t+ T+ i5 l5 s5 y - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
3 `' P* f& p! c0 H0 J( G+ @ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
( R: z5 q! G! j* _1 c - #else
0 m; j8 a( S. l1 K% F1 _) g - #define DMA_PRINTK( x... )0 R% S U& C/ X3 A. r L" e; Z
- #define DMA_FN_IN
1 t0 H4 b; F* R3 d - #define DMA_FN_OUT$ ]5 s, t M$ @3 M3 D; h: t
- #endif
* v; j5 ?4 {2 R+ |( }1 O( |
# {4 P, }1 a$ J5 v- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
6 O& O5 i6 W) x+ i0 U0 r/ e4 P/ A - #define STATIC_SHIFT 38 D+ {# k6 ~, C3 n
- #define TCINTEN_SHIFT 20
( Y4 o; K3 i* [ - #define ITCINTEN_SHIFT 21
* W( {1 `4 Q/ n% m+ g( Z5 _ - #define TCCHEN_SHIFT 227 F+ i4 @8 Z' E
- #define ITCCHEN_SHIFT 23
% P' H0 G1 u$ M- Y- h
+ b8 W7 L1 a( W- t0 R+ g* X- static volatile int irqraised1 = 0;
+ [2 E1 W' Q/ y$ v0 S# z - static volatile int irqraised2 = 0;
" u3 g& M6 o2 a) e9 i/ F
& N3 j& L+ K9 O& `& G- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) u& {. ]! v' E* x8 u
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 x+ `( a2 t; e, u: p
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 H: [; _% i3 O, U& d8 {3 J
) W2 r x- m5 W& ]- dma_addr_t dmaphyssrc1 = 0;4 t" |7 s8 W0 y# z4 y
- dma_addr_t dmaphyssrc2 = 0;
. C& x9 l7 Y2 }4 H - dma_addr_t dmaphysdest1 = 0;
; F5 k, U9 T/ N+ U2 J# @) c - dma_addr_t dmaphysdest2 = 0; ~$ i) i$ b0 t8 q2 Y @
7 j0 Q; {: [4 |3 o5 h# E- char *dmabufsrc1 = NULL;
0 ^* r' ]- ?. ^( [6 A - char *dmabufsrc2 = NULL;
0 C7 U6 I2 S8 W) {3 A - char *dmabufdest1 = NULL;9 r' \1 M* q+ z8 h3 E( J# t, \( _
- char *dmabufdest2 = NULL;5 r( c5 p: |: k% |4 Z" ~/ {
$ p2 q6 b. l- d( y- static int acnt = 512;
- v- [( q0 }2 e* ?$ s% o3 Y - static int bcnt = 8;
) A* m: g) b" }7 {, F - static int ccnt = 8;
; e' A4 u9 a% E; D3 | - & V1 ~ ~/ A4 c7 q3 E
- module_param(acnt, int, S_IRUGO);
, t" }4 ~3 r) a8 V" I - module_param(bcnt, int, S_IRUGO);
+ ?5 O4 d5 r* B8 Q3 l8 ` ~6 y - module_param(ccnt, int, S_IRUGO);
复制代码 4 O7 p2 b" C$ P' b( g) I8 \$ }& `
' S. d( ]0 h) f7 o
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% v: R$ H4 N( s- M) tarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ Z! c7 R, f% o4 ?, ~ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. A( A' s- J4 ]- |
! f* `; E# k! x# N2 |/ @8 c
9 g2 P7 x# t; K4 {3 ]2 |. e2 F |
|