|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * \- S1 N# t& T T5 @
- [code]EDMA sample test application
) R0 g Q2 M( {0 ] w1 J) Q - /*3 g2 ~2 w5 f6 T3 R% i/ P
- * edma_test.c
- d7 P9 ^* q7 O# _ - *& b' l3 g, H( w3 Q9 S; \
- * brief EDMA3 Test Application
' I) j1 C9 Y2 c& L - *" A' q" m( s5 \3 M6 @: H% D8 g
- * This file contains EDMA3 Test code.& c2 u* x- _, D) P" v/ c
- *
5 k5 ~+ P: o6 w- F - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
9 C( d0 s- d6 S% L g3 t: N - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" {: F5 Z$ [6 {# |* X
- * TO CHANGE.
0 u8 z* j/ G& c2 [$ h# ] - *
8 m! A7 p3 v: _ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% n9 E- q/ W! f( \& |8 ~
- *
" E8 e V* h1 A8 T5 m, I$ `: j$ l& { - * This program is free software; you can redistribute it and/or
7 i* K3 P/ \- U% w% [0 E t( [8 ? - * modify it under the terms of the GNU General Public License as
, q% e! P) [ P2 c0 o1 w4 T - * published by the Free Software Foundation version 2.4 a- T6 n) F6 g( c# y+ z1 u# ^ R
- *
( q2 [' G+ p U) o! l - * This program is distributed "as is" WITHOUT ANY WARRANTY of any" r, O* j! i: Q
- * kind, whether express or implied; without even the implied warranty
3 u- E/ C% E- G6 }! J$ \1 e - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the& d' P8 u y! Q$ |- E
- * GNU General Public License for more details.
4 i* M( }# Y7 L3 W1 z5 G - *// h: `& E$ t Q+ J, \
+ N W% K/ Q& `) N- #include <linux/module.h>
& H9 p) A. h: O/ g - #include <linux/init.h>* j$ i8 L- g/ r) w1 m
- #include <linux/errno.h>4 D: `8 {- D4 R" E# ?* \
- #include <linux/types.h>8 D" D; L( D2 j B# t' P
- #include <linux/interrupt.h>3 g, ?3 ]$ G" b+ M! B1 l6 W7 l
- #include <asm/io.h>
! s! R6 C) @; R* ^' {. ?* K4 B; W - #include <linux/moduleparam.h>3 L1 }' c5 [" R3 F; |" @, |
- #include <linux/sysctl.h>$ B/ e- A) D4 e' ]( p) Y/ ]: J
- #include <linux/mm.h>/ A6 Z' O8 ], N6 Y& z s! h/ _
- #include <linux/dma-mapping.h>/ y: G. e) I( G4 ?
- D0 ^) Z7 P# f8 q- #include <mach/memory.h>! m4 m' H1 L# l1 H2 F
- #include <mach/hardware.h>/ y% ~! M8 z; A3 K) e
- #include <mach/irqs.h>0 F; _& V/ x; ~- n
- #include <asm/hardware/edma.h>
0 f5 U! |$ n0 Q6 ~$ F4 ?
4 r) X( U7 O+ h7 F9 `- #undef EDMA3_DEBUG! T/ |2 r% C3 P4 R+ j3 @% y
- /*#define EDMA3_DEBUG*/
( Z \: A9 v% f' S' O2 R; r - 2 [" _" z6 }5 }* ]3 h8 ^
- #ifdef EDMA3_DEBUG7 V: y' m- C9 z4 G" Y
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
, B* m# v$ G4 b; J4 N1 u7 c! \ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
! {, {, C7 W) H) r. O - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
1 W/ l% P9 s3 s- z - #else9 H) ^8 { C4 A% F+ \/ e+ l
- #define DMA_PRINTK( x... )) X, @, J7 J [: Q
- #define DMA_FN_IN: q( u) U8 L$ V2 G& @/ N" h
- #define DMA_FN_OUT
5 f$ ?8 Q$ `7 Y. F6 ^: x - #endif
" h) ~' h1 E' t5 u% }1 y. a7 w
+ x8 f; s- b( W6 U3 n" b+ ?2 C- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
% n" j* S! s7 s. P4 A$ y - #define STATIC_SHIFT 3
! C; R/ a' g; ^7 H0 a m4 T( T4 ^, G - #define TCINTEN_SHIFT 20
+ V6 a, u. q0 d1 u5 X& L4 ~9 f - #define ITCINTEN_SHIFT 21: W* `7 I+ H8 N" p" ` O1 L- u
- #define TCCHEN_SHIFT 22: A0 B, o8 [8 B* B/ a
- #define ITCCHEN_SHIFT 23
) R3 e1 z! Z" k, _& d& Y. j
9 t7 N8 C$ P0 l% I$ \5 {- static volatile int irqraised1 = 0;
# q. S6 Q) x# |5 l$ b- E - static volatile int irqraised2 = 0;
' c! e& X; o! u7 r - 1 {. S0 q0 p6 f1 j' Z% m7 U
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 ~0 i4 W) ]: y" P0 m* ~, u
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' d0 Q3 ]$ T( n% J+ I - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ N" ~* o8 O6 r& x6 Z% x5 Q - ) B7 q9 v* ^, r- ~4 ~
- dma_addr_t dmaphyssrc1 = 0;
5 c: ]' D" P: I+ N: y" c' `! ~ - dma_addr_t dmaphyssrc2 = 0;
8 `# u" v2 ^ K. t; ?+ X - dma_addr_t dmaphysdest1 = 0;
! ^2 ~. s7 M1 ^* L - dma_addr_t dmaphysdest2 = 0;4 X5 X- v2 U9 h7 }
- ( P. Z: r. g+ b' b; E
- char *dmabufsrc1 = NULL;9 E7 o/ T9 E9 K) r
- char *dmabufsrc2 = NULL;
$ Y4 d' {) W$ B, U# R M9 ?, Z! F - char *dmabufdest1 = NULL;" F/ e3 B5 D3 E e( t, {, {
- char *dmabufdest2 = NULL;
/ e0 Q- F4 ?9 I
& S6 W. c- }& c" y( Z- static int acnt = 512;" j: c% x5 p; f b6 E1 N
- static int bcnt = 8; h; ~! \, G: ]) d9 v
- static int ccnt = 8;7 U Z! f. R6 C% M. |( i
- ) q" `, \ Q) U% _4 H# e" `: H
- module_param(acnt, int, S_IRUGO);
* J9 j9 @8 T8 _ - module_param(bcnt, int, S_IRUGO);( M. o% T; J& s1 ]( A
- module_param(ccnt, int, S_IRUGO);
复制代码 1 V5 l5 ], K1 M2 q
3 |$ y& W# s$ F
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) c& I7 b9 o2 l: s8 t$ f* ]
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) f# I5 a+ \7 u ?' Q 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. w( @# e- p4 e- ?+ [
' }% @- Y( u- o9 r7 C0 ^
S* L4 w- H9 F% H' Q( s. ?
|
|