|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 D( a. p3 a$ h; A7 G M6 f
- [code]EDMA sample test application
$ {, v8 Y& R0 Y9 C) M% r* E5 m - /*
o& U) D, [" w' J' J - * edma_test.c& [6 y8 ?" E2 Y, @) t8 A% l% C
- *
# c- m) i; O) U4 Y9 z% w8 i - * brief EDMA3 Test Application. n7 U; R6 w+ S0 F
- *0 V- e0 Q6 y5 k6 t |
- * This file contains EDMA3 Test code.
% {1 e) M' z9 m, C( l - *
; X6 \' j. C6 j* {. l/ v - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
0 F9 P' b9 E4 S8 [0 F4 D - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
, }# s! [3 C# N - * TO CHANGE.4 h0 d2 B2 i6 g( I; C5 `% ?5 l7 ?
- *2 \5 v% j$ ^# m# Q
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# I3 N* i' j. {5 P+ o0 p
- * P0 I- P k5 \* b6 L4 Q
- * This program is free software; you can redistribute it and/or
& e N4 t0 L( l' x$ j7 j - * modify it under the terms of the GNU General Public License as
5 S6 ~% g# T2 l; r9 b - * published by the Free Software Foundation version 2.
3 m; Z3 x! F8 O9 n - * s4 d& n) n- \
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any" v; x M3 f& i* Y' T ]# N
- * kind, whether express or implied; without even the implied warranty% u$ t# ?9 y' k9 }1 w8 i# F' P
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% U# x2 m0 r3 H2 h9 u+ x - * GNU General Public License for more details.
) [4 j9 N( p e - */3 [9 E" h# S: c7 K. r+ v- w8 d# [
- $ p# z8 V v2 h
- #include <linux/module.h>) g9 Q+ ?# \ R( O$ O0 n2 L
- #include <linux/init.h>
4 D! h) V1 M; }0 r0 z) d( S8 p5 X. u - #include <linux/errno.h>
/ l0 r3 g9 b4 ?( { - #include <linux/types.h>
, ]% d. |, @- t7 R N; T y- u - #include <linux/interrupt.h>
1 b# {- ^, w7 ? - #include <asm/io.h>
6 q- t2 D1 S, {# Q( W' A - #include <linux/moduleparam.h>
( O: W) \0 j/ z/ V3 Y - #include <linux/sysctl.h>1 }: m7 h# X7 j. E7 y9 V, t
- #include <linux/mm.h>
8 C8 |( G& S& d- U- A- M& A/ H: x - #include <linux/dma-mapping.h>/ d- Z5 b+ }% P8 z* c! F, y7 Q" p0 l
- [- I; U$ i2 Y2 g6 {7 y
- #include <mach/memory.h>; D3 H+ k2 ?, M- u. O8 y
- #include <mach/hardware.h>! ?$ }9 L6 p" R
- #include <mach/irqs.h>
: ? M3 W2 K4 W i8 Z" o - #include <asm/hardware/edma.h># m& ^! S. M; J, d( f$ U' J
- g: |; I, U! R
- #undef EDMA3_DEBUG
" B( ?2 g) b# d! h - /*#define EDMA3_DEBUG*/
' m; _8 F/ f, p( x8 f0 D# A+ ]
0 ]7 }7 j4 m. W! Z: ?5 U! u1 g% h. D- #ifdef EDMA3_DEBUG
- C9 h6 [2 _6 y) n+ T/ i - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
6 T/ w- E- ], z, |! X - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
$ i2 y5 V# Q1 V% A( o [7 y& I - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
! {: N( B& ]5 D7 [ - #else) }& O Y! B% s' s8 o- C' P
- #define DMA_PRINTK( x... )
9 P7 E( j- ]; j$ ]# a - #define DMA_FN_IN
) ^# P6 [3 q: D: R* L" g! M' ` - #define DMA_FN_OUT$ H6 n- U; z* C' |0 U, }
- #endif
% e- [1 k4 b0 w# G) @
1 |' |* f$ d# x( L) N. u/ c- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
# C2 W8 }5 g5 G - #define STATIC_SHIFT 3
, ^$ q" H7 G$ B4 Q L1 z% t( L - #define TCINTEN_SHIFT 20
5 i3 J5 H/ e6 u, o& g/ v - #define ITCINTEN_SHIFT 217 l" ?0 `& Q- c8 P
- #define TCCHEN_SHIFT 22; `# P R2 K& z6 G* Z; x' z7 p X
- #define ITCCHEN_SHIFT 23
* f% Q3 r' w0 d
: |/ J+ c9 I: B% K2 c" o, ]4 Q- static volatile int irqraised1 = 0;
7 t* u; t7 Y& `" I - static volatile int irqraised2 = 0;
9 F N$ T" G1 r6 ~: A" ` - + {7 ?; f1 G% k" j2 m5 n) o
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 V2 Q# d4 y) A; H2 r# l
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. \" r7 n$ c# ^/ Y v) { - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ k* I8 ~( b4 E+ J0 v8 i - 7 d0 g) Y1 Q' o6 C; h
- dma_addr_t dmaphyssrc1 = 0;
5 Z# ?$ \' ?/ A7 b6 i2 x - dma_addr_t dmaphyssrc2 = 0;
+ m* P$ N2 k; h - dma_addr_t dmaphysdest1 = 0;
' e m1 I+ Z0 x5 W - dma_addr_t dmaphysdest2 = 0;% ~7 A/ C( M! ~' A; W. ~
x1 W) M+ ]) N4 q) f3 x0 @- char *dmabufsrc1 = NULL;% J, f4 B/ B+ L& t3 i7 `* q
- char *dmabufsrc2 = NULL;# a T# B- u' P ], F4 Z& Q# U- N3 F
- char *dmabufdest1 = NULL;/ s ^5 y7 e/ ~ ]" u4 z" P) `
- char *dmabufdest2 = NULL;
' P9 l. r$ c- L; h# d o+ Y
3 Z! ^6 Z& T* t7 c- static int acnt = 512;
! L' v7 H( I' G- n6 m - static int bcnt = 8;
0 k: a9 m/ E* R7 z& o3 k - static int ccnt = 8;
* f3 j4 P7 @4 O- b' q" w4 F - 3 w( H( k' ]; a
- module_param(acnt, int, S_IRUGO);
4 J" r6 H6 x8 @8 N) [ - module_param(bcnt, int, S_IRUGO);. d: n N, _- m9 r5 d/ G. @- ^8 u
- module_param(ccnt, int, S_IRUGO);
复制代码 3 ^/ {" R% I2 \& ~7 ^0 |+ L: U9 j: y
' E5 G+ L" F1 S: u% P/ b 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. L$ f* F- ~* w2 N
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 U& C2 D$ f5 @. T4 |/ g6 C 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 y( D b0 [( V$ S6 A
5 @, _2 i* s( N2 t
: f0 j+ u2 J5 V( F |
|