|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / I3 f7 y4 L8 j& c5 x/ X
- [code]EDMA sample test application2 q% @: l& V9 K; j" s2 |, U5 m
- /*. ~2 l5 E* A) m, W7 q* v) i9 h
- * edma_test.c. G$ x; Y; B% ^$ h5 m X
- *( |$ C2 M5 K) {5 R: b# J
- * brief EDMA3 Test Application' ]5 L0 P @7 @* s4 }% `
- *) j3 f" G6 o7 p- c
- * This file contains EDMA3 Test code.
7 q' _6 P% u, L( b2 g7 O1 t5 X, d1 i - *7 n# e% P' s& K& n
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
4 {: d7 F8 E) o7 T# B, E - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; Q3 Q9 o7 O% B7 U
- * TO CHANGE.. Q7 E0 Q/ E$ H* L5 K8 h) D5 P
- *
6 u- i! b4 _7 a( m8 Q - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 R3 O% {. R; Q- H0 i* G
- *
3 X, `4 i5 {5 K p! S( U - * This program is free software; you can redistribute it and/or
* W: S- k4 f3 |1 B) X) H. [ - * modify it under the terms of the GNU General Public License as
0 }: J/ m; v% X9 s; j# J! v% E - * published by the Free Software Foundation version 2.
* ]" q+ i9 r9 x' O - *
$ r. J4 }9 f- t. q - * This program is distributed "as is" WITHOUT ANY WARRANTY of any. O b( \) ?$ z% n+ d
- * kind, whether express or implied; without even the implied warranty2 @7 L0 Q* q0 r1 `, M }
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- C, Y, h2 s* U2 d3 j6 m7 l- Q
- * GNU General Public License for more details.
+ T4 \ ^. F7 D; ~ - */
1 w( D# G( y8 W) }/ a8 i/ D; }
7 m( ]4 o% T( x% I$ G% I2 V; U- #include <linux/module.h>
) N) T+ P8 U, O8 f - #include <linux/init.h>% [4 D8 ~4 Y D# \0 a
- #include <linux/errno.h>
8 O, O+ u5 }' z) [0 |- X - #include <linux/types.h>) Y% r/ w8 O% C$ W
- #include <linux/interrupt.h>1 E0 H0 o9 l$ `
- #include <asm/io.h>4 y1 J5 I, Q4 }5 `1 W/ q) K
- #include <linux/moduleparam.h>" ?7 ^/ y4 p) @& t" f8 B
- #include <linux/sysctl.h>: j' a( C) ?: G" n- F% Q. l
- #include <linux/mm.h>
: D, O6 A$ f/ o/ C) s/ V1 p X/ m' ~) V8 R( D - #include <linux/dma-mapping.h>
$ y% d( U9 V7 u$ P" E - - U! L& `, a5 S3 t
- #include <mach/memory.h>1 f1 L1 J, E h- Y j
- #include <mach/hardware.h>7 g/ W! Q% n+ \" i% W1 |; G& M
- #include <mach/irqs.h>* b/ C2 d, n. |6 F* P4 [' z6 i
- #include <asm/hardware/edma.h>
: M8 ^( E0 P: O7 C% H" ] - $ \# c4 c9 z3 p z: m6 C) N, c
- #undef EDMA3_DEBUG! a, j' v9 |: K+ p( a
- /*#define EDMA3_DEBUG*/4 @7 U* h1 B: ^$ N% @: e
- 6 C5 m5 W% k% g& Z
- #ifdef EDMA3_DEBUG" K: m# @: t2 I" C/ O- `& e* L
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
8 N4 j, E1 [. n F - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" ~: l; `4 q0 u( Q% T8 U `
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
5 W9 t6 p) A o8 U( S0 I1 J - #else
( d: m. t; s1 H( g% y4 x - #define DMA_PRINTK( x... )
6 U3 h, ~% z2 X+ u* \0 j - #define DMA_FN_IN6 q8 F3 t$ c3 M6 Y2 i/ p
- #define DMA_FN_OUT
) x# n, v8 s+ e# f! l0 f - #endif% x: p2 n: v- _ s# u
- 7 ?+ ~1 |* m$ \/ T3 X
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
; f u$ ?6 y" \3 T S8 R; h, m - #define STATIC_SHIFT 3
& h+ E8 Y3 P4 }5 y# m( N( w - #define TCINTEN_SHIFT 20
6 t+ I2 R2 E# ~ - #define ITCINTEN_SHIFT 212 D1 w3 c& M' q( }. t
- #define TCCHEN_SHIFT 22" v: W, h. o! c, O5 {
- #define ITCCHEN_SHIFT 23
4 A8 h( F8 a3 u1 l8 P. }2 ^
+ @! O' D; d" ~# d$ ~; h6 y9 K( K% x0 S- static volatile int irqraised1 = 0;( l) T3 m/ n/ _* J: {) t3 u
- static volatile int irqraised2 = 0;
' i3 I9 J# C2 z8 m% u8 M - & }+ l, t& Q. ?+ L8 r
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% d/ l) G6 Q5 | - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ {- g. C& H$ Z6 T: a - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
f' M- h% t% N0 p" I - 1 L' m! M' A5 b: @/ B# p1 g: K0 \
- dma_addr_t dmaphyssrc1 = 0;
* T5 g0 Q1 y I - dma_addr_t dmaphyssrc2 = 0;0 D# e9 i4 P! j
- dma_addr_t dmaphysdest1 = 0;
2 P2 q& Z1 z/ X3 ~" W& W# L - dma_addr_t dmaphysdest2 = 0;
: U9 k# e/ r; N0 I - ( c' L. V+ p9 ]' p1 ~: @: l
- char *dmabufsrc1 = NULL;) A- |" k7 B, P
- char *dmabufsrc2 = NULL;
' [+ [! R8 a/ n% P6 p, v2 r - char *dmabufdest1 = NULL;4 ]' M, Z9 o. j
- char *dmabufdest2 = NULL;
0 |; G+ Q0 b3 m- i$ B1 J
; U3 H- N3 ^, G: p. j: M- static int acnt = 512;
. u5 Y4 | q; P - static int bcnt = 8;% E1 r: f+ y8 T; _7 Z
- static int ccnt = 8;
9 F* }, Y& F, O2 t6 g+ g
Z4 U" }8 J& F; H: x; c- module_param(acnt, int, S_IRUGO);
2 M$ y( ?: a6 K- K) w - module_param(bcnt, int, S_IRUGO);
, f# M4 |: V6 b( G* i% p C" m4 b4 I - module_param(ccnt, int, S_IRUGO);
复制代码
( o5 N5 a- p' |3 `
4 H( F, n" ]: N, E 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 ]1 v1 b% Q/ K* C% ^; `8 z. Harm-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+ g1 D6 a- t' w6 x+ q' @: |: ^
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 c( S" h* f& c2 r) E
( _5 _5 {7 O9 @& p1 Z# x
, K; R2 K. L; i) J |
|