|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 r; `2 f6 g3 I9 X: }
- [code]EDMA sample test application
8 K1 u: F- G. N4 c, D$ Y - /*
4 g: u u. _. ~ - * edma_test.c
1 e) {4 r9 W/ P7 |& B8 S$ e4 L - *
+ h+ {0 Z' ^0 E6 m0 X1 l1 l - * brief EDMA3 Test Application
0 f- R3 X# h+ a4 f - *9 Q3 m1 f0 u0 m0 k
- * This file contains EDMA3 Test code.& Y/ o2 ?3 A- g* z6 g
- *
2 A* p$ {: _8 H - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& ?) f+ X0 J* H$ T4 I
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
4 _0 P4 N' e8 Q5 G: I0 o, q4 ? q - * TO CHANGE.
- [2 Y/ D9 }# q% P4 Z: p+ | - *
7 w1 E; D3 U) b5 i) I. R4 M) ] - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
- b2 ^7 O( f( [, a7 P - *7 h- N/ y& m* l3 G0 C9 a8 w; Z- g, y
- * This program is free software; you can redistribute it and/or
; G7 e& j" E6 G+ j% @ w( b - * modify it under the terms of the GNU General Public License as$ w0 J, D% t6 F V, P8 T; B3 E
- * published by the Free Software Foundation version 2.' a9 s$ r, r) ]- v: x
- *9 ~. i* Z& f" _
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 e) @& ~4 D4 I
- * kind, whether express or implied; without even the implied warranty
, u6 p5 B' a9 B$ p4 y, _ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! p, m- t7 F1 r9 k9 |9 f+ t$ t a - * GNU General Public License for more details.
4 S9 w4 S; _ H- y$ c$ c( Q - */- d$ [% C0 R2 y
1 Q+ b5 f* A9 o! s- A2 |6 n( r' m- #include <linux/module.h>
& |: k% X# N C" S& B2 q0 t( T - #include <linux/init.h>
' D2 S R; f' ^! Y ~ - #include <linux/errno.h>8 M/ g) r) T2 l8 n. w4 T/ n& ]
- #include <linux/types.h>8 K$ g( n$ E0 k; s9 x5 j
- #include <linux/interrupt.h>1 X y4 G$ f% y6 T0 a
- #include <asm/io.h>: B3 h/ o/ Q9 @/ [ t6 q
- #include <linux/moduleparam.h>5 ?8 h. C' D. M9 |, Y
- #include <linux/sysctl.h>
% W \9 I: ]7 [ - #include <linux/mm.h>, t# w9 |! [3 x9 M t
- #include <linux/dma-mapping.h>: ?# H) g/ D9 k) h" d
" p1 ^. X+ z/ P; Z1 i2 o- #include <mach/memory.h>3 \6 K" R0 Q) ]( H r% |; F' m
- #include <mach/hardware.h> w+ x1 Q! ]6 i9 {
- #include <mach/irqs.h>
$ @" w( f/ d, _* m+ n/ ~( U - #include <asm/hardware/edma.h>
. ^) v& K9 q& d* Y$ L7 M: P# p# w7 d - 4 U1 m! K; R$ i! D
- #undef EDMA3_DEBUG
+ x C" p7 Y$ A" j( [ - /*#define EDMA3_DEBUG*/
( R' Q) p* S h A; ~, j
7 i9 F1 A8 ]& g4 v( j$ U- #ifdef EDMA3_DEBUG q& ~0 N; L7 x$ e$ s0 T l
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 |7 R" R! P" Q* u
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 }5 V# E5 _ B1 R* T* _
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
3 V. e. W5 W/ {5 P# [3 D - #else
" N J4 U9 i% ]4 r5 M( K - #define DMA_PRINTK( x... )
+ Y& d" l. F+ ^% P! C. V$ q - #define DMA_FN_IN
& G+ M/ E0 G5 n' z - #define DMA_FN_OUT$ K4 _2 \0 u" ]3 M! C
- #endif: |& p( |6 ]* }+ A9 m6 P: o Z% o
- 2 M9 F! |/ K! U* _/ d
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)3 @( O+ q2 ?( s% s' `1 D
- #define STATIC_SHIFT 3! f6 O( t! f" O1 Q N
- #define TCINTEN_SHIFT 20) }$ [ y- e* Y
- #define ITCINTEN_SHIFT 21. a) f) m! e% c! o# \) q, t, ?
- #define TCCHEN_SHIFT 229 `/ O; b' a! r: h- R/ j
- #define ITCCHEN_SHIFT 23- g. E9 H- k, `& r
- Z) t) A7 A/ ^& a1 N7 A
- static volatile int irqraised1 = 0;
- H% L0 z# n8 g6 l9 E3 t - static volatile int irqraised2 = 0;
6 u0 P3 @0 e: o' K8 ~2 N
# W" K4 m$ F4 c/ ]& l, K- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 ?% o. e+ [8 b4 s: i* [- R - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" h- [9 f* {* x - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 G" ^( B ~" }: e0 N ` - 0 t! |8 a- z( u! w7 L
- dma_addr_t dmaphyssrc1 = 0;
; H: z! p% ]# x* G6 G - dma_addr_t dmaphyssrc2 = 0;9 |' p& ~# d Z) h8 b/ C: \1 x
- dma_addr_t dmaphysdest1 = 0;
2 ?: M- F6 E. c; z. @ - dma_addr_t dmaphysdest2 = 0;6 M% R% u4 Z+ g* s, _5 j) E
- * k' U( Q- ~8 _$ {0 {' d! ^' l
- char *dmabufsrc1 = NULL;
5 Y5 K/ z: p& l3 X - char *dmabufsrc2 = NULL;
4 q E7 {& z8 k- A, ^9 o4 g - char *dmabufdest1 = NULL; g5 c) B* z- _# e3 s4 q
- char *dmabufdest2 = NULL;
* w' r% s- ~- g9 M - % r8 F v0 o9 K- y+ s& X
- static int acnt = 512;
}# {$ ^ X* X1 i0 [6 z C - static int bcnt = 8;
9 m$ w- T5 h' B# k! } - static int ccnt = 8;
5 _! T+ c* M9 c* S) C' R" x
' M1 p3 s$ z9 ]# x% o- module_param(acnt, int, S_IRUGO);* k8 u! ]0 x( \+ a* d
- module_param(bcnt, int, S_IRUGO);' I4 B3 D2 }2 d- P4 S- w; _
- module_param(ccnt, int, S_IRUGO);
复制代码
0 t: q- s& o+ U" T$ Y" B7 T, N* h
4 ]0 z. n0 V, P' w9 j5 i3 c' K 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ C3 ?3 _- R5 f$ y3 n' Y, a
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 `# j# r* ~: u" e; w+ R
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, D7 A$ v; Q' x4 S m$ j0 o- a% Z4 ]) w& p' M" x, {
; w$ y+ [* Z m6 U; X4 v
|
|