|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ _5 f8 ~" @0 h; |# q1 N- [code]EDMA sample test application8 V3 T5 y6 F" A+ S$ L
- /* v( x1 j5 ~) }( R7 P
- * edma_test.c
0 `1 V. @0 x+ R6 I - *% U8 U9 K+ ^3 C! s" F0 V
- * brief EDMA3 Test Application
2 O% {! C9 z& o8 n - *
9 `* l4 s* j& ^ - * This file contains EDMA3 Test code.
& X. A% @& t/ H7 Z$ w- ] - *! |& \2 G5 d; i$ w( O
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE6 `, K8 V# n8 M& Y
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 `) d( a- S* ]
- * TO CHANGE.
! b$ V, o, Q* I+ s. g9 D - *0 z# `8 B1 g2 D
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 K5 J2 j1 A" b8 b& L
- *- S& v- B0 F: v$ N
- * This program is free software; you can redistribute it and/or
+ A* G/ u$ ]8 K: { - * modify it under the terms of the GNU General Public License as
, [' d V: r$ O N - * published by the Free Software Foundation version 2.
$ V2 `/ K: |: [0 {( ?4 w7 X - *
8 ]& b( `& z8 G, b" L - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
( H5 G- s0 a7 g7 D* x7 C4 O% d" n - * kind, whether express or implied; without even the implied warranty
6 A, e0 }, r6 @4 T, e' l4 |, k8 D; E - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
& ]% B+ ]+ \, @ O0 I - * GNU General Public License for more details.4 `7 p" b0 z) |- q0 ` p
- */
5 A; H/ h$ a4 q, T" D - 9 F8 d* Z* D Y0 Z: E/ C* z0 y
- #include <linux/module.h>) Y! V9 y/ f$ q% K
- #include <linux/init.h>
% A Z* ~5 p8 L& Z. _' _ - #include <linux/errno.h>
& E$ w% h1 B: n2 E, v8 H9 M; e - #include <linux/types.h>
/ R& i& S/ U3 r1 @9 A8 s4 w6 ~ - #include <linux/interrupt.h>' J. {$ L1 A) T, G1 l
- #include <asm/io.h>
5 u3 \% p, Y9 x! E1 T) o - #include <linux/moduleparam.h>( _: g5 G- h( p7 L
- #include <linux/sysctl.h>
" ? g, ]9 A# g5 Y - #include <linux/mm.h>
6 N+ {& c) M6 V$ ]1 r" h - #include <linux/dma-mapping.h>
3 j) p* E4 D4 g n8 d, j - 8 w% J7 M4 q5 ^" x
- #include <mach/memory.h>
7 _9 S/ {$ {: H - #include <mach/hardware.h>7 g+ K6 Z* j; r3 x
- #include <mach/irqs.h>
2 j( {3 v0 T+ j4 n: m* `6 Z1 { - #include <asm/hardware/edma.h>6 f/ O u( s& o! f w0 J
: ^" j. V4 @, P2 u$ K: r8 E% _- #undef EDMA3_DEBUG1 r" b6 K4 f5 c1 F% y; r
- /*#define EDMA3_DEBUG*/1 y, a/ m# I5 R. d
3 |( ?6 J# ?9 y4 e% b/ r- #ifdef EDMA3_DEBUG% T% G( A( Y: b! T# C" s d9 }
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' I" h, S9 S. C0 J9 [, B& ~# S
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
! @( _6 T8 Y* i4 m: v7 e( ~$ x+ S - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' @* \" Z+ ?0 p! ] Y' p
- #else
' X1 Q/ t* g: s8 _+ n9 I - #define DMA_PRINTK( x... ) f y; U5 U5 r& O% n+ e) \
- #define DMA_FN_IN- p" @) `5 d! R: {. L; S
- #define DMA_FN_OUT
/ {6 `! {7 n+ M! E F - #endif- V/ Y# M8 p' N% s+ S9 o
- ( I' o" k! h5 J+ _
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)3 Y/ A: T0 S. V u$ M' z0 I
- #define STATIC_SHIFT 3
3 _7 W5 P2 D, [6 W0 X% T8 F - #define TCINTEN_SHIFT 20+ m- G5 Z7 R; p5 ?) [
- #define ITCINTEN_SHIFT 21
# n/ n, f$ m2 V: v$ B: D( @ - #define TCCHEN_SHIFT 225 Z! Y6 G$ M. q, b; l7 D
- #define ITCCHEN_SHIFT 23
6 }( i+ v) @' ~' s8 H, c! b4 V
, `" D5 p* a A& W+ W R* W* F- static volatile int irqraised1 = 0; I2 A7 t# f6 o9 ^0 {1 Y
- static volatile int irqraised2 = 0;( C6 A- j/ n# S- m' ~( y7 @0 n$ ~
; ^8 H; _* p4 r8 z- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- |7 W5 \4 i/ ]/ F; ^. x# L0 p
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# l( A; e' V6 H/ M+ G0 U; f! ]: L
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" C; T0 X+ L5 |, d/ a2 m
, o' b: M' X. l' f/ s3 s) n8 t* q- dma_addr_t dmaphyssrc1 = 0;
8 n1 `9 ?: E+ Y3 C1 E2 `: Q - dma_addr_t dmaphyssrc2 = 0;
3 S* t9 I9 Z* i" w - dma_addr_t dmaphysdest1 = 0;
( n. V3 R' w/ b - dma_addr_t dmaphysdest2 = 0;; V( M3 s4 Q! B8 q1 \
5 _! N4 ?2 e9 n) o- l6 u3 d4 |- char *dmabufsrc1 = NULL;
& T, v1 A$ Y0 S - char *dmabufsrc2 = NULL;
8 m. y$ R/ a& i' O: E% w$ z" r - char *dmabufdest1 = NULL;
' b2 g0 y* ~1 k% g# T - char *dmabufdest2 = NULL;
. z, E6 @$ L' D$ w0 R0 `$ D; W* }
- i2 v {/ M' n& x4 V- static int acnt = 512;
+ H6 X9 e/ f _5 v0 t. C; q: U* L - static int bcnt = 8;6 h( a8 d3 k0 j/ i- c4 i5 w
- static int ccnt = 8;
0 x8 z: e7 ~1 _. R
3 ]2 ?5 R# q3 j/ W$ A7 d8 h- module_param(acnt, int, S_IRUGO);
+ [% f4 n. N- I2 ]) V - module_param(bcnt, int, S_IRUGO);
+ C, F9 R k5 t" K - module_param(ccnt, int, S_IRUGO);
复制代码
5 l& V3 G z/ g) t
# O. i u4 u6 {) x E 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" c( C1 Q! x5 y3 U7 B: ?9 `( J+ Jarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 s s& e" U: J. {
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 j$ D# ?0 }5 L' [+ ^5 F* e/ C9 v6 _7 [0 ^
7 x/ F3 u% }. o/ B: b |
|