|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 s# V! K4 Z' S- w2 _& _, ?6 ^+ w- [code]EDMA sample test application
' s1 V. x* H) Y$ m - /*
4 L y8 b- U1 A! B - * edma_test.c' H, @2 \- O2 L2 n' e7 c
- *6 r0 c. F1 ]3 V4 W/ w
- * brief EDMA3 Test Application
2 r! H$ C$ Y0 a) ` - *2 V& b, D5 r( I; I# Z1 `! z
- * This file contains EDMA3 Test code.& \/ ~1 p( A0 h7 A
- *
1 z. a3 F4 C( B7 d4 E0 J - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
3 G6 z9 {8 M* [2 G. c2 \7 c7 m) U - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
S6 O% r$ y0 I C# `. w - * TO CHANGE.! V( ~' S% X; h6 K- p* p
- *
, v& T) ~/ j- |3 T$ x# c1 I - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 f; ^5 i( S) S! g, o6 ~
- ** _ N' z J+ n* H
- * This program is free software; you can redistribute it and/or6 H+ P3 _& X7 X8 g
- * modify it under the terms of the GNU General Public License as F- H0 ]9 ]$ a+ A+ M6 h
- * published by the Free Software Foundation version 2.& G8 }$ t) F8 G( H0 U2 P
- *! @( u; _! Z" ?/ ^7 U5 p- t, s
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any& q2 m& Z# {/ j* D. x3 L
- * kind, whether express or implied; without even the implied warranty% B0 u2 a& \4 S- e0 }, i; m1 L
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3 k, O7 B) O4 E4 {% g - * GNU General Public License for more details.
' ` ^8 x6 r' s2 }8 W. w5 N9 X0 r - */) O# B" {# d7 R. r* Z- ]" Q
- % e5 G; E' P' G7 g, k& Z" u
- #include <linux/module.h>0 U: [6 }. X; g! h
- #include <linux/init.h>$ U X) e, v3 X+ f
- #include <linux/errno.h>2 W" a7 f. j8 L" X
- #include <linux/types.h>1 G9 M( k9 p# z* L. B4 a
- #include <linux/interrupt.h>
3 {9 x0 h4 i3 O! o; j9 |! N( m1 f9 R8 H - #include <asm/io.h>" W( {! `3 }* U9 D; d
- #include <linux/moduleparam.h>% H- {7 N/ B: L% Y: Q! B! Z4 b
- #include <linux/sysctl.h>4 h1 X# i9 k/ n. o, J$ W
- #include <linux/mm.h>8 M" h: ~* O; ^5 S6 C3 l
- #include <linux/dma-mapping.h>0 J3 S! j: r1 _2 k! e+ n' {6 @
- 9 E/ q: H/ C2 L* T+ k1 A% J2 @
- #include <mach/memory.h>) r& U: E/ c( y5 p% T2 | x; @, e2 E5 y
- #include <mach/hardware.h>
2 r5 K( _8 w$ I2 n+ a - #include <mach/irqs.h>
2 W. }* j) Y& N" A& }# H" X* s! r - #include <asm/hardware/edma.h>8 P$ h9 S2 q* G
- 4 p, u! I0 ^ `' I! ?
- #undef EDMA3_DEBUG4 I2 I. H% o8 H
- /*#define EDMA3_DEBUG*/- c2 `2 ?4 c( m
- & q8 s& T$ s% p2 D0 I7 x
- #ifdef EDMA3_DEBUG$ i3 B% {7 O' S' b2 @0 Y
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). E2 n, w' T b- ~' l6 a B* F
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
" B& Y- c1 x2 ]/ l - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__) o, B5 A/ c% F5 |
- #else8 T$ i) I- V; J# ^9 @
- #define DMA_PRINTK( x... )1 N& a8 I; Y) b# @) ^1 R- o2 a
- #define DMA_FN_IN) p! F) O/ y; X8 X
- #define DMA_FN_OUT
) e7 B$ E% Z7 F - #endif
+ n/ l( t: a7 V$ J2 y7 D
2 ]. |" L( u- n7 Z3 O2 [- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
, X, R6 Q( E- c, n% B - #define STATIC_SHIFT 3+ T; {, `' L( a5 g# H& `6 b
- #define TCINTEN_SHIFT 20
4 S! S% t r; D- a6 J$ j" g - #define ITCINTEN_SHIFT 213 y' w8 |; q$ c$ ~' K. P* x
- #define TCCHEN_SHIFT 22
& d5 m6 Y+ D* G - #define ITCCHEN_SHIFT 234 y7 X+ D: _# E9 U7 ]
B, O4 J, Z$ g: l1 x- static volatile int irqraised1 = 0;
0 C3 @1 i+ b& s/ w3 C - static volatile int irqraised2 = 0;
" s" h5 K- K& z% y
: @# i+ w' F7 \; u" U+ `- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( @. w) Z' `' K" S7 F E - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 ^6 A4 g! c. c, L' I/ x! o
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ b4 ?% U* n' m1 C; N2 l% ^
9 V3 d1 n- ?( M- dma_addr_t dmaphyssrc1 = 0;3 Z, Y# h" k" `
- dma_addr_t dmaphyssrc2 = 0;
1 S3 z' r( H" c* s. W, ? - dma_addr_t dmaphysdest1 = 0;
3 o" i; v# O) P! F - dma_addr_t dmaphysdest2 = 0;$ t# s% Z+ O/ |$ E, o5 o9 ~
6 K* l7 z0 @5 a' o- char *dmabufsrc1 = NULL;
/ i+ J$ Q/ C# w; h - char *dmabufsrc2 = NULL;! }& Z, Z I8 b
- char *dmabufdest1 = NULL;0 Y% Z" k/ D/ z+ a/ L3 h+ J
- char *dmabufdest2 = NULL;
/ `9 f) q% Z) ?1 n$ V" V2 e - : A' L3 c9 b% x7 |* |# y/ X
- static int acnt = 512;- U' ]. v$ Z8 m7 L
- static int bcnt = 8;
# ~0 j! I) V0 G8 V7 ~ - static int ccnt = 8;
7 `; j: V2 W0 `4 |2 K5 d
% h$ h3 z) K/ d4 d) r& D- module_param(acnt, int, S_IRUGO);
1 Q5 i1 u+ |& v0 s3 L* Y0 _ - module_param(bcnt, int, S_IRUGO);
) [3 y2 T2 N& L4 N - module_param(ccnt, int, S_IRUGO);
复制代码 / u# y& b: [8 m/ [
5 z6 k1 C- t: v8 G" q 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 @2 t. f8 l* j$ B' l3 `1 K# t! Sarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" c; H, {, D/ D! f+ x4 b
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# d& b1 ~2 {9 F" [. U& z0 z% N" k Q1 U" S. W% U6 N% E
0 K- o$ a# X$ B7 E( F7 U: m
|
|