|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 }2 J8 i. ~: q* s- ]% O
- [code]EDMA sample test application
/ S( x0 c7 v$ H8 I/ N - /*
R/ ^7 o# x5 H4 ^ - * edma_test.c
2 u; i( s" f& A4 b - *; L$ M, G! ~8 W/ N5 T
- * brief EDMA3 Test Application% l' h9 H/ p9 |$ C3 }
- *
' N$ n' T& J( r. @6 f5 C& \% d - * This file contains EDMA3 Test code., L5 ]- f7 B" z9 M% `, j4 B
- *! Y9 Q$ D0 r. u( R3 w: o6 _
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
' F$ \* \; z8 i" m4 O& i - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
! U; Z& P9 u! c. b' L$ P" I+ `8 Q+ f8 ^ - * TO CHANGE.$ e& u ^. D- C
- *
+ e# ?& Q9 ?+ t! Q, P1 _ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 p9 N. B% p: _, m
- *
2 b% d( m, B1 l0 m$ I2 U7 N - * This program is free software; you can redistribute it and/or
! P0 f3 I. J w( X - * modify it under the terms of the GNU General Public License as( K* K# P: W% D& t. n
- * published by the Free Software Foundation version 2.6 c! Q% t8 U) c+ D+ r. l
- *3 m/ i5 f/ g+ j0 K8 k6 D6 R' ^0 Q
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 z1 O4 z- J* X( h, |% d+ \
- * kind, whether express or implied; without even the implied warranty
& @/ u; v' I( n: l0 F7 t - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the2 h2 q) X( ?, E) P+ \8 h$ _
- * GNU General Public License for more details.7 {+ Z/ c/ T7 `# u+ c
- */
2 |" M4 {! s- J' e% M _1 ` - - w" K; [8 O. u/ g( b3 p
- #include <linux/module.h>! T2 a# Z- I# W1 z4 O- _
- #include <linux/init.h>+ i+ m1 v+ \ i- A1 r
- #include <linux/errno.h>$ P; \; t0 d: j; d, Q$ b& n+ d
- #include <linux/types.h>
- j* x) e6 J% V - #include <linux/interrupt.h>
. m. A$ Y1 b& W, g) _: k" p - #include <asm/io.h>
# h8 j! V _2 e( `0 [0 F" {+ {/ Q - #include <linux/moduleparam.h>( L; {- G3 a ^
- #include <linux/sysctl.h>+ S* \! D( a9 }
- #include <linux/mm.h>
% D: L* \% _5 n# n - #include <linux/dma-mapping.h>
2 r) N# D( \, ?0 d; Z9 ~' F& X/ w R
, ^- n( j5 U- V- d+ U8 \1 w# ~- #include <mach/memory.h>2 W. K0 k# x% R5 D/ d
- #include <mach/hardware.h>
: e9 Q" q$ |7 v - #include <mach/irqs.h>
! m; L5 z. X* X! s6 t2 r - #include <asm/hardware/edma.h>. ?- z6 ^+ N! X: j% g" D
9 o! v% D0 m8 }3 L# d+ m. }- #undef EDMA3_DEBUG* A0 P2 @* L7 v3 V9 z
- /*#define EDMA3_DEBUG*/4 b0 Q! U9 F9 J1 k3 }
! C3 O) ?% B& Y z: R d- #ifdef EDMA3_DEBUG# x1 G: ]& f& ^3 z. z4 J
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
" t" n9 r$ c5 [) H$ c R0 X& B \ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
4 ]: l7 e, \5 j9 [8 G; t/ _# U - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
h9 c1 P# J, k# q- E5 t* p4 J - #else C: E' a6 ^$ |6 g: T
- #define DMA_PRINTK( x... )% v( a( M. y4 c2 \+ M
- #define DMA_FN_IN9 k/ `& |4 M s' S# G5 r) {+ Z
- #define DMA_FN_OUT0 h& l6 Z" k# D: T4 `, M
- #endif
5 s# B" {6 V; a) k0 e8 f - : P2 M9 m" s7 |1 W8 X {
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
6 P7 q) X! A2 M! r9 Q - #define STATIC_SHIFT 33 N0 }9 Y4 Q8 V0 A
- #define TCINTEN_SHIFT 20
3 o& d9 p, ]4 t+ w% m- U) `& y - #define ITCINTEN_SHIFT 21$ P4 |5 i L2 C( C' a
- #define TCCHEN_SHIFT 225 O5 u; U- q9 e+ S5 f
- #define ITCCHEN_SHIFT 23% a, c; f: v' G5 S0 X: x5 j" _
; `* x) r4 ^ k- ]: S" r6 z- static volatile int irqraised1 = 0;0 U( W% b9 d# T: [" C
- static volatile int irqraised2 = 0;
7 }$ q. D: @8 k" |) O - ( R' {% _3 @# G. q& R- l
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( x) }! N) y i3 e2 ^2 Q$ T - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) _ {9 U+ _+ n+ T- r' J) S9 x* q
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) ^, @ L+ t- \3 O1 A% R& k m A
- 0 S g* ]* @5 o- ~
- dma_addr_t dmaphyssrc1 = 0;
9 d0 h9 e' _! e- g- W$ l2 U8 N& [ - dma_addr_t dmaphyssrc2 = 0;1 H. c! W' [ d3 I& m) B0 h
- dma_addr_t dmaphysdest1 = 0;
9 Q) c7 s M6 i( Q5 Q3 H - dma_addr_t dmaphysdest2 = 0;6 s; u# q3 Z: [" B! _
1 T# J& o1 N/ X8 u- char *dmabufsrc1 = NULL;
: e4 R% w* A; | - char *dmabufsrc2 = NULL;
" G- U8 ^4 c) J) } - char *dmabufdest1 = NULL;# \( _3 V/ J- R3 j
- char *dmabufdest2 = NULL;
6 T! |8 \) ?3 s2 ^- v
3 G+ I1 `' J% L- static int acnt = 512;; n q5 [, |$ K0 M
- static int bcnt = 8;
}! x1 P* X! y. b' X - static int ccnt = 8;
7 q2 T# E3 ~! M; S - }9 \/ b' m1 J; Y
- module_param(acnt, int, S_IRUGO);2 r4 w' l. ]" x z7 Z5 ]
- module_param(bcnt, int, S_IRUGO);
3 o" E) e( y# w+ k - module_param(ccnt, int, S_IRUGO);
复制代码
1 V9 @ r F2 F0 E4 _( M8 l
5 ~0 b! ]7 z& ]9 \: p$ H/ n0 v 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- m7 z) G1 |6 v/ S: `
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' u* J1 w: ~2 U5 r9 Y# ~ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' E9 V ~$ q3 \0 a( ?; r0 P+ ~+ V% B7 }7 [
# N+ k+ x1 |; F3 Z+ r8 |3 [# q
|
|