|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
g) O; N2 H, T5 a% e# m- [code]EDMA sample test application+ Z5 p" H; Y6 n
- /*
) g- \" I" ?+ T* ~# t- P1 r - * edma_test.c
; V3 f i6 P- { S0 ~( f, D - *
: L) s# K N5 h/ N% G) ~* b+ d1 q - * brief EDMA3 Test Application
9 q" Y) r" \; D& K3 e - *; ^5 y: n/ _. E/ D. b) ?! L. v
- * This file contains EDMA3 Test code.
: D. R4 Z6 W( i, a - *- ], N3 F# o+ Z7 ?' S F
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) m1 @) ?, T9 {
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; `1 s% M7 v/ C l
- * TO CHANGE.
- U4 B2 m5 F: H$ ~ { g - *( q- B3 t8 Z& ` X$ ?
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
, ?. c6 t5 n1 v) @ - *3 A8 l. N- ?% }) J
- * This program is free software; you can redistribute it and/or5 N/ b0 N9 ^9 ]7 q
- * modify it under the terms of the GNU General Public License as* G4 s8 ~2 ^8 l: L4 `
- * published by the Free Software Foundation version 2.
, u# N2 K" ?7 s) w4 A - *
% @1 |# P5 A0 l - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
4 n: d2 T+ p" d0 z8 l: D - * kind, whether express or implied; without even the implied warranty
9 v+ b9 k: Z# ?: F9 W3 n - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- s+ P/ a" U3 P( N S4 @ - * GNU General Public License for more details.3 E0 i7 n# C8 L, q; r, f
- */; N; p3 H8 w( X2 }) H# x. D
- 6 B# o7 L& W8 J% x; ]
- #include <linux/module.h>* Z% K5 B$ m3 ~7 m5 y
- #include <linux/init.h>
+ }4 I5 M! i* \/ f9 I3 I - #include <linux/errno.h>
a1 V# i6 v/ \& F! T8 U& K. F3 q - #include <linux/types.h>1 `) R2 V% L5 X5 R: m4 p# J
- #include <linux/interrupt.h>; C p/ `( k% R+ q8 p4 w% s
- #include <asm/io.h>, r5 z! _; }3 a0 c* w
- #include <linux/moduleparam.h>9 ~. d" @2 S) o+ l) L
- #include <linux/sysctl.h>
0 H# ~& ]4 |2 t) B% ?* j. n s - #include <linux/mm.h>' O% f, L- e' D& p, `4 ?1 J. G
- #include <linux/dma-mapping.h>! t# ?! ?% U# {8 t3 o! }% N
6 _; W* `: [: B K1 i1 f; e- #include <mach/memory.h>
7 L* p4 l9 }0 p! [. ` - #include <mach/hardware.h>
) g7 B8 J( V2 S! T e* t( U+ c - #include <mach/irqs.h>* W/ Z; p6 ]" J+ ~. q0 S
- #include <asm/hardware/edma.h>" V/ u1 g: _7 n3 @0 G; a4 P
- $ o; r% S; v8 K- ]! S
- #undef EDMA3_DEBUG* @+ h7 U2 r5 [" q' s o1 ]1 M
- /*#define EDMA3_DEBUG*/# J [4 M0 W: z) M: X
. O5 ^) n ?1 j- #ifdef EDMA3_DEBUG
, w6 `- b# G! M' s" R3 k - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
! i. `3 R/ H* E, ^. @ s3 M - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! L' i5 `0 Q# s1 ^9 E
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 \& f' X0 {9 U" |
- #else
- `4 H; B7 `; w; d - #define DMA_PRINTK( x... )! Y+ C) m9 ^& O+ I
- #define DMA_FN_IN
( |- s/ e3 A: E# u - #define DMA_FN_OUT
$ |9 @2 l$ H; V; n( n% M - #endif5 o; L6 o# R1 P3 l- `# O/ k5 ~5 \, O
7 f4 K$ u5 _! o) n* m8 M- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
8 S3 X: ~- s9 w - #define STATIC_SHIFT 3
9 y. _: u: J6 w3 @% B) |$ F - #define TCINTEN_SHIFT 20- e" _+ O+ C: E6 G( S, a0 r
- #define ITCINTEN_SHIFT 213 c* f7 ^9 x6 r$ L" j" |. ?
- #define TCCHEN_SHIFT 22/ @' V, @- f6 U/ D
- #define ITCCHEN_SHIFT 23, m+ ~: X" Z) p. u( b& x& d
1 N; ^* R3 f; u" ]% g! H9 \. G8 b- static volatile int irqraised1 = 0;
' Z( @( |' {3 T0 L& D( K L - static volatile int irqraised2 = 0;
) v; Z3 j& m, t0 |, P
: e+ n! r" |7 j9 l' n5 X- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 a0 r$ k0 I! C - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) [& B' J8 ?/ y5 q' T4 s" G
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" j' c0 Y8 t1 Y. A6 v- R: D6 j# k2 X
: g% Z' w, ^, \$ T5 l; T5 t- dma_addr_t dmaphyssrc1 = 0;
) o6 x: M8 ?0 w% C - dma_addr_t dmaphyssrc2 = 0;( a3 ?4 t p' S5 ~0 y1 X
- dma_addr_t dmaphysdest1 = 0;
9 _4 S+ c. [) x - dma_addr_t dmaphysdest2 = 0;
& I2 E, j! K5 m b0 y: a* c
' P: [0 q, h. c+ U- char *dmabufsrc1 = NULL; P! Z6 C* H+ |" l. G3 E" c8 P
- char *dmabufsrc2 = NULL;) ^2 C' j3 ^% t7 b# t6 w" s
- char *dmabufdest1 = NULL;! a" W! K6 o# G5 u( m4 p
- char *dmabufdest2 = NULL;
9 K; W7 D5 g6 e, V
' [/ R2 a8 S; R3 _% @" q" N6 M8 r- static int acnt = 512;7 T' |3 ?$ k* [1 ]' `6 S O$ C: y& O
- static int bcnt = 8;
7 ^5 [) x! K$ f# M. R - static int ccnt = 8;
; h" f# F8 e+ J$ W+ x - 0 b6 D0 j1 ~ o/ S) Q$ }2 t' E
- module_param(acnt, int, S_IRUGO);
9 k3 n2 b+ ^2 j+ T - module_param(bcnt, int, S_IRUGO);
9 p7 a9 O8 k; C/ w - module_param(ccnt, int, S_IRUGO);
复制代码
p8 s% r6 ]4 U; Y, F- o, w; W" k) U& e
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. S7 c5 {- D% ` B6 t4 f+ S( k/ t% \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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 ~) L9 g3 \% V( }
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。; K I: h6 p: t1 H! N4 [
! X" D; J& A) c7 x4 M# ]% Q6 y+ ^5 Q- q5 U0 ]" J1 y
|
|