|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' w4 E5 P7 G8 q- [code]EDMA sample test application" ]# n1 s( u7 w7 ^5 ?
- /*
+ y6 q, Y4 [9 f - * edma_test.c( }! y$ Z$ K+ {( N& B2 _
- *3 |& A, H, F# ?. J& U/ ?
- * brief EDMA3 Test Application3 @+ f( Q$ t$ G
- *
, J; o: v2 H2 y) L4 ` - * This file contains EDMA3 Test code.5 W4 r1 \5 Q6 e( @; s( D
- *
! f- n$ l1 Q. e5 s - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
* x; m- J) @9 a0 T+ o8 V# {( a: z - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ a$ D; w. Y$ u
- * TO CHANGE.
4 k8 W# }) O& A5 K - *
2 N* y! B4 M" j, v - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
8 g. _$ b6 K1 n6 v5 l! V& N: k( i) f. U - *, W# M; ]' `) u3 F
- * This program is free software; you can redistribute it and/or* }/ {0 l2 P* ~8 a# R, u$ [& b
- * modify it under the terms of the GNU General Public License as& |# F s* m1 x% q; \! y2 v
- * published by the Free Software Foundation version 2.
- E! [4 B! k0 a - *
7 n3 B+ T9 ~5 ] - * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 h' [8 g8 m4 f# `
- * kind, whether express or implied; without even the implied warranty
p. W+ ] V5 V4 N - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the8 s% i/ R F! ^5 O7 s
- * GNU General Public License for more details.* W. C2 K7 ?& A+ N/ {
- */9 s" `$ U/ |& M/ T
- 1 J5 U' y/ m- J: Q( L7 c
- #include <linux/module.h>
& C# Y! L" L2 Z0 ? I4 g3 m - #include <linux/init.h>$ S: k/ R2 u# t! Y
- #include <linux/errno.h>* B/ `; }% C( K
- #include <linux/types.h>
3 X% m6 x7 _5 _4 A1 C - #include <linux/interrupt.h>7 T7 S, u3 E$ \
- #include <asm/io.h>+ [( `+ a v; P% C) ?
- #include <linux/moduleparam.h>; {4 J/ Q9 n* z/ {0 Y% _
- #include <linux/sysctl.h>. w& x. }! A) \# k$ N( H) z
- #include <linux/mm.h>0 w; T1 C4 W) N
- #include <linux/dma-mapping.h>+ C' c+ O. Q$ X; w; L% T& I3 b
- 1 ^1 G5 {7 ?, U7 `
- #include <mach/memory.h>
( y; O" C$ u2 K2 b5 _ ]* Q7 A' F - #include <mach/hardware.h>. m1 f+ ~7 I: u2 Q
- #include <mach/irqs.h>- D/ N6 c3 t2 L! M) H( O
- #include <asm/hardware/edma.h>/ Q3 F) x1 S; g
3 R) ^5 m6 u% N- #undef EDMA3_DEBUG
' R9 c) T( R* }" M. Y# s/ y9 J5 d - /*#define EDMA3_DEBUG*/
3 z0 q! h, {( o$ d- A& b - 7 _. b9 v7 d2 ?& w4 c7 H
- #ifdef EDMA3_DEBUG
$ U1 q9 M6 ?* @3 g# l - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): x. z0 g! O1 Q; H( l
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 @5 x: E. m# h Z
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
0 ]% b7 F9 d2 K4 e" E - #else
% }# F0 x- G0 m; a$ R6 S. F' G( v - #define DMA_PRINTK( x... )
( V+ a( x) U! u/ l. L - #define DMA_FN_IN3 t, i* |" p; X, I! d
- #define DMA_FN_OUT8 g. M, T5 }* @/ {
- #endif0 T0 P" D. c9 k! u& l2 s# c% ~! `3 `
! I9 y4 R$ z; E+ H: U# H: n5 Z- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
. n# O0 k% A! d; G! X, d1 K9 | - #define STATIC_SHIFT 32 Y' Q; w. b6 ^% l8 l0 Q6 F
- #define TCINTEN_SHIFT 20
- y$ D* L! k8 g5 n) n- B- T - #define ITCINTEN_SHIFT 21
% e9 A+ N" ?: B. P - #define TCCHEN_SHIFT 22
! v1 c2 W( |6 ^ - #define ITCCHEN_SHIFT 238 t4 v& o" Z! A% `
- ' m0 a- \! H5 a* A' G
- static volatile int irqraised1 = 0;& z& P8 S* ^. E2 ^( ]
- static volatile int irqraised2 = 0;+ _) Q3 c [% j( r$ P- c( H
- 5 P, ^/ b8 O( g
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ y0 t2 _0 Y; }' M2 g/ }/ [# l - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, a P- P) b/ L, g; `( V; l
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' \8 B0 Y. A$ y* b
: q4 {: E9 ?) S8 L. b- g9 | L- dma_addr_t dmaphyssrc1 = 0;
! l% Y g' q/ c8 H - dma_addr_t dmaphyssrc2 = 0;/ O k% X( q& d# W* h& S
- dma_addr_t dmaphysdest1 = 0;& D. ]9 ~5 Q0 i4 ~, m$ P8 u
- dma_addr_t dmaphysdest2 = 0;9 x6 V" y, {: z/ X# T- T
9 N# v; i: V- c" w- char *dmabufsrc1 = NULL;8 U. P# S' Z6 g! A! z: G
- char *dmabufsrc2 = NULL;2 f( G* I8 E9 ]! L8 i. A
- char *dmabufdest1 = NULL;6 `" K, G1 f4 D7 v
- char *dmabufdest2 = NULL;
Z2 K. [' Z, w9 X$ x
3 O8 S* R( I- x% u- static int acnt = 512;
. i% I$ H F" E }1 D/ e) |$ M: D: ?3 [ - static int bcnt = 8;$ U: a& c8 n M- X& T
- static int ccnt = 8;
" s, E/ x9 q1 x4 ~: V8 k0 p - # \! ~* `( h/ {1 p, w
- module_param(acnt, int, S_IRUGO);
; L7 p' u6 u- i7 X% H$ H# P+ L - module_param(bcnt, int, S_IRUGO);
; Z6 b/ \2 I9 d* y6 a9 x - module_param(ccnt, int, S_IRUGO);
复制代码 5 c, } Q" ]% \* F7 U. t
9 b7 o4 |. @7 u$ l5 i3 ~
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, l9 `: C* o; ~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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* Q. l! d9 {/ f* I1 b# E 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) w9 H2 Z: r! q6 \
6 z# U" N. `% j% g: A$ v/ m8 v/ }' `3 p0 Q0 e6 x
|
|