|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! w3 f8 |5 d# s" D' H# n. D+ Y9 m
- [code]EDMA sample test application
9 Z& ?% n/ h$ ? - /*1 C, i0 l" {( a
- * edma_test.c
4 `# _. @$ m7 K3 s - *
2 o! H9 W2 B7 o8 Y2 x- @ - * brief EDMA3 Test Application
7 ^! d# B2 A% \+ K2 o - *" o5 s( D5 c$ u
- * This file contains EDMA3 Test code.; u* u* i: m/ o3 P) w& V1 v) v
- *! M3 R; s% @ v5 p& j
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 V: H2 ?! n3 ~( G p# `* O
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
) Z5 m O& p; Q( P! o/ V - * TO CHANGE.6 I0 `+ |5 n/ R C- b6 W3 |% {8 f
- *# k- g& d* Z$ \0 h3 ^$ D' G
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 r1 C' f) S. |
- *
. }$ R6 C! w3 ^& ?7 r- V - * This program is free software; you can redistribute it and/or
; ]" F# P' Z) k. Z" S3 O; u - * modify it under the terms of the GNU General Public License as6 \3 F, u2 @3 W' ?
- * published by the Free Software Foundation version 2.
& K2 `* u* \* n2 p V - *
2 Z' W8 w8 v" G% n6 L5 ~3 |0 O - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
& Y5 p* u; p) w* {! j6 b - * kind, whether express or implied; without even the implied warranty V2 e2 I4 f! D# S
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the3 v: r3 b! ?% X9 S' n& x2 b8 H* Z8 a
- * GNU General Public License for more details.- }' U- E! @- E1 T7 H
- */7 Z. }3 K7 v) F4 t9 N9 W
; t; k9 ]" a/ w: b6 ?2 y% e- #include <linux/module.h> M, ^1 {+ q0 Q
- #include <linux/init.h>
. ?4 r7 I. } j - #include <linux/errno.h>
; p* [9 O+ g4 G$ T/ ` - #include <linux/types.h>$ [+ Z, }5 \. l4 c
- #include <linux/interrupt.h> L2 g0 q! M7 B& b/ v1 W' L6 `
- #include <asm/io.h>: Z1 m5 u& i: b- ]
- #include <linux/moduleparam.h># P* U0 o8 u0 p2 _
- #include <linux/sysctl.h>
! s' L3 ?+ J1 k1 {: e - #include <linux/mm.h>
3 h( t5 m4 ], M' { - #include <linux/dma-mapping.h>
1 \5 \& ?: R2 F5 U
9 y1 N" L1 C$ m( |9 }- #include <mach/memory.h>
) h. o9 x' t' \ - #include <mach/hardware.h>! r4 P3 _4 | H- ]* g7 W3 |
- #include <mach/irqs.h>$ K: R0 o' ^# w! D
- #include <asm/hardware/edma.h>; W# Z: O2 ?6 P# V
* A; r7 E B7 @3 g1 h- #undef EDMA3_DEBUG1 N) q5 G& c0 ^7 i
- /*#define EDMA3_DEBUG*/1 C8 T4 o2 ^, F6 a1 V8 Y# F
- 3 T& n4 T" I: X; Y
- #ifdef EDMA3_DEBUG" @* F4 Y0 Q/ K- a: F9 q; T3 I
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
! e- N) {7 U0 e$ l W+ [6 w - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( ?; `$ F& B X/ \% f% b4 A
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
" o1 Q( }! w( Y/ L7 e3 l( H" r3 p - #else
: m# n% V, U) G D1 ^ P v ?+ i - #define DMA_PRINTK( x... )3 N7 P" b9 o3 @" E" o; P6 t
- #define DMA_FN_IN: u2 n- O# m# ^. X+ m8 @5 T7 N
- #define DMA_FN_OUT3 D8 j: L& o/ ?2 p0 j4 P
- #endif0 y3 ^" U# v6 f; Z% j
, Z0 @: V# T, Q9 J- #define MAX_DMA_TRANSFER_IN_BYTES (32768)8 y! E0 {. X( ^. C, {1 ?- i
- #define STATIC_SHIFT 3; X4 o0 k" B. m$ O8 W7 K
- #define TCINTEN_SHIFT 20
: I4 d# M/ [* q) f$ P6 w8 \5 _+ ] - #define ITCINTEN_SHIFT 21; {3 `8 g' C+ i
- #define TCCHEN_SHIFT 22 a0 d! m9 V( d
- #define ITCCHEN_SHIFT 235 |8 c+ p/ t0 F1 T( Y
- 1 h* G4 a6 u: b% ?) {" w6 f; R
- static volatile int irqraised1 = 0;
7 I+ z6 f% x) w+ f D - static volatile int irqraised2 = 0;
' H/ B% J2 W1 B - 8 o; v+ o' C) J' {& k( g" k+ ?0 Y
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 `. \5 `1 e4 b+ h. i
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& H2 [0 G5 r+ S! {1 p. _8 i9 j' r - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 H9 y$ R3 b6 ^. {; O - % O/ G& I/ k5 O9 B' _# o
- dma_addr_t dmaphyssrc1 = 0;
8 ^/ {, V! K( s7 b- X, l* G. o - dma_addr_t dmaphyssrc2 = 0;
4 u+ x4 I( A/ W8 a q: A - dma_addr_t dmaphysdest1 = 0;
+ s) k z% Q' g' U4 m - dma_addr_t dmaphysdest2 = 0;9 @6 I8 |8 Q+ a
- : I$ M. d. {. j
- char *dmabufsrc1 = NULL;' H/ m3 N0 e& ~+ p$ j( y* Q
- char *dmabufsrc2 = NULL;
% `& Q9 P8 w8 ~" u2 k6 s! ^ - char *dmabufdest1 = NULL;9 ^. F x0 |: t" i8 S
- char *dmabufdest2 = NULL;
) e! W, [* ^1 Q: x6 [ e2 R - & V+ G1 t2 t; \
- static int acnt = 512;
: d1 N. A9 e/ O2 ` - static int bcnt = 8;
% B0 k$ m5 J; Y - static int ccnt = 8;
* n+ C. B1 K- W0 D - " ~% d, S1 H: c: l4 H
- module_param(acnt, int, S_IRUGO);+ [7 n _5 L% b$ @4 n
- module_param(bcnt, int, S_IRUGO);% K" M0 `) N+ [) c! N2 U6 i7 R
- module_param(ccnt, int, S_IRUGO);
复制代码 9 K; e% k9 W; Y
' h c3 v/ [; I: u3 Z) T 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 ^- @) G+ l# Y { ~
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 K2 L+ K* A: L( D; U- u
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 e+ d$ T7 F9 H) S3 P. P9 v+ z% w
7 s! M5 r. d% c2 Y( E8 t! z( T! _8 k, m0 V# \( r5 Y6 x
|
|