|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ ~0 V5 n( i1 S$ R* p' y V- [code]EDMA sample test application, l( Y+ B8 O7 H( T0 A$ S: T: ]
- /*
^1 `' k, v& `8 k! V - * edma_test.c! m' Y$ c1 L+ K+ T
- *% t5 Y! Z: S7 e2 f% M# ?
- * brief EDMA3 Test Application
! c" P1 M7 j! V& | - *
5 P" n* y' i3 a3 h' q - * This file contains EDMA3 Test code.
" X0 `3 X! {$ X( z, h! h - *
) o' O# u; l) C# r6 A% q$ } - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE l! [ Q$ Z2 q7 ?: t9 t
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
' e2 q2 i6 o! O5 k; I - * TO CHANGE.
3 z. g5 q3 r. `& N - *
1 \' Y1 y# d7 p, ?" B! m$ H - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# s+ n. g2 \9 _" u7 b
- ** _! D3 f. P- ^
- * This program is free software; you can redistribute it and/or2 s9 T- a7 [, G# E+ I% x% l2 U9 K
- * modify it under the terms of the GNU General Public License as
6 K* ^6 p; b' \ - * published by the Free Software Foundation version 2.7 w% ] v; p/ Y1 L
- *+ }: h4 n/ z* d% P" }( l
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any' Z# `1 F+ X$ ?6 W* k$ q4 h
- * kind, whether express or implied; without even the implied warranty
) `( H, \ C0 w; S( e$ U; B4 e# ` - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
( B5 U" v& ~) G: Y. z8 G; N - * GNU General Public License for more details.
8 \& X: T0 K( A2 J9 j. y% @1 i - */
0 i6 i" H& q N( C( c' E
8 ^& @0 A/ v" D0 s- #include <linux/module.h>
6 U( y* {1 V% L% h! o. c - #include <linux/init.h>$ p! w# t6 z# @' {! @0 P1 A
- #include <linux/errno.h>
2 m- z) B ]" u t; n: e - #include <linux/types.h>
. X: w+ m/ H3 [/ a# T+ | - #include <linux/interrupt.h>
1 e8 e( z8 M+ U0 k! y) h! W ^ - #include <asm/io.h>8 B8 ?; u% S: u' T! _1 s4 b
- #include <linux/moduleparam.h>! {' O; k! J7 G. {5 z
- #include <linux/sysctl.h>) q" i- \; g( B3 {+ [3 q
- #include <linux/mm.h>
& i, g! K; M# S$ n$ d3 y3 y - #include <linux/dma-mapping.h>! E- J6 V3 K9 u |) P$ p) O
% q. b+ d' K+ a- #include <mach/memory.h>. p- A+ b) m/ g
- #include <mach/hardware.h>
4 p6 l z5 v; A, l - #include <mach/irqs.h>
$ Y6 c) R4 A; ^# S9 w5 R6 f9 x. v - #include <asm/hardware/edma.h>0 n! J, j* c* l: g
2 o; b& F5 Z; \+ u% }' e/ V, L0 H- #undef EDMA3_DEBUG5 c+ k' D2 T! h2 A4 o
- /*#define EDMA3_DEBUG*/' e' z; Y! T5 v7 C0 E; [5 X
- 3 e1 [, a# Q4 e J$ S: I' j
- #ifdef EDMA3_DEBUG
0 E5 P6 t+ _( B% J! F7 I( ^3 g - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* g5 |; A' s7 }* O3 k6 I
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). Y8 Z' P& q2 }2 F, p+ _
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
* v/ \( ]" ?1 s! I+ p( |8 v) V0 E ^ - #else
6 P# }* I9 i, D5 p% l5 q - #define DMA_PRINTK( x... )# c7 J2 M; h) j* v }! [
- #define DMA_FN_IN
! @9 b! v& T3 q3 R8 B - #define DMA_FN_OUT
: B) F1 R1 [& R! l' l% Y5 y1 N2 w - #endif p/ r/ a- E) M+ t
- % C! W+ ?1 A! J$ }
- #define MAX_DMA_TRANSFER_IN_BYTES (32768). {, j( r8 w. R; {; B. p
- #define STATIC_SHIFT 3
( S( t5 q9 H1 m - #define TCINTEN_SHIFT 20! b4 `' N+ Q, Q8 W) t) @
- #define ITCINTEN_SHIFT 21
w9 l$ K* Y. Y6 j! d4 O; s - #define TCCHEN_SHIFT 22/ N' k. l: b6 A, t4 S$ `: F
- #define ITCCHEN_SHIFT 23" R1 \9 `: Z& ?( ~7 Y
$ T. ]3 L9 i4 J1 @ M1 p1 R6 j+ D- static volatile int irqraised1 = 0;6 X: W7 |/ a- H+ [
- static volatile int irqraised2 = 0;
. g- w9 m' \- i7 O
& L, I( ~8 B+ k) I$ U6 U9 u- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) e3 X3 N+ W! n O# |7 t
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* i% I1 ^; B1 T+ [1 h - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 O/ C6 Y2 e- T$ E! h
: R* `4 k: b9 p; t# P( y6 D- dma_addr_t dmaphyssrc1 = 0;! U4 P3 I% h$ ?; a
- dma_addr_t dmaphyssrc2 = 0;% N g, h+ I6 J# O" S
- dma_addr_t dmaphysdest1 = 0;
' O$ A3 T) W/ m7 W% K3 U - dma_addr_t dmaphysdest2 = 0;2 X' i, n. R/ {6 u$ i8 {5 [
2 ~$ l* L) m2 X, d- char *dmabufsrc1 = NULL;
- l B# V2 b3 i: w$ c) K1 K5 z. f - char *dmabufsrc2 = NULL;3 ]2 {, n% x3 s( |5 P% Z9 ^
- char *dmabufdest1 = NULL;, {' X: _8 u# S/ W8 f5 G
- char *dmabufdest2 = NULL;
4 @* ~& P6 v% J% O
9 z$ \: M& ]- `7 I+ S- static int acnt = 512;+ A: \/ _1 d* L: m, v
- static int bcnt = 8;' r9 Q0 m% g* o9 }
- static int ccnt = 8;8 P+ X1 m T; t$ Q! ^" a
; L7 y4 W v! A" h- module_param(acnt, int, S_IRUGO);7 T: `; F) ~$ |* ?; `: C: E; S
- module_param(bcnt, int, S_IRUGO);
6 ~3 g* s0 w1 o, i# x: I# R - module_param(ccnt, int, S_IRUGO);
复制代码
0 ~- G+ w1 N a" l) W6 g' _
2 k* d3 I; P( G+ T/ c0 \0 x 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 J- V$ g- b+ S7 q2 d3 y- w4 X
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 y' q! f6 S; y 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' a" `% k& D4 U5 ?7 V5 w
/ V( t! ~9 k) `* N" t# o- f; H
* ~' W, d# M2 i6 }3 A/ n, L) Q- {% |
|
|