|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 G: K7 u' A6 P$ S% K
- [code]EDMA sample test application6 ?2 Z/ C4 \: r. Y9 ^+ d
- /*$ z8 I& q, Z1 q2 H
- * edma_test.c
/ R$ e' x+ k/ W; b4 t8 {4 T - *
; ?1 s5 c5 Z( \& u9 {: B# b - * brief EDMA3 Test Application
; y; ]1 `6 F# {. [. V - *
, h% }1 w& r: b+ P5 L% ~ - * This file contains EDMA3 Test code. s" u2 X/ N" a s: {
- * E4 M2 g* d Z/ Y; k
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
/ N" Q! Q; w, n- q8 \! ^ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
" f) ]% I& h9 m - * TO CHANGE.
) R) R: k7 \2 F0 i8 { - *
8 y: p1 ]+ W+ m* `$ U+ r/ S& U - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" i! K1 U4 S$ p
- *
% J3 q* a( w' a6 h3 O - * This program is free software; you can redistribute it and/or" U1 O" ~! \# ^* a1 `' V a& J
- * modify it under the terms of the GNU General Public License as
% a3 f9 e4 p0 ]# [) l1 U - * published by the Free Software Foundation version 2.
) p( ?; h/ A7 k - *$ ^ b; q/ u7 q! K5 r* _
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any- F) ^! ?$ R$ p8 x6 A' ?5 s" b" f4 ?
- * kind, whether express or implied; without even the implied warranty
( i! V7 |: n( J& H - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1 o4 n! f0 x7 A9 C' A+ X- W# H - * GNU General Public License for more details." ?( g7 f2 O. i8 X
- */
' T) Q; c1 @: Q( v: G; T4 t - 2 ~" s3 V' f9 Y5 { b! j! S
- #include <linux/module.h>
% V1 H! `7 E0 l; I4 z8 U5 ~& L - #include <linux/init.h>
/ X b" S% x; k- K) o: _ - #include <linux/errno.h>
% ^9 d# W8 R W( I/ U0 P - #include <linux/types.h>
* L: q& V$ M% p9 ?5 b - #include <linux/interrupt.h>
2 S+ i U4 C. h, |' j - #include <asm/io.h>
4 m" F$ ~2 K7 H - #include <linux/moduleparam.h>
! b+ K6 w* H4 Z% w% k$ ~ - #include <linux/sysctl.h>- y' W: V; R/ Y ?$ Z
- #include <linux/mm.h> H' _1 j# Q$ H0 w; I/ N2 M
- #include <linux/dma-mapping.h>
0 r7 n( j$ p- v0 ^7 ?
1 V7 E, q1 O6 J/ \7 V) `: s5 w- #include <mach/memory.h>( W' t: ~9 r Q# ]
- #include <mach/hardware.h>: u( x1 G$ I5 P V
- #include <mach/irqs.h>7 s5 B! T$ K- t6 [" P
- #include <asm/hardware/edma.h>+ \8 a2 n) Q% ]9 s- m: q
( Y3 z$ x* t. d1 h& `: \- #undef EDMA3_DEBUG0 ]" L0 H1 L E4 a. W0 u
- /*#define EDMA3_DEBUG*/6 A2 Y% P4 Z5 m% `8 m! T/ J
$ E' o5 L7 f! [& b# z- {5 J% a- #ifdef EDMA3_DEBUG
% U0 I) u/ ^1 v) S- N" [" | - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 Q, _' y! U/ X! H
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
3 {+ I- y U$ u: }. V4 q# i - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 e/ x) t7 F- `6 a- M- {
- #else
/ Z& A$ o) S1 n7 \4 B - #define DMA_PRINTK( x... )
; ^% Q6 h7 B& q) z3 H - #define DMA_FN_IN
. ^% a; f9 x1 N* c( F4 H- P7 x - #define DMA_FN_OUT
) _ `8 G7 W; x/ k8 S# C6 i% h5 k - #endif
{. r' ]# v3 g- b: G: H% B: j - 6 C! r# U. g+ q. j$ V
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
# P! X9 p# u0 ]( X! v - #define STATIC_SHIFT 3/ L" z, b1 ^' V* d
- #define TCINTEN_SHIFT 204 b5 a, g. ?% y
- #define ITCINTEN_SHIFT 21
+ a; q* v" V2 [ U# Y( R - #define TCCHEN_SHIFT 22
' X1 O$ p, _8 d9 y4 q/ M - #define ITCCHEN_SHIFT 23
" j) x Q" J" y; p5 c. |' w: n - 5 P& y+ b4 p3 s$ M J0 t+ l% y& Q: i
- static volatile int irqraised1 = 0;
; U5 G+ B) ] a - static volatile int irqraised2 = 0;6 ^4 t9 `5 y* u; ?
- 6 Y. s7 |; r% m! T, J1 N
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! K1 e" n( D! |5 K
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. ^7 [+ J7 x. e - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 |' Q6 z$ j2 U' O
3 E) C- [2 g' Z+ `7 `- dma_addr_t dmaphyssrc1 = 0;5 h& Y2 J# [; o9 v
- dma_addr_t dmaphyssrc2 = 0;
% R& \9 ]3 A2 P3 O- J - dma_addr_t dmaphysdest1 = 0;
5 ~. s# A# f2 Z! N. O - dma_addr_t dmaphysdest2 = 0;
" }( g8 T; j1 ? - / w+ ]5 n! z% k5 \9 P! v7 Z
- char *dmabufsrc1 = NULL;- A' [& Q. ?, v% A: H
- char *dmabufsrc2 = NULL;
# a" A* c$ o Z( f' @6 _1 y - char *dmabufdest1 = NULL;& J. D/ e; j1 ?# p
- char *dmabufdest2 = NULL;
- a. f& q% V% Q0 G9 g
7 S* V( P: Y* @) v- c8 @& Z- static int acnt = 512;* S0 i: W" w& u' U( W$ K( t
- static int bcnt = 8;
/ `& S$ w- B6 m- \) T! ^0 z& S - static int ccnt = 8;
7 {8 m# v* n+ ~. D
8 z D u4 ~# G5 @' L( m4 k. o- module_param(acnt, int, S_IRUGO);
9 x9 u B2 W' F. B1 d - module_param(bcnt, int, S_IRUGO);+ f( {, s3 m6 G, O( z* f$ X+ _0 j
- module_param(ccnt, int, S_IRUGO);
复制代码
% D' ^. v( W; k% B( x' n. |
2 u# H& N0 j- m2 M& b' m 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, W- [+ n) _% z) G/ d3 L) h W 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 r8 R* d9 L( g; p
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 Q- j2 j: j& r8 T/ C z% L/ F
- Q* H4 s0 q( W* Y4 Z" B( P$ m
% y8 h3 x) ^# T5 E |
|