|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ ]/ Q$ F/ h" a7 ~3 f& s, U. M- [code]EDMA sample test application
2 |( B3 a8 R9 n9 K3 d - /*' q# b& e' s% ?) n$ v/ H Z/ j
- * edma_test.c! ]8 O4 S L: |; c6 N8 z
- *! K' ?5 t- K5 k% \2 R" g3 k% Y' F
- * brief EDMA3 Test Application
y: [& f, p# S' \0 z1 c: Z - *
, Z, c0 B; |+ L: s - * This file contains EDMA3 Test code. i0 K5 R8 i, I, q
- *
+ j, s; W* {/ L4 N- j# P M - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% o3 Z4 _3 Q5 y+ Q3 e j$ ?5 n& t
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ K5 f8 |( r3 H3 @- u3 a! u
- * TO CHANGE.
]: N; o; |7 Q6 z3 l - *
' f8 \* @1 U0 U% N" R# z) q - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* A; v% `$ M9 t: j/ N, |2 [ s1 r; _
- *
) J* w! }! z9 u* ? G1 }8 D - * This program is free software; you can redistribute it and/or
% E- B. F* n6 Y! X4 g0 t# h - * modify it under the terms of the GNU General Public License as
' u$ j/ ?, V- P( z( Q5 ^ - * published by the Free Software Foundation version 2.3 N5 L+ m+ R) [& f$ Z5 @/ [) ~
- *
% F5 B/ P( ~- ? - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
. Y4 I; X/ x) _* ] u& v& [1 w9 g - * kind, whether express or implied; without even the implied warranty
% K0 A2 U7 E0 D; O - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
) Z9 s) Q2 g. K# n E" V, B" h3 k. B# n - * GNU General Public License for more details.+ E& M* A: E n6 H/ F$ z" ~
- */
2 O! f! a- I( {, E5 H& c - 7 X8 z. u9 ?# Q* S
- #include <linux/module.h>6 b- K" b8 J( m; N7 H9 \
- #include <linux/init.h>' A4 v# b" {& B1 i
- #include <linux/errno.h>4 x7 y# E o) q" Z3 H' ^, T7 B
- #include <linux/types.h>* L0 t" y0 ?% W, O$ z
- #include <linux/interrupt.h>% x; |! Q- o& X! c/ O
- #include <asm/io.h>
# H7 _6 m8 t- [, i; b; M+ p. y4 r - #include <linux/moduleparam.h>) t' k, K' z! V2 m$ ]% r* T# V. u
- #include <linux/sysctl.h>
( D0 w! \' ~! P4 A" Y3 j7 T! b - #include <linux/mm.h>5 O2 `, J, R, {/ i1 c
- #include <linux/dma-mapping.h>4 D5 `/ b. S+ Q7 r0 R! u
3 U& c8 H" n8 `: r- #include <mach/memory.h>% [7 X( W* D. J. H
- #include <mach/hardware.h>
. |+ D" V t/ j - #include <mach/irqs.h> c' u; j9 G4 D! H+ q, @1 i
- #include <asm/hardware/edma.h>
& \8 H+ i/ e0 x$ S, ?* v
1 {1 i$ `1 ?& \" A% m% t- I- #undef EDMA3_DEBUG
- j, a/ D9 m! L" g: m- A - /*#define EDMA3_DEBUG*/4 a4 E4 b9 U' I6 d* j
" x/ j7 ]- n, m o& g. ~. J e- #ifdef EDMA3_DEBUG
7 u. Y% |) [0 o8 f4 F - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
) w" N. h- L9 |5 Y - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 r) f+ b7 B5 p& n. g
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
7 _7 l# c: ]1 l: i+ H9 \ - #else0 e$ [+ m0 g) S
- #define DMA_PRINTK( x... )( P- n7 Y) F+ a4 K6 }& w
- #define DMA_FN_IN( Y' D1 ~# [: `5 S% g8 B8 y
- #define DMA_FN_OUT
" c) A: ?. `/ T. _4 f2 Y - #endif- E* @% b) t; g+ f' k9 x
: a: g' V7 W( X4 G- I- #define MAX_DMA_TRANSFER_IN_BYTES (32768)) d! {1 k/ u Y! ^& R
- #define STATIC_SHIFT 3
2 ]. z+ P: a1 E7 \! ]* A9 a - #define TCINTEN_SHIFT 20; h% W% F6 g: K' j5 V9 p r
- #define ITCINTEN_SHIFT 21
1 h' z! Q# K! R! [8 d7 D* e - #define TCCHEN_SHIFT 22
; l9 [4 {. M% R7 h6 r9 K9 [ - #define ITCCHEN_SHIFT 23) o& \) i( v, M p
Z3 G4 l. Q7 G6 j( o* _- static volatile int irqraised1 = 0;
) s B# f( I0 p- g' w - static volatile int irqraised2 = 0;. t _* a+ y$ a. P( g
- 6 M3 s1 F7 N5 f7 U! r
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( O& t3 E H2 R C# i2 R
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 j: i9 o3 Z6 Q - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 y0 j3 f: E1 E- B+ I1 Y: H9 o
- , P( O/ P( Q1 q+ M- S
- dma_addr_t dmaphyssrc1 = 0;3 c" I( }4 |; Q6 `# g, i$ b3 t
- dma_addr_t dmaphyssrc2 = 0;3 d+ k- }7 i( P( w$ t
- dma_addr_t dmaphysdest1 = 0;
0 o1 Y, }3 u# |7 z& j - dma_addr_t dmaphysdest2 = 0;
; {7 u% ]8 G1 N8 {& F1 B9 Z
4 S) U$ |" O. P; g- char *dmabufsrc1 = NULL;9 I. ^/ }. ^3 X5 c4 x* {1 l W2 Q1 R
- char *dmabufsrc2 = NULL;
( C/ g3 V; ], S - char *dmabufdest1 = NULL;9 Z3 A6 A7 u- f3 X; J; V7 E
- char *dmabufdest2 = NULL;
; U# m2 {, B% z, g
6 O& }& N% Y, A' o- static int acnt = 512;7 W5 f3 E2 j9 K% q3 V o$ x
- static int bcnt = 8;' s F0 u4 u, [; i' I0 T' K. p
- static int ccnt = 8;. F& F F8 J, F
& M" [- f$ J# X" I- module_param(acnt, int, S_IRUGO);
. ^+ W2 _! d) @$ k- T k - module_param(bcnt, int, S_IRUGO);
- ?% u" A6 t, L+ d: D - module_param(ccnt, int, S_IRUGO);
复制代码 2 [' J- N% p' O* ^5 U
2 }5 N/ q1 R- H# ?" e& ] 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 T$ I0 |/ U1 Q+ b! I* Z5 @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 j4 C, _& t- U% X' Z
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
n: L: q4 }/ D5 `1 D8 X u+ l6 F1 Z. l* W1 M D
! f1 V) Z- l- y1 J, J' T+ z! y+ R
|
|