|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % T- p: G7 H* S- E
- [code]EDMA sample test application V6 E" n9 p+ H+ b% O* g7 Y
- /*
, Y3 H/ S7 [ h - * edma_test.c2 n+ M S) | G7 h
- *' ~& x Q, D+ A0 n- c
- * brief EDMA3 Test Application
3 N( p6 [9 J1 H+ ]9 H* F& W/ p; E: j - *
/ O9 L& D' J: T6 Z* d - * This file contains EDMA3 Test code.
/ b( z, k5 l+ i0 K - *% O0 |+ g3 f* Z# @0 u! U; ?2 v
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* B [; ^/ Z8 \* D
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ Y: v. n7 K% P3 J8 D
- * TO CHANGE.
2 z6 E, |5 r+ N M- Q" o - *8 ]6 u: Z, J5 p. |0 y
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! P$ A O2 b& V* {3 Y7 ^0 D- I P
- *
% D# K6 w" k. D0 j2 O6 }+ y - * This program is free software; you can redistribute it and/or
/ ~4 c8 d1 T( V) n0 d - * modify it under the terms of the GNU General Public License as5 e. P+ @1 e# r0 `$ q4 n8 {$ ]
- * published by the Free Software Foundation version 2.! z3 i5 W' i& M8 {
- * v% c" e. k; m8 q7 ]
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
; I5 t* s4 F: v6 A3 q; l, g3 n. y - * kind, whether express or implied; without even the implied warranty
# L4 v' D% O% l - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7 V; [$ u& |! f" Q - * GNU General Public License for more details.
" }% n G1 O4 {* p/ R p - */
% ?( ~4 T1 g+ z8 g
. n: v% U* t# u7 N; }- #include <linux/module.h>1 f4 U- R8 ?6 ]' p( E
- #include <linux/init.h>7 ^8 O) U# Q. D5 E; j3 G- k
- #include <linux/errno.h>
- v! y! }% L! j - #include <linux/types.h>/ Q1 b& ^7 `/ |# D) Q& f
- #include <linux/interrupt.h> Y9 S. h+ Z. U4 ]2 I
- #include <asm/io.h>7 i7 G4 t4 `. i t/ [* T
- #include <linux/moduleparam.h>
: p7 X# B+ h3 v( s0 h, W - #include <linux/sysctl.h>( n4 w, H, m2 j
- #include <linux/mm.h># l) F1 I1 @/ _: A
- #include <linux/dma-mapping.h>
' t9 W% y1 D1 G2 i/ M - 1 a2 E9 K; i, s
- #include <mach/memory.h>& P: w' b, Q+ W/ q9 W" c, H* g
- #include <mach/hardware.h>
6 w8 ?; @) e( y4 [( ] - #include <mach/irqs.h>
# N' N1 I- Q1 K! v' k$ l7 } - #include <asm/hardware/edma.h># J0 X# D- S: m; ]# Z% j, \& `' w
- 4 h( ]$ F' H7 f G1 \. v
- #undef EDMA3_DEBUG+ U. C+ F+ o! _! c0 {+ B
- /*#define EDMA3_DEBUG*// K+ M1 G( r" g+ G
' e( y2 W7 z- v- #ifdef EDMA3_DEBUG
( o/ k+ C+ s. g' A - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ p5 C* e4 ]& z9 S4 t0 \# B
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
; ]: r, j. ]' v( }9 G2 H$ c - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
2 n. w; t W( ]% }. q+ F - #else
G' h; r! q. o3 [7 ^6 c/ v5 b S! H7 R - #define DMA_PRINTK( x... )+ D; m% q2 X+ ^0 D. X
- #define DMA_FN_IN
4 V! N( T. g8 W9 `- O' V! l0 Z - #define DMA_FN_OUT1 {) S% @; E4 `/ r6 I* ?
- #endif7 x/ O* v- j; K. P: S3 j% A8 p
- , a' q" W# W* L) l/ T) \; n% r
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
% c2 B' f! D. ~5 j' g - #define STATIC_SHIFT 3
: ~0 L' h* C' `0 L7 d. \' u6 Q - #define TCINTEN_SHIFT 20, s! R$ P$ i$ t3 ]1 I$ E6 T
- #define ITCINTEN_SHIFT 21
g) O$ A+ N( W4 q0 O, T - #define TCCHEN_SHIFT 22; V- S9 g. Q0 l% f& v
- #define ITCCHEN_SHIFT 23$ Z# Z8 R3 A/ _1 Z
; u: W, K/ U: }. r8 W$ y- static volatile int irqraised1 = 0;& W0 t8 a6 `; ~' x; A. [
- static volatile int irqraised2 = 0;
6 j4 W% m; m2 z% U
2 D8 w0 |8 y( q8 v+ M0 D- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 u$ i+ G. C) f$ z0 p
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: t! v8 y1 Y. X; ?7 u! {! C! r6 n - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: D9 x; o' a6 R2 j- k1 v) d% I
- 5 ~* \9 M6 F' U$ }# x+ [4 i1 _
- dma_addr_t dmaphyssrc1 = 0;
8 u5 |* e$ Q/ q8 x4 | - dma_addr_t dmaphyssrc2 = 0;
! t7 B$ `! i4 O - dma_addr_t dmaphysdest1 = 0;
- n( z5 F: W b7 o# N4 x - dma_addr_t dmaphysdest2 = 0;, R# c( `4 g4 f; g! k8 r
- 2 G! y4 W" Z* f5 N% T( n
- char *dmabufsrc1 = NULL;' F# i$ ]) {& Y& M
- char *dmabufsrc2 = NULL;
3 C3 r4 O, S4 f- G# L7 F6 w+ i - char *dmabufdest1 = NULL;
+ f7 U2 e" M3 X5 U- c - char *dmabufdest2 = NULL;( z6 U1 y8 y1 z& C; e
- ) A' S# U: B' ^$ t0 h
- static int acnt = 512;
2 `+ l/ }; l* @8 R - static int bcnt = 8;: t" s S; ?- m; ^$ T: Z
- static int ccnt = 8;
' f u' S0 T; i/ Y" p - . W! K* A. W6 e
- module_param(acnt, int, S_IRUGO);/ `5 \$ I8 K0 h
- module_param(bcnt, int, S_IRUGO);
) h6 f. ]0 y: D* E) o' a% o3 W - module_param(ccnt, int, S_IRUGO);
复制代码 " I8 N/ r7 Q; z4 l2 l3 _. p
" X2 x" X& c- ? x; [
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 m8 T# `7 S5 {# ^' w& ]; }6 M5 W
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 K7 | x" D, }4 H, o8 b' f 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! O! u" t: M; ~
- b7 D6 b0 l5 a6 A5 \7 t# ]; E7 P8 j* k5 V9 l+ }3 p& d( j2 `
|
|