|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ Q3 d! i6 U4 T) y8 Z% J* _# o- [code]EDMA sample test application% A& y& _' U1 h- _3 K' R4 ~/ m
- /*
! Y2 K, _& u E/ E& L$ m I - * edma_test.c
0 {) A! I1 r# h% w( h3 e/ @6 e2 E9 ~ - *# H" s0 N5 ]" D
- * brief EDMA3 Test Application
; W0 H _- N4 V1 x) t+ R0 h" m6 V$ o - *
8 X Z6 M/ p: a- c0 B5 M7 q% Z9 d - * This file contains EDMA3 Test code.% q9 N8 q. m( B% J, V
- *6 u. C. W4 \6 _8 D8 R4 q
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, p y# P: Y4 Y* Y$ }8 X$ m2 a
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
+ N( _, _5 K' j; L - * TO CHANGE.
! D9 T4 D, H: s& H/ [ - *4 I4 R2 n8 Y' {3 @$ p/ |
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ }0 C8 i( ^/ r! w7 @7 y' m& B
- *
( |! [* t$ M8 ?: ^$ T6 }( J - * This program is free software; you can redistribute it and/or
6 C' ]# N, Q& @ - * modify it under the terms of the GNU General Public License as
9 h E+ N3 N4 I& n' m* @ - * published by the Free Software Foundation version 2.. a9 I8 K$ S0 s& l; r, b4 R! E
- *
8 Y8 E& G* j4 W, P& t5 o& U - * This program is distributed "as is" WITHOUT ANY WARRANTY of any, C* w( c$ e+ m" F+ u
- * kind, whether express or implied; without even the implied warranty4 e3 ]) m( O+ s' z# ~ i
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- G3 t2 N" v# I( Y% J) M1 p - * GNU General Public License for more details.
, y. ]6 {! F" f4 I8 g% p+ _6 L' c - */
/ J% Z% `7 h# |
3 L: U1 b6 c+ F; l; A j- #include <linux/module.h>
1 Z# s) A5 v- R; G/ ]' ?. _ - #include <linux/init.h>6 M h1 G. K4 u- N: Z% K
- #include <linux/errno.h>2 G/ x$ M# Q4 e6 q
- #include <linux/types.h> G. {1 J) M, k1 L
- #include <linux/interrupt.h>5 Q: ~- ~/ m5 M, a- F+ K5 @9 x. u
- #include <asm/io.h>
* g+ ~' h* K F" M - #include <linux/moduleparam.h>
! B% q; i" y6 W - #include <linux/sysctl.h>! y# m/ N0 C p+ z
- #include <linux/mm.h>
: d& h7 W( R2 m' I) l# q* U - #include <linux/dma-mapping.h>: @# l9 I& J& p+ m2 ~2 U8 }
- v7 `7 A, T" _4 i' b
- #include <mach/memory.h>+ N( t6 l: M; R
- #include <mach/hardware.h>, X( D; a3 D3 T9 A" R" k
- #include <mach/irqs.h>
! P" R7 C) d8 |6 H0 w# P - #include <asm/hardware/edma.h>
/ z0 |- R! p/ c$ U
/ ^& R/ |1 T$ h0 f0 u! _- #undef EDMA3_DEBUG
; ^6 p2 H; L8 A F: J [ - /*#define EDMA3_DEBUG*/
& M3 c0 s8 `& w; A8 R
! ]; E! U; c' [- #ifdef EDMA3_DEBUG. e4 F. t' S. |. Y' L
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
! E: x$ h2 \8 h4 ^' C, o - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
3 y1 `4 ] e7 ]( `/ G: z9 D% R! K - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
! x; U4 s2 E8 x! A* M6 e - #else; Z/ S: a1 \3 K3 m# R4 a) W
- #define DMA_PRINTK( x... )( }4 u1 T, j5 G3 y6 T7 j5 b9 L
- #define DMA_FN_IN1 I4 x L1 ?: s# @# a
- #define DMA_FN_OUT8 { W6 Z6 [9 N5 [; C
- #endif" F7 H5 ?7 R# y1 D; s5 h2 t
0 i+ X+ X0 D/ Z4 m* ]- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
" v! C3 ^* i8 [, Z% q - #define STATIC_SHIFT 3
3 Q- ^. W/ {1 w( T - #define TCINTEN_SHIFT 206 |& U( C5 z% O5 w/ y; O
- #define ITCINTEN_SHIFT 21/ k4 \/ g# {/ \0 K8 F+ j( R6 Z
- #define TCCHEN_SHIFT 224 g. R' e1 |' Y+ L2 z
- #define ITCCHEN_SHIFT 23
6 k( N1 ^; t! U1 R7 D) r; o. e - 2 P" e, K- K- y. ?6 m: A
- static volatile int irqraised1 = 0;% h ?, X! M0 e4 [2 U) @3 N
- static volatile int irqraised2 = 0;0 m! q3 c, V/ d* b6 L1 s
0 y2 X0 b: i, T: V! S& p- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 }1 E* ?9 Q+ ^ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 J1 w' s7 a# b3 c. A
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 H7 \ A3 J- E9 b
- 8 Z1 v1 L9 X! @. J+ X% G
- dma_addr_t dmaphyssrc1 = 0;9 r7 ~) ]! z M- [: B, v
- dma_addr_t dmaphyssrc2 = 0;
2 W' {# J5 [: s( j1 _( f - dma_addr_t dmaphysdest1 = 0;
( I# P, {$ y4 \3 I3 @ - dma_addr_t dmaphysdest2 = 0;
* F5 _6 h8 e* G: ]! A ~4 p! f' I: u p - 5 J" o* h( t7 R0 m6 w: u, u- v
- char *dmabufsrc1 = NULL;
! X% K* L6 }7 [1 r2 T" U - char *dmabufsrc2 = NULL;
9 M( g, q4 b" Q/ F$ M8 ^# s0 E - char *dmabufdest1 = NULL;
2 T* b ?+ t c2 W: n e7 Q: Z) K4 \ - char *dmabufdest2 = NULL;3 I7 x* g' d5 x% E; p9 @7 T$ Z
- , c$ E' j' a$ I
- static int acnt = 512;
3 }. Y/ V& F0 v' E' A, w2 g; G$ B - static int bcnt = 8;
' B. R; _" Y j c- i( g - static int ccnt = 8;
- L4 g1 P$ w0 L# D
/ G- }& v4 ^* i- module_param(acnt, int, S_IRUGO);
8 W' v- [; I( V5 b* s% \1 b - module_param(bcnt, int, S_IRUGO);
H5 l1 x4 H" j - module_param(ccnt, int, S_IRUGO);
复制代码
' |3 E( X1 ~. }) [2 r- [
^8 w2 O6 _, u 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& n. J: s2 G. O! E7 `4 |. p! w
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. m; D- @& q5 { 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。" ?0 ]1 E6 X3 e; n5 q/ H
, n% c4 e( a" W9 x
) k, S% H$ g" d" a6 u
|
|