|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / ^* r# k- z. n! ?8 O
- [code]EDMA sample test application
) h8 F0 l$ ^5 p N6 m - /*
# w D6 f9 z8 E) G0 C - * edma_test.c; c' {6 ~ ] A, ^7 A, y4 U- o
- *
J1 t- d( L+ H" H& L( _ - * brief EDMA3 Test Application
9 X0 Z: R) S& v# h - *6 C- w9 Q0 P- h" ?9 F5 x
- * This file contains EDMA3 Test code.& x! U) m7 ?0 x+ [
- */ y% W- V- i( @# C: k9 U" v
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
1 C$ S5 p S& F0 [( _ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
' W N* l( `1 G8 Y4 l8 U- m - * TO CHANGE.
+ q8 k0 v7 Q' s2 \* h0 ? - *
$ W' i. ^4 \6 m# }& E - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
% r' }6 L* `3 p6 p9 s y3 @ - *
/ N6 M4 H9 V" |" W6 _6 y - * This program is free software; you can redistribute it and/or
4 i+ E( x3 {7 Q! u" }% A2 h i0 d - * modify it under the terms of the GNU General Public License as
( H/ i; R5 m( w) H6 r/ l- |' P - * published by the Free Software Foundation version 2.
# U0 {! {4 `# u - *- N& [+ y$ F+ L! P1 J ] Y
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
O( c' I( t; ~% j - * kind, whether express or implied; without even the implied warranty
" K* t3 W3 Y: k7 l0 S6 q - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1 I% [) d% \3 d - * GNU General Public License for more details.$ E7 }! W5 |& `$ Y+ H9 \
- */: E1 Q; c( ~% \0 a0 p- ]
- + K) D6 n/ O& C+ I; |
- #include <linux/module.h>
$ [& d/ Y1 ]! ~; A; @0 K - #include <linux/init.h>
" G! v4 L& ~- A, R, D; a - #include <linux/errno.h>
7 J+ q# f+ F; U2 }8 N6 C( z c - #include <linux/types.h>3 M9 O! t9 o, \/ i1 H# p* q
- #include <linux/interrupt.h>
$ }( i+ o1 I C& v - #include <asm/io.h>
% ?; F( F7 }- U$ ~/ m3 ? - #include <linux/moduleparam.h>
8 P7 h: O# K) w0 v6 F, Q - #include <linux/sysctl.h># _; `/ W. z# Y
- #include <linux/mm.h>1 i# m! O9 `# L/ O
- #include <linux/dma-mapping.h>
$ B6 o3 q! N' L" k3 O( {8 m - & r* E, D! K9 o$ h% o( D
- #include <mach/memory.h>. j+ ~* x0 d, b( f, f3 X: o- d3 g
- #include <mach/hardware.h>
+ |( c' {8 l- p0 k$ [5 z - #include <mach/irqs.h>' l- d! w$ b# K8 o; m! r
- #include <asm/hardware/edma.h>/ }$ R9 r I. s* a, M9 ]+ `
- 7 K* ^: }, t. ]0 |, ^
- #undef EDMA3_DEBUG
- P s9 [6 a, O- l3 S$ @ - /*#define EDMA3_DEBUG*/. m: r" t# M" \
* U! v* B$ o4 F. u7 S/ s- #ifdef EDMA3_DEBUG) K) G# p7 [3 o/ y8 f4 a. H
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
- s; p# |, V) S+ a/ d( @, ]$ X( I - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
! W1 Y8 u$ t+ } - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 _' o1 O+ \) k7 u* o# _- T
- #else8 q: |; \% L* h6 ]" Y- m8 g" o
- #define DMA_PRINTK( x... )
' q# x: `) `4 t. \ - #define DMA_FN_IN! K" K8 `+ I' d6 f0 h6 i
- #define DMA_FN_OUT! P( y. {+ n; U3 p8 o
- #endif% j) D9 r0 a& Y4 Y, t
- + Q1 Z# X& l0 r4 J! r: k0 t; [
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
$ R) ` y9 ]8 |5 X - #define STATIC_SHIFT 32 ~+ n/ [( O4 z' E
- #define TCINTEN_SHIFT 20& \! @ `+ H* I' e' N
- #define ITCINTEN_SHIFT 216 y g- H- n1 a' Q9 ^- k
- #define TCCHEN_SHIFT 22! i+ V. y0 w5 ~1 V2 _2 M2 }
- #define ITCCHEN_SHIFT 235 d) D( }4 ^3 u$ n3 N, n
( f# v' c0 n- v# Q* A P( ~' S- static volatile int irqraised1 = 0;0 m! V! i" G' o* c* A( Q1 S; V, U
- static volatile int irqraised2 = 0;# R' C* F3 Q, q9 p, A9 K
- . S* v, f; R% V. ?) Y% `* B
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 V) L7 Q; u, A" U% c) [ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( Y8 p0 X# }( I# r1 s - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 D8 Z: [6 B1 P- j" m5 M$ g
1 F& Z3 \* Z9 C. V. z/ F- dma_addr_t dmaphyssrc1 = 0;$ R1 y* X, `4 c$ Q6 ~
- dma_addr_t dmaphyssrc2 = 0; J* c6 @3 V9 C5 }5 y0 c4 {' V, ^
- dma_addr_t dmaphysdest1 = 0;. D+ Z1 b: i& a3 ?" D% o* s
- dma_addr_t dmaphysdest2 = 0;8 D( ?& O( K( _# [: @
- 5 _1 N( k9 E" [5 W. u, d# |+ G5 q
- char *dmabufsrc1 = NULL; f9 D$ r' f$ a8 E8 |/ b( Q, D! ^
- char *dmabufsrc2 = NULL;/ r. n1 [% L4 R
- char *dmabufdest1 = NULL;
0 r. m6 t4 M; E$ K/ n - char *dmabufdest2 = NULL;
; a! y3 V5 Z2 K. k- t- R: z4 y& E. X" i
/ |' r) ?( J. p% @- static int acnt = 512;
3 ` o" s9 E, ?8 u9 A: x) P - static int bcnt = 8;
; P) i$ M9 y. l - static int ccnt = 8;+ l2 L" v! c0 o0 R& P
- - X4 Z3 x# |$ k Y5 G7 W
- module_param(acnt, int, S_IRUGO);; g0 B* y j* P) E/ y
- module_param(bcnt, int, S_IRUGO);
7 r5 k8 q) I8 S1 [) f - module_param(ccnt, int, S_IRUGO);
复制代码 0 H$ M2 T2 Z" X* l2 G* c: R
% H; y( Y" s- }# S- g$ X 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 B9 o0 K$ d Qarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* n) b i; d$ \ c5 g- W0 q
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 d: ?* K, R2 p9 [* |& a5 ~
( }- @. k7 y% d6 F
! C+ b6 t$ W3 o& Q, q: W2 E6 \! |7 H
|
|