|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) C7 |* n/ A1 E
- [code]EDMA sample test application I8 m! s$ D; h/ `2 a) [5 [6 M
- /*
9 u+ ?8 P3 x* }8 C7 v2 J5 ^ - * edma_test.c. W2 q$ d2 B0 Y, n
- *6 a: c7 u H8 l' q1 e% S* |
- * brief EDMA3 Test Application
# p9 s1 k d; U) o2 }4 f - *
( m- a! u/ T& B9 G4 E- X - * This file contains EDMA3 Test code.
; U* ?. M# j# P% X- W* L- i; E - *
1 t3 q( k5 r$ F. U - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* a" _3 H" V) X3 W+ g
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
8 G5 J& H5 f. V* S2 U/ h7 J$ x - * TO CHANGE.
! Y; E2 r. t- N$ T: |% I - *; g4 ~3 |, l5 T7 M0 w2 s! }
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
% [6 v$ J& { k* v - *' z1 P" o7 l K) h L& i4 x
- * This program is free software; you can redistribute it and/or
9 V6 h- u7 M8 N - * modify it under the terms of the GNU General Public License as
/ n8 p6 L* U: K+ V - * published by the Free Software Foundation version 2.( d8 ?/ B, T: }! ]
- *
& N3 Q8 A: p1 t, w$ i% t# c - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
2 A0 n) k( b" A: G - * kind, whether express or implied; without even the implied warranty& M' ]' k; E) G6 i9 c% g( ?
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the. {1 Y; p: E9 M: `
- * GNU General Public License for more details.
: U6 x2 J8 P7 {+ C \& }! Q/ H, ^3 \ - */
7 c% K" Q8 z5 ]/ ~, h% Q4 a
% L* e6 I% T {7 U" k# w1 N- #include <linux/module.h>% g+ m4 ] ?) @/ K
- #include <linux/init.h>$ Q: J. N- g1 O) }2 c- b, c. [; W) g
- #include <linux/errno.h>, A& Y) s8 b$ q# l E+ c' G4 i, f \
- #include <linux/types.h>7 l* N) g+ U+ k* ^! C
- #include <linux/interrupt.h>
' I1 p/ L4 z0 ?" `1 k - #include <asm/io.h>
- U" F, s5 g$ F# ^' b$ Y - #include <linux/moduleparam.h>7 P& c3 r% x E u, s$ B; K
- #include <linux/sysctl.h>, {" Z+ L! ^% V
- #include <linux/mm.h>
/ R7 |/ U# O0 ?5 K3 [0 W - #include <linux/dma-mapping.h>
( C, t4 L8 i5 a# z' d$ D, I - % J! i# r8 _; M n: d6 d
- #include <mach/memory.h>/ ]& W( U# c& B7 q5 E
- #include <mach/hardware.h>
- f! [1 a) o" @% o4 L- U - #include <mach/irqs.h>/ q, Y; d. n+ u% M3 z/ B# A
- #include <asm/hardware/edma.h>
3 d; @% s+ Y% v( j
1 h$ l$ I: F$ u* Y) C4 e' \- e- #undef EDMA3_DEBUG9 k* [, V! V5 r& G# S- C- Q1 k+ g
- /*#define EDMA3_DEBUG*/6 N' B$ y5 { X$ X0 {2 k+ n8 I% ]
- % S) Z' V2 s; Q4 u6 d2 ?$ B
- #ifdef EDMA3_DEBUG* d, I! A4 `! [( v
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 G7 w9 \* r$ H* Q% Y. A+ c
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" u4 r, X* X1 Q- m
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
" R0 R% y+ g) {& {1 ~% I - #else% L1 ?: @0 D' p+ v- C& _6 R
- #define DMA_PRINTK( x... )- Q- n6 \( {; O( l. O2 t# x
- #define DMA_FN_IN8 W- W; Y g$ _' c- E0 V
- #define DMA_FN_OUT
: `( N& X& `/ B- W& M& F4 ? - #endif
: o0 J9 q; d9 W; U9 y" q1 ` - # N/ N# c2 ^& O+ s3 |
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
: h( p! t9 O+ r( u8 L: k; }2 u - #define STATIC_SHIFT 3
U1 V B7 b) ~ - #define TCINTEN_SHIFT 20
: ^; H+ C" H/ I1 Y! u. I7 R - #define ITCINTEN_SHIFT 21
! L1 W( `( m+ o- P/ j - #define TCCHEN_SHIFT 22& u, i Y% E1 c% Z; A5 M
- #define ITCCHEN_SHIFT 23
. I3 r8 C# ?8 Q1 Y8 b% Z2 E - + I5 m" k8 s' Q5 N8 {. X
- static volatile int irqraised1 = 0;5 a! }" {& h; x7 ~
- static volatile int irqraised2 = 0;6 q5 o7 ?* Z/ r3 r( d2 d
6 q6 g7 t: w O `& M% y3 H) [- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); |$ `' c( [4 ~0 P
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" p2 h* [2 g1 N( R
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 U" j. W' U* f; y
3 N4 f4 N; X6 W- dma_addr_t dmaphyssrc1 = 0;
7 _4 L* n4 K1 t5 m! G6 R' ^3 h - dma_addr_t dmaphyssrc2 = 0;
( o' _- C- P* a - dma_addr_t dmaphysdest1 = 0;7 }) q. I1 r# l- J
- dma_addr_t dmaphysdest2 = 0;. F0 S0 {( E6 q! F% L4 n! J f1 R g
- Q& ]$ D, h9 |
- char *dmabufsrc1 = NULL;7 J. D7 D" f9 _: K# A J
- char *dmabufsrc2 = NULL;8 a p. @2 h9 M# `
- char *dmabufdest1 = NULL;
8 t. f- X9 f. I3 j* E - char *dmabufdest2 = NULL;/ x, W' r( F) g
- / ]7 t4 {. e6 R: `
- static int acnt = 512;8 Q# U" a6 ?. j* J
- static int bcnt = 8;% I. g- H0 S3 D- C7 s
- static int ccnt = 8;+ f9 [8 t- t. v4 L2 m" L: a
- ) v/ f& M* H- \+ R5 R
- module_param(acnt, int, S_IRUGO);* w2 Y1 L) _8 U& w
- module_param(bcnt, int, S_IRUGO);0 N! m# w" g6 Z% [
- module_param(ccnt, int, S_IRUGO);
复制代码
- v) q6 S7 [; X4 j/ b- [$ ]+ _0 @3 E! {' H+ b1 ?7 V( `+ ~$ R
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 Q( d9 D+ f% d& @* T5 s
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( d, ^" }$ _2 l3 \+ o8 T 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ h2 S' Y- W5 }5 T, q% k7 h# D$ c
1 h! W2 E3 R) S: W
8 a" f0 u1 [( Y7 |$ ~) k% Y |
|