|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( O% r+ K) U8 \# u+ H t
- [code]EDMA sample test application
4 K$ ~+ _+ b1 Q, Q& D' ~/ p u - /** d8 l6 @: L+ d. f6 f
- * edma_test.c8 @: V1 }9 i! g6 D
- *- ]0 Z6 z+ v9 W) S6 M
- * brief EDMA3 Test Application
' N. }; U. w- S8 T+ g1 N - *( g1 e: e- N4 z2 ` x0 Q4 W
- * This file contains EDMA3 Test code.
M, X' j8 m8 n0 x: T/ P - *
( U2 x$ o0 p/ x2 a - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
! }) [1 y% f O G - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# r& v& ?0 }! U: Y. e$ o1 E
- * TO CHANGE.5 O* |* b% V1 ~& L6 N! Y+ E, x) _
- *
7 K# l# S9 o3 D6 f" b - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! ]4 D( m( R: y/ X, y
- *
. s) s1 d4 x3 k) i( k! I, s - * This program is free software; you can redistribute it and/or
" J0 J3 S) p9 |/ l- P - * modify it under the terms of the GNU General Public License as! f5 C) I( _8 T) m% T( t& D( N
- * published by the Free Software Foundation version 2.
7 X8 ^1 X3 S8 |7 M" q - *
* J0 y+ }0 S7 H4 G' R* `* N - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
; h% S; O8 _3 `% } - * kind, whether express or implied; without even the implied warranty! l5 l9 m# B I1 b( q7 L* v. q+ v
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ x/ P, Z' ^) l+ j A2 T - * GNU General Public License for more details. f& z0 h( H g+ g6 k; }% n5 t* u
- */
6 v7 z |; ]/ x9 |2 v" v) y - 1 n6 q! \' f% J) P/ L
- #include <linux/module.h>
4 i7 c* c3 [- o. P - #include <linux/init.h>
4 Q, [' R$ }: J - #include <linux/errno.h>
: M+ B* |" e3 ?7 h5 {* H' p+ ] - #include <linux/types.h>
& p. ?- V3 M, k. N/ k: B" j - #include <linux/interrupt.h>
* x% B A8 w6 E, M" G - #include <asm/io.h>
( c$ {$ i* ^- E h" K2 ] - #include <linux/moduleparam.h>2 B# e! n) e4 Y
- #include <linux/sysctl.h>
* c% l7 ?2 g$ O- [% y3 t - #include <linux/mm.h>
3 q" \( G& T; W5 [; i - #include <linux/dma-mapping.h>9 N% T3 r" f s, j4 r
, e& } H. U" Y$ t/ ^# E- #include <mach/memory.h>! L0 p4 m% I$ p- s8 B% Y6 D
- #include <mach/hardware.h>1 E# H: i8 ^9 z o9 w7 p0 ?; z4 h9 F
- #include <mach/irqs.h>
, S0 |* |$ T- L: w) ?) }. D0 s - #include <asm/hardware/edma.h>
* N/ m6 ? V& U5 d
# h; S, X/ ^3 k# [, P& t! r, i- #undef EDMA3_DEBUG
8 ^/ Z2 m+ M" Q" i5 ]* T/ r; H - /*#define EDMA3_DEBUG*/; Q9 Y) s# ?( r
- 2 \! D4 j# A @
- #ifdef EDMA3_DEBUG+ s2 W. t) d0 i
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
@) A! c( X9 n* W8 s/ L& o - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
9 |7 Z& P, C3 R - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" Y5 e% u9 }( v- l, d& Z3 |
- #else+ M/ M. [& A* y, m7 B; h
- #define DMA_PRINTK( x... )6 k- K0 ^# j- {% y9 p8 Z) F9 F- m
- #define DMA_FN_IN/ p/ z7 U: d d1 h
- #define DMA_FN_OUT
( B; w k; p! z$ T7 u6 {, z0 c3 I - #endif
" W: c' ^- `& j" W3 n& a
* j' s: n2 y" M# \# v0 [- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
J/ [. z. L3 I8 p2 h - #define STATIC_SHIFT 3$ Z/ i+ {& n) r. s: V6 d6 E
- #define TCINTEN_SHIFT 20
9 G7 q' a) Q: {0 t: g* H) a! q - #define ITCINTEN_SHIFT 21. i, t% A. n" `' w6 C: k. e7 H- P
- #define TCCHEN_SHIFT 22
8 `; ~# J/ v( P) w0 S - #define ITCCHEN_SHIFT 236 f" f! R' t( [
- ) v, Z" u6 |" S" L, [
- static volatile int irqraised1 = 0;
( F5 S: m# `( C& f - static volatile int irqraised2 = 0;
# \: O: G7 y# l
2 m1 Z$ }9 B- J) k- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 k* l! f5 p& P1 h H0 k' H
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. j& n T' K# g+ `$ a, M
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. z) C- y2 G; \
+ H+ d- D' L2 x& M+ p* [/ v! a- dma_addr_t dmaphyssrc1 = 0;
3 o, R5 x1 G3 \2 e - dma_addr_t dmaphyssrc2 = 0;) P1 o7 J$ m/ u% T$ ~9 o6 @
- dma_addr_t dmaphysdest1 = 0;$ D6 k' d6 S5 N7 |8 \: q
- dma_addr_t dmaphysdest2 = 0;
: S* y3 C6 n; V6 h. X" { - ]% f7 u2 E1 Y' F- B
- char *dmabufsrc1 = NULL;
1 z3 g% L, j# s1 K% _) ?; o! j+ ~ - char *dmabufsrc2 = NULL;
8 j0 g3 O4 t K; { z - char *dmabufdest1 = NULL;) G! l \; B. k0 k7 O t
- char *dmabufdest2 = NULL;( @) r2 c6 Y6 A2 }( H7 [' r
- * Y! m C( V2 S2 C
- static int acnt = 512;( Q4 A* E' D8 F# F
- static int bcnt = 8;$ t0 N% M% A! e1 N. c m
- static int ccnt = 8; C8 k5 w, l* S# U# Q' f& S8 h) o
- 2 i7 b( l/ }$ t8 H' v
- module_param(acnt, int, S_IRUGO);
+ I, x4 i% x9 s4 V& M - module_param(bcnt, int, S_IRUGO);, K2 Q! s( U; z# T
- module_param(ccnt, int, S_IRUGO);
复制代码 / \+ v9 D a2 W1 J
" z* O+ w( Z8 ~. A. M+ p: S& W. D7 m! R 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" T0 U) R/ ]& E1 p2 T6 I5 c 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ v% z3 _6 a" @5 C
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) @8 J3 ^1 r( n* C3 w' p* X( c
; T4 R, j' E, U+ n& C6 w/ p1 ~3 G
" t l; [$ h0 S) G/ b) a+ ~ |
|