|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' B9 U9 i+ q" p) M8 O
- [code]EDMA sample test application
3 D) G6 k# w2 k: m/ ~ - /*
1 u) L% I0 L8 N( D. q4 |- V - * edma_test.c2 ~& L# }" l7 W# \+ A3 ~8 r0 `% j
- *
4 |: O, a4 B& s3 X: R# S( U0 D - * brief EDMA3 Test Application, s& `# J3 I2 C, |$ Y
- *
; Y) x9 t- |. R/ `# P5 V7 u - * This file contains EDMA3 Test code.6 A4 g1 v3 ^2 {; G: U0 J
- *0 ~3 z1 N9 B1 H; R" m
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# e5 w) R K3 Z. V, U, k1 R3 p5 S
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
1 K Z J2 S g - * TO CHANGE.
* U+ x6 `7 L7 s$ R( L - *! X4 ]# @! b! b6 i- U. g
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 Z7 w; D& _7 m4 L, f: r
- *
$ x+ z! H4 q9 ?4 W7 P# G - * This program is free software; you can redistribute it and/or
8 }$ {& c7 {4 r - * modify it under the terms of the GNU General Public License as
7 }- ?+ {* d2 p0 p! P7 F - * published by the Free Software Foundation version 2.
k9 n, e: B9 [8 Z \- X( H; W - * i$ o& B. m$ v, Q
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
& `1 Z, F6 I/ z3 k+ N2 p. A - * kind, whether express or implied; without even the implied warranty
7 G g$ @5 j+ p! |( @ Q - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
: v! ]: O4 u1 m5 y3 k: l2 u' L( V( E - * GNU General Public License for more details.
% X m+ o6 ?. {% g5 {& w+ k - */* f X; D; `; r& e" V
* ^+ H1 i2 H# X, e( i- #include <linux/module.h>( i6 e/ j M1 ]. I
- #include <linux/init.h>
; h8 E# C; J( w. ` f - #include <linux/errno.h>
) n V3 g6 s7 `0 j l' z* B& h - #include <linux/types.h>
) y1 m$ S5 d9 r: S! x4 B - #include <linux/interrupt.h>8 X# H' [$ t9 y0 R
- #include <asm/io.h>
# {; b3 U( M0 b! i7 ` - #include <linux/moduleparam.h>
f$ q, T4 n4 P9 P; v - #include <linux/sysctl.h>
, G3 x3 p! v# d8 L; y - #include <linux/mm.h>
$ [5 X+ Y, n& {( i& s- |, ` - #include <linux/dma-mapping.h>
8 {# `: Q$ k. l - ( J& \$ \5 E5 d8 `* _! I7 x
- #include <mach/memory.h>
; W( z3 B( U7 B7 v - #include <mach/hardware.h>
, j0 B& L" W2 ^ - #include <mach/irqs.h>/ O1 r" ]0 @% t& o
- #include <asm/hardware/edma.h>
. @2 g' `3 y4 u9 `$ b - ) h8 @" W, q: d! }
- #undef EDMA3_DEBUG
' O7 _* E, h: K( m- c+ n - /*#define EDMA3_DEBUG*/$ i9 f0 r* T* H/ F! d7 B0 g
+ R5 l* `, q! x: ]( ?1 o% E- #ifdef EDMA3_DEBUG
5 U: {+ p" B/ u - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
8 v/ B. M1 a' `$ E; L5 t - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- z( h" B2 Q# s
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). T# O: Y/ M, l0 i% F! N7 i
- #else, Q9 w1 j) |: S& E& \* c( {' E' `
- #define DMA_PRINTK( x... )4 X; H5 }6 y+ F8 [3 S9 ~2 o
- #define DMA_FN_IN2 g, u9 ^8 L, j5 D! L1 l
- #define DMA_FN_OUT7 r- W% i( R1 o, l5 B
- #endif4 _4 _+ i8 X; f. k/ d9 s
- ) _9 ^8 Y4 F F3 ^4 X# X3 n* c3 U
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)( Q% d) t/ x7 K6 @7 R9 y: K T
- #define STATIC_SHIFT 3 Q. d* }: I: f: ]1 q
- #define TCINTEN_SHIFT 20
5 }7 M s6 b; b6 r4 w: V - #define ITCINTEN_SHIFT 216 O5 \' Q: Z5 J1 x# Q
- #define TCCHEN_SHIFT 22 }0 g8 |; O3 c; @
- #define ITCCHEN_SHIFT 23
1 p7 c% B/ e( b" a0 { - * i4 O# K2 o* ^9 [$ @
- static volatile int irqraised1 = 0;
/ a' i$ Z' @9 g( d+ T- @9 ?8 M - static volatile int irqraised2 = 0;
) |0 C0 h$ a6 g n% O
# g4 S5 f9 N+ K7 p& W; H. t- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 B9 M$ n8 g* p: C% B - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& D- I( q/ G( h- e
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! M5 I2 A) ]/ P' k% j, [4 o
5 Z& c. s) X: n4 E- dma_addr_t dmaphyssrc1 = 0;. R4 [% g. [4 d" t
- dma_addr_t dmaphyssrc2 = 0;
/ N$ z7 b+ d7 T" b - dma_addr_t dmaphysdest1 = 0;: W: ]! {$ y* v& u& m8 e6 h
- dma_addr_t dmaphysdest2 = 0;1 I0 p) c( \/ T9 M/ ?7 m
- ' W: `3 m* l$ p/ X. f& V. k9 c U# c
- char *dmabufsrc1 = NULL;
* f; @+ {' D" x5 Z! x - char *dmabufsrc2 = NULL;
) h/ f# ?: E! B9 Q5 M - char *dmabufdest1 = NULL;1 v6 Q6 R. v( O
- char *dmabufdest2 = NULL;
1 D. B5 x5 E" [7 c
. H% k, [/ n. V/ _" e& Z% ^0 T- static int acnt = 512;7 W. Q6 F$ G" ]) G8 o
- static int bcnt = 8;
; v, \- M) H9 a- E, o s* V5 B - static int ccnt = 8;
8 ?6 J$ e' R2 u$ ]$ H& H `
! [/ h3 {' g/ T, T7 ^( g- module_param(acnt, int, S_IRUGO);
( V6 X: ]. l( W7 W* e& { - module_param(bcnt, int, S_IRUGO);
6 M7 c# a' K0 o( y* d+ ^. D. U - module_param(ccnt, int, S_IRUGO);
复制代码
4 X7 r! Y, v' o% G9 M+ |7 l* d+ J h7 O
0 I. }* o: |, {2 u 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: W& b' Z$ ?& c% _
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# q7 [- _3 {" F2 a6 k 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) y$ O) j d' E9 y7 U
& A3 d8 |$ a% E7 G4 f
0 E) E# L' T6 Z" U* X/ I8 ] |
|