|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - I/ s. U& i# \- n7 X2 Q# L! G0 k" i
- [code]EDMA sample test application9 N- p/ K5 N* |5 S' [8 h
- /*7 c I3 u: E* [$ `
- * edma_test.c
}/ O. |3 _8 [2 x - *# B- G7 W* h% l$ F: c: |& G# @! o
- * brief EDMA3 Test Application
4 c L3 J% |, }& {/ } - *
1 m$ N, p w1 I3 C( q7 N - * This file contains EDMA3 Test code.
' r: `# x2 i7 m) b, ` - *
~; e& r5 T" }% V' y! h- k- P - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 W, A6 u2 k9 ~1 D, t* t
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 K5 q' r4 w- y' }$ w
- * TO CHANGE.( K8 i; Y) f, {* G8 I6 G
- *
0 m; x4 ?1 X8 f - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- @2 U6 H1 g4 `5 D- p8 c
- *
& o% Q0 a2 L a& G% V$ d) X - * This program is free software; you can redistribute it and/or' f# [0 _- B% h: f- x& A! M3 z
- * modify it under the terms of the GNU General Public License as
4 v; E- `2 r5 t! }6 @4 x/ w - * published by the Free Software Foundation version 2." e& W. O1 A5 S; V$ }# M
- *
2 n( K5 S& h3 v3 R - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
8 [! J! F% \/ W/ |$ Y' M Y - * kind, whether express or implied; without even the implied warranty
2 p* D' n. P3 R4 C0 r6 H - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
) X2 L+ a' d3 L6 i) W5 I, o+ w. } - * GNU General Public License for more details.$ O5 }* n: E9 P2 A/ C# ?2 N* }, ?
- */
+ A2 n; w7 {4 N
1 m) Y3 E' I" T) P1 b/ v- k0 h; @- #include <linux/module.h>
0 |1 `% k4 v9 N0 a" F - #include <linux/init.h>
6 d$ @' C9 {! U) @. ]) a - #include <linux/errno.h>4 q5 |) u8 J! _% Y( q& D
- #include <linux/types.h>
k5 d- N# d1 `) q$ J3 I/ @% m - #include <linux/interrupt.h>0 N j0 J4 l. N* y5 n$ C
- #include <asm/io.h>0 A$ \3 T3 ^7 {. ]- T# R- F
- #include <linux/moduleparam.h>
/ O4 i! A0 l( h - #include <linux/sysctl.h>! R9 E/ O( Y$ f0 `) V; b4 t
- #include <linux/mm.h>
6 g6 `) e' A0 R - #include <linux/dma-mapping.h>
6 p- G L5 c: u8 ]
9 c! i' ^% u) N- g3 e* k- #include <mach/memory.h>; @# t2 Y& R& f. s
- #include <mach/hardware.h>4 f9 u, f" d- q
- #include <mach/irqs.h>
3 @( J) I8 F f4 P2 E* y - #include <asm/hardware/edma.h>7 j+ d2 }8 t7 f3 o G3 v$ q
- 4 Q# B8 U! j- r' k
- #undef EDMA3_DEBUG* v, D; H5 V. n
- /*#define EDMA3_DEBUG*/0 ]- q, m. o0 H W h; h* k
- p3 h7 }- m9 J
- #ifdef EDMA3_DEBUG
8 z1 r8 G( P9 b, \4 W3 w# U' u* I - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
5 }: R a! r9 H - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
- d. V( S+ B8 a9 v. Z8 u6 n$ P0 V - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
- M7 W. F3 D, K( B- Q - #else8 U7 ]6 m* a6 `1 B4 M, n' y: q
- #define DMA_PRINTK( x... )
; T# v9 {% c; F$ U3 h - #define DMA_FN_IN
J* E/ N$ f: ~ Y/ Z* K - #define DMA_FN_OUT+ T T: \8 A$ X! v8 ?
- #endif% ?3 o$ @: z/ ^9 B9 W9 ^
' G4 L: i* C! l; k- ]- #define MAX_DMA_TRANSFER_IN_BYTES (32768)4 |( [5 |# W; ^4 L% G
- #define STATIC_SHIFT 3' h7 R4 @& G6 ?" I
- #define TCINTEN_SHIFT 20
# C5 J1 K! _4 C5 F2 V9 } - #define ITCINTEN_SHIFT 21
s& ~8 n/ p3 F: s! K - #define TCCHEN_SHIFT 22
6 L7 j- O0 S" D - #define ITCCHEN_SHIFT 23
+ m+ q2 s4 @9 n6 A
6 F1 Z# R( h4 L" d3 i( ?- static volatile int irqraised1 = 0;
: s& D1 X+ S2 z& i# V - static volatile int irqraised2 = 0;( T3 g0 G! G2 O6 w
- ; ^6 R9 w& E0 J- F: ~$ I
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( q) x& o: C6 D) k - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ ?: C3 h& B/ C) E+ y0 n* \ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 R. Y- r* y3 a, f# J) f9 j - 6 f# o, O, j Q9 `- g
- dma_addr_t dmaphyssrc1 = 0;0 W# ~7 a$ n; f6 V
- dma_addr_t dmaphyssrc2 = 0;5 I0 S- Z+ S) x$ a
- dma_addr_t dmaphysdest1 = 0;& }3 O2 J0 h0 h
- dma_addr_t dmaphysdest2 = 0;
$ G; _/ C$ w7 y) i! `6 S0 r' ~$ c
7 v( j4 q; ^; B2 M- char *dmabufsrc1 = NULL;
" \5 P# r4 [6 M4 | - char *dmabufsrc2 = NULL;
$ F. k' J/ O7 [3 e! Y+ ? - char *dmabufdest1 = NULL;
: o& g' ?$ ?8 n) F/ e8 r! V4 a - char *dmabufdest2 = NULL;- ~. c7 z" O& N. w7 c: w5 ~1 o: I
- & N, [) r) M3 [, z
- static int acnt = 512;" Q2 D; R$ n* G+ y
- static int bcnt = 8;
+ o) \1 f0 u7 E% E9 P: h - static int ccnt = 8;
9 R+ D# p v$ h( M" ] - 8 N, R+ K6 g, \4 w4 A' v
- module_param(acnt, int, S_IRUGO);0 J$ W! E# |7 d4 z0 q
- module_param(bcnt, int, S_IRUGO);7 M+ k) P/ U* E5 T+ d
- module_param(ccnt, int, S_IRUGO);
复制代码
+ v5 y O- k3 `1 z
8 _2 w T- N. \. P3 Z 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 ~; S. S1 j/ C$ w
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 h. V* l) k* h& m# Q3 y# D. E
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- ~' d t( \- h4 g; H1 {: X
+ g# o1 T$ U% c |! V+ j9 u) C- o. N* ^" a! \
|
|