|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' r) G9 s; a8 B- @7 o- [code]EDMA sample test application' v, q+ T( n0 i
- /*
* F3 D9 \% Z) d. I6 F - * edma_test.c
: D' m5 ~: v) _% B) V& T& J - *: c) G( [% b0 H
- * brief EDMA3 Test Application$ _$ H+ x& |2 l+ Q ?0 j4 ~9 |; e
- *
8 ^0 D8 e1 O/ X7 H3 t' A - * This file contains EDMA3 Test code.7 |0 J8 u" A6 L. T( D
- *4 @# T. i: s- O! @3 V
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
! U3 c3 C! h+ J' W* s; C6 g - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 P) o1 r8 y8 q& h0 g6 S8 d
- * TO CHANGE.7 c: H6 `! x4 e/ O" p
- *
- m' s# S$ X2 ~, w& _: h6 @! Y6 M6 { - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
1 |; N* p! M5 E2 O% V2 E" f1 ] - *
7 t, s$ B4 z# \- ]7 k1 V: p! A3 f( n - * This program is free software; you can redistribute it and/or
+ q3 S: `8 }( K4 f3 ]* u$ o - * modify it under the terms of the GNU General Public License as8 b }$ A+ ~. d! j/ f+ d$ V
- * published by the Free Software Foundation version 2.4 V) u2 t$ Y) T& D/ X
- *+ h4 k& Q' V1 ^
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any, o4 I$ j4 T) d1 t" T
- * kind, whether express or implied; without even the implied warranty
% {0 ~& f+ [9 ~6 I - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! X2 } O1 [# Q' | - * GNU General Public License for more details.
8 }+ t5 t4 `' D' a E - */" i% b) c# O% g8 q2 C- I- t; F
. y" Z1 |1 i9 A& W& x$ l+ C, F- #include <linux/module.h>6 d, n. b7 ] E% Q8 k# B
- #include <linux/init.h>
, a" J+ J! ^% F5 [1 b, \5 ^' s; } - #include <linux/errno.h>' m; o' D; ?1 B8 G
- #include <linux/types.h>
$ z3 A7 ~: j+ {9 t - #include <linux/interrupt.h>
1 D" i" @ F! c, A/ X' Q - #include <asm/io.h>
5 J# N' h8 V- r% Y- ^! r1 J& d2 t2 J - #include <linux/moduleparam.h>
1 H% c& u. y4 O* @ @8 O6 M$ R7 ~ - #include <linux/sysctl.h>1 v3 Z4 r7 T) }5 k0 s) E; C
- #include <linux/mm.h>( t! ]3 S3 E9 {
- #include <linux/dma-mapping.h>3 G F7 z, L9 a' @+ _' |
- : s1 }9 I6 L0 X# O. ?3 g8 S% z
- #include <mach/memory.h>
" G2 i0 f/ N/ L, `; a( [& t - #include <mach/hardware.h>9 C2 U% G. _4 M U/ d
- #include <mach/irqs.h>
/ X3 }! n b3 l2 l( n - #include <asm/hardware/edma.h>7 g3 I0 x/ r. C
- , e2 q+ _( q0 q1 H4 t
- #undef EDMA3_DEBUG
% i9 [/ s w6 y5 [1 @ - /*#define EDMA3_DEBUG*/
1 |* z! S5 \8 w( o' E - 5 c0 w' v7 ?0 d
- #ifdef EDMA3_DEBUG: ]' Q0 A' M- O; d: P9 C) {+ e
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
" l& E: [# J9 u8 c0 L - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 u/ \" ?3 k/ `& k" u) i, [
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
4 ~! e* {/ V7 @9 t4 s! d - #else: l5 c, V" ]0 J t' V
- #define DMA_PRINTK( x... )
2 ^- q1 o& i- {, i& Y( \" s$ S - #define DMA_FN_IN- ^. g' r8 Q7 _" M' |
- #define DMA_FN_OUT
" H. ^; b+ U: H2 ?3 l - #endif
4 t, |% T) n' k$ o# r# c/ h2 k8 O - / f+ j$ h5 h! W- |' @/ P
- #define MAX_DMA_TRANSFER_IN_BYTES (32768). [- u3 G" E& m9 F! S
- #define STATIC_SHIFT 3. ~7 u8 @9 X s+ C0 p% ~+ ]
- #define TCINTEN_SHIFT 20
7 X6 K* z! n. _/ }6 A - #define ITCINTEN_SHIFT 21* W3 c4 B& a n
- #define TCCHEN_SHIFT 22
4 Z9 T% m9 N1 s0 `4 s0 j/ {7 p* S* B K - #define ITCCHEN_SHIFT 238 V- K& o. G7 q3 p4 v) u
9 ]. x8 m; }+ C T( s: {- static volatile int irqraised1 = 0;% S9 v) O1 \$ Z5 S( K8 j6 z( ^# B
- static volatile int irqraised2 = 0;9 L+ @, a! t5 h( C; L8 a) _( J
- 1 @2 e) Y1 X* m) }9 ]" v
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ Z7 G* c4 a8 z4 g: J
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 c' }) B/ e% b4 E: s5 X) R% w
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 J6 `5 L+ I2 ?; v. y0 v
/ R( L$ o9 N. v, }/ C9 P9 K1 T- dma_addr_t dmaphyssrc1 = 0;
# Z' F- S2 o) ?" [ D9 J4 i - dma_addr_t dmaphyssrc2 = 0;
, L' l. j% \9 \) H# f - dma_addr_t dmaphysdest1 = 0;
/ u* v4 `& @7 V. ]3 o. Y7 K/ t0 i - dma_addr_t dmaphysdest2 = 0;. d1 G' Y: G- K
- . V. p( J8 q) ?! D
- char *dmabufsrc1 = NULL;
% V. f7 l# `* r1 X - char *dmabufsrc2 = NULL;. Q( H$ G0 O# W4 Z' F$ D8 H
- char *dmabufdest1 = NULL;
* ~9 L5 V3 N, H6 H" R) E- n. P4 R - char *dmabufdest2 = NULL;
: R- ] a0 b: w7 x1 `
; E W/ T8 D* k! R, j4 Q: P- static int acnt = 512;1 w1 z9 `. g% t' V# {0 r/ ^8 H; q
- static int bcnt = 8;
9 v% D9 @% _$ c4 c1 ~- C - static int ccnt = 8;
. |3 u( v. b5 a# V6 I: v2 D; |4 ? - 3 N8 U! z5 O8 b/ r$ y/ i' K
- module_param(acnt, int, S_IRUGO);
6 l! J4 m. R& } - module_param(bcnt, int, S_IRUGO);
* _7 C: `9 @% t" d* w - module_param(ccnt, int, S_IRUGO);
复制代码 2 G! |9 k- {; [9 k! V. _
. x7 p2 F8 g% ^) R$ K5 f( p( t5 {; e2 A
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, V2 M$ I1 i+ G
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; q! j Y7 y j% H* c( I$ \( X
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 P* H% I5 p' L0 G' y
0 s0 u! k% J3 z- a3 F9 \& t
" H, @7 c. h* C; G6 i |
|