|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! m( y+ u; ^1 s8 |( ^# B
- [code]EDMA sample test application7 W# j% \( R6 M; K. b3 y( p' t9 H
- /*
9 `9 M4 K8 x& Y* Y0 c - * edma_test.c- y* p. s# z- r+ |' v7 [
- *: [* G" {+ C; _$ Z( f u. p( e
- * brief EDMA3 Test Application( ^! _2 c" H' I. V: V, n
- *
; ?; C; u1 `$ V: J% i; g - * This file contains EDMA3 Test code.% J+ l N0 ^$ W4 Z- I
- *
( p& W+ d: Z/ e3 G - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
, |# Q5 a! g h - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- m" J e- v6 h2 l+ J
- * TO CHANGE.
0 V/ j8 N0 S* L) N: [3 N5 R - *1 x6 R7 @6 N& _6 i/ j. @
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
7 _4 E; {% P% G# v - *, y5 a0 `0 H, \* `
- * This program is free software; you can redistribute it and/or
7 ` E! N) G, G5 R - * modify it under the terms of the GNU General Public License as
6 Q& [5 K6 q4 |, Y4 C+ w - * published by the Free Software Foundation version 2.
% q0 W% m( i2 w# H# H9 N9 r# q- { - *9 e& p3 M/ h0 H6 a
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
2 W- b' q x9 J - * kind, whether express or implied; without even the implied warranty n8 Y5 H) y& b( L& O8 F4 G$ I' G9 q* {
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the# _. i. S5 z+ o" M: `
- * GNU General Public License for more details.
3 j- \$ C+ |! S* P0 b9 [, | - */& d& y( ]$ |% Q& o7 J
- * G- {; G5 J% t8 J
- #include <linux/module.h>
6 n8 H5 d2 s- U! T1 M/ q* O( Q - #include <linux/init.h>( }/ l/ d. k5 Y3 \# U/ F* o
- #include <linux/errno.h>
3 X& H; ^( ~) x! i) K; b/ G - #include <linux/types.h>* }+ X$ [/ |9 k) u; N& |$ _
- #include <linux/interrupt.h>7 X2 b8 n$ s, O' Y, T
- #include <asm/io.h>
% P$ A6 ~ R' s, \- j3 y8 B - #include <linux/moduleparam.h>6 T: `& _0 ^: i6 ` V) V
- #include <linux/sysctl.h>+ K" B- J M0 F1 L0 e, r
- #include <linux/mm.h>
, j, J; N7 J8 T- d, v - #include <linux/dma-mapping.h>. x8 {1 Y3 v5 J9 Y: q& z
- + R5 F+ x( e4 k" \# i0 H' N
- #include <mach/memory.h>$ p- A) g j2 L, k1 W' A. B
- #include <mach/hardware.h>
5 S$ P' k7 ~& E; M9 M+ u - #include <mach/irqs.h>* I' M0 C1 k- s" T% o0 ]+ D
- #include <asm/hardware/edma.h>( i N* k- q# W B* m
- + E# W& W5 T6 L5 Z# ~# `
- #undef EDMA3_DEBUG
( a+ y; t" l5 d* b* i% f& |0 v# z - /*#define EDMA3_DEBUG*/7 e# ]) z4 w9 O, `" ~" b
9 ]" H9 z0 y" s4 N; P! {* q: F- #ifdef EDMA3_DEBUG
9 `, O9 p! B8 x0 ?$ |3 b - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
7 B, i, f7 I# J% o, H) D N - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
9 |0 q& O" I% j - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
) C- A4 A8 b" C: v - #else' j4 X! d' |% }( F# A. @; x8 M
- #define DMA_PRINTK( x... )2 l8 } L8 E( n
- #define DMA_FN_IN( P v/ ^- B8 {" n
- #define DMA_FN_OUT
/ g1 `$ s3 A8 F; B - #endif
( Y- g$ _% W' u9 t) ` - / ~2 Y p2 L( \3 \! {
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
% B3 D* s2 v1 C' |; Y9 }5 u - #define STATIC_SHIFT 3/ y7 F& j2 N. C" x7 m
- #define TCINTEN_SHIFT 20
! r' X- |9 a* d; \* @* ?/ d - #define ITCINTEN_SHIFT 21
1 `0 I) R: ~- r! p3 N - #define TCCHEN_SHIFT 22; D/ [# I; T& j( L. C L
- #define ITCCHEN_SHIFT 23/ n' s4 T; d! F- x8 d
4 Z7 E& t/ @ t1 W- static volatile int irqraised1 = 0;
5 R: j$ d8 f5 Y* L; \8 S - static volatile int irqraised2 = 0;
: `6 A0 I( L! V. b9 C/ z
: C% x# q0 b# s+ j; t8 v- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 l) l+ ]/ n9 @
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) R6 `6 Z6 y. s5 Q9 `& L3 U2 _ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- P) C* }' A. S' G: ~6 ~ - ( P% b( y' F; V, D
- dma_addr_t dmaphyssrc1 = 0;
; r, b$ R5 O/ T2 r; |# W' |5 n - dma_addr_t dmaphyssrc2 = 0;! I2 m! R# g. x( f. ]/ Q' n
- dma_addr_t dmaphysdest1 = 0;1 [7 O, r; y5 S5 w# B
- dma_addr_t dmaphysdest2 = 0;/ M4 c" n+ Z3 R2 y! I
2 K9 f6 m( ~5 v# |$ k' J7 D0 j8 @4 I- char *dmabufsrc1 = NULL;& M% C4 K$ d7 M" P
- char *dmabufsrc2 = NULL;
4 z/ | i6 O' w& B) @ - char *dmabufdest1 = NULL;
2 Y( |& |& x8 l( R: ` - char *dmabufdest2 = NULL;
, y- }4 N4 g/ ]5 \6 U/ U
8 W% s8 f7 I9 n5 e- static int acnt = 512;
" s/ a- ~2 a i8 e1 g - static int bcnt = 8;
1 z; D1 F w! M p( ^ - static int ccnt = 8;
, d3 C9 r3 F0 w7 `* h7 y1 D - : D7 A% ?( u- _0 G p0 E
- module_param(acnt, int, S_IRUGO);
h+ W$ g: y% w1 J, b; U: i - module_param(bcnt, int, S_IRUGO);1 r4 v# O0 _8 }
- module_param(ccnt, int, S_IRUGO);
复制代码
6 o- O! _$ P. E8 @% Y0 D
, b5 J/ i+ h% Y5 Y9 K 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' S2 `5 U( |) X9 q6 f7 K3 E( Q/ r( F2 warm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& ]: I4 p) ^# U" \3 o, L" {( I- A
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。# o) K- @! s# t& b1 ?4 v
& Y8 L7 K& O' ?+ p4 @; V x6 x$ u. g. @- a' |! }0 V
|
|