|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 ~1 X% X# A& |4 q
- [code]EDMA sample test application
+ ]1 U$ H6 r- N" {! _ - /*. K& T: U- T/ A$ x9 ~
- * edma_test.c4 B' d; ?0 j* w+ w% y
- *
8 ]; A8 r! y- E2 I# j - * brief EDMA3 Test Application" m' L5 Y( b$ \" s+ d
- *
# `1 H( l# I7 Q& D8 z; u! n - * This file contains EDMA3 Test code.
% ]2 _* V$ I9 v: K/ I - *
( l: `; p# R' L% L1 A) w - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 } m4 b+ y7 z9 b1 B5 b
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
- [) [ Z& M5 R" ?, T* p" y4 z - * TO CHANGE.
+ c3 r! Q6 i: ] z" W/ X; }$ F0 Y - *
5 b* X& [! ~8 ?- ~1 \ ~0 N - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
2 p* Z, ~% {: e2 K - *
% g# A1 G8 k! g. q- e L - * This program is free software; you can redistribute it and/or! @" @$ P, ^: M: I, a
- * modify it under the terms of the GNU General Public License as9 x9 |# Z! l' s% B9 V1 A
- * published by the Free Software Foundation version 2.$ S+ ~2 d' K# b/ ]' e( v
- *. U; o1 w4 e6 q2 A) x
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ i; V# T; d* s0 S" r
- * kind, whether express or implied; without even the implied warranty
9 v. ^5 w$ x2 w9 a' \ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the5 T1 F: z p! \! }2 D0 ~
- * GNU General Public License for more details./ C0 R+ Q0 ]/ r; o4 D5 ?6 K
- */3 h+ ~) |- O# e* Y
- 9 O# D, ]: N& j2 ?
- #include <linux/module.h>
+ w8 _* P1 {5 C0 X! [$ m - #include <linux/init.h> B9 R3 e" l2 k: F; F
- #include <linux/errno.h>
0 K8 R. @+ ?/ S* i; f( g3 A9 \; f - #include <linux/types.h>
* M2 X) ?! s+ Z. @ - #include <linux/interrupt.h>
- {" N' J+ s, I1 i& t; b - #include <asm/io.h>- w: x6 A% ^4 N+ }1 t0 t
- #include <linux/moduleparam.h>: e, V. I- H0 P3 S
- #include <linux/sysctl.h>9 x4 G+ U- A0 V+ v/ V$ l" J/ j2 p
- #include <linux/mm.h>
. n7 O1 u3 p- I - #include <linux/dma-mapping.h>
1 A% d4 {2 a9 A2 [1 b - , l0 @8 W8 f9 i( x1 S( s, y, W
- #include <mach/memory.h>/ g5 h' w: U4 p7 c% g
- #include <mach/hardware.h>! V" t+ @. n8 |
- #include <mach/irqs.h>
3 t4 G/ K8 N' J: E - #include <asm/hardware/edma.h>
, O8 H5 @* I: j& b! m6 o9 l - 7 k. o& _8 v) W
- #undef EDMA3_DEBUG' u. F. W" J& Q4 N1 e
- /*#define EDMA3_DEBUG*// x: I% a8 m3 K8 O& w
: b) A; ~4 r; E' I# Q! Z4 S B% K- #ifdef EDMA3_DEBUG2 w$ \3 G1 {( Q5 U, |9 z$ v; P
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ B5 l) |! R& H: p ~
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 J/ f; B! A: ]- c% ]
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ n" K' f0 G) z4 Q$ V" N
- #else
9 L. R" [9 m3 D r, F* u6 f+ s - #define DMA_PRINTK( x... )) H. P0 w7 H3 l: ~0 N9 ?: ?1 `/ R ^$ M
- #define DMA_FN_IN
" h& X6 F2 B8 k - #define DMA_FN_OUT
' J; G. f: b7 q5 n1 ~' B. b0 J - #endif
- j, J! X8 D$ J
" p7 ^; X( L! z# D& Y( C- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
- n- Y% ^' {% d( \: C( ]- Q - #define STATIC_SHIFT 3
% N& W7 S% b3 U1 q* K7 C& _4 P - #define TCINTEN_SHIFT 20
$ p" L3 s' S4 L( Q$ j0 _. O - #define ITCINTEN_SHIFT 21 }) B9 r G; H
- #define TCCHEN_SHIFT 223 `! g2 T/ I8 k4 _: i0 p
- #define ITCCHEN_SHIFT 23
/ ]6 j9 H8 \7 C
# h/ i- v1 x% S9 }, U) W# f5 Q- static volatile int irqraised1 = 0;! u8 t& G' m- }4 ]
- static volatile int irqraised2 = 0;$ K# G# {' b+ ~2 R7 A9 Q+ {
y7 E6 w9 Z" C% p1 ~7 H6 D! D; M- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# n( R& U6 `) p% c/ I9 \& P
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. F- W" H2 o7 S5 r5 K( O" | - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 k# X( t, Q; ]; I. R
- % G* n. h& p; X; P0 M. P) r/ `
- dma_addr_t dmaphyssrc1 = 0;
2 H: K- ^, c2 V2 a2 W - dma_addr_t dmaphyssrc2 = 0;
# t+ y! Y) [4 O( o - dma_addr_t dmaphysdest1 = 0;: N3 g2 ^! _% l0 M# x4 M% o; h
- dma_addr_t dmaphysdest2 = 0;
7 m* ^1 `0 N& S% y l* j. i5 W7 d1 A
* a$ x9 s6 M `: ~, O- char *dmabufsrc1 = NULL;
1 @6 q" [2 C+ m9 P9 M4 B; S) W - char *dmabufsrc2 = NULL;
; t, G+ q$ b v4 H# }, q, D8 C" n - char *dmabufdest1 = NULL;* A4 Z4 o9 y1 i5 J* x% }/ e0 r
- char *dmabufdest2 = NULL;
/ `9 g; E7 e0 K6 o3 N9 C - * A4 E9 D" m2 `. Z T6 J& R* m
- static int acnt = 512;4 f! D1 }3 N1 ~3 P/ F
- static int bcnt = 8;
) V# `+ o$ b) g - static int ccnt = 8;6 G [) ?! e3 s1 F+ t0 |
- , R& u+ r x1 ^; V" w
- module_param(acnt, int, S_IRUGO);
3 @' U' W4 P" j6 C! T$ T - module_param(bcnt, int, S_IRUGO);- g7 \0 B1 Z4 B" H+ b: `
- module_param(ccnt, int, S_IRUGO);
复制代码
# m2 k8 D- Q$ M$ l* J4 y# t4 P3 @+ p) p: B1 M9 }1 N9 @
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* t3 F$ Y2 c1 r4 e/ Z- ]! h
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 d; Q/ u% y4 K+ c* y/ ` 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* n4 X! [! ~$ U# t
d& M; |7 A% ]7 k; X3 U: v2 N) ]2 |5 w. } S
|
|