|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * W) ]; k/ G/ _ L
- [code]EDMA sample test application
! f3 B: z3 } k, ?' H. g - /*
8 Y# o+ h+ O6 i; v/ Y W( ~! P - * edma_test.c
: Z# G4 A/ ~. b - *
6 Y- N$ ]9 ~8 q$ T: ~ - * brief EDMA3 Test Application ?! s# h9 V, m& u7 t: ^
- *# a6 N7 J4 o; X% E0 Z, i% @
- * This file contains EDMA3 Test code.
) z; Y( G V3 C7 k9 I - *
& a- }5 y% n" e% C4 _, n# I - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ E+ \* ]4 }! R# @7 x9 ^
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
+ z$ }+ y: t$ u4 I/ b# J - * TO CHANGE.4 `$ Y3 n3 k* W7 d. Y
- *5 T0 [% L' c$ B7 @$ J x5 M R3 X
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
+ {4 _; F j3 p4 \6 o' e } - *, i+ |9 g7 T) t' D' v
- * This program is free software; you can redistribute it and/or
|$ n# G' h) g7 c$ D; g( i - * modify it under the terms of the GNU General Public License as: A" t. _2 ]* \4 @
- * published by the Free Software Foundation version 2.0 }/ ~+ J1 Y; L$ q$ h7 C/ n( S
- *
+ H7 v- ~! e" p8 E. c5 O& ? Y - * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 h5 `5 b" ^9 l/ @! u/ w3 i& u
- * kind, whether express or implied; without even the implied warranty
: G4 x% g3 i" \2 K7 A& |0 f3 R% Q6 ] - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
, v! k$ X/ U8 `' z - * GNU General Public License for more details.
' C$ j; U8 }# ~/ I# E - */
! a! {. S0 q2 M
! ~7 @9 d: y9 l& z& m' a- #include <linux/module.h>
' X' G7 j# g0 ~8 J% H - #include <linux/init.h>( o- E" B$ A C' B
- #include <linux/errno.h>
; s/ u: W2 N3 A( R. H - #include <linux/types.h>
}) {7 `. D2 t5 d - #include <linux/interrupt.h>
; v2 k! w6 X' f6 e5 f! [% t+ n - #include <asm/io.h>
! ]: i% d/ f4 y" R - #include <linux/moduleparam.h>
. N3 Q: ?8 O6 g. z; W- ]5 w - #include <linux/sysctl.h>
" o) y2 {7 q7 N7 M: y8 {6 ~ - #include <linux/mm.h>* e D1 s0 C0 M) `
- #include <linux/dma-mapping.h> e* k+ \0 A: u* e$ ~
- ?/ e& P% j1 w7 B! @5 D1 z- #include <mach/memory.h>4 `4 o V @* k6 |, `. E" Z
- #include <mach/hardware.h>- n- S9 p/ w0 X, J7 |& D
- #include <mach/irqs.h>
- E4 a9 J/ P( o - #include <asm/hardware/edma.h>1 E: b, p4 G7 a1 x# z+ Z
- ! P' g5 E8 U; m1 r. |. X2 a
- #undef EDMA3_DEBUG$ O" I" ]! C8 q# Z
- /*#define EDMA3_DEBUG*/
4 x& c+ b- I- F' p- [ - & Q/ P$ g/ L( z3 A2 J1 q* R
- #ifdef EDMA3_DEBUG
4 L" L N% C6 K0 n - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
% D9 L# ?6 n1 R1 ~8 E& Z - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
4 S+ u m# V% B7 \2 K' Q7 E - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 T* a0 |8 P* v I) Q1 ]
- #else+ [( ?, x0 F8 _* J9 c% t5 |
- #define DMA_PRINTK( x... )
[3 }$ M! S% h, V9 D I. q - #define DMA_FN_IN
2 K( e7 w" G/ l! o% \- [ - #define DMA_FN_OUT
- S+ g, y) z4 W9 w4 S$ r$ t y+ [ - #endif
1 R5 C: H% B% w H" P# T0 q( ~. G - q! d- t& Z; Z5 R0 L! p' M/ v
- #define MAX_DMA_TRANSFER_IN_BYTES (32768); j- H2 q- a$ o* R4 |; L) c
- #define STATIC_SHIFT 3$ e5 B! t/ u. T9 w+ B: w
- #define TCINTEN_SHIFT 208 C$ p! M. n/ q) j; c2 E" L
- #define ITCINTEN_SHIFT 21
3 u! y0 P4 A- z - #define TCCHEN_SHIFT 22
9 W# s- l8 z$ B - #define ITCCHEN_SHIFT 23% m% o( h! c5 d, a0 H, D
- 8 ]5 j6 o/ U% ?8 K' z$ w8 a# ]; t
- static volatile int irqraised1 = 0;- N: `+ C8 {5 S; B* D8 C0 {* T4 v
- static volatile int irqraised2 = 0;% c3 x" r/ @9 L; k ]- \! K# F1 E
' D% S8 X A2 S& P+ [% e6 E- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! x7 D8 \# R- K5 C7 C& g
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 l0 ?0 ]7 j+ U- E
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; y2 Z( [0 g; i
% ^1 \- M! M9 l, E0 I n4 R- dma_addr_t dmaphyssrc1 = 0;! f1 ?6 N, ` k8 G7 m
- dma_addr_t dmaphyssrc2 = 0;% S' r2 a- Y0 E, ]9 v
- dma_addr_t dmaphysdest1 = 0;
: A0 X) h. ]8 H6 ]8 q* j+ m - dma_addr_t dmaphysdest2 = 0;) f j) p' x! }+ J
9 ~' @5 K+ J9 ?$ a$ A, w! W, c( g- char *dmabufsrc1 = NULL;. M% x, T, M% p1 w2 h, M: W5 w
- char *dmabufsrc2 = NULL;
7 l6 ?& N: f6 |; J' n2 I - char *dmabufdest1 = NULL;
4 K! c0 x" F, v' b+ f2 R3 V - char *dmabufdest2 = NULL;
* G, X3 \# A2 B( V6 O, W
+ j6 T% C. G" `! I" j- static int acnt = 512;
0 _5 h0 p0 N( O1 y4 [) M - static int bcnt = 8;1 ~# R7 r) @! g1 R
- static int ccnt = 8;7 Y; \: S0 @; [; P. O/ k
- $ T5 ?2 b- H% m+ M
- module_param(acnt, int, S_IRUGO);
5 t1 x* _3 I, i, |' @+ h - module_param(bcnt, int, S_IRUGO);8 i6 H% ^1 h+ I# K
- module_param(ccnt, int, S_IRUGO);
复制代码
! E# |" c. r! D# ^* P$ G0 ?( H. F. A' i4 U e* w0 Y
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 F# p. c) G, f Q' Q1 L- B
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 Q4 a2 q! v9 ~! k! t; c% U
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 u0 z- S! H; ], [
( i/ r( Q' S* q( N5 S% s* P; q
|
|