|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 ~/ @- {4 ?! }! x0 |
- [code]EDMA sample test application
2 @5 {# b( i- t1 V. e* e) z# x+ ^' a - /*7 a+ \) M5 g" z; u0 S0 J
- * edma_test.c/ {2 k* u# I E7 p' M
- *
0 {# @6 X1 O( R. z) i# h5 S - * brief EDMA3 Test Application
: ~$ b7 k# ~# ^4 ]3 m4 ?) h' O4 ? - *
: y9 j8 L+ l% R* ]6 Y" _ - * This file contains EDMA3 Test code.
: J% b* {5 k6 n4 d' }0 S/ f$ ~ - *1 i4 l6 p0 k7 S6 p" m( _
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
g9 o1 b% U2 B8 u# _& p& Y$ { - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
* s( ^: ]$ F, B3 y: T* X% U - * TO CHANGE.
7 r" L5 E/ b: V. a, J- k - *" d, e) J1 Y* o5 D: D$ b- o, c
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 P* E% O7 X3 c0 ]9 L0 {. ]6 Z# R8 k
- *1 z1 q' `5 |& E/ p) ]. G* e
- * This program is free software; you can redistribute it and/or
+ m9 d) x9 ] h! A5 J - * modify it under the terms of the GNU General Public License as
1 K. U* j- \) z$ M - * published by the Free Software Foundation version 2.
8 H8 U/ U9 D! U/ e2 s - *
s8 f7 Y( |( H0 A' N4 @1 i - * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ j; T/ ?# l; f9 P
- * kind, whether express or implied; without even the implied warranty( N7 F& }% f0 E3 A I& Y
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the, h9 A; L9 K1 k$ V: p/ f$ e
- * GNU General Public License for more details." c! ]; Z4 t) n, A
- */
( K7 R* R7 Y: f - 5 m+ R# A% l- ~& p4 u
- #include <linux/module.h>
( T. I; U; ?+ f* s( {2 E) w - #include <linux/init.h>/ z: H& f- \2 W4 r0 \+ C4 u. }
- #include <linux/errno.h>
* W2 T7 |8 F/ | - #include <linux/types.h>8 W" f" y- Z& @
- #include <linux/interrupt.h>
* F- U1 J3 K6 d( S* j! R/ @ - #include <asm/io.h>* f) G5 Y; `- b- i6 S: M; F0 q
- #include <linux/moduleparam.h>
% S- I* @8 Y$ ~! L1 J# x - #include <linux/sysctl.h>
' i+ I& x" G/ r4 d V. D/ A6 w - #include <linux/mm.h>4 L( d' x8 s% Y/ G4 n+ } h
- #include <linux/dma-mapping.h>; [" o0 q2 ^) R
- a( z2 ^# ^# `+ l) L3 ]
- #include <mach/memory.h>
v) w; ]5 ?4 S' `+ m& p0 c - #include <mach/hardware.h>3 p$ w% r4 S6 \: O: z- ]
- #include <mach/irqs.h>+ G1 v! j- c0 m9 m4 Y
- #include <asm/hardware/edma.h>
6 m& {1 ~* S( ~' n1 _
) a: ?. T9 M$ ~( i+ m8 s- #undef EDMA3_DEBUG
5 p3 |+ ]. `" S" m/ T - /*#define EDMA3_DEBUG*/% g( i; q6 i0 n; q' u4 d; J% T: |' g
V% R' ^* m, O% o! ~/ e- #ifdef EDMA3_DEBUG
`8 b8 B2 I3 I& H6 \" O* w+ x: b$ u - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! y8 z' W7 h% w( e! L
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
/ }' q9 y% d) j- O# v2 ` - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
, G: E/ f' j3 Z) ~ - #else
# a1 z3 Q1 [5 w7 b - #define DMA_PRINTK( x... )! D, k1 }: \ U9 O0 Z
- #define DMA_FN_IN7 ^- J6 A* M' W; [" j
- #define DMA_FN_OUT
: d M% e; W6 v% g! A5 T5 e8 k - #endif9 S$ x1 M6 R6 I# T9 o
- - o) W" B% ]9 o4 v5 b& k0 o
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)" n7 B2 \' }6 O% ?; L+ A& O
- #define STATIC_SHIFT 3# G+ l7 Y. P1 I9 t! S
- #define TCINTEN_SHIFT 201 G1 p) p8 |9 R# l. m; ]
- #define ITCINTEN_SHIFT 21: M2 M4 r* f; [5 i; N
- #define TCCHEN_SHIFT 22
4 p' H b# T4 d - #define ITCCHEN_SHIFT 239 I; J1 t$ n) F
- * M1 {( J5 }) E% S6 x9 l/ H
- static volatile int irqraised1 = 0;
2 R$ @! v' d( J. Y. \9 ~ - static volatile int irqraised2 = 0;' w# Q3 d5 m/ B7 P/ l
- # `9 ]2 w9 X$ N, _- J8 j7 y6 j$ A
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) d. b0 e" C! A1 f* c - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 f9 R. U v6 w# f" A
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ c8 G0 G, e$ S5 I1 O
- 1 H, V9 c0 b4 h
- dma_addr_t dmaphyssrc1 = 0;( M2 |- O2 D5 D2 m
- dma_addr_t dmaphyssrc2 = 0;! W" v: P% A& j4 e
- dma_addr_t dmaphysdest1 = 0;
a& X" j; }" Z* G - dma_addr_t dmaphysdest2 = 0;
& _+ w" P4 x s8 H) M3 p9 X( m( H% m - $ t L4 @; A9 j, O, q1 ^
- char *dmabufsrc1 = NULL;5 y1 S M. F6 ?! {- O! I+ S
- char *dmabufsrc2 = NULL;2 \4 t5 U! G4 ~
- char *dmabufdest1 = NULL;
0 }+ G$ s4 @6 w/ f3 R, x - char *dmabufdest2 = NULL;
8 c; N. g* _9 H- I; \+ g - ~0 e6 q1 ]4 c, M
- static int acnt = 512;
9 }# k1 f3 B% z8 b/ ^" ~ - static int bcnt = 8;
: n1 {- d$ C6 v: t" v6 Q+ E4 Q - static int ccnt = 8; [/ |# Z" p4 C6 |
- ; `& Q5 I6 o3 @* H; v
- module_param(acnt, int, S_IRUGO);
* }; f; v1 f4 E" k6 N - module_param(bcnt, int, S_IRUGO);. [8 z- x; A! W6 A2 y* D+ f
- module_param(ccnt, int, S_IRUGO);
复制代码 + Z; {% |$ \6 V/ ^+ y6 ^- o2 f
. O0 F$ ?+ i( P8 E; y- G( n
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 W, P6 l1 K0 X+ n
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ a% j- W7 `' W
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ z5 l5 W8 @# l" q |3 e
+ C7 q. w' y5 `: b$ k7 k
8 i. @$ a2 X ` |
|