|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
0 ~. K6 j1 w9 Q+ l! R1 P; Z- [code]EDMA sample test application0 e# s7 j3 H P
- /*
W" f, O& X1 O2 T- } - * edma_test.c7 t8 v2 f% f* h7 O! d r0 k
- *' q0 @: G4 D, X
- * brief EDMA3 Test Application
, |/ H+ O3 U- i! o6 r- \" [; G# J - *# I" _1 P. Y/ x; F
- * This file contains EDMA3 Test code.
, S7 U1 o( G' l. [7 A' M, h - *
$ g! @( ^3 Q, A; R' W } - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
4 \! ]9 q& j4 O - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
A6 ?6 G0 A% Y$ Y" @- P f - * TO CHANGE.& j* N; b) g6 O5 e9 d6 t: v
- *4 }% |/ T1 L2 S
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; K* I2 W- _1 q2 Q! L
- *+ ^/ J8 r" }" l9 i# L
- * This program is free software; you can redistribute it and/or. J( g% M+ k3 G
- * modify it under the terms of the GNU General Public License as
7 r7 d$ `& V2 f* n1 T - * published by the Free Software Foundation version 2./ P' l( T- I# e% P( U$ j ^
- *( V; g0 j$ T) k# t
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
# p& ?3 `- n! D1 ~% n - * kind, whether express or implied; without even the implied warranty) w! I9 }& B$ r' a4 g: H! S
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the' b* N* J5 c; }* c9 V% Z7 R: g4 f
- * GNU General Public License for more details.3 M3 I* n1 L9 P% {6 D
- *// J2 K' r/ T1 J. D; [) \ F4 u
% x+ D0 m% E% S: G; T+ b" H1 k% ]- #include <linux/module.h>: Q4 K" X9 E& x& n1 R2 t
- #include <linux/init.h>% ^0 ^' T' r4 K. J( X% _
- #include <linux/errno.h>* i3 {# w+ {! c' u7 O5 |$ ~7 }
- #include <linux/types.h>2 e; ?; ?. Y1 @9 l) ]
- #include <linux/interrupt.h>* c a ~0 v. f
- #include <asm/io.h>1 ~& q$ T. Y4 a- `
- #include <linux/moduleparam.h>
5 o+ }$ e7 v- O2 M9 o o - #include <linux/sysctl.h>
% [/ @) ^/ V( y5 e. G R3 k - #include <linux/mm.h>
4 I( `6 O( s& ?4 C/ M3 F - #include <linux/dma-mapping.h>7 [5 X2 G! S0 a2 Q4 d
- $ V% q6 K. h/ a5 A7 b- ]; N
- #include <mach/memory.h>. \6 l1 Q" R8 W6 Y8 c' Y/ V
- #include <mach/hardware.h>! t! K* E8 p, Z! C- d; ~) H- \
- #include <mach/irqs.h>! h0 {5 J* y0 i) v# [* i2 w' u
- #include <asm/hardware/edma.h>- A6 i/ _9 M6 S( w6 T; c0 b3 f
- & Q! o ~( m9 k2 H
- #undef EDMA3_DEBUG- W. v2 o% V+ n1 `0 m: |2 W
- /*#define EDMA3_DEBUG*/
, a! ?. U8 R' h9 L/ y
0 V9 ?7 y: V" E3 h: H, d" \- #ifdef EDMA3_DEBUG/ L9 e; a0 L% p$ V7 L3 [
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
5 ^$ v/ Q; G8 ]0 ~' L - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
/ `- p& D& t0 d) Q/ a/ b! N - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( K4 f# H; J# O3 z( F
- #else
/ _& F3 h2 G% ?0 N7 F - #define DMA_PRINTK( x... )
4 v: O: g% X+ C - #define DMA_FN_IN& H/ R7 x( N1 o5 R4 W, a& a. k
- #define DMA_FN_OUT
& A! H3 k! @ S) S - #endif
, h! E9 g# L) j2 f+ ^ - 0 n; g" N6 e4 o; }+ s
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
8 u Y3 V9 Z1 i3 R+ V! O - #define STATIC_SHIFT 39 H* h( P8 b; O8 h! r
- #define TCINTEN_SHIFT 20
1 j- V1 M% z* T3 x- k+ r - #define ITCINTEN_SHIFT 21/ x4 t% I) A/ R2 O8 s& l- i
- #define TCCHEN_SHIFT 22
" e. g3 f: Y# n f. D - #define ITCCHEN_SHIFT 23. Q$ n4 V+ |- l3 x5 c- L( V, v+ P" q$ }
- ) K$ U8 G2 m2 P& {0 B2 Y0 V, N
- static volatile int irqraised1 = 0;
, Q- r6 \: ?) n) I. p: M - static volatile int irqraised2 = 0;6 P* y: [/ W( N) k
- 4 M& J( s: x" B' l" t ^
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( m/ |* S1 P) I$ g5 Q! P/ s; b" N
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ e% s1 {& {$ J# T" Y6 K
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, Y8 v! w0 J. W! _. Y8 t F
8 ]: a" c8 N/ [0 B- dma_addr_t dmaphyssrc1 = 0;( t5 P, ~! v$ x6 K
- dma_addr_t dmaphyssrc2 = 0;; Y* X- A& U, I3 l6 [
- dma_addr_t dmaphysdest1 = 0;5 Y6 r o4 m: i
- dma_addr_t dmaphysdest2 = 0;7 J6 }6 e |. U* N P
- " {9 z [1 B/ j0 g$ v: s
- char *dmabufsrc1 = NULL;
( D1 G9 d# Q3 |& Q8 F0 _* g - char *dmabufsrc2 = NULL;
$ L/ R+ R! _$ M2 K" v$ Y/ G+ T o - char *dmabufdest1 = NULL;2 L( ~. F9 }7 y9 M2 u
- char *dmabufdest2 = NULL;3 S7 S$ P$ q) `: \% ^- Q1 R
' Z' C, _$ l7 J0 [( T6 J H6 _- static int acnt = 512;" B) w3 X: L# g/ ^2 T
- static int bcnt = 8;4 I5 j; }$ u( v* [
- static int ccnt = 8;9 H! {6 E! f \4 P9 P& F9 R
7 D# ], |: c% C3 V+ x# k$ X' v- module_param(acnt, int, S_IRUGO);2 H- F) x0 Z2 j! h) D5 n9 U5 X$ E
- module_param(bcnt, int, S_IRUGO);7 f- G4 h- Q7 ]/ X U, n4 J
- module_param(ccnt, int, S_IRUGO);
复制代码
6 f" M1 V r+ I- ?3 [) x- a: r Y. Y- U1 k' L S6 J3 n9 `' d9 E
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 ]! Q. {, t% m) `' A% Marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( p+ p: v/ R# U1 V
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 E2 U1 X7 i- ]' Z
" I5 ?& |+ Q2 Y& u- r: d' m3 E/ `* p9 ^
|
|