|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 V( k2 [( e; X+ T3 a
- [code]EDMA sample test application
2 a/ E9 R0 E1 @ - /*
3 E3 o6 t7 f9 A' A - * edma_test.c
) I. ]5 N( \, r! L4 u5 ~6 | - *
# }7 b3 E' S) V9 n; r- Z' V - * brief EDMA3 Test Application
8 C: h& }2 y1 w, t& {: H - *
" V% j, y7 q* Z1 r- S - * This file contains EDMA3 Test code.
% a7 s2 c P( I9 g9 o$ I - *4 o7 N/ m' k6 s; a3 K
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
4 e- {4 U! ^8 l - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& L$ G& s( ]% j% B2 W$ I8 e! U
- * TO CHANGE.
, P/ R) \3 h) m1 r - */ t/ ], A6 _0 [0 V: t! F% i: I
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: w% O2 {$ e3 V* `) i
- *9 K4 l0 N3 d: w, f' M- Z, z
- * This program is free software; you can redistribute it and/or# V, `9 }) ~) `0 q7 J
- * modify it under the terms of the GNU General Public License as3 O/ z4 d6 K9 m% n i) b
- * published by the Free Software Foundation version 2.
% r' M: h. W2 q9 k - *. y! C1 e( M9 Z+ Z9 B$ G1 F
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
) P& y6 e, t% S9 l! B - * kind, whether express or implied; without even the implied warranty* s, K8 D" z: B9 g
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the, E4 j* ^: }6 `6 Z
- * GNU General Public License for more details.; @# a9 k- G3 d C& x" P1 \' h8 }
- */
0 s- o, H6 G4 W/ S6 X - . l* y5 K5 Q6 B Q( w0 ?6 ^
- #include <linux/module.h> L5 C: e6 G& v2 Z+ `
- #include <linux/init.h>
' a& ~, _4 o) @/ ] - #include <linux/errno.h>, h7 V0 b5 G4 S# c+ }
- #include <linux/types.h>
6 j# @" d$ l0 b) [4 g - #include <linux/interrupt.h>. v. A$ G* V9 s/ s0 ~( V4 Z2 d# V5 c. |
- #include <asm/io.h>
6 m! m/ M9 c7 P$ B4 ] - #include <linux/moduleparam.h>+ d' ]! ]+ b5 w I `$ m: p
- #include <linux/sysctl.h># T1 l' w1 ^; V: Y& _
- #include <linux/mm.h>
+ N" ?% N* E9 M6 B* U [/ ^7 X# Y - #include <linux/dma-mapping.h>
% e1 L0 g/ R# e2 G - 1 Q* }7 V! A% X4 E
- #include <mach/memory.h>$ C9 ~( K3 R0 X+ O
- #include <mach/hardware.h>
$ @3 k" X. I ?: J# {2 j" n - #include <mach/irqs.h>
# F) `( Q0 j# c' p) F - #include <asm/hardware/edma.h>
# A6 e& c; l4 q9 M' s: _9 u* s
2 I4 f7 l1 p& r X- #undef EDMA3_DEBUG
9 K7 m) p; `* B* d8 H - /*#define EDMA3_DEBUG*/
& m! b' E" O3 c& D2 d( j, W- \* v - 1 B* g, _+ p4 q; [
- #ifdef EDMA3_DEBUG
. C' B( O% O: E - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
+ ~. n3 P( g5 `' j2 ^ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
' Y; J: i3 i z, _% f - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
# M5 e2 V; g+ g; U. J! [: F" K- @ - #else9 Q1 Y N* _1 W2 B$ w
- #define DMA_PRINTK( x... ): d" ^7 a# @# q
- #define DMA_FN_IN5 u" \) R9 o4 C2 X
- #define DMA_FN_OUT# n+ |# n0 t, G7 g% c) s# [
- #endif7 w# \( J2 Y! B& K8 E" }+ P/ E* ]
- 6 y7 c; N& B& U! m# `
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)& @. b2 t- w; }4 y0 W
- #define STATIC_SHIFT 3& C: h$ I1 ], \5 o' w
- #define TCINTEN_SHIFT 20
. o2 G. }/ B$ y0 B9 Z) \! R - #define ITCINTEN_SHIFT 21% c* r7 T/ w" i, L7 U. }( v
- #define TCCHEN_SHIFT 22
4 L: \6 q: T) Y% g - #define ITCCHEN_SHIFT 23! L$ F5 @; c5 Q: S. M ?3 ?+ a2 b
4 L) n |& }6 |/ T0 e/ o* h4 L- static volatile int irqraised1 = 0;
, _& i; J5 {! c2 y3 J1 M$ I - static volatile int irqraised2 = 0;! t. H1 u9 V3 u$ k& U
- & V9 [' Z/ H2 _
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 o3 Z, B, ^1 K0 l - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 ]2 u' Q/ `' d* M - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ {, Y# B6 T, O t2 Z, I5 w - $ K. q8 ~8 x* u3 A5 n
- dma_addr_t dmaphyssrc1 = 0;9 J- x& H! N0 _# [3 j2 l, [3 |9 x
- dma_addr_t dmaphyssrc2 = 0;
) t8 k6 c# d" z- c8 n4 k6 j2 F0 C0 x - dma_addr_t dmaphysdest1 = 0;% s6 @0 o6 n) N7 q% L& _$ {
- dma_addr_t dmaphysdest2 = 0;/ [" M# Z9 y d) Y7 C
5 _8 Z& X: [0 c$ z8 \1 d) g) W- char *dmabufsrc1 = NULL;* m3 V+ u) W6 v# y: v
- char *dmabufsrc2 = NULL;: g; n( \" x0 n
- char *dmabufdest1 = NULL;
7 s1 ]5 V$ g9 O0 O+ _/ L; L - char *dmabufdest2 = NULL;2 X+ [" i$ Z/ o5 g
4 K% Y/ a3 W6 N4 \; N A/ f- static int acnt = 512;
" l4 T- H9 c" m' j! m/ p - static int bcnt = 8;
% u2 C) r. E$ ]* i - static int ccnt = 8;
0 ? S$ a4 @5 N$ H* n8 I - # a) N/ G4 _+ X5 y u& H" M
- module_param(acnt, int, S_IRUGO);) ^ z" \/ c+ R, w5 i. X; E4 r
- module_param(bcnt, int, S_IRUGO);; e" K6 X$ I- V/ |# v S
- module_param(ccnt, int, S_IRUGO);
复制代码
1 M, C y) A( U. q# E/ T- O z) a/ H+ D6 g( v n! L+ h* t" o
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
9 X7 \! A/ v. v& K _; earm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 Y P4 P, U1 q5 X3 R
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 Y0 x4 M' f2 B- m' [& e4 A; M( d" A
- h8 U" k5 F) T5 u* Z& E, a/ L& V |
|