|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 }" P- {' _# C) Q
- [code]EDMA sample test application
' O- E: `) S8 x+ H: k9 ` - /*; C/ ]' M3 p3 f" n- }# h& R
- * edma_test.c+ n a4 i# {5 I. v# Q
- *! O# ~# x9 l' |/ s$ n
- * brief EDMA3 Test Application
( T1 V* i% x. `/ B/ q - *& A" w: l9 y; d6 U' f
- * This file contains EDMA3 Test code.2 M1 @7 t$ s" S
- *" e- c8 h6 k, \6 G
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# x. M2 o' h( p/ b( X$ Y5 J
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
9 C1 i* f3 ]4 {5 ] - * TO CHANGE.
" e* G! n0 n9 j+ I( w- e5 n3 L4 D - *; {* d# w( n0 C& W0 z
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 K3 E2 b5 u2 z+ P- q0 x+ |
- *) n" T2 C6 s0 P, k9 C
- * This program is free software; you can redistribute it and/or4 r! T. U: J- V, Z# d& @' v% _( r
- * modify it under the terms of the GNU General Public License as
& h; D, ?/ B! D2 C% a+ G4 A - * published by the Free Software Foundation version 2.
: E" Q1 w5 S8 E+ j - *! k# r7 P: S' n, {( s4 b5 J
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ S$ ]! W9 _1 I7 Y: L
- * kind, whether express or implied; without even the implied warranty
3 N& ~4 l- d9 O, { - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the& V- N. D/ l8 D+ o% x+ _
- * GNU General Public License for more details.
\! ?6 b; d( N# Q2 Y - */
- Y$ {! r! p* f - - n7 |2 I8 F' e' q: y! n9 L
- #include <linux/module.h>
2 |7 D' @! U/ @9 |9 @ e8 @ - #include <linux/init.h>* [; G4 U1 R/ X4 v o/ z- e0 N; H
- #include <linux/errno.h>1 X3 M) p3 N: Z$ J9 n9 b
- #include <linux/types.h>6 B* w2 ^( Z# e$ S5 j
- #include <linux/interrupt.h>
9 l; ?6 l, S* c8 h* n - #include <asm/io.h>) i7 T/ N" b9 w* v: P9 h! J$ i
- #include <linux/moduleparam.h>
$ Q. p7 {1 b8 M4 Q6 A - #include <linux/sysctl.h>, k1 N( _- ]0 P% Q: ], t0 {7 ^7 X2 O Z
- #include <linux/mm.h>
& y- w" s+ P2 M - #include <linux/dma-mapping.h>
; ]8 ?) u- F* }+ J0 ] - ' i( n W% Q! {* T
- #include <mach/memory.h>
/ \8 C" L3 H) @) X2 T K0 G5 W2 f - #include <mach/hardware.h>* C3 o) ^+ y3 x) N* @; [
- #include <mach/irqs.h>
5 c7 e9 p8 U" [6 V - #include <asm/hardware/edma.h>
/ k2 s e3 D0 q C- l- g+ F, l+ N8 c2 j
( v, d( ~) s) n' g8 N! F- #undef EDMA3_DEBUG3 M3 T1 j1 J2 |, f. M: @5 o% Z
- /*#define EDMA3_DEBUG*/
' U8 Y+ X* d, O6 ]2 A - % _2 f; k- A! c3 W7 X' w3 i
- #ifdef EDMA3_DEBUG
/ Y* F- ?: ]& ^4 L! Q$ N) u - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
" G9 C2 s* ^% K4 v/ h4 U2 [ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
) b E# H" {. v; o7 c) B - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 e' F# [- t, G5 T: C; w, f
- #else! }4 x) S8 A) Z* @. |( J6 p6 e% b
- #define DMA_PRINTK( x... )
2 s' A- V. ~" c/ W - #define DMA_FN_IN( {, `$ r8 B; ^4 \. `/ o. W* ^
- #define DMA_FN_OUT+ j, c) Q2 m: ]
- #endif
" e7 h8 a* |9 z - ! k, h+ }0 |& q! i: |7 C
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
1 V6 x$ V4 `0 ~3 T9 l2 t - #define STATIC_SHIFT 3# w, E5 g% Y, w2 C+ }: G3 \# v
- #define TCINTEN_SHIFT 20/ B; G9 c! t3 f K' S$ Y, b1 [7 q
- #define ITCINTEN_SHIFT 21
2 x2 Y2 N2 ?0 N5 {& H9 T& x/ m& c - #define TCCHEN_SHIFT 221 }1 n9 F% Y [( i0 j8 @
- #define ITCCHEN_SHIFT 23( S+ J |4 U, ~
/ q' |# ~; ]1 X7 e- static volatile int irqraised1 = 0;! a9 A4 ?8 a& `5 p
- static volatile int irqraised2 = 0;
: q5 G# z( x L c - ) c0 K; J+ ^- X0 t+ U
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) `( T! x F) Y0 O$ H
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) H( C0 S S1 U" l( _9 ~
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 k* C, W; v1 [3 I3 V( z
& M8 P8 ~+ m3 n7 N$ H W- dma_addr_t dmaphyssrc1 = 0;1 y$ ]6 v1 R6 }3 Q
- dma_addr_t dmaphyssrc2 = 0;# w5 X& j4 N! _ h4 \5 I0 b/ R
- dma_addr_t dmaphysdest1 = 0;
, d) m, @# {6 o/ ~& l! m" t - dma_addr_t dmaphysdest2 = 0;
; L" k5 h$ i6 I3 a
( u1 Y- k6 [* l- char *dmabufsrc1 = NULL;# x5 S' z f1 g: p$ i
- char *dmabufsrc2 = NULL;
, i+ n; g9 ~1 |2 \ - char *dmabufdest1 = NULL;
: N# i, h* d. l }+ y - char *dmabufdest2 = NULL;
# P& \5 M V% w9 n
. b7 D6 h& N) p' `- static int acnt = 512;
! W( X6 v" c2 `5 d* I - static int bcnt = 8;
3 Y) n& E5 k9 a7 Y" | - static int ccnt = 8;' `/ i# g# E; s' }
8 Z! g5 [3 ?3 i- module_param(acnt, int, S_IRUGO);4 S0 ^3 r; }/ N. ~ ~, C
- module_param(bcnt, int, S_IRUGO);" T$ `$ d9 E+ ~
- module_param(ccnt, int, S_IRUGO);
复制代码
: O1 N2 N' L% M/ |5 S4 }% }& R/ O+ Q$ q8 G1 a- Z0 x
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用 \& H. R: V" X: `1 ?9 D
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 ~* Y8 M7 m8 A: Y3 t3 p# I) c* ^: q 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ u3 [/ f3 f3 X$ a4 _
: L: g1 S1 k; `1 N, _! e
8 y/ t$ f' @, Z0 F* `- J+ } |
|