|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 A) K. \2 f+ i8 m1 h* ^+ m
- [code]EDMA sample test application1 V7 z# i3 o8 n
- /*! T7 @! M& Y& |( Q3 v+ m5 B
- * edma_test.c
5 t! e3 j B9 a% f" t8 [% H - *
0 B! {& A6 ]' I: l - * brief EDMA3 Test Application) P( N+ s! k2 `' z# V, N6 g
- *
: `; U7 z d7 g, L2 j: i - * This file contains EDMA3 Test code.- e% [2 `8 D& ]* f8 |' ?
- *
+ l% ?# }0 j# O# l( k6 ~( t - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
$ @! `7 M8 o6 \, ~ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
4 g+ Q9 ~+ }& o% g: _) O - * TO CHANGE.
: @* x, d! m$ l8 z5 F3 H - *+ |* P" M) E3 K: U1 o
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
3 a6 Y* O; L, E1 {( S& R8 e - *
7 v* S1 N6 W3 m+ L3 y) k f$ g$ d - * This program is free software; you can redistribute it and/or! w3 y) S! u$ ]! u9 o3 V& ]! A
- * modify it under the terms of the GNU General Public License as
' O! o( z5 x! G/ y5 l) f4 h - * published by the Free Software Foundation version 2.
5 Z$ X5 t X& i/ P! Q/ S - *
4 w7 ?! s/ l2 p$ J0 f( | - * This program is distributed "as is" WITHOUT ANY WARRANTY of any. J& K; a1 [% t8 v+ s7 O4 t' z& C
- * kind, whether express or implied; without even the implied warranty
% Q6 W( R. S) c" ~ @ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the/ o/ l9 d# [. p U" K! H
- * GNU General Public License for more details.
- F( \, \! ?' ~6 n, N6 ] - */- B5 P0 c! y0 C' n1 W' }& o
- * o9 f* v6 O9 \( ~4 P
- #include <linux/module.h>
! b+ ^$ b2 V- `- G - #include <linux/init.h>
6 z$ T: s# Q/ b5 [1 q - #include <linux/errno.h>
1 E% g. k1 `' |/ d N- N - #include <linux/types.h>
0 ]& y8 ~1 K! V, ^ - #include <linux/interrupt.h>: U. ~( Z" W+ X, f5 m' T
- #include <asm/io.h>& q8 O6 w/ i- e
- #include <linux/moduleparam.h>
, J. }2 O; [3 ? u - #include <linux/sysctl.h>* U: O8 ]9 D9 }9 N. S* Y
- #include <linux/mm.h>* ?$ ]+ o7 w9 O" z% L
- #include <linux/dma-mapping.h>
) j( u) ]4 ~, U. G0 h+ E
* c- ?/ i. w0 T8 I g2 T- #include <mach/memory.h>0 ~" ~/ @0 U4 z. [# Q& U- {3 [8 h
- #include <mach/hardware.h>& ^3 e/ r* R, p' ^' k+ `' d y* F
- #include <mach/irqs.h>5 u2 g% c& r/ v/ J) a' e
- #include <asm/hardware/edma.h> a) j9 w |1 Z6 @
" A& K6 S; V% I% e- #undef EDMA3_DEBUG) J' J0 }3 k' l6 L. L! Z
- /*#define EDMA3_DEBUG*/
1 V3 L+ h5 N" N" P% b1 {
! ]' Y1 w, ~& a+ K0 ~1 g! [- j- #ifdef EDMA3_DEBUG
: v, R9 [& J& V - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS) j* \0 K& ]8 ]7 j# h" e1 e
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). \( |' p3 ~3 n7 S
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
9 J3 j, r, d+ x5 B - #else
& E7 L! f; @8 l+ C - #define DMA_PRINTK( x... )
+ t [! c# ^( Z3 [ - #define DMA_FN_IN( u$ Z, E- a, T& i, O0 N5 V8 w
- #define DMA_FN_OUT' G9 Y; ]6 f3 H9 X: P; a0 e+ n
- #endif( [, I# G4 l' V- [8 b( O
- 6 j3 Q' k4 W) E7 c- I r7 |6 b, L
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
- @; S6 g4 ^5 \8 \ - #define STATIC_SHIFT 3% V4 S0 k e5 _. z( h
- #define TCINTEN_SHIFT 20 l0 J. \1 [0 c2 i% k* T. w
- #define ITCINTEN_SHIFT 21
6 ^) h8 V6 t5 A - #define TCCHEN_SHIFT 22: c1 o( o- {( \: M0 A; P6 q
- #define ITCCHEN_SHIFT 232 \8 e- O5 b+ H% I' v" |
; V: W* ^" ]- S! M- static volatile int irqraised1 = 0;/ [5 B- B2 X# H- I2 R( m- l
- static volatile int irqraised2 = 0;" C* Y8 }# T% j# c' I
- # {4 I) X# Y1 U0 U6 e
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" x3 g: y$ R! O4 u. o
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( Q; K9 x! G5 p$ E0 _
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 L) U; n0 a9 V7 Z1 w- \' X
% V" |! k4 @% c2 w: d2 k7 _- dma_addr_t dmaphyssrc1 = 0;$ ^5 h# q6 }! f1 B& z
- dma_addr_t dmaphyssrc2 = 0;
4 v9 a1 i: t$ Q9 d3 a - dma_addr_t dmaphysdest1 = 0;
% K' J; U. T$ U6 x) T9 Y6 O - dma_addr_t dmaphysdest2 = 0;
; `" L- L! i/ k7 f% O6 I$ K - ; l7 F5 y# p# C. a
- char *dmabufsrc1 = NULL;9 ?8 M$ I+ U( X
- char *dmabufsrc2 = NULL;8 q# e3 c+ s* s8 h( C6 d! W8 J
- char *dmabufdest1 = NULL;' K$ d9 |' e8 M) W4 c5 Y
- char *dmabufdest2 = NULL;
( E6 `8 z% z2 [ - & r* D9 @5 n; M; N V* K5 B
- static int acnt = 512;
7 ]" \% w1 U2 S - static int bcnt = 8;
. J0 D- |% r: @7 i' S6 |. ~1 y) R& B - static int ccnt = 8;
- ?) Y: M0 u9 ` h8 F5 n
# Y. m) R$ q, n$ d# K J" M) R/ Y) K- module_param(acnt, int, S_IRUGO); a, D2 y$ U. h9 U8 Z+ W" K/ E
- module_param(bcnt, int, S_IRUGO);2 ~" j' T( B3 N2 n
- module_param(ccnt, int, S_IRUGO);
复制代码 ; k* \6 Y7 t3 n4 {) r
: U/ L/ z; m4 F9 ~) `8 R 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( z, P: ?# I' O% R5 m: A5 S7 ?5 Harm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 N3 C* r1 f8 i* K 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- \9 U1 F8 A! `2 I- `
- Q' i/ e# x7 K- {4 {
+ [9 H' t9 i; c; Q3 _9 A- _8 { |
|