|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : ~! o+ ~0 S+ V
- [code]EDMA sample test application* U+ K% n4 k$ W: r4 }1 V2 U
- /*/ J2 j2 F4 M7 ]. r- M
- * edma_test.c2 w6 v r- T" L- [+ ]# ^
- *
6 ^: D& D% N; ^6 T - * brief EDMA3 Test Application5 \2 l7 A" B0 O% }
- ** j9 }- x: R; \% g
- * This file contains EDMA3 Test code.) |" y9 j; O$ N+ A
- * t$ E y' A1 q$ J
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE6 @2 i: ?$ D3 z# e5 R' ?
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 V9 O, l4 _3 l; f4 w! X
- * TO CHANGE.: s4 }; G. s$ z: D2 m
- *
6 u4 U Y+ |3 [9 h I - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" h0 v( }: e: n& A$ p& M5 t3 ]
- *
; U4 m7 V/ [5 i$ B - * This program is free software; you can redistribute it and/or6 v0 t, A$ X! q2 d: [; x3 p9 W
- * modify it under the terms of the GNU General Public License as4 D& W8 W& f0 o/ G9 h
- * published by the Free Software Foundation version 2.
7 `$ K) h6 _; T/ j5 V: L - *2 X1 I! P6 R! I% p3 y6 L
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 ^5 v) f, e7 E4 u8 d
- * kind, whether express or implied; without even the implied warranty& T; |* R9 I8 r! f( Z
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5 i, P5 ?2 u) ^, O6 K - * GNU General Public License for more details.9 }9 x) }: r# ^
- */+ x" W! c" R. H( g s. |/ _
- 5 d9 ^) R: y; S7 x
- #include <linux/module.h>
4 u! ?! A4 P! R$ c - #include <linux/init.h>+ c& b, r R k# p R# o
- #include <linux/errno.h>9 i' a" t" d" V+ V. K8 J7 c
- #include <linux/types.h>) x* x$ f1 x2 ^6 t! A# r
- #include <linux/interrupt.h>, d3 I# z- a, e! P( u
- #include <asm/io.h>
& T. c; ]. o; W- s8 j( m - #include <linux/moduleparam.h>4 J5 Z2 {: [ Q6 W) `) _6 q
- #include <linux/sysctl.h>
9 |, R- a' C1 C; K2 \, _1 [ - #include <linux/mm.h>
# o; |" ?) V. @0 N. n1 a3 w. ] - #include <linux/dma-mapping.h>! V7 T( _. k. x( R4 _$ i: u6 c. \
, Y q1 x* e5 ^7 x0 z2 w: {- #include <mach/memory.h>; L# H& }4 n# K2 {- f/ @- d
- #include <mach/hardware.h>7 u8 {( h" W( D: @& ^
- #include <mach/irqs.h>7 Z$ W. a+ B1 M4 T0 q
- #include <asm/hardware/edma.h>+ _+ L3 m) t% ?% a U
9 o: B4 I% T1 C2 O$ Q5 V( d9 x% z% ~- #undef EDMA3_DEBUG
: F( P$ X l) R8 {- v - /*#define EDMA3_DEBUG*/
! |2 W1 _# _# o# a - $ q, t7 W9 G. ^# V- d( a1 p
- #ifdef EDMA3_DEBUG
; @$ i3 }7 U7 _ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 i& q' \/ u9 `
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 r" U; K6 q, [
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
0 V( N5 s6 {3 D* [ - #else1 C) F% q! B9 Y, N
- #define DMA_PRINTK( x... )7 Y# h! Y+ u$ X( i# V. p: O/ k
- #define DMA_FN_IN# B+ g3 ?% S( R0 ^7 q
- #define DMA_FN_OUT
0 P. N+ f2 c9 o" ]! D - #endif
2 }% \6 D% Y; ^2 Q! \: m
# }$ A9 J. D1 h' d M" z6 E8 E5 j- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
5 r$ [. u6 A) B" d' ^1 { - #define STATIC_SHIFT 3
4 ~0 k" ^4 F7 \1 ^9 X: [. c - #define TCINTEN_SHIFT 20
2 m& h( u7 A" ^3 M - #define ITCINTEN_SHIFT 21
! ]$ x# p2 z% K, y - #define TCCHEN_SHIFT 22
" J/ h" y9 x+ ?( E6 @9 l - #define ITCCHEN_SHIFT 23
9 {/ b, C R# t# V5 M - . \9 t# E& Y) l6 a+ N
- static volatile int irqraised1 = 0;
* s6 U! {6 D& ~# m- E. s& d - static volatile int irqraised2 = 0;9 A/ W% f3 m8 A. v( o
0 ]8 p, G3 S% H- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 C: T& Q5 x% ` - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: |+ `) |* L* u9 U5 ^ j
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 z R1 P" Y; ?3 [- U% f
- # |0 z4 l- h) o- [- R
- dma_addr_t dmaphyssrc1 = 0;
% Z6 U2 D. q+ W! a! h a - dma_addr_t dmaphyssrc2 = 0;2 b: b' C. I$ L9 Q1 P" @, K: U- H
- dma_addr_t dmaphysdest1 = 0;
5 {& ]4 R$ [' j$ H - dma_addr_t dmaphysdest2 = 0;% Z9 `( \, T& I# g( q4 B
( q3 Y9 Q% Q. U! h) E8 E9 u- char *dmabufsrc1 = NULL;& A: e! @4 h# c- B
- char *dmabufsrc2 = NULL;7 b6 Q2 i* a3 N! d) p4 `0 S! J4 l$ v, X
- char *dmabufdest1 = NULL;* ?) X+ F2 {( Q. H, ?7 n+ I% k# Z
- char *dmabufdest2 = NULL;
. j c$ O8 h. e6 u8 w! x - 1 V6 n7 d3 D" |, v9 |# C% a
- static int acnt = 512;& a6 r; ~/ f0 |# L' R" y
- static int bcnt = 8;
% v+ S: S4 R" n# B - static int ccnt = 8;
. W# N1 {' x$ W0 a0 ] - ; X* t4 o0 F& ~
- module_param(acnt, int, S_IRUGO);
6 F$ ^" l6 T2 f - module_param(bcnt, int, S_IRUGO);7 Q l N% s7 p- v6 C4 u
- module_param(ccnt, int, S_IRUGO);
复制代码 9 Q6 Q' ?+ G3 I0 q) b
- q' a# Q# a3 y, H( F. u 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ A b: y$ ?- ^/ y- S' C/ j
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 @" y, G+ R/ B1 y' Q/ T 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: M+ q: _4 \2 X+ M& V
1 B8 n2 w$ _& I4 w1 x
0 Z* Z9 o6 p) l) \2 ^' s |
|