|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 ^. q! H/ @4 W$ `* s9 K3 V- [code]EDMA sample test application
0 T: E$ [- M0 U7 K - /*2 A) W' |% s2 o4 d
- * edma_test.c
) m! e s: l& B+ y- {5 `2 K - *3 e# `, U9 P! D' v
- * brief EDMA3 Test Application
- C& b# I/ z6 o2 m - *8 K# { }& F- c9 {8 H( N- o
- * This file contains EDMA3 Test code.
9 \# m; M2 E7 R/ ^% c* I - *
! j# T$ u, Y; d, Y% f: \, l) R - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
( w; q: g1 L) C K% D8 [4 f - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% L' _" P9 e" ~0 H Z: c* S
- * TO CHANGE.
: W5 g% o F7 x/ W# y* j/ F - *5 u' P i6 a3 p& e# o. {
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
" p) d( l# s" n/ h - *
4 c1 p% e# Z0 F) ] - * This program is free software; you can redistribute it and/or% ~0 o0 |' R" ^* X* g5 h
- * modify it under the terms of the GNU General Public License as4 A+ I: [% Q" M% k* L
- * published by the Free Software Foundation version 2.& J; Y- Z+ h3 C7 V5 I, ?+ ]# E
- *( T$ Y$ Y1 I- ^
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
3 K; y* o. T+ }7 A6 [7 M - * kind, whether express or implied; without even the implied warranty
; n# [4 G+ G. X; O4 U* k - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ W' B+ x8 a" N& `
- * GNU General Public License for more details.
& p( l' a3 x$ ]. j6 T2 y - */, K2 n/ t9 H9 _! H1 ^
- & O! C; t1 k( t8 {+ [
- #include <linux/module.h>
0 P) D6 j4 Q% M6 ?* X3 s - #include <linux/init.h>) }8 i+ I) H8 H7 t5 G" A( J
- #include <linux/errno.h>+ D1 \. z1 R+ a q8 j7 ~& Z
- #include <linux/types.h>+ }( J) V5 `6 `: x/ Y
- #include <linux/interrupt.h>
% L% ?/ B! o& F# o- L2 J - #include <asm/io.h>2 u2 R; V( D' z/ Y# F- ~; C
- #include <linux/moduleparam.h>
: h8 m0 V2 q# R4 B5 L& K. E - #include <linux/sysctl.h>* V0 @% O) A* m3 z' H2 h4 Z3 `
- #include <linux/mm.h>4 p* p' K6 v5 h3 Y" I$ A6 i
- #include <linux/dma-mapping.h>! _+ o$ P% @8 V+ s* W7 ?% N
- ( O( {2 X Z6 b
- #include <mach/memory.h>+ c. A9 |5 z( N0 q( g+ b
- #include <mach/hardware.h>5 ?+ Y* W& m) a8 Z' o
- #include <mach/irqs.h>% j& O2 A: h; F0 S
- #include <asm/hardware/edma.h>
J1 d/ W; x0 r% w Y# z; V( |9 i$ m7 J - 7 S; Z7 ?. _0 d5 L4 `# X }
- #undef EDMA3_DEBUG1 f! E6 n4 l% N' x! f! j( V4 P
- /*#define EDMA3_DEBUG*/
+ Q4 D3 g! A, x. i: ^6 V' N+ X - + O- v* X& f' z1 k2 ^
- #ifdef EDMA3_DEBUG/ j$ w8 @$ U4 ~* N. F5 I: ~- w J3 C
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
- _/ d) M. o. v" x - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
" Z2 B& O+ V9 ~! G$ | - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- p' ?: _2 k5 u' w
- #else
/ W9 g5 _5 b: T, M$ p - #define DMA_PRINTK( x... )* o" z' X# h C% O6 c6 H
- #define DMA_FN_IN, O) c; c: G. S1 f6 B
- #define DMA_FN_OUT
8 \+ c% ~ B* z8 q1 } - #endif# t5 B5 U# p( f/ f8 h' e
s, Z0 E$ p3 M- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
9 t4 a- g2 @6 q# t! z, Q* \ - #define STATIC_SHIFT 3
( Y( ^' k4 Q8 C# h4 s - #define TCINTEN_SHIFT 20$ N' L8 h! X# p- a
- #define ITCINTEN_SHIFT 215 R/ m- z$ V |! [
- #define TCCHEN_SHIFT 22
1 ^3 s/ Y- O9 c6 L& h$ | - #define ITCCHEN_SHIFT 23! W8 L7 z, y0 @2 d
4 S$ E) p1 H" m* b4 ?2 A" x9 e' P- static volatile int irqraised1 = 0;+ Q" P# x' j# s% t! h+ ~6 B( c+ [
- static volatile int irqraised2 = 0;
' R) D/ [9 C% G# n5 _" b% s
! f* Q! z0 R' s0 j, q" K+ s* I- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 O. V$ E0 e) }' e, F" z - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. `& }. m5 j. G K/ H) c - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* R, {% N" a4 y9 z$ ?2 E* e' d) E! { - 5 p2 P; t% E |. H) X, _
- dma_addr_t dmaphyssrc1 = 0;
" X7 w' ~/ R% n K9 O - dma_addr_t dmaphyssrc2 = 0;
9 J, j8 @1 j* K; M' q3 L - dma_addr_t dmaphysdest1 = 0;
6 p: X; R4 j ?# s4 k - dma_addr_t dmaphysdest2 = 0;
8 f7 g' S6 }' c! _' c - # z0 i* L$ ?3 U- _# ~8 v3 o. V
- char *dmabufsrc1 = NULL;! U' K6 s' l: l7 E( m
- char *dmabufsrc2 = NULL;
, V7 ~1 V6 T s+ k8 B - char *dmabufdest1 = NULL;% f/ w9 @7 X2 j. u& w, O; f/ K
- char *dmabufdest2 = NULL;" N2 s& H# y) g+ L
4 f% K/ l. j$ M. F- static int acnt = 512;/ ?! f. P; d! Q& a/ U; h: G
- static int bcnt = 8;7 b; `3 X. t s/ ~
- static int ccnt = 8;
7 n$ j# m3 D6 V1 l) s - 4 P. a# E( W$ E/ I o) f
- module_param(acnt, int, S_IRUGO);
( y e3 b. w( H! e1 w5 x - module_param(bcnt, int, S_IRUGO); N* g) U# p# y0 \* H u z
- module_param(ccnt, int, S_IRUGO);
复制代码 : w# @, e# _3 b& j- o0 Y5 ]0 x
! X8 W! i, [2 V 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ o; p: o$ G; o# ~
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 [% k' Q0 {0 b9 v8 o6 T 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' ?9 ^& [# g0 K/ Y- q
8 g6 ]) @, x5 H- _! j- {9 U9 c4 K" X2 v" w5 e! f2 ^1 ~+ A- P* N: S2 j
|
|