|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* M* }5 ?4 D) F7 ]1 _+ T- [code]EDMA sample test application
/ y, m4 A2 ^6 M - /*
# \( S: H3 ?0 W9 ^4 ^- |3 I - * edma_test.c2 B Y7 U& ]! f/ x9 s% P' U
- *
0 F! T1 F" r7 X. i8 C2 m$ I3 k - * brief EDMA3 Test Application6 Q+ x' Z9 a7 _! S2 b5 K
- *) d( {. R# v, {( v9 I) M1 a
- * This file contains EDMA3 Test code.
- @) `" S- r' T+ P - *% W7 X4 n$ c/ d
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
7 P2 ?6 l- r* J# ^$ G `9 W0 D* ~ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 R( P6 M! |! V/ Y; z6 F
- * TO CHANGE.
8 _7 H4 I8 `/ P3 b4 _& l. r( X* Q - *
" M3 n7 b: \4 s2 ~7 c/ u/ X - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
# v* f5 o6 S! v% D0 f6 b - *& ]7 d/ F4 |: _9 P& K# p5 b
- * This program is free software; you can redistribute it and/or! C5 P. K: }$ Z, [" P
- * modify it under the terms of the GNU General Public License as4 n4 p# B) T+ A9 L" w
- * published by the Free Software Foundation version 2.* z5 P# [- H+ \; i" U4 n
- *
9 Q) Y0 _1 m- b" B - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
i* V4 a j9 W" D5 E - * kind, whether express or implied; without even the implied warranty' a, K" [) e$ Q: l
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the8 j0 E p: h( b0 [
- * GNU General Public License for more details.! f ~. K3 C6 S( m2 C# o
- */5 P) w) ` ~- D; P$ _
2 y2 {+ r: T G; K& @; `- #include <linux/module.h>
, H! }* ?* r) a! s+ K3 z3 n - #include <linux/init.h>$ A7 U% W: \- f9 `1 y+ X
- #include <linux/errno.h>3 U' l% H4 l8 w# ~
- #include <linux/types.h>; b. B% X4 u; X3 F+ P; j0 }
- #include <linux/interrupt.h>& b/ K) Y/ s. G% X* V
- #include <asm/io.h>
$ v" U; U" j1 b - #include <linux/moduleparam.h>5 J8 V3 X* [4 s! }* ~# P6 {
- #include <linux/sysctl.h>7 ^3 \7 e; o" \( ?, ?8 X
- #include <linux/mm.h>
& p7 T, Y" G$ S8 d2 C0 p - #include <linux/dma-mapping.h>
9 F" g y1 ^7 s! F/ f5 |2 y - * {: c% ^! l% c2 w( `: Q
- #include <mach/memory.h>3 U% C0 `3 A3 t6 P& F$ _6 p6 P) Z
- #include <mach/hardware.h>) h% k- S/ O! l4 j$ i; f! _6 {( h
- #include <mach/irqs.h>
% l5 a5 F4 E* P( @' ? - #include <asm/hardware/edma.h>. [( j" c8 e& B( l. I
- & g) Z; \/ z$ W: m/ }
- #undef EDMA3_DEBUG4 a7 z5 I' D, x7 F
- /*#define EDMA3_DEBUG*/5 H: u8 x; R" F( D( ~
- 5 k1 C( T+ t6 l# m' p+ J$ b2 g
- #ifdef EDMA3_DEBUG
3 h! h+ b' b! d' K3 b, B) @" E# ^1 Z - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), v" ?# v2 I1 Y) |# R
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
8 K0 R6 D4 F P% {8 ?3 S5 K- l - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
" O; O/ l( c9 v; I - #else1 ]" Q3 Y+ ~: |. u# F: @
- #define DMA_PRINTK( x... )( o" i7 w7 E( }6 ]
- #define DMA_FN_IN
; `8 p \9 ?9 l - #define DMA_FN_OUT
4 _' U* c! r( `. ^ - #endif. ~; J1 X* o: q$ d
, o# \6 a& ~( j [ ?- #define MAX_DMA_TRANSFER_IN_BYTES (32768)5 ]) k. j' U c, I- o
- #define STATIC_SHIFT 30 @0 m. E9 R7 C
- #define TCINTEN_SHIFT 203 ?$ J( X# J5 d J0 d! b2 m/ V3 s
- #define ITCINTEN_SHIFT 21
: ], o& {2 A+ \( p( c' Q+ {8 @" N! r - #define TCCHEN_SHIFT 221 J* W5 ] @5 f% p" x) L
- #define ITCCHEN_SHIFT 23
" f; @! J4 H5 U) a" [
/ K: u$ H6 g) N6 `( w- ^* X; H: [- static volatile int irqraised1 = 0;$ r( ]5 W" p1 w0 a: k1 ~
- static volatile int irqraised2 = 0;
6 ?7 i6 @0 [% U/ d% q; u/ h - , X! _8 A9 z/ W4 A" {1 X. i
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 y+ w7 R' P( g1 H- r8 }" |) m+ ]
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- F7 l2 {. t1 o) v
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 e/ _$ ~% p/ ?$ L3 E8 X% ]
, A2 q" n6 I9 F/ } z$ ?- dma_addr_t dmaphyssrc1 = 0;
* f- l5 w- D/ n2 O$ P: G - dma_addr_t dmaphyssrc2 = 0;1 ]2 I5 b" `8 D% d: n8 b
- dma_addr_t dmaphysdest1 = 0;
" t" ^* q/ e7 u$ A# X - dma_addr_t dmaphysdest2 = 0;
% N' Q) O z; f
. T7 Q8 x: K6 N/ P8 j2 D" ]" _- char *dmabufsrc1 = NULL;
0 L- q) Q0 F* P: e7 d - char *dmabufsrc2 = NULL;/ \: P3 R7 H6 V( B* B
- char *dmabufdest1 = NULL;$ Z5 f9 L" `* b- ^/ g
- char *dmabufdest2 = NULL;
- r6 c. P, V. `0 _* y# e" W - - ?" ]; C9 g# W9 C
- static int acnt = 512;
2 Q6 w6 n: ?, {3 l - static int bcnt = 8;
4 r, v) l* M+ H, O A$ E& b. | - static int ccnt = 8;
6 E& |5 u7 ~( |( F
# E1 j7 [1 R a+ |- module_param(acnt, int, S_IRUGO);- g2 ~* O c- L
- module_param(bcnt, int, S_IRUGO);
( Q: o* ?' k J4 m, z - module_param(ccnt, int, S_IRUGO);
复制代码 : y3 a7 M# I" \3 B
4 y I3 `) i% _# ]" }
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 L; w0 @/ H* ]0 o% p$ V$ R9 |
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 |' G! k7 t3 r$ S$ z# ?
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' y1 {6 c6 e( O" X2 i4 Y# X9 k/ w
7 o/ p8 t1 }! J4 L- Z+ @! d
|
|