|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! J P& R5 m* J! w. X, l* H- [code]EDMA sample test application3 G# {/ h+ J9 [5 j% V9 b0 D$ d
- /*: r6 Z8 [0 P7 L' w/ P( u
- * edma_test.c
$ B- ^- q$ s n0 K/ z4 T - *$ f: v$ |, `. O9 H
- * brief EDMA3 Test Application3 ^6 j7 e4 r. x: v* |' ], g2 V! T
- *1 t( R/ J* _2 v. S
- * This file contains EDMA3 Test code.
$ |; _$ s" a! k, `4 } h - *
1 \4 ], F, W: R* Z - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
% @7 X, Z |' q' h - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 i, L0 U/ O2 r& \* u
- * TO CHANGE.
l& D' L7 b8 y! n0 O p - *2 K: n; K! @6 Q* A" F
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
2 b& p: y9 v# x - *$ q# P9 p3 G3 G* j/ S
- * This program is free software; you can redistribute it and/or2 W& f# q! P/ B3 @
- * modify it under the terms of the GNU General Public License as
- A( s$ A1 `5 u' K - * published by the Free Software Foundation version 2.
# `2 G2 f+ h; G9 X, R; E% V9 e, h - *
! q0 p7 { f+ I% d/ Y x U3 P - * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ H! t/ B5 P& l: p# E% P Q
- * kind, whether express or implied; without even the implied warranty/ l7 ~$ Z) ]# s4 H" n5 H
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the i j ?8 m+ r. G
- * GNU General Public License for more details.
1 z% B. Y7 i2 @0 p# Y; }; z1 c9 U - */- |: d8 w5 Z' g3 Q$ z$ r9 x
1 `: H! s' C' r' G, v6 a ~ h# D0 ]4 B- #include <linux/module.h>% w2 l3 C, Y- G0 y" K' c
- #include <linux/init.h>
; Q! U- P* |: `5 G! f - #include <linux/errno.h>1 @ r9 q4 L5 l5 A$ \' N7 M2 ^) Q/ J
- #include <linux/types.h>
& f9 J- c( b& m. ]9 C+ i - #include <linux/interrupt.h>
+ O+ ^9 U4 d' T6 ?# D% z$ | - #include <asm/io.h>+ ^$ G7 d( F: g: Y) l, G
- #include <linux/moduleparam.h>
) c8 }7 p5 F& E7 j - #include <linux/sysctl.h>+ C& w8 ]9 M7 m% L: }
- #include <linux/mm.h>
2 E" ^; Z4 h7 i% j2 O$ P - #include <linux/dma-mapping.h>% D$ V# k& m* W% \, r
- ! d& P0 w3 i }
- #include <mach/memory.h>
, D* Q1 b) ?( z$ A8 f - #include <mach/hardware.h>8 r- Q c( m9 W9 ^3 y! e# B2 j
- #include <mach/irqs.h>8 V# c( ?) U5 d5 d
- #include <asm/hardware/edma.h>! R4 Y1 L5 j$ g5 t: s' A- f
5 c7 ^! Q/ M9 G, H3 |0 @- #undef EDMA3_DEBUG8 P0 s9 G# U) C2 C8 h$ u
- /*#define EDMA3_DEBUG*/
. C$ m" t4 e9 G4 }; N$ C; r" F - % G- h! ^: Y8 U5 v1 @$ N) b# K
- #ifdef EDMA3_DEBUG1 r6 E( H- Y; Y4 m0 A! i
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* {) T/ ^. G1 X% D7 D2 G" p+ v7 S
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), o1 W+ ~: v1 [3 F" ^
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( Z! e9 p. A# z$ W: K2 c8 Q
- #else
* s6 o u4 N* q! M. b: `5 o - #define DMA_PRINTK( x... )
4 h) z% N2 U- c# @! F - #define DMA_FN_IN
( ~5 b1 R8 D- f8 i* t' h - #define DMA_FN_OUT
0 D4 \# O4 k7 Z - #endif
( a, r& h! \+ S, y4 U* k1 M/ M
: m; J# u4 {& K o- W. |6 Y, V5 t( u- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
6 g: h- `& z0 [1 h* |9 U - #define STATIC_SHIFT 3
: z+ J( a! z2 \7 D( N! m - #define TCINTEN_SHIFT 204 ^. N& o$ Z1 I
- #define ITCINTEN_SHIFT 211 f% N9 t( |1 g8 }
- #define TCCHEN_SHIFT 22+ E3 h8 P$ v% K+ C% g6 F
- #define ITCCHEN_SHIFT 23# }7 k @, j' [: u, t3 p
) G5 ` l: N* V" f- static volatile int irqraised1 = 0;! F. c+ z4 c* ]1 C$ t5 Y0 A' P
- static volatile int irqraised2 = 0;
$ F S9 `$ {, D - $ ?% e3 s0 n+ w( |
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( j, _& N9 K; }8 Z. M7 e
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! T. D, D& T& B- j
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 O! s/ P: q0 W! Z - 4 {; ?+ L% w' }" s; D
- dma_addr_t dmaphyssrc1 = 0;3 v4 Y, _; O5 S7 G! Q# v
- dma_addr_t dmaphyssrc2 = 0;5 i9 B! A8 v! v$ t; a) z
- dma_addr_t dmaphysdest1 = 0;9 H+ `5 f. N: e. G6 g1 \2 H' U
- dma_addr_t dmaphysdest2 = 0;8 q( a# K: w8 T8 R
- 5 ^+ t8 s; R$ L, h% m
- char *dmabufsrc1 = NULL;% A& u& D3 ?; k& ]
- char *dmabufsrc2 = NULL;6 h- {1 t0 _: [( w. Z9 X" [
- char *dmabufdest1 = NULL;9 h& }2 e% w1 |
- char *dmabufdest2 = NULL;
- Z1 Q4 I3 L( e
* Z7 a; d% \4 T* g- static int acnt = 512;! [) ?8 M$ l h: N! ^' J5 T0 j( X" x6 ]
- static int bcnt = 8;
/ X$ w: X' g$ z/ y# s3 p$ ~$ {& W - static int ccnt = 8;. A0 z9 l1 W! C# p V) N% b$ q: S2 @
0 E; |3 z: A5 c0 V- module_param(acnt, int, S_IRUGO);
& L; q o- t/ {+ i+ m - module_param(bcnt, int, S_IRUGO);$ Z! y, t: P$ I8 S3 e0 n
- module_param(ccnt, int, S_IRUGO);
复制代码 ! V# F' m" H0 j2 T: z% T
4 U$ }* B' y; e5 V 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 c: o4 P `, w" F% a3 n( P8 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! _" b9 |/ T0 y3 o
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, a/ T8 b* E: m
% |+ E8 p4 n! e. D, l) r/ k7 h% D
* A, K0 v* @) f3 g3 I+ }9 I |
|