|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; j2 s+ ~7 j0 x5 q' @$ o$ [- [code]EDMA sample test application% Z+ C8 X' s6 x. x
- /*
: L, h! f8 b. R. B- ?' T - * edma_test.c
, U4 g9 R! b$ P. Z$ w - *$ o" A. ]% g; k
- * brief EDMA3 Test Application
+ g- p2 c% p1 M- |5 P - *
3 ?1 @) i# E1 _; A/ i: U1 e1 C - * This file contains EDMA3 Test code.
1 \$ `3 y" U7 d# F; V - *
- D8 k* Q& ?5 M' q7 L" ` - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 X$ N; }2 A3 z; K
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
8 L+ ^& }0 e4 k( v8 H5 S1 I. ? - * TO CHANGE.4 q% E% K e+ X3 K
- *
+ b9 r' ?1 t1 h4 `) s - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
2 h! F/ t- s! C. U0 z) i! { - *; ]8 ?, N7 V/ k: s+ ^! T
- * This program is free software; you can redistribute it and/or
/ Y& ^4 D" j! s( k7 m7 N - * modify it under the terms of the GNU General Public License as- ?7 T6 R/ b: S: a0 S, T
- * published by the Free Software Foundation version 2.
% F6 N# t% U' I% v/ F - *& Y) i. }, @ O/ h3 Z5 u
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 d1 V9 i$ `: _/ D# y4 O/ _* N
- * kind, whether express or implied; without even the implied warranty
: _: f$ R6 c/ s; h7 V9 F* x - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the. c( ]; d% n! `+ G) ^& I
- * GNU General Public License for more details.
6 e" W( [! j7 _1 m: E: I0 A( R - */
5 ?% @. O, h& V% G9 V$ K. F; q$ w# ]$ K - 9 T- f8 Q; {' X# g
- #include <linux/module.h>
( P9 V" Y) a$ D4 U4 H6 Y - #include <linux/init.h>5 G( s& `, Y5 v4 F2 k6 B
- #include <linux/errno.h>/ a4 p; M& m! K2 ^7 B0 q h
- #include <linux/types.h>
2 p# Z1 r; K2 Q( a$ p - #include <linux/interrupt.h>
. G+ }( H( W. t% M - #include <asm/io.h># I u- f! x. F) |! i& u/ O
- #include <linux/moduleparam.h>
3 w6 ] L2 L* U: O" Z/ o0 c8 } - #include <linux/sysctl.h>4 F: r& O/ p' {/ g! {1 I4 }
- #include <linux/mm.h>2 a: z1 S* L$ Y/ ~, |+ B
- #include <linux/dma-mapping.h>* c! Z$ C, @7 t& c4 R1 b
% L4 d( G. j5 g9 q! ?: V- #include <mach/memory.h>5 ^' f2 O$ s4 P8 O3 Q, b9 q r
- #include <mach/hardware.h>
) g X# M3 |& ~4 P1 S) S' ~$ Y, n - #include <mach/irqs.h>
+ d, ?( X& r) _0 z - #include <asm/hardware/edma.h>
( ]- `& C8 m9 ?' C; h N - ; U7 B* F* T8 {9 Y0 T
- #undef EDMA3_DEBUG2 l! x& u# B- g* V, V; S
- /*#define EDMA3_DEBUG*/+ M, r5 Y7 e1 }, Q9 X/ ~& b; w
2 W5 ^: c! A, Q# S4 _- #ifdef EDMA3_DEBUG# b, U8 w- [- l, Y
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
' e$ @$ Q: Q6 B3 e/ m - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
: q' T3 b+ S9 E f - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 l b/ J) {) @* S0 I) M0 @
- #else
1 z7 m! c' K S1 e - #define DMA_PRINTK( x... )" \: g7 h7 U! n! v$ R# i' k4 c
- #define DMA_FN_IN
( @/ R; r d' a' r. \/ _6 |! Q5 ] - #define DMA_FN_OUT( E' @! b$ @$ x+ Q) C' E
- #endif
5 G2 d9 J' Z# U1 e
' x8 |- Q: `0 ^. q5 y! [- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
) C; ^+ W: V! d/ y2 P - #define STATIC_SHIFT 3
: F$ x5 O# t; r( N% O5 A - #define TCINTEN_SHIFT 20
5 l' k& A3 \6 C }1 l - #define ITCINTEN_SHIFT 21% b, u2 i' U5 q! R
- #define TCCHEN_SHIFT 22
; Y1 l t' u1 w# \" ? - #define ITCCHEN_SHIFT 231 @9 q( d& Z3 w% q+ h
: w/ @9 o! Z! j# M+ q9 i7 f- static volatile int irqraised1 = 0;; L, g4 o8 e9 S8 N5 j, |
- static volatile int irqraised2 = 0;4 w' Z! v3 L; W; D, i# f; ~
0 j$ T! T- l3 m8 P- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# l+ T0 l( M' G# c0 B - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" o$ D6 ?1 P9 w K) h+ D5 G7 w
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* o4 T# ?' j Y2 d% [ X
- & m- B$ @0 [+ o2 q& J4 w9 w, G
- dma_addr_t dmaphyssrc1 = 0;
4 N! B4 A" n; i( }" W9 } - dma_addr_t dmaphyssrc2 = 0;
; e0 @8 t9 S2 i& G4 L: } - dma_addr_t dmaphysdest1 = 0;
8 A" I, q$ e# u3 V+ c/ ^ - dma_addr_t dmaphysdest2 = 0;) H' i& n( Z( h& b) q( e
8 f" {: Z ]- |3 Z5 W: Q- char *dmabufsrc1 = NULL;
) U* A) `3 c' V8 `0 ~ - char *dmabufsrc2 = NULL;' [4 t3 Q0 z7 R
- char *dmabufdest1 = NULL;" y- H3 J) D' h" o0 m6 m0 s
- char *dmabufdest2 = NULL;
( h# H; Y, u4 G: E% h
! [6 V. |3 u% p% W7 R5 q# l) q- static int acnt = 512;! x1 ?+ ]7 l6 f* E7 z/ H( j! i6 |- Y
- static int bcnt = 8;
$ I) K* X; S1 s - static int ccnt = 8;
) f' o( E. K% z8 E. e, ` - & v1 [3 c+ n+ M/ E* i' y
- module_param(acnt, int, S_IRUGO);
4 z* u# [+ x; _+ d5 m/ D2 }+ O - module_param(bcnt, int, S_IRUGO);
0 R S+ l/ t0 i& J - module_param(ccnt, int, S_IRUGO);
复制代码 & n8 N: Z( r$ j/ T7 O1 s
. T- {" p3 I" X" d* O+ u3 J 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 K2 T+ M8 o6 X* r2 M" r2 A
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ D4 U- X1 Y% R! z, x. t
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& y- |' `9 A- h! t$ i/ L$ X+ e! k7 ]# K8 ~3 S% t3 o
7 @* W: b& r0 K7 s! _ \ |
|