|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. {4 i% F) L' ?# L% [+ i+ H- [code]EDMA sample test application
p/ S, E# r6 u, ?. P - /*' d6 Z7 S) Y S' C; @$ [+ G4 k
- * edma_test.c
1 O& A( a2 z4 q1 B! o3 O6 s - *0 ?( m- J( w" X- V
- * brief EDMA3 Test Application( \# v Y0 c& p$ B. n5 X( ?' n, T/ \
- *2 X1 a: C9 z: [7 i6 j! I$ Q
- * This file contains EDMA3 Test code.- y2 a6 |* p9 n# G) ~- l
- *5 }9 F, Z: F% [' W4 ]
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: v: |; y' q2 e1 v+ `' {+ J! x
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
- U8 J. Z7 J* l+ @* S - * TO CHANGE.
& i) [3 @' I& `3 J2 b. f t - *
+ R& t @, q1 h) B - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
/ L T+ A% e4 i# {7 l' Z0 e - *! ` f# h, l/ K2 q( P
- * This program is free software; you can redistribute it and/or
& {/ O6 H7 }4 }% N - * modify it under the terms of the GNU General Public License as
# N$ H/ @; I; R4 i - * published by the Free Software Foundation version 2.+ t5 e1 l) f3 x
- *
6 y! r' W0 ^. }9 z - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ @$ S9 Q6 M# B! z- e - * kind, whether express or implied; without even the implied warranty+ t$ Q, t2 j0 }. J7 L7 R
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# {1 F$ t5 t7 ? - * GNU General Public License for more details.
7 P, v: L+ `; D( q9 e9 q - */
2 x7 v3 p$ Y, g3 H }) R1 y - ' f8 Q a0 m5 X: N, C6 S9 M1 Z
- #include <linux/module.h>
" I; u- m2 ]; k4 j4 j0 K+ \ - #include <linux/init.h>2 Z+ W$ a/ w( D- Z
- #include <linux/errno.h>* I8 i$ r6 |# p( |$ P* O- J
- #include <linux/types.h>
, _9 }4 g- j- T" I. f: A - #include <linux/interrupt.h>
3 x2 O: {1 P# i2 u* b8 t+ v - #include <asm/io.h>
7 y. G0 p) u, Q. t& {0 y. [% X - #include <linux/moduleparam.h> a# {1 R- z" V: b5 f3 a
- #include <linux/sysctl.h>
* a1 u3 @% H6 o4 _" j - #include <linux/mm.h>( i$ N H" j0 C) `
- #include <linux/dma-mapping.h>
9 ?3 N1 ]1 N$ k: w+ h
& I0 A) _* E, r& U c% y. t8 k- #include <mach/memory.h>
" y. j! e8 `& T2 M5 f. j0 S* ? - #include <mach/hardware.h>- N: e" i" Z+ f: M+ J+ @
- #include <mach/irqs.h>1 Z& c& U* c$ Z/ ^
- #include <asm/hardware/edma.h>3 e$ `/ \5 r: Q* V U W
- $ M7 \/ x- B* b, q4 P
- #undef EDMA3_DEBUG! G$ f+ k; B( [4 R$ S& |) x9 |2 U5 O
- /*#define EDMA3_DEBUG*/
! k# y# [5 u `5 | - 7 p# {2 B8 ~- P! r8 ]: f; N" S* u. I
- #ifdef EDMA3_DEBUG
* l! J4 T* ]2 {! P4 H2 l - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
- k0 ~- S4 g9 a/ P: c6 k2 w: a - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
4 z, s& C$ i/ F8 O7 M& k( w - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( D5 u; F" A% a* |+ g8 f
- #else
! Y+ a( f4 r7 P5 f" X/ s& A0 s - #define DMA_PRINTK( x... )& A) B; D/ l" |
- #define DMA_FN_IN' S% W+ V8 Q8 F$ { B
- #define DMA_FN_OUT
* r( m5 d; y& j9 e - #endif
4 w, ^4 V( E" }+ b( W. q
: [# [# U! k5 ?$ k# p- #define MAX_DMA_TRANSFER_IN_BYTES (32768) Y* h8 a4 E. ^$ }+ b* @1 X
- #define STATIC_SHIFT 3. N- y# F$ n. ^8 o
- #define TCINTEN_SHIFT 20. Y, I' Z" K6 V# \3 o
- #define ITCINTEN_SHIFT 21
! d0 S0 V! W4 M! H, K: a+ x - #define TCCHEN_SHIFT 22
1 E0 y4 t3 U9 G; f. | - #define ITCCHEN_SHIFT 23
0 s# y# z5 R# c' ` @" S$ u' i - / |$ q# F( f! J) j6 w" q5 G6 F: [
- static volatile int irqraised1 = 0;
2 G, e$ M$ ~3 E3 J" P. z - static volatile int irqraised2 = 0;
' I0 ?) F1 |/ H; M: S8 ~
; l# b+ K, J- n" H- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
J# U3 b. J' L# l - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 R/ G1 m, B! s( O+ i* v3 a
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' y2 I! l# m( t6 M8 e
4 ]$ @! o! ]+ b9 M- dma_addr_t dmaphyssrc1 = 0;. y! h' Z7 H" U% O
- dma_addr_t dmaphyssrc2 = 0;
5 p7 E) L$ ~% c& } - dma_addr_t dmaphysdest1 = 0;9 }; g2 h0 e/ e) }1 y+ q
- dma_addr_t dmaphysdest2 = 0;
) L, v$ i x, e: \ u1 h# E
, {; E' G+ a) h- char *dmabufsrc1 = NULL;8 b/ H" u' ]- l8 m
- char *dmabufsrc2 = NULL;2 w* a* A- T2 r5 Q& c. X
- char *dmabufdest1 = NULL;
/ p. i! t1 L# |1 K1 u( c - char *dmabufdest2 = NULL;: y9 g; L- g c, r5 h& ~, ~7 z
- ! q4 U& w! P% W ?/ x" |# `! h
- static int acnt = 512;
' [) }0 R, e$ M0 F# {. a6 G - static int bcnt = 8;
- l) Y+ g( O9 h* e* P* z - static int ccnt = 8;
4 l+ i& x; Y6 k) j* V O7 s
q, W, j' r, C% K/ D- e- module_param(acnt, int, S_IRUGO);
' l0 h2 \4 E/ v3 m) O7 O - module_param(bcnt, int, S_IRUGO);
' J/ I3 o! @' Q. X D; r - module_param(ccnt, int, S_IRUGO);
复制代码
9 r0 [ g1 v- P0 \' U. y0 Y) m; ^% K6 D8 S' z# Z! X
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 _9 }& H3 ^; a& L% u
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 T' F* {% I# w! i0 U/ M: T
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 _& e2 D+ t, X1 O
# q2 |0 k# J: T) V+ p! b/ C3 `) {# y, [$ A. ^. Z% {
|
|