|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 F* o* q d8 P; W- [code]EDMA sample test application
) y( f" Z$ J4 }3 y - /*% ~+ ^5 C& D8 w1 |
- * edma_test.c7 h3 H! m0 k b
- *
6 \# E# T; I) P' `* a - * brief EDMA3 Test Application
2 i& d: P8 U9 b* n0 m% C# i - *3 l8 U1 {9 w. v
- * This file contains EDMA3 Test code.. d0 W3 z4 w0 N6 h8 v G# K8 ?( U
- */ |2 F* }; z [* d# ?
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
1 C' p7 c; W9 ]" t0 R. L, K - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' q/ H* P6 N- C( `! _' _( _
- * TO CHANGE.2 u1 F v& G0 u+ u% p A; j
- *
. N4 T8 m) ?- Z - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
0 ~ ^9 l' D+ ^: a3 R) O - *: a% `7 A3 M, F: R% u3 j
- * This program is free software; you can redistribute it and/or
* V- F# ]! h3 v0 c - * modify it under the terms of the GNU General Public License as
* b) \( w, \5 {, J1 Q# W - * published by the Free Software Foundation version 2.
2 D& J+ o4 P2 a8 h2 v% L+ E - *
: ~( r9 u5 t. | - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
, Z t. F n& M+ Q1 _ - * kind, whether express or implied; without even the implied warranty
# w/ I ^! D- \: [9 @ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8 q. ^: n5 e/ n1 [4 X - * GNU General Public License for more details.9 {. Y6 U' H: |6 h b% } w5 L
- */! x) Y; F- Y4 ~
- & Q2 N0 X8 [" b. Y' E) b
- #include <linux/module.h>* k% x: I" {; H% m
- #include <linux/init.h>8 z9 | z( H1 z
- #include <linux/errno.h>7 z5 Z0 v _ K8 e
- #include <linux/types.h>7 \" W5 ]" a/ h$ }5 k
- #include <linux/interrupt.h>
' F; A; J: [: l9 T - #include <asm/io.h>
/ x; B8 k8 w( _ b6 B$ d( ]" g - #include <linux/moduleparam.h>% R }0 d; u8 Q/ W* K, g/ P- Y
- #include <linux/sysctl.h>$ @. L( j. C! [4 a2 j
- #include <linux/mm.h>
( [6 c- G5 A# D2 I. Y - #include <linux/dma-mapping.h>; A9 ?' _) e0 ~+ c2 W
7 D, ?& Z& d% x$ l- #include <mach/memory.h>" ]3 r0 ^- S! F2 V* Z% [9 ]1 e
- #include <mach/hardware.h>
- N) Q: m3 C) v/ ]3 U/ e% M: v - #include <mach/irqs.h>
$ X- a6 x$ M4 C# [! x" N3 F - #include <asm/hardware/edma.h>
& Z; Q8 ?2 `* {2 T6 w: m' a7 H
' d5 v6 g6 y! t( p( c- #undef EDMA3_DEBUG
7 `1 q; G! k9 x) F* R" u0 } - /*#define EDMA3_DEBUG*/0 A8 o+ k) w7 F0 h$ P
% N( y3 T, Q+ `. p- p5 Y- #ifdef EDMA3_DEBUG! ~1 V2 {" n# h7 k. n' _* C
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 e. n" ^0 G( `2 r+ M# s
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
) P! o/ E' q; f7 c3 U4 U7 g- f- ? - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
; M/ i3 ^# Y5 ?7 \& I' n+ } - #else7 x7 h. l# B/ l( D1 V \
- #define DMA_PRINTK( x... )9 x7 p! @6 a( ]: _
- #define DMA_FN_IN8 X! _, ^! T. U: _( q9 h/ j! h
- #define DMA_FN_OUT
1 ?/ A; S; l0 {1 d l/ {* E, Z - #endif6 s5 {7 r0 d* q5 y! [0 L# b
4 i2 `# ^; J) ~ l! H, Q- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
% L- x* w5 P8 N3 X - #define STATIC_SHIFT 3) W- H0 L5 R5 K+ M7 A2 r* m3 `
- #define TCINTEN_SHIFT 202 k9 O# T& b9 |
- #define ITCINTEN_SHIFT 21
; i$ x- f! ?/ V9 d - #define TCCHEN_SHIFT 225 G% v# Z) q1 c! u& b# \& w" i) ]1 |
- #define ITCCHEN_SHIFT 239 E( a1 h, m2 N# U
' y8 o0 D; i, [! |- static volatile int irqraised1 = 0;
9 O, m+ Q. ?* }2 e* ~/ [0 E! b/ A - static volatile int irqraised2 = 0; e% i- i$ Z: w7 ?3 e
6 H+ _- u Z% D% E- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& w6 c3 {+ b* ^) Q& x, z0 {4 Y
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* I D+ q z6 T4 R7 i1 a$ I* | - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! B4 s% ^2 A3 Y0 ]
# Y |' k9 M5 j, c2 x/ ^9 h6 E9 X/ x- dma_addr_t dmaphyssrc1 = 0;
# n, t1 W* J, l; n - dma_addr_t dmaphyssrc2 = 0;
3 D, `4 M' [$ z, E5 }/ T9 V# ` - dma_addr_t dmaphysdest1 = 0;5 n% q! f1 n7 d' H n" n
- dma_addr_t dmaphysdest2 = 0;1 D p6 V% r3 C9 Q4 P
+ k. \& l* q f; I3 `. _9 I8 M- char *dmabufsrc1 = NULL;6 p3 d& N7 A: Q1 _
- char *dmabufsrc2 = NULL;
1 R9 v: ^8 @. v/ J* y5 P# V - char *dmabufdest1 = NULL;1 g# K# x2 E, p- d2 `
- char *dmabufdest2 = NULL;* T, l; {1 x& l! D" A- H
- " T, ^* Z! w, r: X1 ?5 G: e
- static int acnt = 512;
, X) D/ i. @6 f" c - static int bcnt = 8;
. w& S$ l Y8 z. D- `- r) E0 g - static int ccnt = 8;/ T4 I) t# B6 e7 [
- d' B3 o! f: b3 j
- module_param(acnt, int, S_IRUGO);
9 H$ |) k# p9 ` - module_param(bcnt, int, S_IRUGO);8 V. a2 Z: i& J5 {
- module_param(ccnt, int, S_IRUGO);
复制代码
& r$ p4 Z: z( `1 U# ]% y- U
) i# v& a2 p! ~ |- k5 f* V3 b 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 ]6 g$ _4 r& l2 M9 C P: E0 M
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 V- X, w0 Q4 n, a! q' H& M
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# G- ~; A. s% ` H
+ |3 E" O! ?, z4 ^
' x# T! u% I3 {2 f, X( @! ^ |
|