|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 ^$ Z8 j" z& c; Z$ C, C/ n9 l
- [code]EDMA sample test application
* L" @9 j$ t5 j! f( H% C* \3 k/ u - /*
- B, L4 D. l5 h) O - * edma_test.c2 C5 C6 r) n: N+ ]- {
- * p* ^% t( L- D) L+ [: x" D: t
- * brief EDMA3 Test Application
; k* ?4 }8 ^. V# \# l - *
3 Z7 o2 W4 W8 V9 A! c. H: K - * This file contains EDMA3 Test code.3 L4 y$ n0 b7 H0 q: T
- *6 W5 z1 ?; _1 H! T; @* H) m
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
/ h! F& z0 m( A1 n( k - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
* T6 h$ x& x0 ^4 t - * TO CHANGE." ~: b+ g; v( {
- *" i. f6 x+ U) F8 d- o/ V
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& Q% t7 `, Y$ W9 `; q
- *
1 J0 q; y+ t$ z, z) O/ N6 i - * This program is free software; you can redistribute it and/or' J( u1 w) F* j0 I
- * modify it under the terms of the GNU General Public License as
9 q; Z$ s' D, z - * published by the Free Software Foundation version 2.2 o1 D# W/ l$ ]1 p! I) p
- *9 q1 k! L0 E& E S3 R" K" ?
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 S& x& k8 S6 [5 I
- * kind, whether express or implied; without even the implied warranty
/ H4 q5 z1 N3 g& X* p - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the& q' k2 t- ?% S
- * GNU General Public License for more details.& s* U: L3 X7 h" m# J; g/ g d7 h
- */
* q* v9 @$ Z$ W/ D
6 v9 M' V4 y! A' r2 z8 O! d! C- #include <linux/module.h>, t6 B# q/ T) f
- #include <linux/init.h>. \( X/ G: l+ N O% u
- #include <linux/errno.h>! V' E* c2 T5 k
- #include <linux/types.h>3 P) W' q4 |3 F
- #include <linux/interrupt.h>
1 a( ^( \0 N( K6 m' \2 {3 f9 { - #include <asm/io.h>
+ p4 u' b3 J0 t, q H% }& E - #include <linux/moduleparam.h>6 d3 w' I4 @* U' Y; V* w! H& C1 V
- #include <linux/sysctl.h>% Q3 i: ]" H. B% y1 V/ L3 r& A$ b4 _
- #include <linux/mm.h>5 y9 S$ t+ p0 f$ s
- #include <linux/dma-mapping.h>
: d$ m" T- Q X5 s - / c# C1 c+ Z4 B K
- #include <mach/memory.h>
' I; N, r6 g7 q9 E( P - #include <mach/hardware.h>
& o, T% J0 q! ` - #include <mach/irqs.h>4 `! N3 g+ V5 |: b3 j
- #include <asm/hardware/edma.h>
# [" a7 f8 r/ p# ^1 X
5 s6 O: Z% r3 n$ @$ s+ k# P9 J6 T- #undef EDMA3_DEBUG
) U' L' j3 H+ v' v* P - /*#define EDMA3_DEBUG*/# L" i$ a2 J. Q5 d) e* @) k1 k5 l
- ! ~6 g+ s. P) P: {
- #ifdef EDMA3_DEBUG" T+ R1 @' w' E8 t: Z
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" F* e* U: @2 e2 u' e
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 W0 ^1 X7 c% `, F* i9 ?6 J
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
- C+ V; x. \/ V, R9 f - #else
) x2 ^/ y2 ]9 j X, g- R z* x ~ - #define DMA_PRINTK( x... )
9 X/ ]" b% i1 ]; H6 ~/ `, `: M - #define DMA_FN_IN z7 l" [! ^ [4 [' P$ M
- #define DMA_FN_OUT1 R! ~ ?6 B1 I9 N: S2 J! y: s3 O
- #endif; R% h g* X# k( M
8 h+ \3 \# v2 _% m, K1 |+ R- #define MAX_DMA_TRANSFER_IN_BYTES (32768)# F5 T! d: o6 b7 m4 y4 b3 c9 C
- #define STATIC_SHIFT 3
2 ~- J! n% m) `+ t5 R& x5 O9 w! } - #define TCINTEN_SHIFT 208 g1 z- q% r6 o$ i1 ?
- #define ITCINTEN_SHIFT 21
- d3 Q+ m5 @ @. [4 \2 M* @' \ - #define TCCHEN_SHIFT 22; i! H0 g# U, v6 Y
- #define ITCCHEN_SHIFT 23: E2 C7 o6 c& ^% y8 {' W
- . `$ [) @! l( Y( M, ^+ |! b; r, {
- static volatile int irqraised1 = 0;
, U: A9 ?' S t# \; e% k - static volatile int irqraised2 = 0;
% K% {/ s1 y. q9 b" j - ( W" C; P' A% b. V6 u/ W, y( X& l
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 _0 V+ O- u2 S, H - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 M: g7 y0 f7 t, u# ^: E - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, k4 y! b7 q0 t X8 V* K
- 5 K" v. B9 P& }1 G+ ] p& o
- dma_addr_t dmaphyssrc1 = 0;
9 F8 x B! C- e8 l# a - dma_addr_t dmaphyssrc2 = 0;
& z, Y1 U8 t/ Z4 t& o& H& F' u - dma_addr_t dmaphysdest1 = 0;
3 D& x# P) n; u6 A - dma_addr_t dmaphysdest2 = 0;" Y$ e8 L5 l" G4 z
- 9 ^0 B Q, r; k- t
- char *dmabufsrc1 = NULL;
! g) K& l5 f' p - char *dmabufsrc2 = NULL;
; o: p2 ]# G( d - char *dmabufdest1 = NULL;
_% l$ d8 T0 x* L - char *dmabufdest2 = NULL;
% j3 M8 L9 P& J - , b6 U, d7 F& ~8 k
- static int acnt = 512;
6 h. ?, M* i n" [' X - static int bcnt = 8;
2 C, s2 h8 O9 x - static int ccnt = 8;
H$ S2 P9 g3 }! ^; ^% k( i7 E - & H8 b. p0 [8 G* [7 J2 b' T
- module_param(acnt, int, S_IRUGO);; [2 z2 O. S) w8 T% E5 o. S1 c/ ?
- module_param(bcnt, int, S_IRUGO);
4 S0 F' J y& k- f0 x" b' G+ z - module_param(ccnt, int, S_IRUGO);
复制代码 & O6 Y( A+ @' ]& k! ~% g! ]
0 F: p% A; ^! {) c
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, p6 G/ w# O2 `! n
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 N) g1 }, ^/ b" ~- Z" T 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 p# Z8 @8 u2 M( M
4 P0 |" n' o" K" Y" U0 p ]. H. C
, J L2 W; O, z' O4 ~9 \$ U |
|