|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' h7 V1 M% K' f: p) g
- [code]EDMA sample test application& j. w, I& Q8 c: x x/ @ D: J
- /** `7 A5 Q% H3 \: P1 W$ s& U% M
- * edma_test.c
2 J: u7 h* u6 D) F% g2 E/ s, d O9 c) y - *( Y8 e. R3 Z0 m+ I, q* k3 X2 W4 F
- * brief EDMA3 Test Application3 Y/ G/ f/ H3 v# Y) p
- *
5 E9 ?' \: A# t8 ? - * This file contains EDMA3 Test code.
# H. M- m; d) A% d - *, Q- U( a5 P1 X8 n
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 [2 {4 W5 r0 G' d
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ I" e9 y [, d* D9 X
- * TO CHANGE.
0 c, x* K+ H: J- J) f - *7 w$ q$ Y7 [8 s9 m. K8 H( Y) A& P
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
1 P8 q# `% [: ]7 C4 u2 R, J - * N% O$ H R6 k4 u
- * This program is free software; you can redistribute it and/or5 u# B r) L; D
- * modify it under the terms of the GNU General Public License as
" a3 G$ x: B( a - * published by the Free Software Foundation version 2.
6 W4 [8 [7 W0 v/ j - *) H1 |6 }2 e/ j2 D+ m2 e
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 H( k* f2 @' K
- * kind, whether express or implied; without even the implied warranty
+ I7 V1 _4 W7 M# y' J5 P, x3 P! x& S - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1 X, V% c3 E; b3 ~1 X
- * GNU General Public License for more details.
$ E# ?' n+ t% O+ F& l: o1 Q - */: q4 u: \9 ]5 l: n' N0 _8 Y
4 N, K% z1 K3 z- v/ o- #include <linux/module.h> a( }: e; J3 d D2 H, Z9 P! {5 z, L
- #include <linux/init.h>
6 v6 z) h/ }& B" O - #include <linux/errno.h>+ ^' |/ ]5 ~- m
- #include <linux/types.h>
% r7 U9 N/ H/ _- }5 }6 }; ` - #include <linux/interrupt.h>
( o; b; L& I* p! y, k - #include <asm/io.h>7 k% u( }1 y) _7 L, h; W% D4 l
- #include <linux/moduleparam.h>
2 U+ ~: B" X5 | - #include <linux/sysctl.h>
1 \ a1 |" |* D2 P. j7 E - #include <linux/mm.h>$ |% v& Q- C9 M8 V3 N5 V5 M
- #include <linux/dma-mapping.h>
! h0 n( T" }( ~# d - 4 {' k' K) {! C
- #include <mach/memory.h>
V4 ^' v" H0 x - #include <mach/hardware.h>
. K N5 J8 y9 v: p# U" u - #include <mach/irqs.h>* w- c6 @' Z6 t' ^: p8 I9 V( y
- #include <asm/hardware/edma.h>" n/ \7 ^% a& j" F
* k0 Q7 j0 R% C+ a' p- #undef EDMA3_DEBUG
" @, w+ D; G7 ~# [! Y$ p3 F - /*#define EDMA3_DEBUG*/3 c- h1 k8 q9 B2 s
2 m6 f' u: P% z; q4 {- #ifdef EDMA3_DEBUG% z" G8 x. P8 R# B
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ b+ W' l i0 u
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__) `1 d7 p: @ y
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
* h( `* o7 G+ U. N) {0 n2 [; o - #else3 D/ Z" j$ L6 k# m" i1 t- A. D
- #define DMA_PRINTK( x... )
6 v4 w: Q5 I) y. k - #define DMA_FN_IN
6 k5 V/ v7 ^- S1 E( i# D2 e2 H' z2 d) F - #define DMA_FN_OUT
+ A, `! b, d5 ^3 F3 u! Z% e1 _ - #endif
/ D7 |1 I, T7 _1 G& ?& a
; ?# v8 }7 K" T4 n- #define MAX_DMA_TRANSFER_IN_BYTES (32768)) v5 z8 L9 n5 H* F. @) M% V, u8 d
- #define STATIC_SHIFT 3' ~. j; S! i1 Q7 k: E
- #define TCINTEN_SHIFT 20( [) |! s) Y8 `7 Y; |; b6 B: J
- #define ITCINTEN_SHIFT 21
2 o6 m* L1 f0 s6 N$ _ - #define TCCHEN_SHIFT 22- Z5 {$ x' x% ~, J3 y! s
- #define ITCCHEN_SHIFT 23% U. _) X: W4 y6 g4 g
+ a# C4 X$ {2 z6 D% V- static volatile int irqraised1 = 0; g" ]; {! N4 i0 u
- static volatile int irqraised2 = 0;
/ F; S( ]+ z, T$ P1 ^/ X6 ~' u
5 b( e& l0 m9 T/ J& b/ e1 ~- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 ?1 H/ j* Z7 W; ?0 t - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; p5 T6 N2 [: h1 Z* k: Q - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: b% i5 o% ^3 m j+ a3 R
3 C- {" i" ?) N0 e- dma_addr_t dmaphyssrc1 = 0;
2 C" _& J0 f6 ?0 X U - dma_addr_t dmaphyssrc2 = 0;
9 J+ Y8 Z7 U, p& Q! p/ C& s# K - dma_addr_t dmaphysdest1 = 0;
" ^+ o, v1 p: ^7 |; T - dma_addr_t dmaphysdest2 = 0;
) m" X' v7 g; ?# v9 W4 |+ G- q1 \ - " `7 x- L8 a" f; z* Z$ U
- char *dmabufsrc1 = NULL;
# Y& ?; K& o0 g& _; x8 [2 b - char *dmabufsrc2 = NULL;
: w! ]6 d4 V: b2 N" ?) y - char *dmabufdest1 = NULL;4 W& [/ S. I1 F. q; [
- char *dmabufdest2 = NULL;
/ W6 @, q- L r, x j0 w3 a: g - ( u* T7 k+ I; x* ]
- static int acnt = 512;" ?* f M/ b) e1 a
- static int bcnt = 8;7 V: S: r$ u, m/ r1 D' ? ?
- static int ccnt = 8;$ g' V$ L2 o+ }- f9 P6 R" e' |) O( q
( X6 G- r3 s8 x6 X' L- module_param(acnt, int, S_IRUGO);
% A8 F6 D9 [1 S - module_param(bcnt, int, S_IRUGO);
/ N. V0 @2 ^, S1 U5 b; c - module_param(ccnt, int, S_IRUGO);
复制代码 : s# @! I1 F3 [- A5 G
% k l& p8 S* r, W% i, `7 }& O5 m
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 E, @5 W4 x0 h* _4 n& \ |1 \# {" Iarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" J: v9 n7 F2 ^% I+ R. ^ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。 a" [% [5 Q* X/ W, k, b' F G9 A
0 A/ S' B1 q* @9 k: q) g; R2 o. b5 ?; A! _5 ~: H5 H M0 X
|
|