|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# F P& x2 q9 C, y- [code]EDMA sample test application" k( z8 ~' @5 E2 }/ m
- /*
V' C% Y& J7 e; { - * edma_test.c
$ U0 ]5 E- ~ z g9 ]$ d - * r2 s7 z' B$ K( r/ p
- * brief EDMA3 Test Application
, J$ h- `1 h. k7 V' }9 M - ** m! A! i2 L& ~+ W4 ^3 h4 F6 ^
- * This file contains EDMA3 Test code.
0 r9 y* W' A7 ^ M/ P+ y - *( ?: P* P: N: u, h4 I5 W2 @/ {
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 }5 H9 ]% k7 v4 G/ t! T# y
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ z" l0 L( i$ O2 ^& ~
- * TO CHANGE.
7 V6 C w/ ^9 e* \ - *
8 ]. M0 x4 y5 c X& y% o4 U - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
- Q' b. I9 R+ E, _ - *
8 \0 I) T- k3 [$ {$ d4 C. G e# ~ - * This program is free software; you can redistribute it and/or7 r% H+ Z% f$ h/ E" L
- * modify it under the terms of the GNU General Public License as
0 @* G8 a/ }2 w - * published by the Free Software Foundation version 2.
) V7 H7 |8 y" h! Q. S - *
. C4 w5 \: W6 v& D( W2 R! j$ M% j - * This program is distributed "as is" WITHOUT ANY WARRANTY of any) d3 k \* h+ Z
- * kind, whether express or implied; without even the implied warranty
$ d$ w( C. n6 E4 `1 X5 z - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the2 D$ X% n0 e& Y2 y: f2 k
- * GNU General Public License for more details.
! i8 `* b L; T' H - */
6 n; K0 c% b' ~9 Q( i1 D& b* N1 h5 N - 5 V0 F, n" C# e( J
- #include <linux/module.h>. x7 z% z: [0 H$ n4 v5 x i
- #include <linux/init.h>
$ m3 H& I5 S# `( I9 I - #include <linux/errno.h>
4 |) ]% g9 h2 O0 D - #include <linux/types.h>
; W- B& p" @, l0 [2 R" i - #include <linux/interrupt.h>; E, h# @- ]; Y! g) E! ` t
- #include <asm/io.h>
5 W/ f Q6 O# a$ G v* I: | - #include <linux/moduleparam.h>
$ I/ b9 m$ n$ y - #include <linux/sysctl.h>
& B7 h3 U7 X7 j4 ^ - #include <linux/mm.h>
. T: I# [% t+ |: G! H4 y4 q - #include <linux/dma-mapping.h>
6 k) a' R _* m; u. L, f
- X% | s% D% ~* u- d4 d- #include <mach/memory.h>
4 C3 Q/ o" _! ^, e3 ?. i9 A - #include <mach/hardware.h>; r1 p, e) ^( N
- #include <mach/irqs.h>& Y, E1 |4 i: s/ T: f# f
- #include <asm/hardware/edma.h>
& ^1 C% W# Q/ H F6 l% ~! _( L
. A: T) ^ }7 m; Q% m- #undef EDMA3_DEBUG5 C9 ]$ P- K/ `0 v' Q
- /*#define EDMA3_DEBUG*/9 B5 q7 P$ b0 M3 `) x! M
- 7 j! R' b9 b$ Y
- #ifdef EDMA3_DEBUG4 O# I/ Q5 J' U D2 v
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 i2 q+ Z, z! L2 N; M. w' R' ~; D
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& z7 E, O$ j4 V
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
C, Y8 p7 A# d( c3 N6 A" G+ Q - #else
- x, P( H2 p8 U( g- w9 Y - #define DMA_PRINTK( x... )
- t8 W. ]* O0 ? - #define DMA_FN_IN5 Z, ]9 X2 }9 F8 i/ d' `4 h
- #define DMA_FN_OUT7 s+ a4 |2 O9 w) [2 p3 L! S
- #endif- ]4 X$ _! M9 A6 I
- 8 ]& k7 A1 i& Q3 V7 W" D4 L6 F7 e
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)8 C; q9 i$ i; U: m3 E
- #define STATIC_SHIFT 36 H9 |: } S; _2 i; G9 x5 ~
- #define TCINTEN_SHIFT 209 h+ P* f' x: R
- #define ITCINTEN_SHIFT 21
- v# m7 \2 |/ H' s2 C - #define TCCHEN_SHIFT 221 G# W- v: G. I( W; q& W
- #define ITCCHEN_SHIFT 232 F! c5 ?, R9 F# ]8 S' a; Z
2 r3 o t: |2 {% w7 [- static volatile int irqraised1 = 0;
( }; F: A% O9 i# G! D) c - static volatile int irqraised2 = 0;
! J5 D( C* W3 N2 }* O8 y/ I
5 S j! d# ~# }: r) e4 b/ p- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 H7 \0 }& u. N$ _( t4 ^4 S2 Y9 [ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( V4 F5 }* V8 K$ R
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" q; o. v# ]; b# i8 A( }
: t3 }" |! i2 \: Y" ?: \( B' d- dma_addr_t dmaphyssrc1 = 0;
8 h5 C/ z& W' Z4 _$ ~0 i& z - dma_addr_t dmaphyssrc2 = 0;
, |3 D+ x3 a! w0 d9 S- w - dma_addr_t dmaphysdest1 = 0;
7 d+ F+ ~8 f i - dma_addr_t dmaphysdest2 = 0;
( s+ ~$ x% X) j
/ N2 J7 m9 |+ j7 i" w. y- char *dmabufsrc1 = NULL;
0 |6 K* c: b( f - char *dmabufsrc2 = NULL;+ n6 L& J P9 A5 B \; V
- char *dmabufdest1 = NULL;
8 Q! w$ D8 t+ \6 T - char *dmabufdest2 = NULL;
8 M, \* G, N, q1 `* ]& T6 `& C/ v( r - 1 i/ w! |+ \6 r& Q7 o, R1 e
- static int acnt = 512;
U: M7 t, x; Q9 H; a( L$ F5 ~ D - static int bcnt = 8;
2 n7 _' ]& j/ P w( P - static int ccnt = 8;' k4 q# j' p! Y$ a; \- b" c
" C* _3 c! a' P/ Q% R- module_param(acnt, int, S_IRUGO);
4 w3 q) A8 h" o* O3 { - module_param(bcnt, int, S_IRUGO);
% ?$ j, G- g. K* H# D ^ - module_param(ccnt, int, S_IRUGO);
复制代码
* Y3 M" A* c0 G! O* q& t
& n$ I8 S0 j4 }: g1 f0 r/ ^% z) I 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- q( e% s6 ~1 Narm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 X- s- L. Q6 W! F
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 j6 e T6 y( D3 x M
$ ~* E: E- D* h0 G+ {# x7 T: n; x& [- w
|
|