|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " W# x/ _8 b8 x5 G/ J. M7 d# c
- [code]EDMA sample test application& J! Y1 M: g- ]9 r* ~+ Q5 ?4 Z
- /*
; |+ O1 V/ h' _" y$ l - * edma_test.c$ W4 C- f+ w' z4 s, Y
- *- l2 }) Y7 J& I+ w
- * brief EDMA3 Test Application( e- O: ]9 l- ~7 Q0 V i
- *
. m# K& E% V) X - * This file contains EDMA3 Test code.
4 v" {. z5 k& i! g/ l' j8 O: g - *& q a9 t% t: f# D
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 \; ^ E8 C2 ?2 y4 C+ R4 s
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 o' @4 F/ ]1 o' {
- * TO CHANGE.
9 v }, c2 H9 t; { S U- N - *5 B1 V, z$ S0 ~) b* E0 z& I
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' E3 a6 V! u0 j2 N/ G' c# p
- *7 ~4 Q6 m3 i8 j1 y0 ]$ N
- * This program is free software; you can redistribute it and/or
% |3 s& M% K, g! G0 @ - * modify it under the terms of the GNU General Public License as
+ w/ ]2 V& [: \8 m/ ` p/ B - * published by the Free Software Foundation version 2. q7 Q7 [# E z& N2 ~" L/ E
- *
u' q. l0 s, j9 A5 n( C - * This program is distributed "as is" WITHOUT ANY WARRANTY of any- D4 U! U) [% x4 g* D: P$ t
- * kind, whether express or implied; without even the implied warranty2 ]0 H1 `+ i( l7 U" L A
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
( |3 s( H7 z1 z) S: U, g w" l - * GNU General Public License for more details.
1 U4 C, L7 D/ J2 m+ A% ` - */
& g, B( X. m5 b6 X6 U - 1 o8 u+ [8 Q w
- #include <linux/module.h>
9 L- T, I" ], N. [ - #include <linux/init.h>* j t/ E/ T, v5 k% y) B& @
- #include <linux/errno.h>2 j: I# W) H% ^+ T/ Y
- #include <linux/types.h>
5 H1 N' ^0 w9 f - #include <linux/interrupt.h>
( N/ Y" b+ `6 ]# e' P- V - #include <asm/io.h># c0 g2 {( ]2 Q, N# y
- #include <linux/moduleparam.h>
# q$ U; H* H( ?7 v( q - #include <linux/sysctl.h>
3 C# ?: h( ^8 {+ a# P - #include <linux/mm.h>
9 g) h2 z! z) m2 ?9 B, b e& E; s - #include <linux/dma-mapping.h>
) L8 I) y6 G0 z - 2 ]% y& D p0 @- _
- #include <mach/memory.h>5 G p: }; y! G# B
- #include <mach/hardware.h>
0 L1 {$ s k# O: n% T - #include <mach/irqs.h>
5 t' ?6 m5 {) a/ i" Y; y - #include <asm/hardware/edma.h>
/ l# V+ o8 z6 k4 u# P! @
9 W% e* I& i; u1 l) ?* U% Z- j8 ^- #undef EDMA3_DEBUG) K! t9 h$ q9 ?/ e) d0 h i2 g
- /*#define EDMA3_DEBUG*/) s8 ]1 v& M6 r$ j( x( v3 ^* m
- # A+ ~4 B' z+ P/ U* K: `7 O% M |
- #ifdef EDMA3_DEBUG. Z1 u5 s' b; D t6 q7 W
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
; x' a8 M7 w5 E/ c; t9 _ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
# _5 H: k( `9 j0 N - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% I% _5 v2 D% t4 E
- #else& J/ \) y, _+ o& `- s
- #define DMA_PRINTK( x... )
$ b- V8 u4 D6 W) Y! F - #define DMA_FN_IN
& B. F* T/ ?! Z6 W5 v S - #define DMA_FN_OUT
! g, S; F$ ?, ^ - #endif' ?' e) |- M5 {4 @: C; J# ?9 J
- 9 o+ v6 o& s! G/ p# R. y
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)% r( A1 b8 W9 q7 G
- #define STATIC_SHIFT 35 g; H" z* Z% q/ b: t0 v
- #define TCINTEN_SHIFT 20
. b* O8 C7 m1 n6 I2 S - #define ITCINTEN_SHIFT 21) Y+ {6 w- l% X
- #define TCCHEN_SHIFT 22& Z6 J% z6 L6 F5 u8 \' x8 o8 S
- #define ITCCHEN_SHIFT 234 L* s n( M+ \# G- t- {& y; d! J
- " K7 M% o5 z1 q0 |
- static volatile int irqraised1 = 0;2 l# n6 X9 |3 ~7 s6 W* F# B
- static volatile int irqraised2 = 0;
j) _8 ]7 W$ p. B: v1 _7 } - , j0 \: b9 Z9 E. s
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; m2 B ]5 K& p3 z" v$ ?& ] - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 M) L5 {9 E9 U6 |+ }& n9 [' D - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 m' ^; g2 ~; b9 k4 X* k
7 J" E$ U _( N- dma_addr_t dmaphyssrc1 = 0;
* N& Y, r; m# O6 O1 [7 \* B' Y - dma_addr_t dmaphyssrc2 = 0;
9 M" N- @- l4 V. J$ E+ L - dma_addr_t dmaphysdest1 = 0;) g8 o( Q$ A" j' T ~7 }! L- Q' Q- d
- dma_addr_t dmaphysdest2 = 0;+ N- p. p0 L# x; S
- 0 M1 Q9 ]2 B3 R I6 D) Z; m% X
- char *dmabufsrc1 = NULL;" R# d) a* U+ t) N
- char *dmabufsrc2 = NULL;. W0 ~9 ]- `" Z; y
- char *dmabufdest1 = NULL;& N# h# Y1 X, ~! N8 u! h( J
- char *dmabufdest2 = NULL;
1 M0 S! f9 }) }, X. C( j/ V
6 K) f8 l! E" C5 O$ p: e3 r- w5 C- static int acnt = 512;$ Z0 l8 l, L$ D9 v) D L; _
- static int bcnt = 8;
/ p+ b2 {: t+ c: X - static int ccnt = 8;, _6 H9 M2 t+ T; q
6 _/ B% r8 {$ V$ ?3 _& Y* W$ i8 G- module_param(acnt, int, S_IRUGO);1 B( J, r# `1 }7 T9 i s5 t$ ]5 r
- module_param(bcnt, int, S_IRUGO);2 D6 H3 C$ z2 W& z
- module_param(ccnt, int, S_IRUGO);
复制代码 . W* s) U+ i& b" ]# C) r
: d, E+ ~7 j3 h2 p 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' b* k, P8 |+ w1 h: Y: u \
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' `: s( f3 ?0 r2 l5 g& X
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 O2 j( n9 \3 M" S2 R0 D1 B2 j- F) q) J {* @
5 k. i# ]5 [$ ]+ W; |* o |
|