|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : G/ ?, V5 }2 `$ p
- [code]EDMA sample test application5 Z" r, T5 m: }8 I: Z \3 q8 l/ x
- /*
) p* O7 @$ b6 A% R - * edma_test.c
% `+ V' ~; y- B - *3 F; v( d2 e/ `6 o
- * brief EDMA3 Test Application9 G, C/ r( g) r8 F
- *
0 Y( E/ @" O; I - * This file contains EDMA3 Test code.( R- Q# \; E7 @ [8 y6 @$ h
- *
; i) ~+ ^5 U+ j6 B - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
# Z* [* s j' b& L o( h* f* J - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 G6 i3 g8 `5 w2 K1 H) z
- * TO CHANGE.
4 \' J, g! m0 A' T: W$ q - *
+ V& d& a3 D& k) Q5 p - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ Z( R+ O% J1 J8 J2 T! @, K
- *# L/ Z0 O9 x7 S/ i/ H
- * This program is free software; you can redistribute it and/or# D; v4 ]( A7 p& Q$ x* v
- * modify it under the terms of the GNU General Public License as
# E6 U3 G" p- m - * published by the Free Software Foundation version 2.
) F: b% B* x" s5 j5 t) E* j* ] - *1 F9 n2 R* ~7 H2 r: Z2 k
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 ?3 J& R' ^2 g+ j
- * kind, whether express or implied; without even the implied warranty
' N8 T7 A& x8 ~ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the; [: A2 F5 X: { ~( L
- * GNU General Public License for more details.
5 l4 w, ]1 ? r; b& M, V0 ~ - */6 c K. c5 `$ \" ^+ s5 }
; z# w3 }) T `+ v% x! J- #include <linux/module.h>6 c) r; w# s1 ~$ [7 Q+ U' U
- #include <linux/init.h>
" f$ E- Z" a9 l* ? - #include <linux/errno.h>
7 w0 V- e6 D1 f! S* |' X - #include <linux/types.h>
* Q" o' j6 r" D - #include <linux/interrupt.h>
. R) F' [& e, _3 G - #include <asm/io.h>6 @ G9 l% r }, a7 f
- #include <linux/moduleparam.h>
G! I. B, q8 g: h' k9 |3 y! z* K - #include <linux/sysctl.h>
$ G9 y; W* r) L% k* | - #include <linux/mm.h>+ [3 J# |* m! Q
- #include <linux/dma-mapping.h>7 q1 V+ E& B/ I. k5 Q
4 P: h, j; S" K; w- #include <mach/memory.h>4 l3 U! e( r( }) D: U9 k3 m1 i; R
- #include <mach/hardware.h>8 S/ f( |: h7 p: [
- #include <mach/irqs.h>5 Y7 w- A8 y5 a8 E! \' ^; e
- #include <asm/hardware/edma.h>
6 e" @1 A# ^% u& y* Z
: m0 A2 t- l, z+ B+ W3 X+ n$ [- #undef EDMA3_DEBUG
4 S/ o/ O' q1 j% {0 Y) b - /*#define EDMA3_DEBUG*/
3 r" J" y6 Q+ O7 f9 I) V, y( U& M
3 R }9 \4 |0 u- #ifdef EDMA3_DEBUG
- ^+ G) J4 U- f - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* S6 |" ?( f/ E( e v' E
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
% a$ ?3 x: y+ b( ?/ B: y - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
8 n9 J: {+ ^8 m- A ?' S3 ?6 N - #else. H- _4 Q+ Y9 ]
- #define DMA_PRINTK( x... )8 E3 g1 w) _5 a
- #define DMA_FN_IN
. e$ y6 f- y6 | - #define DMA_FN_OUT
1 o% q( `1 C0 j, s' M) a& s) c - #endif! q' Y/ g) O" z) T9 e1 ^, g# O
' u! q) W5 N* w/ s- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
, \* ]( {: m0 V0 F: e - #define STATIC_SHIFT 3& i: m; Q* r$ N' }4 ~- s0 L
- #define TCINTEN_SHIFT 20, d( j6 E9 ?* `7 P
- #define ITCINTEN_SHIFT 21/ a7 Q" l" A, u; G
- #define TCCHEN_SHIFT 22; \7 a+ O4 U l4 {; m7 k
- #define ITCCHEN_SHIFT 23
8 ~. K9 I! K2 k; f( T/ @$ v5 O - 2 F8 v% P7 R2 |! j6 X. Q+ W. w
- static volatile int irqraised1 = 0;
0 o0 ^" o6 ^" S6 u - static volatile int irqraised2 = 0;
) v$ r% x* o4 S- k/ m$ {. N
/ u6 q' S* p* c$ b- y7 [: f9 A7 n6 e- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: m4 D; P$ z) E0 C
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# d. p7 p( }- T3 `; O+ ^9 `5 b
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( q5 r3 Q. \0 l5 B/ B* s( R- q
) N9 d5 G% O& k3 d- dma_addr_t dmaphyssrc1 = 0;
+ y, n. q8 y+ O7 { - dma_addr_t dmaphyssrc2 = 0;1 A) C0 _) N" }+ [0 a% S9 a. D
- dma_addr_t dmaphysdest1 = 0;. S' w& y$ A8 F
- dma_addr_t dmaphysdest2 = 0;
1 k( ]- I0 [* `# h" r# l# w - ; i: N" t. k' T& J% o
- char *dmabufsrc1 = NULL;, B* Q! ]5 v+ P( Z/ _ P
- char *dmabufsrc2 = NULL;
/ T6 g4 U, m7 E# {0 ]3 o3 j5 ^/ Q - char *dmabufdest1 = NULL;$ Z1 m3 Q W# ^2 a+ _; {' S
- char *dmabufdest2 = NULL;) z! p( N! Z) H' b$ s
- " s1 e' f- }! o. ^" u
- static int acnt = 512;
' W- t d3 S. M2 y. T. K0 B - static int bcnt = 8;0 G0 B% q3 e; ^3 w1 ?8 R$ N' n
- static int ccnt = 8;" j3 N2 D( P. ?3 `. p, b
- " l7 M/ E+ }+ C+ c
- module_param(acnt, int, S_IRUGO);0 K1 t2 s, ]( Y9 q' L
- module_param(bcnt, int, S_IRUGO);. E2 D0 P+ u+ x* j. J
- module_param(ccnt, int, S_IRUGO);
复制代码 ! N! Z) Y/ `. y4 r! ~
`) Q& d$ h& j' n; M 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& ~$ r; x# H% ?, H1 {
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
3 Y2 V, o) ]: y( C$ t9 m4 T 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 s3 r M2 P" O8 y) _' d+ Z2 i3 M# G( r3 n
/ }( P% a) T* h
|
|