|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 c, _* y' P6 c0 u# x# G, p. H1 u; x2 J
- [code]EDMA sample test application9 e: `3 k9 R: V' F% p) @8 Z
- /*3 R% O5 J9 q# k0 m6 z
- * edma_test.c
! a9 r- e1 T, s7 q( y! b - *: G- l' ^/ J" D& g& q
- * brief EDMA3 Test Application
0 }: u( @! f: F5 a - *
2 \, W, C# G- p. ^8 u- `% C - * This file contains EDMA3 Test code.
4 g4 p4 Y5 S6 |$ v - *
9 S) u `+ d- V7 X7 d+ f - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ _5 C7 }# n# O0 g8 E* K0 \
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ j' K+ G6 t" D' G2 j
- * TO CHANGE.
+ R$ K5 u# G H( x2 o - *
j7 O" b* t ^3 I o2 u - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 R- ]1 P( t( ~5 ]
- *
" y# [1 y9 A+ a! u. x6 [4 `3 r6 q - * This program is free software; you can redistribute it and/or6 [, Q! F/ X6 R; w
- * modify it under the terms of the GNU General Public License as
9 `: D Z: m; i - * published by the Free Software Foundation version 2.
- n: n& b" U) I3 f; X - *
! O1 ?& ]( g1 ^ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any- A& u0 ~- C$ b; V; n
- * kind, whether express or implied; without even the implied warranty
@+ H( r# c+ I2 Z2 t - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the' y0 s2 f- }4 |' w. w
- * GNU General Public License for more details.( g7 i; c, v1 p5 [2 [* S
- */) F0 n2 c: w- w6 z7 p+ B* Q
- 1 D0 d0 L! F# B6 e' X2 L
- #include <linux/module.h>: A! J. x6 V! E# i. O1 K5 t% X+ e
- #include <linux/init.h>
: g5 ^, _; n& O; u, n# H+ X' [ - #include <linux/errno.h>2 ? l9 C& X% l) b1 O+ [7 A# K3 W
- #include <linux/types.h>
* L; o4 R0 X: Q# m9 \ o - #include <linux/interrupt.h>6 ]4 c) h2 N: {
- #include <asm/io.h>
8 `5 P0 {2 y9 R, d/ k1 J - #include <linux/moduleparam.h>
2 L: j2 i2 I5 m; q' V: X5 } - #include <linux/sysctl.h>
* {1 U6 J1 j/ m) [1 X3 U& D$ g7 A - #include <linux/mm.h>
: k* m9 A; n4 y& | - #include <linux/dma-mapping.h>
, _+ H& {( }) o5 l2 h - * X- U8 M8 O; ~* |' X
- #include <mach/memory.h>$ f, N" M: p/ R& v
- #include <mach/hardware.h>" P+ d, h6 ]0 A, g
- #include <mach/irqs.h>
1 R, |; O3 ^1 D, T' m6 V2 F' K5 { - #include <asm/hardware/edma.h>7 j; G' z( u& T' U% l- b
- + Z0 G/ P$ Z. r3 n& ?9 d6 |
- #undef EDMA3_DEBUG
" j. ]9 Q6 W& L - /*#define EDMA3_DEBUG*/ x9 q# O+ n. o7 m. i
) k) U/ b1 K& H. }1 J2 \% \- #ifdef EDMA3_DEBUG t% @8 y) L2 i- G! R
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
9 ~: c% ^# u6 N; R - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( v& L9 [7 s" a" O
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
4 f( V5 N7 K( e' Y1 W+ R - #else' `$ Z; [4 @$ x
- #define DMA_PRINTK( x... )- A! ]* M% C: ]; |$ j) H& ^
- #define DMA_FN_IN8 O! A% e6 A7 k
- #define DMA_FN_OUT% D3 j# {: D1 {* t9 T# l
- #endif4 H$ R y- X) M
- " Y& }0 M% l( T' N
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)' m8 @/ P7 R M f1 ^+ X
- #define STATIC_SHIFT 31 y/ G) r7 e, u! \' k
- #define TCINTEN_SHIFT 20
7 k# ~ v1 p7 W; M" P, I6 s6 V/ q - #define ITCINTEN_SHIFT 21
! T6 c1 G' y& ~6 A4 _ - #define TCCHEN_SHIFT 22
# u! x* {7 |+ P1 [ - #define ITCCHEN_SHIFT 23# N5 a. l |' S( _& Z' c
- 2 V# _! H" b3 c" E9 x2 l
- static volatile int irqraised1 = 0;: D; u2 D$ L8 G: A3 f. N+ a
- static volatile int irqraised2 = 0;" J- Q9 _2 S2 s
- % a/ j9 i$ K& b1 }
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 [0 M. V+ K- D4 k q
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( d% f' a- h: m) X' `5 ?) v
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& i- X8 J% c. T
. f- j$ L/ ^7 l. J2 [; y- dma_addr_t dmaphyssrc1 = 0;
9 d; ?) }2 G3 X6 H" n# ^! }& |2 ? - dma_addr_t dmaphyssrc2 = 0;
( V2 [# Z8 } C; {- k4 f- I - dma_addr_t dmaphysdest1 = 0;
' G0 S+ w% l+ b& W - dma_addr_t dmaphysdest2 = 0;
) V( L; s8 E* c* z# |0 n - 2 [) a/ D2 E# p, _, v, i
- char *dmabufsrc1 = NULL;
1 o9 x; J+ \# I) \' H L+ | - char *dmabufsrc2 = NULL;
" p1 Q; x* u# U* a' z - char *dmabufdest1 = NULL;& |$ @( v6 D9 v1 v
- char *dmabufdest2 = NULL;( V- I u- [" q
7 K" ~% v$ o+ c0 X& {& c- static int acnt = 512; c' G( j3 B8 B5 w+ s: v( l% o
- static int bcnt = 8;
2 k$ r) l, `' X+ \$ A - static int ccnt = 8;2 \5 n( j8 |# r8 T1 M$ C- W
* x3 M3 b* Z8 x. K( Q2 k. N- module_param(acnt, int, S_IRUGO);6 B; I8 E" r, G) z
- module_param(bcnt, int, S_IRUGO);- O$ S6 }6 d. f% O- n$ f
- module_param(ccnt, int, S_IRUGO);
复制代码 0 I8 ?% X8 J7 O& z5 Z/ l: Y
/ w1 Z" s; R, h* [- T: {, T
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ N2 I3 e$ g6 ]
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 H, R# f) x. U
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# D0 ~0 ]9 }! O
8 U& ^- P5 r& I, M5 A, G' {5 ~- @: _' _# ~7 ]* y' n
|
|