|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 K" w. W0 n# W" n" V( t1 p/ C3 |- [code]EDMA sample test application( h8 o% ~1 Y) _ s% L
- /*; v: z& |( R0 D3 V* @
- * edma_test.c
3 l+ E5 j$ w& t- C - *
8 O) g, C; A1 `& P1 ^$ s - * brief EDMA3 Test Application
& n6 i" d8 Y/ ^' M3 u& F/ k' { - *3 }) F. h0 e. V# V9 q" f9 L0 k
- * This file contains EDMA3 Test code.# R: S2 x9 Z# B# N! B+ p
- *
+ x% t! K2 ?) J1 k2 X; p - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
) X8 t, ^ e. n4 r - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
s- G& o/ w6 E7 K7 x# G: `; ] - * TO CHANGE.
" H/ H( z4 Y/ Q% }4 b, G - *
9 b4 P. _# L* E0 |* B - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
, C; D* d! @' Z - *
- C( {( d3 l( ?. x+ x0 l, T - * This program is free software; you can redistribute it and/or
, \1 t3 t+ ~8 N2 N! J" s( f# u$ w - * modify it under the terms of the GNU General Public License as
3 j) ?- e% i2 V1 }) x3 A* @5 @ - * published by the Free Software Foundation version 2.
% y! `7 G9 m4 k& v* _ - *5 R- {9 S" Z6 h$ |& k
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 Y. s; a( D' n6 J9 p' {
- * kind, whether express or implied; without even the implied warranty
% Z$ F9 b' k" W3 t - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the$ E; }/ H, |/ Z5 \# i- U Z( C
- * GNU General Public License for more details.
3 J5 y: B$ G8 H3 g/ v - */( @/ f1 M$ f( X, |) |( X4 ^1 [1 t
3 D3 W0 q9 n* b7 ]2 d# z- #include <linux/module.h>
: W( [& v( [9 U - #include <linux/init.h>
' V( f/ ]6 q$ ~ - #include <linux/errno.h>1 Q) t0 q' E! V. N: l
- #include <linux/types.h>
4 t9 ^! n3 L1 r" W) ? - #include <linux/interrupt.h>
: r" f! ?# A6 r% ` - #include <asm/io.h>
: i7 ] m5 r/ R- r9 T Z - #include <linux/moduleparam.h>
! B8 V% T4 E: s* D' }6 P - #include <linux/sysctl.h>) B! G+ F& Z$ [8 z. j
- #include <linux/mm.h>* ?5 e+ S" C: ^3 q# `6 F
- #include <linux/dma-mapping.h>$ @/ X# S; o) o. h: {! u/ F" W
1 X# i1 q# `1 ]! W7 f$ x5 }- #include <mach/memory.h>
0 }6 R5 [( G4 m/ e, z - #include <mach/hardware.h>! P2 t& ~ I5 N. K( w
- #include <mach/irqs.h>, I7 b+ I7 g s- v" Q G1 R! r
- #include <asm/hardware/edma.h>( q$ {* c& K) |0 h7 ]8 ^5 o+ u
- " q$ {+ F+ q6 R3 b, l9 ]& W. y* G3 R, L
- #undef EDMA3_DEBUG
% @; I! A5 O! |: c" A - /*#define EDMA3_DEBUG*/* g: j9 i+ e0 l( `* D3 E# z( J
- / X# o; d0 F4 Y: N0 t6 t/ I
- #ifdef EDMA3_DEBUG
. C& \1 [* W' q' m' [ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 G, a7 J3 O- K
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
* y9 X( K4 z' ]& g! W; h" `8 j4 n - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
5 s5 ]8 U% x$ x F3 D6 s- o - #else
) x; u9 C" K$ B5 J$ }& ~ - #define DMA_PRINTK( x... )5 |8 `: t' H' @. f
- #define DMA_FN_IN
7 Y3 P# J* `# ~. Z8 ?- q o* X( m - #define DMA_FN_OUT
, k2 u1 d8 W0 o' W) j+ j - #endif* ]6 A3 u" s: w" P9 f% p- P
- : b- ^8 g- c" Q2 x' c7 o
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)+ O3 v& f1 i' W3 T
- #define STATIC_SHIFT 3
! T% D+ O- M H( j - #define TCINTEN_SHIFT 20
- v" i4 B5 ~6 ?: f! Y! g - #define ITCINTEN_SHIFT 216 I% z5 ?1 d' L4 V1 [( @
- #define TCCHEN_SHIFT 22
; x5 y( r; v- K- N ] W - #define ITCCHEN_SHIFT 23
2 ]# t7 ]0 _1 m) K. ~6 @6 } - # C2 ^9 W3 a: r" }0 {, |9 u9 \
- static volatile int irqraised1 = 0;: O# H% E1 r0 F" E) y
- static volatile int irqraised2 = 0;
& e& t2 X8 X& G Z( t" v5 N5 F
& q# {5 A4 X9 v% N" W) n; K$ Y- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; V+ U# @' p9 H6 q( ^; t9 l - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; l5 `; c* A* [2 w! H* T, r. P
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 Z, D) V) ?' q) N4 I5 v# J- {
( K3 K# J' r: s! ?# P5 Q3 U* I- dma_addr_t dmaphyssrc1 = 0;5 A* F F6 E- q
- dma_addr_t dmaphyssrc2 = 0;
$ _- v# X. S9 h9 E) o - dma_addr_t dmaphysdest1 = 0;
- u! A; ]! u! }+ O - dma_addr_t dmaphysdest2 = 0;, v- [0 j) x* P" j: e9 ?
" M0 O2 {4 i/ w- char *dmabufsrc1 = NULL;* x8 E6 H( X8 D" \" H9 Q0 E
- char *dmabufsrc2 = NULL;
' |9 z0 v% G7 a, C- D# I' \ - char *dmabufdest1 = NULL;
3 j9 k( U5 n2 \4 \. l, e7 j& K! w - char *dmabufdest2 = NULL;% E' z* y' c" h9 F
# h6 s! s' O% t2 A; K. I- static int acnt = 512;: G: ~$ f% n4 U* e( ?. Q
- static int bcnt = 8;
$ r$ z+ o0 e0 m5 k) l& j - static int ccnt = 8;$ [% k* J, v3 j" p- W; `
8 `& Y t4 O% _) u- module_param(acnt, int, S_IRUGO);# b9 S& g0 |$ D' t# \ m
- module_param(bcnt, int, S_IRUGO);
' W( t8 X. X+ x: l; V1 t - module_param(ccnt, int, S_IRUGO);
复制代码 5 R+ B! I$ Q4 d3 {5 ?8 k2 s
3 A8 i* W4 g! j/ Z) b1 _5 d
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 K. _4 ^4 n- q0 @, ]9 _% b
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 U( ~7 ]' z/ B( F, H
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: l0 P7 c- Y7 f& k
2 _$ a. V9 S) G! @# L% ~# H8 p
6 v9 ~+ K8 B! e/ S |
|