|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! {. v' u8 V" u9 J2 c- [code]EDMA sample test application; A0 p. Q( B2 ^8 ~
- /*
4 U1 w$ o9 I' C. b$ @& ^# b) t - * edma_test.c
+ j! q& ] c l4 U) B F - *( O: S5 j' n9 Z" x! X) t7 I
- * brief EDMA3 Test Application- `" v+ B; b: T5 z, [
- *
; ?( B. Z' Y a+ k! ~ - * This file contains EDMA3 Test code.
8 W: w: y7 ^& o' G2 P$ l7 S - *
* S N8 r4 \* K% [5 c - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 u) G6 w* ?; x0 ^2 T5 f S
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( V! h( e2 f6 K4 F6 U ]) ^" A+ M' u' g
- * TO CHANGE.. x/ B$ f4 X3 }, @' m5 o
- *' ]1 ~! A6 Y" v5 @. b9 y4 s
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
: T7 f5 g4 Y3 n; s& e% N - *
+ p( j+ |4 H* O" V: |" y4 G - * This program is free software; you can redistribute it and/or; A3 K- S% M+ b. e- q; m9 y5 f
- * modify it under the terms of the GNU General Public License as- Y9 {5 j, j, o" d. J& g- l' `0 W
- * published by the Free Software Foundation version 2.
! W! `: x) K8 Q+ H) N$ b - *
2 @0 c. x0 ~: \) [( }* J1 _$ w+ ` - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
$ L, O3 H6 H! }* Z! f; E - * kind, whether express or implied; without even the implied warranty
7 K4 |; t9 ~% A7 ]' e0 k; }2 E - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3 \: O4 Y1 x# n* V! Q( ~1 G% J - * GNU General Public License for more details.
1 n+ L1 F) l! p' W- j( }3 Q - */( g, G S& Q2 V" f
: v6 V' S1 Y7 T+ n: H" G- #include <linux/module.h>
% d- ]; W0 y: O9 \, C& h - #include <linux/init.h>
" J y- F T1 G! `3 V3 _/ } - #include <linux/errno.h>0 y8 V9 R/ H4 Z2 s& \* {
- #include <linux/types.h>
- d# m7 Q' ~) D# F - #include <linux/interrupt.h>: j- c9 N1 k( P
- #include <asm/io.h>7 t2 K. B3 X F, B6 |
- #include <linux/moduleparam.h>
! S! j( ^ U' B8 E* E9 u( _ - #include <linux/sysctl.h>
8 d" L+ P c: B& L - #include <linux/mm.h>2 g7 y; |3 d8 O
- #include <linux/dma-mapping.h>
% D p, w2 _/ @
+ ^# E/ ]7 b/ A) G3 t% M- #include <mach/memory.h>7 {) g: l& C9 P* N. _$ X1 i
- #include <mach/hardware.h>
! e7 \& F# l, L @ - #include <mach/irqs.h>
6 w4 `( p, j5 ~# q - #include <asm/hardware/edma.h>, p$ q2 P9 g1 h% S. K9 x9 y) R
- 0 h: p( L7 F q$ V
- #undef EDMA3_DEBUG
) c/ z6 t' A- k/ C P - /*#define EDMA3_DEBUG*/
6 u9 W& F) g G8 Q1 U0 z - / k; R7 m7 L: L) T& O" f2 ]! R' }
- #ifdef EDMA3_DEBUG7 p; s7 j" u6 j( L1 m x! F' C
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) Y/ O. G8 x% o! ~: @( N
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
+ S0 i! @5 @/ A( l - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
6 J3 j2 S6 q X6 i3 m7 A - #else
- m* G; `1 y/ X# A/ H! ` - #define DMA_PRINTK( x... )! X( ^# K$ u) J" e s0 l7 p
- #define DMA_FN_IN4 w# \8 O, @* g3 A$ u) ^
- #define DMA_FN_OUT8 _. @2 `6 {: ^9 k& B/ ~' d
- #endif( k7 G3 F G! {3 J
: P; ?/ J, J8 y, V: i- #define MAX_DMA_TRANSFER_IN_BYTES (32768)% X. q5 t4 q: [! H
- #define STATIC_SHIFT 3
3 T: q$ J% a% J6 `( @* V$ Q5 }; c - #define TCINTEN_SHIFT 20
9 ^, x& T$ j! O% |" W/ q - #define ITCINTEN_SHIFT 212 F8 {7 k8 W! [2 r& e
- #define TCCHEN_SHIFT 22
& E6 ]- R, T5 }( [0 K7 m4 @+ n - #define ITCCHEN_SHIFT 23
' A+ v1 {( s' O! S- n6 P2 q - ! m2 ?* l0 O; b+ R! x+ f" \
- static volatile int irqraised1 = 0;! p% \) T# |- j
- static volatile int irqraised2 = 0;
* B! V/ l3 M! \2 ]
. p) a4 L* L! E- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 @5 n& C# B2 d H+ n
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ g' e2 n* ]/ V
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ S$ Z9 J- ^' T3 P% A6 t0 D
7 |' P) B" h1 o" _- dma_addr_t dmaphyssrc1 = 0;
: L& m$ L- S3 |; O" ?; i - dma_addr_t dmaphyssrc2 = 0;
: n% s; ^$ [% y. x' j/ Z! e' M/ j - dma_addr_t dmaphysdest1 = 0;
" b1 x6 o/ ^- v; G0 ]; v% ] - dma_addr_t dmaphysdest2 = 0;
( T7 @2 Z; a% F" {& M7 E" o
( x$ }2 O2 N% ]9 y8 [ {- char *dmabufsrc1 = NULL;# o6 ]: d' t& c/ ^" ?4 l* j9 |8 A
- char *dmabufsrc2 = NULL;
4 @4 }5 t1 ^/ q6 P J - char *dmabufdest1 = NULL;
; B0 o; _. s: y* o5 M - char *dmabufdest2 = NULL;
: s. m. ?* f3 B. r
& X3 R5 b b( u: r) m9 A1 Z% T- static int acnt = 512;
6 X5 }+ S) \4 }' K - static int bcnt = 8;
# V' ^# W* I$ d/ L' w - static int ccnt = 8; x3 E1 ~( B3 B! R, o
- # }6 r7 p+ H+ }7 a0 b* ]
- module_param(acnt, int, S_IRUGO); f& N$ C" S' y1 _5 n2 q
- module_param(bcnt, int, S_IRUGO);6 {! v9 T; ^* d o! G
- module_param(ccnt, int, S_IRUGO);
复制代码
$ S [- O; P! I; g4 Q6 {' p
% `9 N; ^7 g. u F6 _% v 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: R6 S' ?# H8 T4 l' ]
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 ?! K) }; `* ` 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ ~ s! ]1 c: }% E1 Q0 n: l8 r
- F) T; Z; H. g& z U! A0 V# h- m8 e" c2 r1 l9 B) n
|
|