|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 v% }( E" L Y, Q# w. K2 S- [code]EDMA sample test application% w7 w3 a9 ^' K# p, S
- /*
/ p6 P+ \5 i$ Y - * edma_test.c
' D3 R+ J) u0 u) h - *: W% M( C! [) X" A t! R
- * brief EDMA3 Test Application$ c7 r5 N$ b+ n9 k( w6 Z
- *( l0 X' K, m" x: w+ R0 }/ z
- * This file contains EDMA3 Test code.
( g6 R3 i& I7 t( N - *- m% U, }# T3 ~7 t4 @
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" K" Y; x2 p2 l! e) S
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
3 c+ K1 j7 z9 j# F0 k) l - * TO CHANGE.7 @2 ?* A( J. N9 }$ k2 D
- *
2 ~* k, z. m$ C/ G1 J! X9 t - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 W0 d2 u6 r* J$ V* f
- * N% J( ?9 r) q/ v8 L
- * This program is free software; you can redistribute it and/or/ f; x5 m" D& W5 f3 n
- * modify it under the terms of the GNU General Public License as. o! k( F8 x' Z2 k8 Z
- * published by the Free Software Foundation version 2.
5 d L2 t' G; `6 X - *. u9 G1 L# j9 A: p$ u5 B+ ]* _9 n
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
, F0 a0 j; j- U - * kind, whether express or implied; without even the implied warranty
, y$ X$ f6 Y5 R - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the. T7 n: y& m% U/ g6 D
- * GNU General Public License for more details.
& p \6 W7 c( D6 ]; k - */
6 H5 Y, W5 n8 h( L/ @! T
! j5 K5 L6 s. @6 s( V- #include <linux/module.h>
4 j5 e8 T) J" }8 b8 M# d4 z - #include <linux/init.h>
+ q% X0 B8 a; z( a; M# h - #include <linux/errno.h>$ b, D! a: V5 y- o: o2 Z# _
- #include <linux/types.h>
& H6 T6 y0 `6 a, F; [7 W8 h - #include <linux/interrupt.h>
: |; L# G0 }' J - #include <asm/io.h>* @4 R3 B# y7 D0 ]4 R1 x+ v
- #include <linux/moduleparam.h>
, r7 t* l/ Q7 p$ q; P9 X7 W - #include <linux/sysctl.h>
4 j% n- Y( [9 L& y9 C5 q; P - #include <linux/mm.h>
, ?0 l5 a" i* c3 m1 m6 C* a L - #include <linux/dma-mapping.h>1 ]' s' G% k7 s: R$ B
- ! \; ?: S. d1 Z3 j5 @" D
- #include <mach/memory.h> s8 F* B! o+ H( }% R9 C7 G
- #include <mach/hardware.h>
I; h8 v' k/ z$ _* I/ F- Q4 I" r - #include <mach/irqs.h>
6 _/ Y8 ?$ J& X - #include <asm/hardware/edma.h># u q: h/ F0 F2 V; R
- ! O+ v3 V* X3 Y+ C* X3 c$ B
- #undef EDMA3_DEBUG
, Z {; p3 H1 O) l8 u" G - /*#define EDMA3_DEBUG*/" a, L) l: X0 M; b% F( |
- & u1 M2 h. W" h
- #ifdef EDMA3_DEBUG& E6 x) E8 R5 b" S! h7 S
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 X, F9 e$ x# P- n4 ~/ |. o0 ?
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) k8 S! n/ S/ r0 |) m
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
7 U( {5 ^, ~; p" I - #else( @. a( x$ D+ ]7 L0 F; f6 y
- #define DMA_PRINTK( x... ) m# h. X; {( I; N
- #define DMA_FN_IN- [. w/ Y( M. g2 ~5 {1 @5 r1 u
- #define DMA_FN_OUT
# ~- j0 l4 n9 O - #endif' I. ?5 ]& @! M. s T2 c
- & u' R# l# U0 T) t
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
) M5 s# R9 z w( q7 q - #define STATIC_SHIFT 33 u6 b6 n) G( [: H5 h
- #define TCINTEN_SHIFT 208 o ^# b; q& q
- #define ITCINTEN_SHIFT 21" g4 T) { k9 {/ K
- #define TCCHEN_SHIFT 22
% D) [2 S3 ~# F' E7 t - #define ITCCHEN_SHIFT 23
/ H5 i/ v, ^$ q x6 D9 J
' z+ }3 x7 Y ~ G- Q- static volatile int irqraised1 = 0;
% q, K) M. g; Z% X5 @) D; M$ L& M - static volatile int irqraised2 = 0;
3 d2 Q+ s& ?% s3 c) a+ T
6 Q& S, U, S+ w3 p4 j8 |- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 b. N% W9 V8 }; X2 A5 p
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 D3 [1 ?# D; c
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 c% }; t! h% Y0 g - {7 f0 G% _/ H
- dma_addr_t dmaphyssrc1 = 0;* n/ X: k& i! w+ D! {% L
- dma_addr_t dmaphyssrc2 = 0;! L7 G3 a" W7 m* Q2 S$ {' v
- dma_addr_t dmaphysdest1 = 0;1 s* Z( F) c$ z- {6 Z% ?% A
- dma_addr_t dmaphysdest2 = 0;0 C! t0 P5 z8 B5 M+ _' v7 j. v
1 S6 S- K" M I8 O4 F+ h; \- char *dmabufsrc1 = NULL;
6 m/ C5 ]" o9 }$ ?* j$ A' ? b - char *dmabufsrc2 = NULL;
" `5 l. ^6 ]& I7 T# R" c( l - char *dmabufdest1 = NULL;( b7 H" f: `2 y* ~
- char *dmabufdest2 = NULL;: q3 b: I7 a$ U5 w' `2 n2 g4 p/ {
6 f& \$ _! E" k# P- static int acnt = 512;6 F$ M9 ]( M9 P' I9 I
- static int bcnt = 8;# B4 p" N: k2 s6 h! K( x
- static int ccnt = 8;+ m. @& C0 o! T. b+ z- |6 V/ }
- 1 h- p8 l ]2 ]5 | O
- module_param(acnt, int, S_IRUGO);( M" n% n) S$ X; w# M) n
- module_param(bcnt, int, S_IRUGO);
/ b7 o: P9 f* |, x& ] }$ \: R) M - module_param(ccnt, int, S_IRUGO);
复制代码
1 Z9 X2 ~4 a! Z- A d4 W- t/ l% M+ j* B4 X: Z
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) s0 z6 _4 a% T- {3 C* N
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 X' C" `9 F$ h& _0 N A: b
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 g5 F' S/ Q# Q8 G( F
: H5 C4 U) c' G
8 S& X' W5 [ |+ y, S$ ]; X |
|