|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ l9 _; _0 R" D7 t c, a/ x, v
- [code]EDMA sample test application# B: T; N+ m( j- N! V5 ~" o
- /*; G6 M, h- i3 @
- * edma_test.c
8 U/ K4 D, {( \: r/ c6 ~. u) I; B) p - ** ?- ]6 e+ o- D3 O5 h& o3 y0 F5 E* _6 k
- * brief EDMA3 Test Application
9 t! r* ~1 c3 A- P - *# U& f$ O3 n8 y
- * This file contains EDMA3 Test code./ g% @+ ^* { U- H
- ** Q! S4 I" Q+ X. q0 t) G& F. h
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* s' R* O! j5 N& P C2 i6 c
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
4 F5 k6 R5 h/ a1 ^ - * TO CHANGE.3 ` p: t% k1 s W
- *% m5 G/ f6 ]% Z5 _' Y% L9 T
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 I4 c2 z ?' C0 W! S
- *
. ^ T# e: T& {3 [9 |) \ - * This program is free software; you can redistribute it and/or
& U9 W6 W |$ ~, M; [ - * modify it under the terms of the GNU General Public License as
}$ E- `0 p1 ?( H1 L3 f& P/ { - * published by the Free Software Foundation version 2.) I" _; ~! I7 u, m4 q8 _2 {* @
- *8 O: W0 x# x( `- ?9 G+ ?5 ~$ m
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 M' Y# F% j: _% C
- * kind, whether express or implied; without even the implied warranty
9 x; [) g- i7 X+ L; } - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the' P! H/ ~4 O( t
- * GNU General Public License for more details.' g& a$ P9 X2 x6 {* P/ b0 E- n
- */
3 n4 q* [, c& y0 W - # W6 Q; J5 w9 c- V
- #include <linux/module.h> q1 c. `- A$ B
- #include <linux/init.h>3 s. P: J ^3 ~% |2 S. i
- #include <linux/errno.h>
7 y' _: N. `9 ]0 Q# _. A - #include <linux/types.h>
5 x$ \3 r0 q8 r9 w3 { - #include <linux/interrupt.h>
) k* k+ {+ _7 Z# U9 ~. n( q9 K3 G2 H - #include <asm/io.h>
, a3 I' [+ c: @" K& x - #include <linux/moduleparam.h>
& }3 b6 v- z) n0 `6 g; D3 o0 a - #include <linux/sysctl.h># w/ s% K8 F& R! {2 g
- #include <linux/mm.h>3 X" R' u0 V) k
- #include <linux/dma-mapping.h>
( G+ ^' k; j1 G/ d
( {3 [& N& `, c- #include <mach/memory.h>1 B' M$ D* B- Z2 f9 U$ J5 ?
- #include <mach/hardware.h>8 ?; @# ^9 Q8 `$ B9 L- P! X
- #include <mach/irqs.h>" ^! U* }; W5 e% b% Y
- #include <asm/hardware/edma.h>- K+ H& [ t t
- 2 q) h# ]! A5 L: A/ G
- #undef EDMA3_DEBUG8 z$ t5 ?. h! {* H
- /*#define EDMA3_DEBUG*/
4 Y: k( M- H& {5 y# ^
, m7 [( S, b" e2 P! V- #ifdef EDMA3_DEBUG
9 S, p% k' }5 y$ k- ~5 t% Y2 e - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
) u* a& w4 U- A! z1 D - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
8 i5 A6 @. i: ^' n4 O6 D; g# a - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
6 l Q: s4 e6 ` - #else
- g& `# d) b: O# E - #define DMA_PRINTK( x... )5 }+ i4 i6 a- A0 j( G! T( M8 y1 A# | L
- #define DMA_FN_IN
5 b3 X- `4 t, t, z8 u - #define DMA_FN_OUT
4 [1 n V) \' ^, H s - #endif$ ?& R& i4 ^1 X; y( M. U0 d
2 Y& b* t; n! `9 p- #define MAX_DMA_TRANSFER_IN_BYTES (32768)" g) R/ C1 `2 a4 q
- #define STATIC_SHIFT 3: D; ]" x$ c: S% C
- #define TCINTEN_SHIFT 201 ^$ O: g. L, p# s# [: O! `$ W1 n
- #define ITCINTEN_SHIFT 219 d5 L- I* P! `! ~* I
- #define TCCHEN_SHIFT 224 V* Y7 |, z1 ~
- #define ITCCHEN_SHIFT 23
p+ i. c0 L3 o! v/ i! P1 q- o - - q$ L S. F9 c
- static volatile int irqraised1 = 0;; A6 w& G2 f$ Y
- static volatile int irqraised2 = 0;
7 t) L$ [+ A6 A. P- C
1 _' W8 t/ k) {# p. b7 X A; a/ ]- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ Z6 K2 h4 ^; s2 \( S9 j" A/ y
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: D) p0 ?1 p) ^2 b% @3 `0 g' o2 M6 B
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 a: |3 l- ~/ Z) A0 @
8 s9 Z" t1 N# D: P# `" l- dma_addr_t dmaphyssrc1 = 0;" E" T5 A& C' Y- u) ^) V
- dma_addr_t dmaphyssrc2 = 0;
! p+ F/ U4 B7 N1 M6 }( a: c | - dma_addr_t dmaphysdest1 = 0;; O# E, d4 `5 z, [. q3 }
- dma_addr_t dmaphysdest2 = 0;
3 F3 Z2 C! K8 ~5 i
, ]3 e6 ^; T4 A, \* @- char *dmabufsrc1 = NULL;
* ?; u7 A1 q/ A8 Y - char *dmabufsrc2 = NULL;; K9 A* s) g3 {# i; v5 u0 c5 H
- char *dmabufdest1 = NULL;% Y5 x5 n7 b+ [2 W/ [7 Q& U
- char *dmabufdest2 = NULL;
( G1 L! m5 `- j* ?/ R x) j- J - , x8 W N7 b4 v/ t8 y, M$ z0 J
- static int acnt = 512;
/ `2 H5 b$ s M0 X& t6 k- i6 F - static int bcnt = 8;
% r7 X4 H' i9 x# t+ Q7 i: P4 x, U - static int ccnt = 8;
. `9 C5 \4 H) H+ U' b7 j - * w9 J; V# C1 F
- module_param(acnt, int, S_IRUGO);
h6 j# Z# k2 L: b - module_param(bcnt, int, S_IRUGO);
+ |+ n5 i! Z" c* x C1 h+ B, p! u8 U - module_param(ccnt, int, S_IRUGO);
复制代码
. \, V1 X2 L* T$ k7 X
' ?5 T* f4 D- L# X x: N' s 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 e% N' ~% p, U% E; N6 y# xarm-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* j. d8 K3 A. W: p: T+ D( z% r 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 i% A. _; H6 S) H- u
+ K# p+ k+ w% ~7 x6 X) N+ R6 @, h; [8 x8 ]' \0 m
|
|