|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : o- c7 X' t# ?( d! ~
- [code]EDMA sample test application
% t+ d! {- W. Z! q* k/ N - /*$ } m+ H5 r5 P; f
- * edma_test.c
% q8 @% t$ c, u5 y. u1 Z - *
7 K* H2 B( H( ]9 g* @7 q - * brief EDMA3 Test Application
+ V; `; f& T* W - *
4 H' B; ]" d* C M - * This file contains EDMA3 Test code.. N+ T. ]& K. [
- *+ F) d Z' a; R* I8 o
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
/ v6 C1 z# e8 Y - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
6 k2 a) Q4 m, N6 l, X' U - * TO CHANGE.( z* a5 g' P, y& L4 t! H
- *5 F3 U* Z" o3 X" X
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' [' w5 r2 X, h) c2 ]
- *
- G9 F6 ?1 u* u! m4 e2 u - * This program is free software; you can redistribute it and/or
0 _, S1 U- U. I7 B- @6 l - * modify it under the terms of the GNU General Public License as) \1 p. ?9 I5 W
- * published by the Free Software Foundation version 2.3 L4 l7 p9 K' D8 |9 N9 d+ i" t
- *
- R: M* ]0 T& X" a( x - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
: d8 J2 Z% J: s# s5 l: B8 r - * kind, whether express or implied; without even the implied warranty
( }7 B: c3 l& S, K" I- N - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
) }# X# g- U9 s+ w6 y L3 b* P) Y - * GNU General Public License for more details.8 Q/ Y, `: f8 t+ i
- */. l; R8 ]" M& A# [% k9 \
- 4 I l' f4 _. a7 w8 r+ }
- #include <linux/module.h>1 h" n+ H. ^1 }* h9 l% \
- #include <linux/init.h>
9 \: t2 S4 o$ t. O8 a- x" V, x! Q" C9 W - #include <linux/errno.h>$ _2 X+ j7 d8 S/ q. s; ]
- #include <linux/types.h># J: t' T, _0 a+ ^: ^( B2 u9 J* p
- #include <linux/interrupt.h>& _2 D8 Z2 y' @, Y/ d1 @
- #include <asm/io.h>) `$ m f, U0 m2 S0 F
- #include <linux/moduleparam.h>; \' ^) t4 o2 B7 [# C3 Y+ k4 z
- #include <linux/sysctl.h>' L$ G5 d7 B9 V K% e! H* B. z/ S
- #include <linux/mm.h>" {' ?; W( s1 ?% r# k$ S
- #include <linux/dma-mapping.h>
5 q2 q5 _1 ?" O- @% v. O
, y' K- K- X7 U s, n( m- #include <mach/memory.h>
\* Y, K' m7 K/ _& T; t; s - #include <mach/hardware.h>4 D3 L h% u @ H
- #include <mach/irqs.h>- [6 l- }5 x# x- k7 h# `: V) w
- #include <asm/hardware/edma.h>
1 |# u X7 v: K8 ?# s; B9 E
- x3 Q0 a4 q: Y- #undef EDMA3_DEBUG
& Z# p0 v5 {+ M - /*#define EDMA3_DEBUG*/0 K/ H& ? a9 m, P9 E$ J' T
e! r! X/ {2 W* S- #ifdef EDMA3_DEBUG# X8 \" Q3 e# _8 ~
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) ]- \% W( r1 r) {3 P
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& ]: t9 w! D$ {) ~# W* @# b
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! [( Z9 a' Q, I5 z. a. e* n
- #else
6 u1 ?: K( ]5 S - #define DMA_PRINTK( x... ), I0 y* V0 e. D" Y
- #define DMA_FN_IN
_+ e; n* s* O. h' ?- Y6 H - #define DMA_FN_OUT6 ~- H5 r' t+ ~9 R$ r: A1 h
- #endif5 D7 w1 U' P/ j0 a. ?# R' Z, {
- / S4 E( `) w& t& p# Y8 x4 ]0 |
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
( }2 G, ^3 ?/ G5 _( H - #define STATIC_SHIFT 34 u6 ?$ A- ^, I) X8 H9 A
- #define TCINTEN_SHIFT 20
- C$ j6 X+ S' v - #define ITCINTEN_SHIFT 21
; i8 M- c) _ \/ C - #define TCCHEN_SHIFT 22
: z& O L8 f9 S7 q1 N3 d- ^ - #define ITCCHEN_SHIFT 236 ?, V1 j- I& z% j) y- s3 x
" v7 Q3 [6 [- K( b' Q* f* h- static volatile int irqraised1 = 0;7 A6 W+ P- y9 J+ [& K. o0 _
- static volatile int irqraised2 = 0;
+ |" B( u5 L& }( \9 N* e - / q6 V0 q8 t! h" S7 L
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 d! i6 ^! C: S5 o - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% A6 \; c" `" n1 U1 v0 q) e
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# B3 B1 G/ W# R C
- 6 G) |# `' N# J! D5 q. Z4 K
- dma_addr_t dmaphyssrc1 = 0;0 V: s( n7 X% m: L, E0 Z& Z- w6 J7 D3 E
- dma_addr_t dmaphyssrc2 = 0;8 v0 _- j' l5 }' r/ v s& D
- dma_addr_t dmaphysdest1 = 0;' p# l. S, J- D5 w8 r
- dma_addr_t dmaphysdest2 = 0;3 I* {* F/ t4 @+ D
- ^3 d6 E, q' g8 w2 i3 w; D* h
- char *dmabufsrc1 = NULL;- d4 i, x& N0 g9 a) S' k/ ]9 A- ^4 A
- char *dmabufsrc2 = NULL;
$ u! U1 q% k8 W% z& k. ` - char *dmabufdest1 = NULL;$ \4 _$ O, ~: u
- char *dmabufdest2 = NULL;% Z' ?, e; ?: \
: T# F8 e: d# Q8 {7 [. l6 @- static int acnt = 512;
9 o5 q" k( [+ U T7 C. E, n - static int bcnt = 8;
2 F5 [. p* }0 n$ x - static int ccnt = 8;; _3 }+ l( U8 @. }& N! u
- 3 y6 L, G9 \* H m: `! o7 y
- module_param(acnt, int, S_IRUGO);
* E8 J+ I# {0 r+ ?6 j - module_param(bcnt, int, S_IRUGO);. p8 ~+ P& z5 {8 I: x# j
- module_param(ccnt, int, S_IRUGO);
复制代码 % [( B# O+ o+ i7 v
& ~0 E- B4 u8 g6 ]5 p# ~' s 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ h2 L* d" P- Garm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 n* y+ M# O N% U6 f7 H9 L
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, W8 _) E7 P1 J6 f) {6 A5 O- t$ m* d+ p5 _; u4 e& J9 K! e
- p+ o8 E# a; K; w. f+ `
|
|