|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: f% r k) m7 j8 v% W/ c- [code]EDMA sample test application, R [! d; ^8 k5 v( t' k/ r7 Z
- /*! ?; p- f C& M4 o
- * edma_test.c
; W* J6 e) w( O5 P - *: _) H& P% d. \# T
- * brief EDMA3 Test Application# O* E, f* Y4 `
- *1 Y/ F \# _ n: F. u# U, M _
- * This file contains EDMA3 Test code.
, {4 Y9 q0 {) ^ - *
3 `# g( c. \6 P- O1 p: E; b - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
" A0 g4 s5 }3 k2 K6 ~ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
3 T+ \- b4 Y/ _1 o/ [1 U - * TO CHANGE./ ?2 B0 ]# ?: @' \
- *1 I" z7 D; `2 D% j% @) w1 u8 c$ |
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 b6 ^4 w Z' p" P
- *. _5 B# A4 p. m
- * This program is free software; you can redistribute it and/or
/ ]3 c s n9 ^9 p5 ]7 C2 K - * modify it under the terms of the GNU General Public License as, I) n# ~3 J: \9 g' r. F9 V) G
- * published by the Free Software Foundation version 2.
0 j6 D# O& y, G2 i" j - *" d Z0 i# _3 |* F# |& V
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
: y; @! B T9 p2 G! L/ w( | - * kind, whether express or implied; without even the implied warranty
. Z8 ^" Q; H1 `) L - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
& x& F* B' e3 p+ ^1 v8 T( r) ~ - * GNU General Public License for more details.
/ n+ T4 M, m+ A" _! p - */8 t+ H+ K8 A" p# B
- ; {5 r" N% ~3 `8 Z' c- P) ]
- #include <linux/module.h>
. V. V& o1 h' ?- n# a) ` - #include <linux/init.h>& H, ^. F* p) V0 T$ n8 O- i
- #include <linux/errno.h>) f0 T0 a) Q7 T1 X3 A4 _& p; y
- #include <linux/types.h>
7 t9 {! `8 }) U, h' p% j: Z$ V - #include <linux/interrupt.h>, \: a; J% e& [! a
- #include <asm/io.h>
- j! e9 f1 e; r- g/ | - #include <linux/moduleparam.h>
- I! a- v4 }- l! n8 y - #include <linux/sysctl.h>2 s; p! Q |) l% @* _( x4 w2 {
- #include <linux/mm.h>
3 k; \( N" \% r; o% H, O1 O3 _ - #include <linux/dma-mapping.h>. U! ~7 i$ c ?6 N4 n( f
: O2 D7 e4 Z$ f8 U7 v2 m4 p- #include <mach/memory.h>
* H% o. T( |6 s- h, M* t, U% a2 [ - #include <mach/hardware.h>
4 n: q( J) [8 ^+ \9 ` - #include <mach/irqs.h>' y" N: b' b8 O. Y
- #include <asm/hardware/edma.h>/ y* @ \+ n, L4 E- V% `
3 P9 u; n! S" [9 A2 ^0 V( L) P- #undef EDMA3_DEBUG
; O1 N9 Y% V5 \* I8 N) K+ ]- b - /*#define EDMA3_DEBUG*/
/ }! O9 I7 ~4 h5 m- d: \ - 9 w# X6 z: H; z6 X+ a5 R6 _. u3 @- z
- #ifdef EDMA3_DEBUG
7 c) R5 a& P0 o. g4 S. S - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
1 [+ k: U6 o# y1 f0 q* [% G, |: h - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
$ t: i0 ]( [4 K; T/ \" r0 y - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* \- ?! o- x( x4 C7 w6 W0 d5 m
- #else# w& X0 ^) G4 e) B
- #define DMA_PRINTK( x... )
& O: f8 o' `; X$ G& r0 _ - #define DMA_FN_IN
% u/ g( l' J8 o" n& a - #define DMA_FN_OUT
2 {* F6 Y1 _: J. K- F& t% s - #endif
9 r7 q, n. ?6 a' V7 Q; ? - 8 `# B5 N. U4 ?$ F$ q% ?! ?1 e! y
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
. d! K2 x8 P% O6 m3 l: v, Q - #define STATIC_SHIFT 3
+ \7 X, A1 X1 I J - #define TCINTEN_SHIFT 20
' L3 m9 o0 O5 O7 L. _3 K( G8 v2 H4 z - #define ITCINTEN_SHIFT 21
1 H4 [( m9 u* ^+ e - #define TCCHEN_SHIFT 22
% A6 T) `. Z: z4 h' v# U - #define ITCCHEN_SHIFT 23- @ i6 a( w, i1 }+ x
' r: b* k8 z. k8 @. t# t- static volatile int irqraised1 = 0;
3 i% u/ M: M F) b - static volatile int irqraised2 = 0;
" r6 H- Y: Q8 @# o' L* r$ Y
2 ]+ a: x. C& K2 D. u9 \- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. N- i% X) C( G
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! O9 [8 D8 m9 T4 T1 S- e/ E
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! z4 N& c) c4 O" r: F
1 ~. ]: z) P. n& a( c* O- dma_addr_t dmaphyssrc1 = 0;0 \0 ~8 m/ f2 i7 x1 v* e# y3 o
- dma_addr_t dmaphyssrc2 = 0;4 e* \/ F9 B! Z+ _, D
- dma_addr_t dmaphysdest1 = 0;
. o6 `& l; ~4 [1 {* ^, S7 G9 c - dma_addr_t dmaphysdest2 = 0;
$ V& T( |- k( W8 B* m( }/ Q
/ N- e9 v. t8 V7 h3 x0 s- char *dmabufsrc1 = NULL;
% i2 t, b& H2 S - char *dmabufsrc2 = NULL;
. B; f0 }$ |- T" l - char *dmabufdest1 = NULL;
( v6 q1 m# V! K6 ~' d - char *dmabufdest2 = NULL;& o* O* i$ b* T" O7 \$ G, d% u, y
- 0 P* U2 D3 g& g/ s6 B3 s/ h- s1 H: x
- static int acnt = 512;. c4 M" ~. v& Z
- static int bcnt = 8;
; u% r7 p; \9 J$ S* c' Z - static int ccnt = 8;5 O* ~6 S6 O6 H1 J/ ] q5 F3 \
- 8 d$ F# w O% y6 C* _
- module_param(acnt, int, S_IRUGO);' g& P- O2 V) X0 G" Z1 m j: ^
- module_param(bcnt, int, S_IRUGO);
6 O: F& R8 ~8 }6 s; ~0 v - module_param(ccnt, int, S_IRUGO);
复制代码
4 Q, T/ ~3 S( E+ ~: n6 N' |# a |" N9 H
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% \* t: \" t1 B, }# u+ k' z5 jarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. q' s6 F9 V0 H8 H 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ W, Z7 S% s" h
. ?# m5 c+ [5 Z; i3 e4 H/ ? Q& I' n/ t- I1 Y6 e4 D
|
|