|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # N7 `0 k: s* `" w! n
- [code]EDMA sample test application
4 j4 I6 v. ~: L* M7 Z - /*
6 I6 [6 u! n) F; J* S4 H$ [3 e) @ - * edma_test.c: ~; E: e: Z& S9 y( C
- *
' q9 P3 K% [: R - * brief EDMA3 Test Application, q0 c; f0 b: V/ Y( J
- *7 o# n$ L' M+ c: E1 L- ?
- * This file contains EDMA3 Test code.4 a! j, t- v' _) P! k5 e5 {2 k( ]% s
- *4 I; I2 Q; @8 U/ F
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 U0 I4 {; j0 R, q/ _+ R) ^
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
- Y. D; x; M0 t2 `8 F, ` - * TO CHANGE.( q1 g* Y9 R* N' V
- *
* w2 O9 X( U0 c1 b& N# W, ]$ r - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// ?; p( g7 x5 l/ W8 U% D3 V1 C, g
- *% Z( H, ]7 y- X3 i2 [4 _
- * This program is free software; you can redistribute it and/or
# X- N6 J% S# ^6 \ - * modify it under the terms of the GNU General Public License as& ]# u' b1 O' m* ]$ g' Y
- * published by the Free Software Foundation version 2. V6 r& S' X1 w( K
- *: W5 c# K1 i. D' I; S/ F# r* y
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any" E" C. D2 n$ c. L' |
- * kind, whether express or implied; without even the implied warranty
% q6 W) n' [# n* I% P3 l' G - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3 C8 c4 \9 R5 U+ V, ~2 d( g - * GNU General Public License for more details.
9 V7 d u% s" A) p8 h0 k% s - */
" z# }% d! s0 ^9 u7 z# ^. |; h: ? - # X* d; `3 b* {# C& `7 u! h& A, w
- #include <linux/module.h>, f5 W6 S( d8 v3 m4 e
- #include <linux/init.h>- G% _! E1 V$ [+ b2 `4 A* x2 S8 g
- #include <linux/errno.h>
+ j- j! e) X. q" u4 x# Z: h1 }% n - #include <linux/types.h>3 Z. V8 L9 O0 ]; X- J Q
- #include <linux/interrupt.h>3 b d5 m# `; o
- #include <asm/io.h>, u5 t& p1 P5 m, N- S' h
- #include <linux/moduleparam.h>1 m( H C4 G0 ~; a$ m! r" G3 X
- #include <linux/sysctl.h>
( u T8 R: J8 ^* w - #include <linux/mm.h>
" F5 e8 }: d0 S" I$ { - #include <linux/dma-mapping.h>
# g. n! t; i$ @, A& s p2 r1 Z
3 i# O7 f& \) x) M; k; g+ |- #include <mach/memory.h>
' o, b) ^ n2 u0 N) ? - #include <mach/hardware.h>
W2 X0 j% h. W - #include <mach/irqs.h>
W% m* ` t5 |9 M: b; @# J - #include <asm/hardware/edma.h>& H6 }3 z# ]8 m; e
. U4 K& [' ~; V/ G) d. C! C- #undef EDMA3_DEBUG5 G1 x5 B" l2 _' v7 R. N
- /*#define EDMA3_DEBUG*/
- o/ f' M* H/ C) J; N
$ y) [, i/ h' G8 M- S+ r b- #ifdef EDMA3_DEBUG% P L" ~5 m, D: g. d
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 x+ r* b8 I% t( r, m$ V' S8 w
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
# z7 n$ s6 K s; O3 B0 L$ Z5 n - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 F6 k0 s! a3 t( A% ?! f) y
- #else
2 z# Q& g/ G) R2 |1 g( y7 ?! X3 `! E* Y7 F - #define DMA_PRINTK( x... )
7 ^# r; j s7 ^/ C' c - #define DMA_FN_IN7 _$ @% q8 I5 ]
- #define DMA_FN_OUT q# N+ j! W2 Z
- #endif
1 r: L% S7 |) Z$ U* J
* ~+ \$ q' h, U; D! R3 J/ R- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
' N) ^/ s5 k( d8 ^) s - #define STATIC_SHIFT 38 V# I3 X& q) |$ T: h
- #define TCINTEN_SHIFT 20
0 b5 M2 ~4 R% m, l$ z; u3 u - #define ITCINTEN_SHIFT 21
( ]4 L. @% ^! v8 j0 ? - #define TCCHEN_SHIFT 22
$ _( Z; A3 H4 o/ ~ - #define ITCCHEN_SHIFT 23
& W0 G7 g. V7 h5 c8 o& h; j
& a4 X) n( \9 Y3 D) _% g- static volatile int irqraised1 = 0;. ^1 k3 S7 C8 ^% n, z
- static volatile int irqraised2 = 0;
* e' k' z6 a2 i' e: Z% z, u - 0 M$ c" a# u; z$ X# B
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ p- D' d- A6 d8 w B4 u
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 b& K8 @6 B1 }: u/ Q/ X$ P: Z6 C
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. b: `2 I( J _
& Y! b$ o$ d' L$ l# _( g+ C- dma_addr_t dmaphyssrc1 = 0;
/ u1 |, W9 t! h1 k# R3 p3 J4 F - dma_addr_t dmaphyssrc2 = 0;
; P X2 L. L0 `+ k4 r - dma_addr_t dmaphysdest1 = 0;) r M+ X+ H/ I/ d) D. j+ b( ?& S6 ^
- dma_addr_t dmaphysdest2 = 0;+ F+ x; M' |2 L- B- t% ~2 t1 V
2 q& r y3 x7 e" h/ T4 d- char *dmabufsrc1 = NULL;
% } C8 [& L" M6 ]( Y8 D/ { - char *dmabufsrc2 = NULL;/ ^* ?2 M! v( q7 v! h5 o
- char *dmabufdest1 = NULL;+ }, _' b& F% c. L3 F) i
- char *dmabufdest2 = NULL;
* s! L9 U# {& X0 V$ k
# ]( j2 e4 l% X1 I/ q% \- static int acnt = 512;/ U9 ~' {: I! a5 r6 ~* b7 _
- static int bcnt = 8;: X/ C/ A- B' X6 B2 q7 f; X
- static int ccnt = 8;) L E) i; t8 r, w% ?
- # O& u6 p: p. u5 m, M
- module_param(acnt, int, S_IRUGO);
4 l1 K$ h+ Q6 b, A0 b" q4 ? - module_param(bcnt, int, S_IRUGO);
+ T' {7 B. V0 R5 |& |; ~, L5 }1 i - module_param(ccnt, int, S_IRUGO);
复制代码
0 o' R* a! p; ~! A: W1 B3 B) |( J! Q" ?* [
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ k! C; `* a! ~5 O2 y0 P0 g* \+ q- _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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! R/ h5 L; ]& b
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 Q5 S7 U7 b1 H
' f+ W/ N7 E4 S6 x3 }% T3 v. W# _4 D: ^% ]% ~6 U2 V7 E
|
|