|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. O1 U+ d& N1 d2 X- [code]EDMA sample test application+ y' e* v: d& |. G0 F' e. z/ w s/ g. g
- /*
5 R! R- v6 l1 R1 C( { - * edma_test.c
3 c7 ?& l q7 `. W. J. e- l - *
! P' {6 t+ `$ Y - * brief EDMA3 Test Application
, O I2 @, `2 x - *
' u _1 o) ~! I* I - * This file contains EDMA3 Test code.
1 p, b) J( \! P( M+ M - *' B9 X. f1 R$ t- z
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 ~3 S& q# q$ B7 _5 r" h5 e
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
3 ~. e/ @1 s7 F6 |. q. D, k - * TO CHANGE.
6 A2 X: H; z* \1 O) [5 a# y& [% ` - *) w( Q. I- s3 N& [8 b5 s( W4 N
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ s( p6 M+ u# A! y# J9 |
- *
9 r3 J9 ~. n; F! a- D5 e. | - * This program is free software; you can redistribute it and/or& R- B; b$ a- `4 @3 M( ?) I5 c
- * modify it under the terms of the GNU General Public License as; ^; f2 M5 m# b7 i
- * published by the Free Software Foundation version 2.
% V3 q3 e* Y/ b6 e) u6 s1 G i - *
7 C7 e) K; t! f. t8 ~" ? - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
6 {& G3 `$ B* S: H* }" H- w& a! k - * kind, whether express or implied; without even the implied warranty/ X g f, X" E7 I) `
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- w# ] x/ \3 D) f4 n& C: \" d - * GNU General Public License for more details.
" x( t% y3 N& i w6 J5 k9 T# g - */ {* o U' i. m: V9 z1 O. J
- 9 @+ q$ o4 V, y
- #include <linux/module.h>
& T) e; N5 G$ [- U, K# H - #include <linux/init.h>% }4 y: M# ~1 N, y
- #include <linux/errno.h>* r0 L4 _. r$ z- Z
- #include <linux/types.h>
: z# j f, j& [ - #include <linux/interrupt.h>
+ D! t: o" R# @. n- U. a' y/ n- K - #include <asm/io.h>
5 V; h2 `* n: e9 w& l' i - #include <linux/moduleparam.h>
7 [5 H; w0 |3 L- a2 l& W1 n' A% @ - #include <linux/sysctl.h>/ I- ^+ d3 p+ t$ B* r( e+ B6 B' M
- #include <linux/mm.h># A0 d2 @7 R" F
- #include <linux/dma-mapping.h>
" y: E- t/ p; y7 X- E1 j
2 K% R5 `. U1 s2 C- #include <mach/memory.h>' h# n" M3 o2 d+ i
- #include <mach/hardware.h>9 N" s9 U" u0 `! w& o, o* X
- #include <mach/irqs.h>: ` S6 k }2 }, p( }. {
- #include <asm/hardware/edma.h>% ?1 \" Y9 g6 ~. ]8 O
- 5 _7 I' |6 V, G; A4 g/ d- L" q( _
- #undef EDMA3_DEBUG' i( _6 ? _ y p5 p( D, j6 e& e
- /*#define EDMA3_DEBUG*/& L) u8 I4 l6 U- H
) Q5 m# _& F8 ]& x# F' U& L/ j7 G- #ifdef EDMA3_DEBUG3 F7 f+ E9 ?# k' D9 J2 L! s) q
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
& u8 J. C' J5 S5 g - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
- _$ B' Z- b. [- R+ r2 |5 c6 I - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ Z& M. c3 [+ c3 ~/ s
- #else
$ Y8 H5 S6 O, |2 b1 ~" D; d - #define DMA_PRINTK( x... )& K- Y3 W) T* C6 {! B/ y
- #define DMA_FN_IN1 y9 t* V5 r& t) O% b4 S
- #define DMA_FN_OUT
+ J( p. y' x9 a) J* ^" w2 x& \ - #endif7 L- t+ ^, w& }# P1 J
- ( ~) y' f$ e& O/ H6 ~
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)% j& W9 N' [: f
- #define STATIC_SHIFT 3! t b# l: Y4 P! Q! j( ^! `
- #define TCINTEN_SHIFT 20
$ N1 e+ x) f. q1 j7 |$ }3 H - #define ITCINTEN_SHIFT 21
- I% d- f f2 J' X - #define TCCHEN_SHIFT 22, f; R$ |9 t% Q
- #define ITCCHEN_SHIFT 23: p* e! X) o! n% L* O
- $ }1 s+ ~2 H2 e2 G0 W. |: q, x
- static volatile int irqraised1 = 0;
: W, y3 G* y) S - static volatile int irqraised2 = 0;8 F6 f3 t: G' M
! ~* l4 G6 C+ {, G( }- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, K- b; K3 `6 o) \6 U+ e
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; S4 C/ K2 k0 w: ]( y* R0 {) L; d - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! [& r- A3 Z- \
+ Y! M5 k* B: B& q9 T2 _) {- dma_addr_t dmaphyssrc1 = 0;: i" U8 a! T/ d( d4 c* d5 I5 f
- dma_addr_t dmaphyssrc2 = 0;9 ^( q8 n" S' o. D. y X3 _5 @
- dma_addr_t dmaphysdest1 = 0;) h$ u0 t- L- ^7 _
- dma_addr_t dmaphysdest2 = 0;; Q7 t% H5 O2 F" ]1 Y& T
- 5 Y# j, _$ `8 g+ T
- char *dmabufsrc1 = NULL;
) {8 U% _/ h( ^$ f. n - char *dmabufsrc2 = NULL;& @* z2 f9 H% [( j, O& F
- char *dmabufdest1 = NULL;
O" D3 x; z% p+ n6 h- D. d5 H9 d - char *dmabufdest2 = NULL;
M; L) K+ w( G h' n1 |4 x
3 G. L3 X2 M+ M6 a- static int acnt = 512;
6 o1 d' ]7 U, D7 ~' B - static int bcnt = 8;
' ^; T) |4 T* X/ |( M - static int ccnt = 8;+ G+ e- N& {' N
- 0 j3 i# R5 u2 z6 o* U6 W
- module_param(acnt, int, S_IRUGO);
8 @0 v/ z x$ F( w6 s& u7 y2 b4 a' d5 Q* F - module_param(bcnt, int, S_IRUGO);% k7 W/ y! F" ^; L9 }- x! k0 l
- module_param(ccnt, int, S_IRUGO);
复制代码
% s1 P' h# q" ]' g9 b9 j+ t+ {; V5 |
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) I: @7 c) U! J/ j! `# Z; ?6 h6 `: warm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ B2 S# k9 F1 `2 Y9 C) T
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) N6 f. t- B" z' B7 s& M" `# q G* y' E& q R# R4 G' Y5 K
, ?" m0 {5 e* F1 |* e. X
|
|