|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" K' c! I T/ I ^- [code]EDMA sample test application& a' m( p8 n: |9 N6 P
- /*
+ A* O2 d* p; Z$ h! R1 l1 l) G - * edma_test.c: U* D/ A+ r3 G* F% e" y
- *
9 M! Z) h& l* u" J3 g! ]4 M+ F& r" C - * brief EDMA3 Test Application
9 `2 A6 m4 m/ p, Y - *
2 }$ A3 G# n! F3 V - * This file contains EDMA3 Test code.
9 {2 k k; I3 E( c& }3 t# T+ e - *8 w' w0 P5 q0 Q
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 A( F7 [. h* ? C/ ` w
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
* F6 i: J1 C' w4 w9 G/ I - * TO CHANGE.0 a j4 y! V* y/ B
- *
0 j! ]# j0 k( f - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
/ |; ]2 b2 P S - *( C4 v1 U1 o# h& z: |1 F6 v
- * This program is free software; you can redistribute it and/or
) \+ T; B M% c% a - * modify it under the terms of the GNU General Public License as5 u- v- x5 \& y' L0 e1 q
- * published by the Free Software Foundation version 2.
. ]$ }+ r/ r' n1 S6 t4 {2 u, Y - *, E2 s. |! s) O) E
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
! `0 g1 Y0 G$ J: `7 f) a - * kind, whether express or implied; without even the implied warranty' m" `, Z, a8 D& `+ O Z
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the% D& Y3 G& }! o; i7 J
- * GNU General Public License for more details.* U7 E$ q" k( \
- */. m" n2 I/ J: e1 x4 F
- 4 C. {1 L. o6 v7 m1 n
- #include <linux/module.h>! `/ e6 g. c+ V v! I
- #include <linux/init.h>
9 c& P. ]) J4 w- I7 U* p# A3 M - #include <linux/errno.h>) D# V7 \3 X' [5 \+ ~4 i
- #include <linux/types.h>
0 h' _. b' [. a! c O+ ] u" z$ ~# p - #include <linux/interrupt.h>* G# C$ H* ?* {, B) R
- #include <asm/io.h>: Y- l2 X* W. I+ b* }
- #include <linux/moduleparam.h>
5 j9 t& _. I$ B - #include <linux/sysctl.h>
" x3 S! F" J& ^0 ` - #include <linux/mm.h>( I# P5 _+ b8 J- P* l0 Y& {* o: Z3 w* G
- #include <linux/dma-mapping.h>! C( {' D8 v, h) d& G3 V1 i7 f
7 F" Y% c: S% H& z2 u) e: H- #include <mach/memory.h>
' \! k& R9 X! E4 S+ d6 R) c - #include <mach/hardware.h>
; G$ B9 t$ N6 T9 W' l! c - #include <mach/irqs.h>
9 @, o3 X$ c0 ? - #include <asm/hardware/edma.h>
1 S% F- A& J. y. z - ! n" `% K2 j3 p1 u, T# n3 e
- #undef EDMA3_DEBUG
3 V% O/ U$ n0 B - /*#define EDMA3_DEBUG*/
$ }6 @& H1 `. f4 Z; h
; q5 Z0 g& `& D& P# q' e K: {- #ifdef EDMA3_DEBUG i/ k! D, h& ?' X
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
6 I# J- d# P) K9 X3 ?6 E# D& K5 {; Y - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
0 ~4 t1 U, x; r6 | - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 b% Q* g/ A# b: i+ g& r
- #else& s6 P3 r) w$ w
- #define DMA_PRINTK( x... )2 L0 r, ]* a2 o4 i
- #define DMA_FN_IN
8 ?9 \- G. g. a2 O- o - #define DMA_FN_OUT
6 p- H" w# j0 Q - #endif) Q# o2 z( P( I( I' F2 j+ W/ D9 A; y
) A9 e- O X0 D, g5 g- #define MAX_DMA_TRANSFER_IN_BYTES (32768)7 W5 E$ w2 [; B
- #define STATIC_SHIFT 3+ w6 F2 U, ?" v% ?
- #define TCINTEN_SHIFT 20
" m g! e. i3 j+ S1 S- j" u - #define ITCINTEN_SHIFT 21
2 Y8 v8 r2 } X' S' t k: F - #define TCCHEN_SHIFT 22
8 A" E8 |0 s- @8 E0 Y# D/ p% j. k - #define ITCCHEN_SHIFT 23
8 r1 m6 Q0 X8 L! f - * x' p4 `4 q$ ?2 I2 \0 A
- static volatile int irqraised1 = 0;6 h$ A1 H4 D% J' I+ x
- static volatile int irqraised2 = 0; P- m i7 J# `9 }+ [) Q1 O
) v7 B% W( u' P, R3 U- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ |& {4 F/ s* h4 o$ m% w- w( Q
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- ^: b' W; U2 ~9 Q4 ^ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) o+ C- v8 |' T/ Z - 8 K' h0 z1 ?! z2 L
- dma_addr_t dmaphyssrc1 = 0;7 i) ?- T' {8 z. \
- dma_addr_t dmaphyssrc2 = 0;
& e9 i* n7 G" Z" G - dma_addr_t dmaphysdest1 = 0;( Y: X1 |2 H4 M
- dma_addr_t dmaphysdest2 = 0;
7 u8 b) j* ]! k; x" a a - # t& k, a3 t2 A! t2 d: L/ q7 q% r
- char *dmabufsrc1 = NULL;0 g; t/ i& }. G' o3 M& b
- char *dmabufsrc2 = NULL;
( p# M5 Q7 n' @2 C! e - char *dmabufdest1 = NULL;
( A& u3 X9 P" \4 C& I+ n1 e& p - char *dmabufdest2 = NULL;
! Y& S+ r; G0 C& C
7 x1 c* n3 Q0 |- static int acnt = 512;8 l+ Y. c3 d0 F# n6 w
- static int bcnt = 8;& V4 M" C& P6 _3 f7 F6 S
- static int ccnt = 8;
% c3 N, ?0 M, h. l' [* l - , q: s7 g; P3 q# s
- module_param(acnt, int, S_IRUGO);
) X3 r/ u3 ]9 J% f& ]0 o* w - module_param(bcnt, int, S_IRUGO);
8 X$ y1 @( ?% c: R% {( d - module_param(ccnt, int, S_IRUGO);
复制代码 $ J( m+ n1 L) ^( }5 g
) @4 c# D6 d) j0 r1 m2 z 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# A5 u; v5 {2 j$ W; E$ a
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- O* U6 k& t8 u* d8 T% ] 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 l5 _8 x5 @ Y3 z0 n6 x7 k+ ? N; p9 D3 E+ O
; D. X' v8 q; t
|
|