|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 y! T7 l N1 B3 i
- [code]EDMA sample test application* b! N( x- A2 S* t) C
- /*
3 D) V$ O$ b4 [ - * edma_test.c3 `' @1 U" R. b, v" L
- *& M8 F% k' A, g
- * brief EDMA3 Test Application
7 U& |; m" A3 M0 q, q0 Z: F# e - *! J$ W! @+ s& _2 u
- * This file contains EDMA3 Test code.
- \2 o ]& x6 p. E+ V; L - *6 F% i7 \3 o4 f
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
6 Y9 e5 l& D' B; s6 r, S - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 m. E) X! s5 O! G. v
- * TO CHANGE./ [8 p/ K6 s" L+ L
- *
( `$ ~1 y0 G: X4 a - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 N4 x7 J1 A" I
- *
& T& r7 N& U6 t; Q - * This program is free software; you can redistribute it and/or; u% ~! R1 |7 [6 r
- * modify it under the terms of the GNU General Public License as
3 U3 A0 Z! e3 I+ ~* L* L/ Q - * published by the Free Software Foundation version 2.& b; Y o% o8 h8 `7 }6 `2 L
- *+ u: D. O) E: N# |& x
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any% E0 Z, T- K2 [; Y5 W8 I
- * kind, whether express or implied; without even the implied warranty
2 \) ~9 r |; a; h5 F7 P; @ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the0 V: `7 _* h* T+ y# M2 F# i
- * GNU General Public License for more details.) ?! {) K8 h: ?2 ^) M# w0 e; Q
- */- {# d$ h- Q3 O% h+ A2 c
5 z3 {2 |! t5 b Q; N- #include <linux/module.h>: h; v8 V. n7 }' k& W5 t: B
- #include <linux/init.h>
# m ] f1 \/ A - #include <linux/errno.h>4 S6 S# ~! L7 Y7 f0 L
- #include <linux/types.h>" z- t' `' S- e) z7 D6 @' _* c( c
- #include <linux/interrupt.h>7 y* u1 b, B8 j$ h
- #include <asm/io.h>: y& A+ A( M% p: w2 V) E
- #include <linux/moduleparam.h>+ w2 A4 K' @- W, w( o2 ~" x. Z _7 m
- #include <linux/sysctl.h>
0 h: ~) d3 d# {* m: I - #include <linux/mm.h>
2 ^$ ]2 Q U( N+ H - #include <linux/dma-mapping.h>
! z8 j. E' L8 c5 S - ; s, ]6 s, P. \( t) s
- #include <mach/memory.h>' K C5 u' l$ E! E3 o# e2 @* p
- #include <mach/hardware.h>
/ \: U$ U) c& h - #include <mach/irqs.h>% w5 F7 l# E) K: Z; k
- #include <asm/hardware/edma.h>9 G2 b1 a& o' O" f% k: M+ h
3 f$ T4 n) c) |- T7 ~2 c- #undef EDMA3_DEBUG
- M* B2 ~" q6 X6 D; V/ F+ d - /*#define EDMA3_DEBUG*/- W$ E( N; G5 i$ A) b5 y
- ! d, Q7 ]' Y }
- #ifdef EDMA3_DEBUG' W; y8 w" u8 L; e6 |9 h
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ N u+ i& w( ]" T a
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* N2 k8 t$ Y# Q, }& `; q3 t! M
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 ]! x) T" C4 B2 ~& v5 s
- #else
0 s& l0 \7 S* g - #define DMA_PRINTK( x... )
/ p0 j6 B2 T0 n% i% ]' z - #define DMA_FN_IN
; @" Q+ |: S. K - #define DMA_FN_OUT- N, _" W6 n/ I) j* b0 z
- #endif
O2 K" Q4 T# b& ? o! o - : ~' `5 |9 j9 V; u1 g; x) F
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
* Q) j7 e) H4 Z$ X' I7 Z - #define STATIC_SHIFT 3
5 r# t7 k, P: G% @ - #define TCINTEN_SHIFT 20/ W* y: ^, M$ K" Z
- #define ITCINTEN_SHIFT 216 D6 s$ K. z1 u8 J) a6 ]
- #define TCCHEN_SHIFT 22
' G* W5 v g! z* s2 N0 X - #define ITCCHEN_SHIFT 23- S% Q) Y6 J7 L! H" M6 x& m
; O5 _# j* c; ?# N% W8 p- static volatile int irqraised1 = 0; V( Y* f# D7 y9 V- U8 L% V
- static volatile int irqraised2 = 0;
/ V, q% c; o2 T8 Y/ a
! H: Y; R% F0 c! W3 E- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; u, G/ s! v2 Z- v# ~( g" |+ L5 W- y
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 [- p) O# R! ~, g$ x - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 k/ R& B$ [. H6 @: r$ O
" b5 E- r8 F4 f# { T7 s8 Z9 I! O- dma_addr_t dmaphyssrc1 = 0;
' w4 O* o0 P p. s! T - dma_addr_t dmaphyssrc2 = 0;* G$ y$ `; Y6 t9 L9 R- |
- dma_addr_t dmaphysdest1 = 0;' _) m8 }" h- u) K H$ t7 J+ x) T5 h
- dma_addr_t dmaphysdest2 = 0;' `% t8 p, v( `, l
- ' m) ^1 {0 k$ A0 ?. r+ v# q* A' \
- char *dmabufsrc1 = NULL;
2 A( r& N! p6 F- O% z - char *dmabufsrc2 = NULL;
) H7 F* G0 z/ w - char *dmabufdest1 = NULL;. R6 F# [1 A' [2 o. ~
- char *dmabufdest2 = NULL;- [; F3 a& H; u# z2 g' t+ N8 t' X1 I
- 0 I/ P" W- ~6 q5 S
- static int acnt = 512;
4 F- {, j1 E5 |) X% N* K% X - static int bcnt = 8;
% G6 f4 Z* }, }/ ^ - static int ccnt = 8;. q6 `0 D) x0 z$ U
# z3 v9 N5 G- Z4 l! v- module_param(acnt, int, S_IRUGO);7 h" x+ Q' ]) ^/ ]
- module_param(bcnt, int, S_IRUGO);
& B2 ?3 h) K- m1 `& z8 B; ?8 u/ e - module_param(ccnt, int, S_IRUGO);
复制代码
: g2 ?. ?* ] i& t* N; R$ C. b6 n+ Q& Q8 ^: i7 `7 Q) `5 I
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ }) }1 ~5 g, M) w% f# c2 Marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; O2 o+ D9 l+ ^( |8 J) g' Z/ X, R5 ?
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 ^- m! p u* B5 ]' h
0 U$ M! {/ C- ?" k. U0 G; C8 @- r4 w5 \& l6 q
|
|