|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) Y$ Y: P% w9 d0 B4 Q$ T, Y- [code]EDMA sample test application
! f# K9 o& ~- s; O u( h6 ]% f4 m - /* Q' g. g B2 f- o3 S
- * edma_test.c
9 j6 l& t0 d7 g2 z& y! W- P( t - *
1 }1 K: v: U# q1 l3 x) p- E+ C0 G - * brief EDMA3 Test Application
3 J4 l3 l7 ]9 b% h* L, m0 W/ O# s$ I - * {4 \( p. c2 Y8 w, N/ ?
- * This file contains EDMA3 Test code.) X0 m8 ~! Z4 [# l4 R- V
- *
5 [- ]6 R0 _! w& E5 G3 c7 Z - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
& q' [, s' f( S. ?' Q" H - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
3 q% v* ~- a/ N - * TO CHANGE.
/ \9 O, y, y" J& A6 E8 S - *
0 u$ V v* ]# X - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ o; h4 v+ Q: h7 z7 q
- *
7 Y- n6 |3 N; P6 D) A6 @3 {; O8 j - * This program is free software; you can redistribute it and/or1 [! Q9 y' U1 i+ J1 a ^
- * modify it under the terms of the GNU General Public License as
& y; W' T; o5 e0 w" D& G9 G7 @ - * published by the Free Software Foundation version 2.5 `5 d9 n/ n3 g8 l7 t
- *6 q# n# x+ Q; d/ Y6 V. @
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any, V' z; `+ Q7 g
- * kind, whether express or implied; without even the implied warranty5 ?9 J6 Y4 N9 d# J- b3 ]
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* y1 ]. i, K+ `) r1 B4 D - * GNU General Public License for more details.) O4 b) E7 e3 x* t0 s# @" q
- */ C- B( E, W2 Y
- 9 A r: I# S, z: P
- #include <linux/module.h>: \, w5 s# b) S7 j5 Y# K
- #include <linux/init.h>1 |. A; N% P& X1 ^0 J0 B1 _7 x' I M: T
- #include <linux/errno.h>
( a1 b2 {3 Z+ m- p8 Y - #include <linux/types.h>1 ?3 E0 c. l% @! X
- #include <linux/interrupt.h>
3 l7 O8 `5 L Q( \; {% ] - #include <asm/io.h>- N& y8 M n9 Y3 g! h, e
- #include <linux/moduleparam.h>
7 g) ~# [9 F0 b - #include <linux/sysctl.h>9 V( K" P/ l& u+ k6 H( i0 i
- #include <linux/mm.h>* f, K* K3 s$ j
- #include <linux/dma-mapping.h>9 }' B5 C# T- S2 q! j( K
- ! E+ p# w8 C* g/ N ^% _! M
- #include <mach/memory.h>
+ R5 S' c" E3 z) L" B1 m' A - #include <mach/hardware.h>
+ y+ B- Z+ U7 y6 ]# o H - #include <mach/irqs.h>' `3 }, W( ` d" Q, x! R
- #include <asm/hardware/edma.h>
) u5 C( y$ |' r" E- @ - 2 N- {6 e; Z. L( ?
- #undef EDMA3_DEBUG
8 e6 Y0 q# c4 x7 \/ K* { Z - /*#define EDMA3_DEBUG*/, i9 p8 [+ s* d5 W, e9 x8 B
- 2 [8 B7 r# w0 i9 b
- #ifdef EDMA3_DEBUG0 v% M; e0 | y
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 O; C+ U. B$ s8 _$ S
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
! o: N2 {- }; \7 [; t" j7 Z& b$ d - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 E8 i! ?( R$ I2 G, C4 d
- #else
`8 E$ S, N9 u/ s7 y' N - #define DMA_PRINTK( x... )1 I& l4 Y3 o/ r' X0 ^' T5 e
- #define DMA_FN_IN0 u9 y5 p: g2 y
- #define DMA_FN_OUT( s2 G" D' A7 g6 i3 X p1 U+ w
- #endif! n5 b6 `# m! O0 v3 B# S: ]- m7 E- F
- 9 q. R# h5 a2 M- Q6 \
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
8 }, a2 {4 N8 S2 t d - #define STATIC_SHIFT 3
6 {! T, B, F* N% Z. N, J/ Z - #define TCINTEN_SHIFT 20* L, e7 C' m/ g6 m# t
- #define ITCINTEN_SHIFT 21- o! M8 B1 A; Q, Y$ b1 ^
- #define TCCHEN_SHIFT 221 z0 T0 z7 U& z, P
- #define ITCCHEN_SHIFT 23
( N i* @" Q) y$ p4 t - . I: C0 i! f) G: R) j6 c% k
- static volatile int irqraised1 = 0; U: u1 H( h2 {% ?& [; m2 X/ @: |% C
- static volatile int irqraised2 = 0;% ?; B+ m) d7 L v' P5 [1 ?8 ^
+ m# M/ D* `# P3 s9 a4 @; N/ S; b! }- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! Z: h+ G4 G, K: X! {4 M - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& x8 {3 d7 V9 e8 ?
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 p& L1 |" L! R4 V e5 r N
6 ?) ?3 _; S6 H/ J- dma_addr_t dmaphyssrc1 = 0;
' i/ {5 s, K* C5 q( m - dma_addr_t dmaphyssrc2 = 0;+ H4 j! P2 ]" }7 |. E |* N& {8 i4 s
- dma_addr_t dmaphysdest1 = 0;
Q7 h; n* L8 F - dma_addr_t dmaphysdest2 = 0;0 e3 k6 B/ u1 u/ G. D* M
3 ~0 D4 x9 ~8 i- char *dmabufsrc1 = NULL;9 }% U. N5 U4 a$ C# O8 w) \
- char *dmabufsrc2 = NULL;
5 g( W/ o! M" g5 `4 c - char *dmabufdest1 = NULL;
8 A7 f6 m+ I v' } W - char *dmabufdest2 = NULL;
; M3 X, S( K5 O5 @9 ~' w# D' z5 ?/ h( U - , a5 {, S# Z0 K( _# |
- static int acnt = 512;0 a5 n7 ^- G, E- k. c p
- static int bcnt = 8;6 {, u) ~+ S7 p- A
- static int ccnt = 8;
9 [; Z$ q# i1 Y0 f' C9 U
' m2 N5 [" X$ W* V" ]- module_param(acnt, int, S_IRUGO);6 y4 s0 B: w, C6 [' ^/ w
- module_param(bcnt, int, S_IRUGO);' V5 ?# M1 }/ h
- module_param(ccnt, int, S_IRUGO);
复制代码 + \8 l1 m! t, S/ j5 J& q
& C8 S9 n% [0 `& `
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& p3 e5 Y! W5 t5 X2 parm-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 g" A$ t- q5 r' ~ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# a% j/ }" V, O7 h7 @0 ]3 j. } R5 L! M( j+ u* |7 S& }
* E( X* I I5 x# Y4 l& M
|
|