|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & k/ `8 x9 u* v5 }5 i' U* A7 y8 z
- [code]EDMA sample test application- V% Z x* J+ j# E. F( H
- /*
. v' ~* R$ f& o! V( o7 | - * edma_test.c; K$ J0 P# r+ L; d3 @: y) l% v
- *1 q7 B1 U. G/ W1 ^$ F% t3 e) C
- * brief EDMA3 Test Application
! v, o/ z, x; V, C* v& m! i5 P - *
: e" i& M) {0 t3 x& k/ ~ - * This file contains EDMA3 Test code.
1 y$ _( @/ m, P$ i! i - *
! Y8 d6 p3 Q" e4 o - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 r# X5 E" r# N) w% Y' A* m; y
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
2 K$ e7 [6 ^5 g4 Q$ J - * TO CHANGE.
8 o0 L" \" \, V q - *7 O2 [8 r, X0 t& ]
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
5 c6 A( ^6 O# \, u - *
% l( M! e) R! c' s" | - * This program is free software; you can redistribute it and/or
+ v g1 q" w5 l - * modify it under the terms of the GNU General Public License as1 c4 D# }' K2 r" Z; p
- * published by the Free Software Foundation version 2.
' z8 U/ Y6 i9 w) J - *
4 u3 C) R V, x g9 ]* A - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
7 F, B" Y+ I; K) V - * kind, whether express or implied; without even the implied warranty% B/ @$ I; [9 o
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the9 u$ K3 T% V9 K9 Y
- * GNU General Public License for more details.
& k3 b" ^7 U K+ R* P - */% U7 Q$ Z) z9 a# S4 ?8 b+ C
$ p* O7 G R/ O5 C2 Y- #include <linux/module.h>
% D$ q6 ^7 A' \7 B6 r - #include <linux/init.h>3 Z( |- ^% s* E. u2 o' @
- #include <linux/errno.h>$ c) Z ^0 E& m' `5 {9 y/ e! k' J( N
- #include <linux/types.h>
4 H( ^; }0 x- p( ?" H2 D" V - #include <linux/interrupt.h>( b) W2 o1 b9 {& |4 p2 |
- #include <asm/io.h>$ X5 d9 Q3 ~+ ]3 u; }
- #include <linux/moduleparam.h>
* h/ @. D+ Q( \* W5 L, w - #include <linux/sysctl.h>
9 V7 d5 p* X# m- t2 I2 D - #include <linux/mm.h>
; m; `6 {, ?9 [/ N: J: K - #include <linux/dma-mapping.h>- Z- Z8 R& l: G' b
# V1 C4 W, I, q4 j% k5 W" v3 M/ A: g- #include <mach/memory.h>) {) U# Z' c% x% \" H
- #include <mach/hardware.h>
9 M I8 i; b* ~' c - #include <mach/irqs.h>6 n E6 e& N; \( R: J$ a2 s( n- O3 B
- #include <asm/hardware/edma.h>
6 h p! ], l6 X7 Z1 d+ V - * q4 ]& ~# p* P, p H2 S
- #undef EDMA3_DEBUG
; _3 Z) @5 r. c, u7 F1 q - /*#define EDMA3_DEBUG*// b; F& x# C5 e; S4 q
- 4 t% s. l k+ p; p: F
- #ifdef EDMA3_DEBUG6 M' H& u1 s; W) h# _7 l1 [
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
$ a7 [* A* \* ]+ v. [ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
- c/ h! G) {; b - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
: d& q6 y6 s. H l" ] - #else f9 o$ t3 y4 l) Z( n7 M
- #define DMA_PRINTK( x... )
+ G2 |2 k# e2 \: h- h; U* @3 r1 U - #define DMA_FN_IN3 c# O1 Y% O j S
- #define DMA_FN_OUT
: C" I7 [. A! _& [2 T - #endif
1 {0 ?0 F# f9 f- x. o' E/ q - 9 W: J' i0 m; @. e
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)5 e5 b. M8 ]; c8 z. @6 E! h
- #define STATIC_SHIFT 3) @# \, [ e" ~! d7 r
- #define TCINTEN_SHIFT 20' W9 |5 b+ {; h: \8 `) r
- #define ITCINTEN_SHIFT 21/ j8 y& J4 T) m0 T Y% k0 D- ]
- #define TCCHEN_SHIFT 22
8 T" v9 f. Z. ` j% e- k3 p; _ - #define ITCCHEN_SHIFT 239 M8 u% D9 d8 n
- : y+ ]+ ]* m# N
- static volatile int irqraised1 = 0;! x: c& V5 B9 s; p. t7 H; G2 e8 M! [
- static volatile int irqraised2 = 0;
1 b" P+ Q0 n' f% f" n; h
8 [1 p% {. j& a8 h, w) o' \- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 O! N' i6 S5 P% `
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ {' S- _: T" O' K. p# i - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) `) {# [3 e$ d3 ^ - 3 M( I) ]8 J0 F9 t; i& o* ?
- dma_addr_t dmaphyssrc1 = 0;
. V# G6 J' I0 i3 u - dma_addr_t dmaphyssrc2 = 0; n# r" X5 S( k" I5 ^* {' P
- dma_addr_t dmaphysdest1 = 0;
5 E9 y$ g$ m5 P; Z" ` - dma_addr_t dmaphysdest2 = 0;
* x4 b/ f: F8 ^* r
; C- f2 h' c4 ?6 D; c/ }4 a: k- char *dmabufsrc1 = NULL;
5 [6 `6 U3 C3 S5 P8 Q& B - char *dmabufsrc2 = NULL;
1 Z5 i, W$ G7 K1 l! y/ | - char *dmabufdest1 = NULL;8 v% z6 w. x: L7 t
- char *dmabufdest2 = NULL;7 H, ^. S f; G4 d: k
: g8 \# J3 R/ ?- static int acnt = 512;' p2 j0 C1 w+ N; I( [2 l
- static int bcnt = 8;
& h: K. n7 h4 O1 b2 n9 G - static int ccnt = 8;
3 ?9 R: ~, i1 X) ~0 [+ g - , ^ N+ _2 e4 g8 ?- i9 U. ^/ w
- module_param(acnt, int, S_IRUGO);8 `0 T6 I* q# P5 o4 g$ b
- module_param(bcnt, int, S_IRUGO);
1 y8 t4 u4 T1 V& `' f# D - module_param(ccnt, int, S_IRUGO);
复制代码 / Q7 R+ K" m, K9 {& d
$ K0 y# `+ W3 x! [1 o0 [
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# i6 }' U2 m+ C0 g3 F. qarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
5 c( F+ E- w) q2 l7 c4 `6 I- A 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 f" P/ U6 H3 i* L' `, g5 s$ h% @2 Q! y1 P- m! p6 J, b
0 W J @) w1 u6 c
|
|