|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& [# E# U/ H, R: E- g; `* X, B5 @7 f- [code]EDMA sample test application
w5 P2 O6 A0 e% N3 P; n - /*
- Y$ R& D9 j/ K6 ?3 [$ v. Z. H& i - * edma_test.c% | r7 G3 H [ F/ C
- *7 |1 Y! @; Q/ L# B7 d& T8 ?+ Z
- * brief EDMA3 Test Application
3 o+ c% K# m; X7 k - *' b- m Y- K; \$ f* _/ y! [$ G; Z
- * This file contains EDMA3 Test code.5 `- c' ^# o7 t" a# n/ ~
- *
% [! o: P. D8 [0 W - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
7 G$ H6 X9 Q. o9 S2 K1 `3 Y; s - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ m. m6 P8 L6 t" f- W) t7 K& g
- * TO CHANGE.& p" t* {7 X% f$ A4 B5 i
- *' D# v2 c: F1 Z- |4 f
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# @* f# ?2 g' a
- *
' m) _; N& }- L& v- ~ - * This program is free software; you can redistribute it and/or
+ k. f7 I) f/ Z' _1 B. `* S - * modify it under the terms of the GNU General Public License as7 T7 T) [8 n4 W+ _! s
- * published by the Free Software Foundation version 2.7 m" W! T, q2 {3 y
- *
( B, Q( B! p' z - * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 p6 j2 ?' d5 R
- * kind, whether express or implied; without even the implied warranty
) K5 i/ o& ~: ]2 N* u - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
: l# W, d* n9 y2 [9 _ - * GNU General Public License for more details.1 r+ T5 S" t _/ F+ ^
- */! e0 W9 p+ _% A% R
- $ Q; V6 f+ _0 N% L7 H
- #include <linux/module.h>
5 G9 S6 R, D6 u/ ]5 w" ^ - #include <linux/init.h>% r( Y( S9 I- T! n7 C
- #include <linux/errno.h>2 @+ e' Y. b7 t: G; T6 `/ r% [' o0 V
- #include <linux/types.h>) X& ~' p: C q
- #include <linux/interrupt.h>* \- k1 b. }$ i" x7 r
- #include <asm/io.h>, J" [6 ]3 X! {+ X9 I* K: J
- #include <linux/moduleparam.h>
, X! T) X( t2 r$ A6 x - #include <linux/sysctl.h>" |" E5 z/ y2 a" A' K' e
- #include <linux/mm.h>/ o4 E G# c2 G6 Z# x9 `
- #include <linux/dma-mapping.h>. [+ @% m8 a/ s# g
- 7 k" S) r' e l! m
- #include <mach/memory.h>! Y ^# N% l: f8 q( Q; E6 t+ b+ y
- #include <mach/hardware.h>' J6 X( b* y1 A7 a+ |3 w7 S% b
- #include <mach/irqs.h>1 m* [" P* m/ c4 s/ X
- #include <asm/hardware/edma.h>, `) j) }9 t/ x' V
- . `4 J# p7 n: a( y
- #undef EDMA3_DEBUG
, i4 y1 L& I. j - /*#define EDMA3_DEBUG*/$ c$ N# h( O6 f# B, a
- . e9 J* h2 G+ c: S- j2 R' ` @% X
- #ifdef EDMA3_DEBUG5 Q$ r: `+ Z1 l9 ]
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 l2 ^7 R/ X1 C! ]) p
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
5 Y5 h6 ^4 T/ m - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
# G* V { _2 q8 _1 j% a d - #else- U0 ^% B! R' h& m) z
- #define DMA_PRINTK( x... )" R1 Z( }# S) d! W2 ^% \8 g. g7 z
- #define DMA_FN_IN7 I8 q9 n. ?6 z5 U
- #define DMA_FN_OUT! O ]+ S! U+ r8 _0 \; n8 U
- #endif
8 ~# o; l# p# M$ `1 P" ]
7 d# H3 x9 \( N6 _" R- #define MAX_DMA_TRANSFER_IN_BYTES (32768)& N" v# z2 r; D* c
- #define STATIC_SHIFT 3
2 s9 v& _ k. x. a; l - #define TCINTEN_SHIFT 20
9 I! X; P' L& \3 a' Q - #define ITCINTEN_SHIFT 21- i8 C7 [+ x4 v6 V
- #define TCCHEN_SHIFT 22: y: R" C5 p4 q: V
- #define ITCCHEN_SHIFT 23
% o/ }' q5 x! t
" k3 w. ^" c& \5 r1 y$ ~- static volatile int irqraised1 = 0;0 A7 V! E( K8 o1 E' H/ Y
- static volatile int irqraised2 = 0;
/ W" F/ _7 G1 Y9 J$ \ - 2 |) K- h: j9 H/ h) {. B. s0 R
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ g2 d% V8 G# c, W' Z) t' j, R+ h - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; W3 K; ^0 Z" L5 l - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 v. r- t+ }! B2 @8 K% x$ ~
( u- n$ ^- K" k5 b% F- dma_addr_t dmaphyssrc1 = 0;7 K- [0 o- N% T5 @1 p, h
- dma_addr_t dmaphyssrc2 = 0;/ x( j6 @) c! G/ y; N
- dma_addr_t dmaphysdest1 = 0;8 u1 d$ W; `! C6 y$ \6 S& X" E' y9 b
- dma_addr_t dmaphysdest2 = 0;' r* ?1 I& C& W3 E1 |/ ~7 b
- + T. N4 D2 q2 D1 {) e/ }( G
- char *dmabufsrc1 = NULL;
! s3 U* E; s. g8 Q3 x# ]8 q6 w3 Y - char *dmabufsrc2 = NULL; f C0 i% Y. @! i" t
- char *dmabufdest1 = NULL;- m A, u9 X- Y1 i# i: n
- char *dmabufdest2 = NULL;
# G0 |3 J: B: y7 s
9 r# s, m6 r! K- static int acnt = 512;
5 x1 J8 ^- y) j4 @# K1 i' N - static int bcnt = 8;0 @4 N6 u1 O. {" b( G0 x
- static int ccnt = 8;+ f. P$ m. |6 h4 w+ U- u7 A8 U
* h0 _& D( ]7 x3 _1 \" ]( M; l- module_param(acnt, int, S_IRUGO);
* F6 o, M A" l4 b7 {& S+ R ~ - module_param(bcnt, int, S_IRUGO);
3 w" k! d$ |$ R3 Y5 Y$ T - module_param(ccnt, int, S_IRUGO);
复制代码
8 y' U- u1 P* R+ D8 L0 A; T' W6 R3 l; L- Q# }% k# l
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ B( p* U( x) U5 l+ p" @
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- c# a/ i2 u; y+ ]! M/ s+ D, M4 [1 f
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 S" S0 s& r+ u1 A) F) P
! D( ^' F& R3 P4 Q9 R2 |, ^: I; F& m) s1 D% O
|
|