|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 k( f: A: p4 e% b, m- [code]EDMA sample test application
! |1 z" c- m3 F1 I) G! G" w - /*$ F3 |( Y9 o( R" p
- * edma_test.c
* a) V6 ?3 Z2 H* C - *: \) `& }: }6 S: f. Z
- * brief EDMA3 Test Application
2 ]" K4 k: D' ^3 m$ l2 \4 g8 _ - *
9 H: x1 ^7 D! n t9 A - * This file contains EDMA3 Test code.- ^8 Z' C' @% N& w' V
- *
/ Y% D: f ^ Y- q - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
1 Y8 D- f$ _1 Z - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
: g" }- B5 }( G8 R3 z" N7 o' b - * TO CHANGE.
* U% z- b' e3 A) K( {. T/ N+ J - *+ Y8 h7 }# f/ ?8 V, Q
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
4 Z: ^3 n; _8 N0 X) L - *
7 d. r2 ], u7 ?- q* r' Z. ~ - * This program is free software; you can redistribute it and/or
9 q* v' y! G* o: C - * modify it under the terms of the GNU General Public License as
0 @4 d2 G( `) h3 n T+ Q - * published by the Free Software Foundation version 2.: h6 @3 y% B; n; T+ R) j" V
- *) g& y7 ]6 H& ?' v
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
2 f( E( R: Z+ g - * kind, whether express or implied; without even the implied warranty' R) p4 m0 S) N7 i- w! A
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the7 @8 A- g5 p$ ]. f
- * GNU General Public License for more details.( k* H, U# v; E1 C0 Z
- */
% H) F6 Z6 Q' A& |, s0 ]
& T0 f# t8 O, [2 ]- #include <linux/module.h>
& z+ e3 P$ j, S0 C - #include <linux/init.h>
$ @# P9 g2 p- R& M$ {! E: C - #include <linux/errno.h>
: G* \/ C* @9 G# O - #include <linux/types.h>
3 m1 d* ]7 s w1 V4 l3 F/ o - #include <linux/interrupt.h>) e1 ?1 e& O9 f$ [* ~5 P
- #include <asm/io.h>) L* O6 X+ k1 d' t; i
- #include <linux/moduleparam.h>
$ \) r) t, Y6 A( ] - #include <linux/sysctl.h>
6 l/ M: _9 c0 u - #include <linux/mm.h>
9 K. {* B1 V3 L) D - #include <linux/dma-mapping.h>
; i5 j* W& q) X, l3 Z - / D# s% Z# P8 \
- #include <mach/memory.h>, S0 _1 H! a: T. V& |
- #include <mach/hardware.h>
/ p" d: Y2 D, ^4 z* E - #include <mach/irqs.h>
; x, U) ]3 a$ ]2 d$ g: H5 b v7 G - #include <asm/hardware/edma.h>5 R) `5 ?- d" q- Y! w0 G( b8 s" V" g
1 _6 }0 \5 R1 Z& L2 g/ }6 c- #undef EDMA3_DEBUG% R& T7 d8 H3 ~' x8 B `* g
- /*#define EDMA3_DEBUG*/
: s9 t @8 T; k% W+ } - 4 l+ i! I6 l9 C, v' U
- #ifdef EDMA3_DEBUG8 j3 f8 E( X% B$ J6 y1 |
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% V% L* S E3 D, t% D9 l' @" S3 X
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
* |7 Z2 t$ z$ m/ m9 z b4 W4 C - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). s1 A1 L5 U5 y+ x1 \0 {6 \: ~
- #else
2 v1 M; ~# V8 _$ I - #define DMA_PRINTK( x... )6 p; V" W, J( Y! s9 f. v& f
- #define DMA_FN_IN3 g3 S" m" M+ \+ w6 ?2 W
- #define DMA_FN_OUT
$ H: a, p! w, s" E - #endif/ H6 z2 j8 t M$ [" P
- - p3 G% z5 C1 K; e6 m6 m
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)% V3 ~9 j S, n3 \, \% ^
- #define STATIC_SHIFT 35 p% O) u; K# `. E6 U
- #define TCINTEN_SHIFT 20- \* W1 y7 p( P" N- `
- #define ITCINTEN_SHIFT 21* D" \( b5 E$ q" r5 r6 y2 m4 D
- #define TCCHEN_SHIFT 22
F# k$ W& ^2 r" w5 z - #define ITCCHEN_SHIFT 23
1 Y7 z7 W! a) ]0 u, j( b. s - # s% Y0 s* {* O0 K6 k8 J) w
- static volatile int irqraised1 = 0;
8 K% S: r9 z- T4 S - static volatile int irqraised2 = 0;# k9 I/ l( }/ E9 A6 K. e
3 M ^4 [+ t7 j8 A+ X! i- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: C/ H- f- W1 E+ U( [ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, U3 O' o9 Z% a
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" l$ n2 F! I8 N+ Q! ~7 h" o/ b
" F0 f2 `$ n3 D1 R- P6 H2 g$ k- dma_addr_t dmaphyssrc1 = 0;
( z* p2 u3 L+ _& \+ J6 u* P# P- ` - dma_addr_t dmaphyssrc2 = 0;
) A& Q7 B" f* A - dma_addr_t dmaphysdest1 = 0;, R$ G# f" s. E ?! P! N' o; C9 B
- dma_addr_t dmaphysdest2 = 0;* @3 P9 k7 x0 x# f
- 3 G7 V' ?# n- d. E" @
- char *dmabufsrc1 = NULL;0 w' e% c7 W: q9 f1 E
- char *dmabufsrc2 = NULL;- g; r8 U7 `: A8 \3 W3 |2 |* {
- char *dmabufdest1 = NULL;, E) T/ D7 X, a. h g- D5 ?- N) A
- char *dmabufdest2 = NULL;
) g0 l R+ K4 y: ~4 Z - 8 _2 j) n1 t9 j" g& c3 b
- static int acnt = 512;: I! K1 p% d+ W1 k) ^
- static int bcnt = 8;7 H0 V; [+ X- i& L
- static int ccnt = 8;9 h9 q$ A, d- F2 C6 S% h
- ' V5 D1 |: O, W$ c
- module_param(acnt, int, S_IRUGO);; W3 A6 Z$ Z! m6 y: s' {
- module_param(bcnt, int, S_IRUGO);
( e, ]6 t5 J: H2 e - module_param(ccnt, int, S_IRUGO);
复制代码 # v. z( b' H/ S- q/ s
8 y s/ T# q: K6 R) A) J8 F
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* W5 U2 P* Q. earm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ U* Q+ {% n5 n+ ?. B 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ L3 h4 P" \0 `. w1 x' x% l' ^
7 `: V( @0 e# C6 d
4 U. k+ S/ r/ [: l: d. }, s
|
|