|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 A' b8 ]( t" Z ^0 ^. ?) y- [code]EDMA sample test application# c7 s" p7 L/ z9 ] ^- C
- /*6 `, c/ W/ J, m4 g! ^" u
- * edma_test.c
3 ^; k4 n: O! L/ y3 u( }; e - *
4 l8 V+ g% A) E, j - * brief EDMA3 Test Application
, N6 V3 e5 [ ^" V - *3 m* ^$ ~& |- u( f! j
- * This file contains EDMA3 Test code.8 u* k0 C9 v) ]/ w" y' Z' n) c. R5 ?
- *
: N5 M6 i! H. [* v: M0 ` - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
5 F6 p5 v% c# H8 b# a r5 M1 e - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
6 {. A7 U. B( D% Y4 o9 ]4 I# g7 ? - * TO CHANGE.
3 |* w& G7 G& @! g/ ]- e0 A/ } - *6 Z j8 e6 b0 z8 {6 ^
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
8 y2 ^) A2 ?/ Y) U3 o - *3 ^' d* K6 y) o
- * This program is free software; you can redistribute it and/or+ o. B+ p3 [0 e3 Q9 x5 D
- * modify it under the terms of the GNU General Public License as
9 e& t( |- {; l7 z o. H - * published by the Free Software Foundation version 2.
) F5 I: s+ c) s& P - *; y. N$ ]+ S0 x" z
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
^8 c" i1 R! S3 d( {9 d - * kind, whether express or implied; without even the implied warranty: K5 G0 N( e4 E' I$ Q
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- Y+ a3 h( K1 Y
- * GNU General Public License for more details.
. p- J# g. @0 C- \# d! B7 k/ z - */
8 f* Y' R# Z% A+ @ - 0 H1 t% h6 h% [0 z, L# y, Z
- #include <linux/module.h>9 K6 c' e3 h$ e {
- #include <linux/init.h>/ f+ `4 C' } p# W9 ?+ y" t# a
- #include <linux/errno.h># `# v4 N, e( i" M* m6 l) C
- #include <linux/types.h>8 N0 {; ^- E9 j. o: J3 ^
- #include <linux/interrupt.h>
1 g K! O. w, R9 F3 y; R - #include <asm/io.h>
3 s* u) W/ \- `. f! H - #include <linux/moduleparam.h>. M# @/ Y! s( Q- v) x
- #include <linux/sysctl.h>
3 d2 Z; }: Q% L% |( y6 K. r - #include <linux/mm.h>7 e. \ o2 U: k- f
- #include <linux/dma-mapping.h>
3 i3 ] k+ n! j) r% S
4 B( V- V3 a; i% \6 a7 P! U1 K- #include <mach/memory.h>. i9 a7 T$ Y2 G
- #include <mach/hardware.h>+ T8 t: Q* U6 n4 e( S0 s$ \4 \5 A
- #include <mach/irqs.h>. y( [3 s2 u0 Z
- #include <asm/hardware/edma.h>; E$ j* Z; M( g* Y# O1 z
- , O3 Y$ l8 c/ Y3 s3 Y! t7 h
- #undef EDMA3_DEBUG
6 W, @) W9 M4 B w* C - /*#define EDMA3_DEBUG*/8 `, H3 E3 P' {' Y8 J2 ~" q" H
! e/ @1 E2 f5 ? c/ E- #ifdef EDMA3_DEBUG
3 w2 |' A) }# q8 i* \6 @: S2 \ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
+ j7 o3 I: u+ e2 e' o5 k6 w - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
- w) `- c; ~, W0 F4 W* D - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 J! I* a0 M. ]' X( g& g
- #else
0 e Z# ^; Q6 K9 O1 w - #define DMA_PRINTK( x... )9 o& t5 e y2 D
- #define DMA_FN_IN
% h1 J* o9 L! c, a' U- B( C2 H - #define DMA_FN_OUT
) t$ m* _3 u* }" M - #endif$ G* m7 ^( k1 i9 A
# s; o0 Z, }& w5 @$ [2 S! L( p- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
. ]* f P3 }6 z( n1 ^ - #define STATIC_SHIFT 3
& ~- o& O( U' c$ v3 M5 a; h; [8 p" T - #define TCINTEN_SHIFT 20
/ ^; x7 M; Y7 `& [( p( }; x p2 s - #define ITCINTEN_SHIFT 214 f& e0 ?- u1 n/ H
- #define TCCHEN_SHIFT 22% Y I( _( l5 n H3 Q9 M. o
- #define ITCCHEN_SHIFT 23
$ ?, p8 X7 B' E8 }! C* e1 o- D
/ z. {2 C$ v& O( B: L0 D, j) I- static volatile int irqraised1 = 0;8 W# q+ B! D+ y3 d- x6 l. z
- static volatile int irqraised2 = 0;
; Q- {. T9 V/ M) [1 I - 7 X' W% P% j; R/ D2 B; ~( z! I& o7 y5 @
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ d6 I0 C" T3 e/ k
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 V1 S) i6 B' T' f+ R+ i - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 [" T' s- q; [5 R. | - % H! o4 l5 [3 I- @
- dma_addr_t dmaphyssrc1 = 0;
* F$ h% a: @( F/ y - dma_addr_t dmaphyssrc2 = 0;
6 q2 j* u+ c4 o7 N - dma_addr_t dmaphysdest1 = 0;
8 x6 J+ B. ~9 ^! k) p9 i ?& y+ G - dma_addr_t dmaphysdest2 = 0;
' R4 ] ^1 a, ]% k ~: @. p3 I - + r' i# |8 L, ~" n
- char *dmabufsrc1 = NULL;, o) ?' M! G! t* n8 y* H
- char *dmabufsrc2 = NULL;
$ |! Y. d5 v0 N- B S! c! Z& y) b. y - char *dmabufdest1 = NULL;& g3 N4 a: j- ]0 ^; o, u4 l
- char *dmabufdest2 = NULL;0 e! B' l8 S4 B( y
/ i# l" L' e1 {( u; M( I- static int acnt = 512;0 s4 |% d* ~& Y% C$ _: X% \3 g
- static int bcnt = 8;/ r: _( b) L1 s% J- Z$ _9 \% y" z
- static int ccnt = 8;2 q( ~) P4 g. O( O/ {
- ( L$ E4 U, e. I$ P( z
- module_param(acnt, int, S_IRUGO);
3 y) `# |4 E' y0 r0 } @- C9 q$ S4 | - module_param(bcnt, int, S_IRUGO);& C+ z1 |, g3 c) K
- module_param(ccnt, int, S_IRUGO);
复制代码
. U) r! s$ q) S% v6 `9 n
/ {6 ~7 d: A) T$ s, N 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 V F! M- @& ^/ uarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 p! k* {0 s! D
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。 S* [2 O* |: ]: z
) g+ @; e6 N' O; m8 d6 O3 n" {
3 J s$ o- `" C( e1 @
|
|