|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; l' p7 ?- ^6 K( }( p8 y" _$ ^- [code]EDMA sample test application
% S0 b. |8 u& `7 e5 |& E9 q" d - /*
8 d, W X8 D2 g i$ Z) r - * edma_test.c
# P! N) ?* w$ U$ j - *2 x- h# o+ e7 h' Y
- * brief EDMA3 Test Application
! t, y9 Q7 S* l1 I" c - *9 ^, g: Q# b7 L8 H. C- z
- * This file contains EDMA3 Test code.$ Q# a7 y+ ^' {- {6 L7 b! o
- *: `2 L& a5 E" \: ?8 L, w+ v
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
! \0 }9 x- e0 g F c* F3 [( J - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
" g! p+ S% {( ?$ Y% O0 Q# U - * TO CHANGE.
; Y# `1 h" Y' e- g" K - *
- q4 O/ o* v6 n# R6 r; d- n - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
5 G, d7 o9 y/ {, \: x+ \$ _8 g - *( A) X0 G5 `5 W; U ]- b; o' m
- * This program is free software; you can redistribute it and/or5 ]0 w! t% @1 p$ C7 |
- * modify it under the terms of the GNU General Public License as
8 W5 ?. `$ }# r! o7 C9 D2 W - * published by the Free Software Foundation version 2.
1 H3 H: L/ j' r1 _7 z - *
! J. u( i! E: N3 h g - * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ h6 z! `4 o( c1 ?$ Y% V8 r4 ~
- * kind, whether express or implied; without even the implied warranty
. y1 B7 v) F5 p$ } - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
& Y. J# Z/ ^# B- g" j4 R - * GNU General Public License for more details.
/ W) W% O) d' B( I - */
$ {/ V& h% _: I9 \) T - ; S1 `5 A$ V4 L, V
- #include <linux/module.h>& A Z% e& w `, F+ M3 m E
- #include <linux/init.h>
' G( @; ?1 C+ G/ x$ [7 u0 } - #include <linux/errno.h>0 _( E1 z6 D1 p% V# e
- #include <linux/types.h>, C/ e, i# K5 v3 K
- #include <linux/interrupt.h>/ o+ l! }5 W% c; Y# M0 ~8 l' G4 U" \. V
- #include <asm/io.h>
# u7 Q' E; }+ E - #include <linux/moduleparam.h>
H$ e8 U$ ]. N2 _ - #include <linux/sysctl.h>
( H U, J0 z- s" x u - #include <linux/mm.h>
7 s& [% D. a( r" Z+ A6 c - #include <linux/dma-mapping.h># c) ^$ v* N. O5 |3 I" |! F
- $ y! ?1 r# u) Z' N( X
- #include <mach/memory.h>
8 ]6 u8 V) B- R' P! e9 I - #include <mach/hardware.h>
" n7 t- e. F( `4 Z9 u6 x - #include <mach/irqs.h>9 k F2 c/ g+ \, B
- #include <asm/hardware/edma.h>' Q9 M! c# b' V8 d/ u- A
- : ]- |1 S! K8 v! e& U
- #undef EDMA3_DEBUG
6 z% s, n4 \: H/ [% b$ l8 D1 D - /*#define EDMA3_DEBUG*/
" S' B9 F$ y: }$ o! v - 3 V) q% v, e: R
- #ifdef EDMA3_DEBUG$ L# q7 M/ V. c; ~3 f0 T2 Q
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
' B; q: b/ y# [2 }3 y$ u, c - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); ?8 G4 x, k& g: _ e4 [
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
* C1 Z% r/ I7 b6 M1 \1 a8 ^2 i g5 l - #else) R" e5 W% z% R
- #define DMA_PRINTK( x... ): E/ C3 @& D, v
- #define DMA_FN_IN
4 m& v: J3 |0 I - #define DMA_FN_OUT$ ^5 R% V! x: g1 p1 C3 D+ }
- #endif0 i) b8 K: a2 L
- ~- X7 q- L7 S3 s# }
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
! r% Y9 ]& j- }8 P - #define STATIC_SHIFT 3
+ a3 {. S* a# k8 b% H0 H - #define TCINTEN_SHIFT 20
& b$ u- a" Y( Q- z5 D- D- H+ W i$ g- j8 _ - #define ITCINTEN_SHIFT 211 p4 F7 w5 E+ Q; q1 b5 n
- #define TCCHEN_SHIFT 22
; b2 d- b, g1 v9 ^ - #define ITCCHEN_SHIFT 23
) m2 M3 @, v7 E8 |/ Z0 Y- G- L$ t9 ~
c) t9 O0 h/ F4 P- q# H- static volatile int irqraised1 = 0;$ P) z; l( I* A% Z$ U9 [
- static volatile int irqraised2 = 0;2 D6 f1 M2 [7 ^1 V0 Z: a0 X
- $ c6 R Y7 K: ~. r& l' Y& Z7 R
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 ?4 B/ d \* ]4 {' B' Q( E - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
u; F* z' y7 X Y! m1 f( k - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* H0 I* Y `; B% M3 Z. S
7 i2 l: n0 u. A/ @) }- dma_addr_t dmaphyssrc1 = 0;1 s7 e3 n. b1 A" c- s
- dma_addr_t dmaphyssrc2 = 0;
4 M9 |8 }6 g h - dma_addr_t dmaphysdest1 = 0;- v' }/ ^9 m( t( {# `7 S5 @
- dma_addr_t dmaphysdest2 = 0;
1 @) b- b0 }2 E+ H: F" F( H - 6 Q3 \8 _! J* O5 H& H; \8 n
- char *dmabufsrc1 = NULL;
. w3 \/ B3 A# w2 l, D/ S - char *dmabufsrc2 = NULL;
# F# ]6 j4 Z4 y - char *dmabufdest1 = NULL;3 t0 }# a- M$ P% J) R' S9 v: j
- char *dmabufdest2 = NULL;
) J3 C; ?- K; ^" @ @ - ( f, X- z8 y+ v4 {* ~6 k9 i
- static int acnt = 512;2 P* f, r( C; `% m) h8 R
- static int bcnt = 8;$ i- R. D% v! b4 h! B, w9 @1 E
- static int ccnt = 8; A3 C- ]# ~! u/ ~( f
- : G& C6 ]+ I8 |1 W
- module_param(acnt, int, S_IRUGO);
% r2 x: S" U5 y) @% m. Y1 V+ { - module_param(bcnt, int, S_IRUGO);3 q# u* e4 t+ u& x' |. u% o0 H2 Q
- module_param(ccnt, int, S_IRUGO);
复制代码
: Z* w9 \2 a& o( V
4 T% ~ W9 E: S; C5 D 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- R2 d+ m# [9 r4 f) `6 r! O
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# p0 L( a' P( N* \3 s 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 }, g& h s5 _4 @& \
5 P8 c( l- w- B: n* [$ z8 h) k4 O5 u- g# ^$ K
|
|