|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 Y: _+ |. i( b# i3 R- [code]EDMA sample test application2 y- ?4 s j7 y6 J
- /*( r$ B7 h3 ?2 B
- * edma_test.c
' K) U3 \' g& M, h( N- G! R) a - * b7 R6 s' }. A1 q' N; R
- * brief EDMA3 Test Application
' t) Z. C; G5 g( p/ P" G6 \, q4 x - *; i/ l' x/ [7 k3 z1 O
- * This file contains EDMA3 Test code.' f4 d3 W* d6 |% S
- *
7 r2 }, P( X0 l+ x - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
/ o; ^0 K& ~: G. v& f0 `2 A - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
( K0 ?) l( t& ^ - * TO CHANGE.
5 M+ I+ T0 @; e5 d4 O - *
) ]8 L) q, @( F5 L) y5 @5 t - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
( @; z* O( U* p P& [ - *
& k1 o/ M2 a) U8 M - * This program is free software; you can redistribute it and/or2 C9 q! J/ M% K- a( F! w( ?
- * modify it under the terms of the GNU General Public License as
& v/ S4 N% I. u; Z - * published by the Free Software Foundation version 2.
f+ X4 b8 M% d5 g7 W! H5 \ - *" Y, h+ Y* B8 S
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 F' F' }. G& p
- * kind, whether express or implied; without even the implied warranty
. u" S9 Y' ~$ P& M* o - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ |# P- L, n3 D3 S8 I
- * GNU General Public License for more details.
+ X$ J: W a* [$ s: N! G - */; I' {8 j5 k) w3 S2 s$ k
1 f9 M$ A" ^2 G5 s" E/ P. x- #include <linux/module.h>
# g. n6 P! f4 U8 N5 c - #include <linux/init.h>: C8 n9 c# H! g9 d
- #include <linux/errno.h>* n4 l4 f8 `& `4 J0 j ^
- #include <linux/types.h>
% r' o4 i6 _( H; b# P; _: U9 F - #include <linux/interrupt.h>8 H% |0 K" }" ?+ ]
- #include <asm/io.h>8 N* Z: |3 f) j9 C$ {1 v. o1 P( [
- #include <linux/moduleparam.h>
$ j+ j2 P" N, H% y - #include <linux/sysctl.h>, E* P* U) [. {' n6 z
- #include <linux/mm.h>
# d7 v1 R5 f7 v9 b! J! ~$ h2 T. z - #include <linux/dma-mapping.h>; x3 U9 f/ n% B: o0 {! w# J! f
% E+ `/ q/ _& h/ ]- p- #include <mach/memory.h>$ W( [8 V9 o" Q% H w
- #include <mach/hardware.h>
) T4 [: a6 F* q8 Z2 C. Z( X) F/ J - #include <mach/irqs.h>- A, w( C. E% D; v9 }* y
- #include <asm/hardware/edma.h>
& j$ v0 e( B. Z: W, p) c - ; V4 Q% f' _( l5 | ]
- #undef EDMA3_DEBUG! h( d5 g2 Q% e" j
- /*#define EDMA3_DEBUG*/4 K5 r, \6 B v4 P6 Y+ M% S
- , T: F7 m3 r$ h9 @4 q7 C
- #ifdef EDMA3_DEBUG
( i) Q1 b" J$ x& t - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 q; g9 P+ h# ]& ?9 N* N6 t
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
7 H! V# v: B. S8 ^2 p% F - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
/ l* Q0 H6 W1 R6 t$ a4 r% O - #else. l+ U/ J+ `7 W, z
- #define DMA_PRINTK( x... )% ~, S9 @" Z7 ~/ I( G
- #define DMA_FN_IN
4 s3 I u* `& a2 n2 y( ]$ r - #define DMA_FN_OUT. M- E- z2 x5 I3 Z" x3 M# N
- #endif& d0 G0 R! W. O4 o
! }: r, G0 ?5 z- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
0 N' I+ u& }* l! O" F5 ] - #define STATIC_SHIFT 3
" m: {' m3 t0 ^5 `% | - #define TCINTEN_SHIFT 20
. L3 I& P# d# C4 a - #define ITCINTEN_SHIFT 21% T! C) H; ] Q8 _2 H2 e% c1 f9 q
- #define TCCHEN_SHIFT 220 [- K" I1 K* C
- #define ITCCHEN_SHIFT 23
+ P: K2 x+ i+ L5 N9 R
' j7 b/ e+ D3 @" A% x& O. h- static volatile int irqraised1 = 0;+ S* V! W+ ?: o2 h0 v4 j- V% \0 \
- static volatile int irqraised2 = 0;5 J! R a/ r* `, ]" |9 e, w
# y' P6 ^1 S5 [5 {& a- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* U/ Z! C. i2 j# ]+ T; e8 r - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 z: M9 e6 }) C5 x - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ B1 l7 Z- b$ V+ F4 F
4 u. j6 z$ k7 Z1 B- o- dma_addr_t dmaphyssrc1 = 0;
+ X+ G: f0 u8 N i- i - dma_addr_t dmaphyssrc2 = 0;
$ P! [3 m, k, t% Z - dma_addr_t dmaphysdest1 = 0;6 ]2 [5 c- d" r9 C) U
- dma_addr_t dmaphysdest2 = 0;
/ k$ q& b# z7 ? B
+ o' M$ Q* }" x, n1 N- char *dmabufsrc1 = NULL;7 J8 y9 r0 l4 [; l7 I) Y
- char *dmabufsrc2 = NULL;6 E* y N' U, Q! o8 T3 d" \$ a
- char *dmabufdest1 = NULL;
6 W% _" F4 O; R0 N - char *dmabufdest2 = NULL;; i8 N+ r* {/ L. K, D
- ' i- S' P g- \6 U+ W5 Z3 h" W/ \
- static int acnt = 512;
: k; H1 O o. G6 A( T0 N$ X) L - static int bcnt = 8;
: B$ Y+ O3 \8 p# U) P" e: J - static int ccnt = 8;8 a6 n5 F+ [! N# y
8 N: r* M' g$ U: i- module_param(acnt, int, S_IRUGO);
' y0 J4 X- g# H - module_param(bcnt, int, S_IRUGO);* A: h2 V/ U2 U4 T4 @
- module_param(ccnt, int, S_IRUGO);
复制代码 * h, b+ k7 h ~' U% _9 G) C# G: q
2 t/ X" @, N* c" y
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 o" U- j% P& b) Aarm-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 @# m5 g& f- d" {% u1 f/ \1 b 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 g: F9 V8 ?1 J, L0 K$ H
4 M3 G2 L) P! \# C/ e ]: ?( a4 p8 }0 R2 W) g8 x" [
|
|