|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) k2 l6 O4 u6 F, \' g" Z- [code]EDMA sample test application `3 B" M& j0 p' j1 L% i
- /*# C6 g( l+ ~. z/ O; y' g8 \2 o$ M
- * edma_test.c/ j1 S& P" [/ c- K" T
- *; A" |" i9 F$ V% s4 a) O
- * brief EDMA3 Test Application
$ G6 _2 F7 w, w+ }5 r7 d - *
" M' i; G6 K7 a6 l) |- F% a/ D) | - * This file contains EDMA3 Test code.) k8 s% x5 w7 c, E: i- A' x
- *
9 O1 Y7 @8 y0 ]2 r3 R - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
" I: u2 O; \2 O0 D: f - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
: S1 h0 b8 j$ @2 ~) w% m - * TO CHANGE.
% P0 k- x, i9 j7 X1 o* U - *
+ Q2 J# t' S4 v9 h - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
9 b$ Y. H/ P( b7 ` - *
, I. e. ?0 O8 |; O# a1 h. P - * This program is free software; you can redistribute it and/or
/ r+ r& p$ K6 N) G - * modify it under the terms of the GNU General Public License as4 A- [6 E' L6 [" `8 W1 h
- * published by the Free Software Foundation version 2.
+ e5 L' l% s! i$ X6 w! O - *8 n. R8 [# L T1 Z% b4 _' u
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any( m2 S# C, v! f4 a3 R
- * kind, whether express or implied; without even the implied warranty
3 L# d+ S' j- H/ j+ O8 r3 N9 ?) K& O - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Y `! h$ E4 k# S2 c
- * GNU General Public License for more details.
2 d; n) {& e. v - */
* ?7 |0 X- ?( o+ M' S1 \) X
- y6 m0 _' I1 ~/ b9 D) z- #include <linux/module.h>
* |6 p% x7 [6 b% ?2 ~ - #include <linux/init.h>7 O/ O, K" j l( l& [
- #include <linux/errno.h>* L" E9 T' L. z% ?
- #include <linux/types.h>7 i$ F2 b8 [# h1 D5 @5 X% k0 S
- #include <linux/interrupt.h>( `; A1 @' G5 y. b, z
- #include <asm/io.h>
5 [# Y$ S5 ]4 x - #include <linux/moduleparam.h>
3 J. }1 w% F5 p! U8 W - #include <linux/sysctl.h>4 Z3 ]! s2 d- N4 T
- #include <linux/mm.h>/ i% ]9 u( o6 A: `% ~
- #include <linux/dma-mapping.h>
# L7 ]. f0 B; k; @8 S- c3 }
6 J8 ~6 ?1 U' e# C, P- #include <mach/memory.h>7 H. _9 x3 ^4 y; ^
- #include <mach/hardware.h>4 I6 R7 f' ~4 [
- #include <mach/irqs.h>/ ?8 F$ V/ o# Y" m
- #include <asm/hardware/edma.h>5 b$ X U0 W3 u7 J7 R
- $ L" o9 e4 X) a' t0 g5 W6 O
- #undef EDMA3_DEBUG
" o( T* v: [% r$ u - /*#define EDMA3_DEBUG*/
) w. O7 v9 }! k9 I- t
) t; b; X. P; N: J- H! r3 l, c- #ifdef EDMA3_DEBUG
+ {5 A- x+ @+ K+ s0 ]+ c - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
4 ]# o% u( T* q# Z" T* u - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
% k3 H& r1 D$ g4 Y/ X' ]# t - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)4 U" l1 X9 P3 }. D, Q
- #else
! ` k& Y3 {7 ~+ D2 b1 G X! Z - #define DMA_PRINTK( x... )- q) Y9 w" f6 D1 C
- #define DMA_FN_IN
6 ?- S% @/ ^2 t% l6 A& \, Q - #define DMA_FN_OUT+ J. i1 y' T1 r4 C- V1 ?4 ]
- #endif
# Z% |+ C1 D+ \( Z0 s& `1 J4 N - ( X# a0 V- d6 J3 C
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
. j/ `) v/ z5 c1 ]8 S [ - #define STATIC_SHIFT 3
0 C) v& h1 q5 H8 } - #define TCINTEN_SHIFT 20
! u# X5 v1 z2 t' X- }3 N - #define ITCINTEN_SHIFT 21: ^3 y* z) T2 d" f* f
- #define TCCHEN_SHIFT 226 c; f, T) E- u( W1 |! O
- #define ITCCHEN_SHIFT 23. W7 H/ L I9 k1 C
- ; i& U- y- ]# _1 k3 V6 L# ^" |
- static volatile int irqraised1 = 0;
5 A, f5 K7 Y8 {9 g - static volatile int irqraised2 = 0;
! l4 C; @6 ~( l- | - x* u% I; S5 P/ D& o# l8 m3 o
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, x) a2 z" F9 G, \) J0 o: r J
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 i4 v, ]. o9 [; O( q6 C8 N
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: D9 k: [" n' m0 ~
' M# q% |& [) ?1 K( v& D- dma_addr_t dmaphyssrc1 = 0;( p2 T2 r/ o K$ ?' p# Z! o6 M6 Z
- dma_addr_t dmaphyssrc2 = 0;
3 ]* a5 b$ G$ s3 D$ Y# V - dma_addr_t dmaphysdest1 = 0;6 b; R* F! j1 x$ w0 L
- dma_addr_t dmaphysdest2 = 0;
" B1 [3 M+ R3 ]5 f6 [ - / s. e! m& J- q# r9 {
- char *dmabufsrc1 = NULL;
a9 ^' r5 T9 | - char *dmabufsrc2 = NULL;3 e) _( C* Z/ H9 ?9 p$ k) S
- char *dmabufdest1 = NULL;
2 Q3 k8 ]% a y- T - char *dmabufdest2 = NULL;7 u) ~ F& V( a
# [5 R, [1 A/ F' w5 X- static int acnt = 512;6 u% C, Q% ~7 K
- static int bcnt = 8;
4 s& C- _/ F/ ]/ @! A$ J9 Q; @7 A3 P - static int ccnt = 8;* C7 R6 E- n2 D
; z6 Y! t0 U( i0 y2 y5 p" }% c' ]8 ]- module_param(acnt, int, S_IRUGO);/ L3 x. t7 t( N3 T) _
- module_param(bcnt, int, S_IRUGO);0 T, I# N$ U1 K& [* S
- module_param(ccnt, int, S_IRUGO);
复制代码
( Y/ j6 i. ` S- V8 }% [
& X5 J' c( M/ t. J 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* ^5 a$ B* B$ g" Parm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。 i m6 a5 |9 E
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% K) f+ q. Y: U5 |- m, k# w
/ { ^+ A( X! I* i/ R
$ ?+ a6 G/ | E8 { |
|