|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 m+ @6 C i: J4 \
- [code]EDMA sample test application7 z% I* a- ^7 l9 a9 u
- /*
8 }1 s+ w& u* R - * edma_test.c
e2 m2 ?+ {3 K+ z - *1 C+ t4 j: w9 q4 t$ R
- * brief EDMA3 Test Application V0 a. {( `7 Z3 A5 \
- *8 {( U& {& m6 ~
- * This file contains EDMA3 Test code.$ {- \0 q4 s0 k5 m9 h3 O) l
- *
/ |! V. K* ]( D2 Y - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( Q4 N: P( @4 E! A, W/ R* y% y c+ J
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
+ u9 J5 k: a; X) B% N# } - * TO CHANGE.8 B" ^3 y" z: E
- *
1 {3 y' D" j& X4 V! q7 i4 j1 R+ A% Q( c - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
9 r# ^, _+ I4 l$ K7 m - *
/ M/ _2 c* S9 N9 u+ {: V - * This program is free software; you can redistribute it and/or
7 T9 F" `0 |$ w0 \$ Y" T/ x% T - * modify it under the terms of the GNU General Public License as& `7 P- C" {. `9 T& Z2 e7 [2 I s, d$ c
- * published by the Free Software Foundation version 2.$ x$ v. f1 t' c( k. C7 d$ A
- *
/ r3 `8 x$ m2 H. k - * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 c8 X! ^2 l: o, e# ~- ?' A
- * kind, whether express or implied; without even the implied warranty; I; d: \! k) R+ W# x- \( B6 |
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the. @. I; l1 T" p7 t& N
- * GNU General Public License for more details.2 Z# ?) G: m$ g/ Q
- */" M3 n" M9 k6 N9 [1 w2 W
. V. e2 C- I* t2 W- #include <linux/module.h>
6 v( t' }! g* H - #include <linux/init.h>; D- T+ a. N! }# ^' J: ~4 F
- #include <linux/errno.h>3 a1 w6 {- O: k5 S( B
- #include <linux/types.h>7 K# r+ f6 |2 T1 I. L' ?# K7 j& c
- #include <linux/interrupt.h>
/ m& @/ _ O7 s& w8 T - #include <asm/io.h>- q; F) ?, d& ?
- #include <linux/moduleparam.h>
* Q5 k8 {% F' @$ } - #include <linux/sysctl.h>
( x1 p& V1 ]' L* J, a - #include <linux/mm.h>. `: o2 x: `& T2 @; Y x
- #include <linux/dma-mapping.h>
9 d! h; ^/ f) N) }: y5 k
" O, b+ d A& Y2 h. h- #include <mach/memory.h>7 Q, d3 I- `. Y S7 y) H
- #include <mach/hardware.h>
! N0 z+ s! x+ T - #include <mach/irqs.h>& T, O' g: y1 q- a p8 }
- #include <asm/hardware/edma.h>
E4 D- a( `5 J6 V1 V - G! r* P* o( h8 z6 I! Y
- #undef EDMA3_DEBUG
9 V% }3 x1 W6 j) b8 |& E+ [& P! V - /*#define EDMA3_DEBUG*/
2 p9 p) {' R& c; g
7 z( X7 S9 b/ N! A+ V9 ^. q5 l* z- #ifdef EDMA3_DEBUG: f, d+ x# H4 c7 v# [& a( S0 S
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 C+ b2 ]6 x3 X0 Y5 p+ S
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
0 h( c( x( j+ ?# H8 O! b - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), n9 H4 ]2 c, a
- #else6 m/ \' ~' A# D: D
- #define DMA_PRINTK( x... )5 D) _" C$ \) v' \- ^7 w9 X
- #define DMA_FN_IN
4 N( T5 c u( w6 I* v5 z7 Z% ] - #define DMA_FN_OUT. P& D$ [9 J2 H; k: ^' J' P8 p. k
- #endif
1 g/ \5 Q4 _; p3 v. V
! p" H$ n9 T, x% ~9 g ~/ j- #define MAX_DMA_TRANSFER_IN_BYTES (32768)$ [2 D! J) `6 G; d" |5 f
- #define STATIC_SHIFT 3% e9 A$ t0 S: D1 h5 L, k: m
- #define TCINTEN_SHIFT 20, v- y0 d: [3 u- h
- #define ITCINTEN_SHIFT 216 M7 ^, q* N3 C/ j: R" M0 r
- #define TCCHEN_SHIFT 223 V4 \- x' o0 `& x% G R% m6 m5 B
- #define ITCCHEN_SHIFT 230 S; L% s1 A) E7 H
% X0 `! P0 S. |/ E' o; ~, q- static volatile int irqraised1 = 0;8 @5 ^5 F8 ~1 X1 |
- static volatile int irqraised2 = 0;
: p. H0 R7 ~, E( r# j - + y! T- _- z2 o) h0 W
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ Q' I. y1 S! k7 i! \
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* g1 [5 @, B# }. X1 r# x( Z0 h% ~1 s @ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. [ Z7 H @' E. }+ b - % A5 E- K: Z3 o$ V9 u2 ]
- dma_addr_t dmaphyssrc1 = 0;& B6 k7 u/ i6 R7 q; l
- dma_addr_t dmaphyssrc2 = 0;. q5 @4 L2 U2 G; F' @( ]& Q" J
- dma_addr_t dmaphysdest1 = 0;9 j1 L" z4 e7 V2 M6 S5 s6 N0 x
- dma_addr_t dmaphysdest2 = 0;, ~) }: X( c, p' a) |8 n9 ^
- ) M- n [' _- V# Y
- char *dmabufsrc1 = NULL;
P) Q% F3 X9 H1 G( r - char *dmabufsrc2 = NULL;# y. M- z$ U0 u6 J
- char *dmabufdest1 = NULL;
; N2 U& M" K8 B* K# \1 c; s7 o - char *dmabufdest2 = NULL;8 s9 l6 H& r: A" I
& G3 ` x% ?3 M0 V- static int acnt = 512; m& ^1 }: U3 ?* X9 V
- static int bcnt = 8;
( E+ g9 h+ Z3 g* ]9 `% v5 I! m - static int ccnt = 8;3 Q2 L$ U% e) j) H& F1 @! ~, ?2 v6 w
8 d+ [. B% z+ V, I& Y/ r- module_param(acnt, int, S_IRUGO);
) ?7 ^9 [0 Y c% K! p - module_param(bcnt, int, S_IRUGO);. Y9 U- y4 k/ K3 K2 X
- module_param(ccnt, int, S_IRUGO);
复制代码 ( {# Z0 k6 k( `+ @
7 t. g9 B: w7 t8 k: ~( g 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 p6 ` A; c. ^
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 K, ^4 y7 `8 ?% q) d5 N, I. F. T
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
P3 j: ?) l* G% N8 L+ S* U/ @0 k4 V% a4 ^. A8 E6 w }4 w: m- k
; w6 |, W; j5 z0 ^" \/ @- l* u |
|