|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 K! ]$ E9 F9 H9 \" t# }- [code]EDMA sample test application# \/ `' H' W: n) \" q o2 S/ {2 J
- /*. r& g1 d/ J5 e) h
- * edma_test.c
& ?7 Q2 C2 M) T% a5 r - *
+ f1 I7 e5 h9 ~1 F5 v. O - * brief EDMA3 Test Application
, h# h4 @ `* h' { - *0 y* w% j* l. D' d% Y
- * This file contains EDMA3 Test code.: h0 ^5 g* k+ y, y+ b7 w' O
- *9 y5 u3 _) C8 B7 v
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 e9 W2 V- V% F% p0 U
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" s" ^4 u4 z$ ^ Y
- * TO CHANGE.; M3 r( G- X9 h; i
- *% f8 h/ l) k. @' a
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
; U/ u* g' _5 v; A8 b" U! ] - *
4 V- H0 A6 U, D( J# X - * This program is free software; you can redistribute it and/or
! h e, \& O2 S% z ] - * modify it under the terms of the GNU General Public License as
; b- Q: W. Y! J2 V - * published by the Free Software Foundation version 2.8 E7 X6 P/ v1 r
- *0 M7 `6 y2 d2 x. O1 x
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ a& e; U! B9 R7 r! i
- * kind, whether express or implied; without even the implied warranty
* A- ~- C/ Y! r: o2 A - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! |9 m6 [" M+ O* r, y# F - * GNU General Public License for more details.4 {: \0 o( Y, _1 j3 O
- */
) \3 y9 C: m* B7 t$ M9 j1 z - ! e0 q2 f7 [% b8 w
- #include <linux/module.h>
6 b3 d; {3 s* Q( h7 Z - #include <linux/init.h>
2 n2 x# x9 J. w+ F, y* S1 H - #include <linux/errno.h>
' v0 Z& T- E' J6 V - #include <linux/types.h>
" B. t# u# `" i p7 D, B" p; y - #include <linux/interrupt.h>6 v4 y) j' v* J5 f
- #include <asm/io.h>3 m1 ?$ Y3 L7 B8 r3 G
- #include <linux/moduleparam.h>: N& P2 r; f% e) |( m
- #include <linux/sysctl.h>$ f1 Q3 b$ P l( H
- #include <linux/mm.h>7 J( x- r! }, t
- #include <linux/dma-mapping.h>" Y# K/ N5 W! u j8 R0 i
3 }% b* v( ]0 U+ Y2 [) q1 t0 M( T- #include <mach/memory.h>
5 F+ l- n2 i7 P9 e% [7 ~. F - #include <mach/hardware.h>
1 k3 W" G, O1 `5 |- K - #include <mach/irqs.h>
( g; g) }( O d+ P5 l i& L. ? - #include <asm/hardware/edma.h>
! F, @. T6 b" @3 v3 n* r- Z
# P/ \( i! E$ r# q) Z- #undef EDMA3_DEBUG$ i, a9 f/ u3 T/ ^8 E
- /*#define EDMA3_DEBUG*/, Z, Y: e3 s$ \1 y3 }, ]
- 7 S: W. [3 n! s, N% H# v3 l$ M. T2 @
- #ifdef EDMA3_DEBUG
) i# f' `, o) K8 y9 P - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
+ m: {, ^/ T" k) i) \ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
# O. L0 d/ O7 O/ L, J5 k( S - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 P4 G) H: x3 J% b8 J
- #else! g6 m$ s5 v. y. Z
- #define DMA_PRINTK( x... )
3 O( |' b8 W" O" A - #define DMA_FN_IN
( [; [' B+ @; [% p% k - #define DMA_FN_OUT- ~: j& s3 V9 s9 N8 ~
- #endif2 t9 i1 R" `2 W) j
- ! D B9 H: n, f! Z- [. s
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)* Z, v* D' V: g$ `6 ?( J; v# E
- #define STATIC_SHIFT 3' I2 f, \7 m, I5 n" v
- #define TCINTEN_SHIFT 20% M4 Q B4 X) M) g% N
- #define ITCINTEN_SHIFT 21
" {: x: j1 G/ F/ H1 { - #define TCCHEN_SHIFT 22
' L, {# T0 T4 `) T1 R( D& A - #define ITCCHEN_SHIFT 232 c) ]4 F/ k* |% Z+ q$ x; @
- * `# m* D1 o. [4 \7 G3 e
- static volatile int irqraised1 = 0;% C0 r& i$ V5 M4 V' n; b: Y
- static volatile int irqraised2 = 0;- n( f3 s" D! |% B$ o" _
; R( g7 H" Y8 U7 T @- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# R% M. I2 K9 C. J! t - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 ~( c* |7 B0 ? F1 t
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 o7 F! K% ?- B k5 H
/ |/ t/ u$ X( I0 ]- dma_addr_t dmaphyssrc1 = 0;
0 h" l1 y# \3 M- [" {' ^; R - dma_addr_t dmaphyssrc2 = 0;
: S! x! g5 l) O& O/ r( g - dma_addr_t dmaphysdest1 = 0;
* `, j ]$ }2 i! b. f2 o8 q - dma_addr_t dmaphysdest2 = 0; T1 ?! ^/ g; G* s4 ]; P6 P
, Z7 r% X) \2 U* a4 w- char *dmabufsrc1 = NULL;, g* r4 u( j5 r, b# l
- char *dmabufsrc2 = NULL;$ [2 ^7 F; p8 x7 W/ b
- char *dmabufdest1 = NULL;: a. I( q& p: O" l; u+ y0 G+ i
- char *dmabufdest2 = NULL;
$ f; W4 n* N8 s - # F% e) D x: Q. ?
- static int acnt = 512;
+ i6 c% ]% V2 U4 v" M - static int bcnt = 8;
! b& ^- V7 E' E# I - static int ccnt = 8;0 |" K J4 T0 v. O" {& q
1 K+ M! Z, h8 x; t0 k, x1 f% q- module_param(acnt, int, S_IRUGO); R. n- T2 K$ o Z3 y) J. T& Z. ~
- module_param(bcnt, int, S_IRUGO);; Y; P: W9 a4 q- P* D4 s
- module_param(ccnt, int, S_IRUGO);
复制代码 ' u4 a: h4 f6 R& T& k/ K
- Q1 ?- j8 R3 Z) J8 C) E U
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 M% R' e7 {& i6 p( ?3 ~& Karm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! T3 N+ N7 l* S0 _" f: L 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 n) {: u; t3 F- f; o$ G( Y1 ~
, ~ Z6 h( c1 B1 y, j: v
$ y( R$ q2 H. _ m |
|