|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
x; o" i5 Q- a0 s0 H- [code]EDMA sample test application( O) F" a) o7 Y- K
- /*
; h( F6 ^1 [$ {" u - * edma_test.c: [" r j! B8 S! ~
- *
, {1 H+ n5 [* @5 A - * brief EDMA3 Test Application
8 \( L. A K( s6 t0 r3 P - ** _$ w2 I- u: s. G
- * This file contains EDMA3 Test code.
: c, f6 z, @3 l) }0 f* d9 _ - *" i- n1 w* w8 A E, ~
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 d, ?; q6 u; A; m
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
5 D6 Z% U/ ] a+ x* T8 g1 y. Q! b - * TO CHANGE.0 w! n9 Q# n7 D2 A6 T3 Z8 x) L) @
- *
/ {6 n3 H) S6 l( K/ x' _ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 K! |' `# c: X
- *
. I5 W5 y }. f: J4 p - * This program is free software; you can redistribute it and/or
2 _6 `: N0 B) a. f$ C( }4 M - * modify it under the terms of the GNU General Public License as7 ^ _8 f& T2 _9 ?0 B% o
- * published by the Free Software Foundation version 2.
& I2 }7 r2 ~* J; F c3 l8 Z' E - *, Q2 b- s+ e* {$ B5 d6 H- J
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any: X, X/ h s$ |5 d4 _+ a% c
- * kind, whether express or implied; without even the implied warranty& D: w# @0 `6 A# a ~0 Q
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
: s. p/ O9 w. W% d. G - * GNU General Public License for more details.3 v4 z. D, O; Z, h5 f+ B' u
- */6 w6 R& z' N8 o, h, N w
- " H% s; z# A0 M/ g5 r3 z
- #include <linux/module.h>$ @) N8 p# g- M3 i% _
- #include <linux/init.h>
' V, J% l9 P7 c - #include <linux/errno.h>" f8 F: C6 ]. y# N% V
- #include <linux/types.h>6 O4 g' D( j% N( G. [% x1 @
- #include <linux/interrupt.h>4 {, Y" n& N6 A4 }# J
- #include <asm/io.h>
# g; Q8 g: z& J( z - #include <linux/moduleparam.h>1 o. [1 q6 }% H* A* V! G1 I$ J& L
- #include <linux/sysctl.h>
( G0 {/ k4 N" ~- r+ L" ~ - #include <linux/mm.h>
1 T1 v4 c! T0 N: w6 d% e - #include <linux/dma-mapping.h>1 E& b% I! L; p, G4 A$ s# _* S, B
- " H4 ^* p" }, }
- #include <mach/memory.h>
3 r4 o' g V8 [1 J - #include <mach/hardware.h>
5 `( @. u; W' T - #include <mach/irqs.h>
/ d$ z( H4 `( D - #include <asm/hardware/edma.h>
( N# i) p4 q- ? {- I" H8 |) s s
; b' z! ]1 ^0 l1 z- #undef EDMA3_DEBUG& w* v5 ]8 C2 [3 O* F
- /*#define EDMA3_DEBUG*// v7 W" K' V+ s( e
- 9 P5 N, f3 z' g- o
- #ifdef EDMA3_DEBUG( {& C g5 G! A6 w$ K4 P) c
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! N& N z- b4 r Y
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ ]5 s) k- p: M+ {" J
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
5 J! o7 T5 r& l4 V8 c9 @ - #else
' [- @$ I7 h% V - #define DMA_PRINTK( x... )
+ s2 ?! g; J* C, [ S+ \; B/ R. p - #define DMA_FN_IN, \# }0 \8 T- |" _5 Q1 G8 V4 b
- #define DMA_FN_OUT
1 T) i1 _: R: x1 q! P - #endif! Z) M3 S" C2 H
" q& \5 t2 T! x9 j- #define MAX_DMA_TRANSFER_IN_BYTES (32768)& s+ b l! }: D3 O5 _+ P
- #define STATIC_SHIFT 3% h7 j% z. t' G# ]6 _' L# w! u
- #define TCINTEN_SHIFT 20( G% }" h+ V- B; h
- #define ITCINTEN_SHIFT 21
l+ i7 L* G; o6 X! a - #define TCCHEN_SHIFT 224 }7 B) Q$ @( _+ V' t& N) K) r
- #define ITCCHEN_SHIFT 23
0 ]6 g# K$ T" e9 f6 E - 9 m( H! y9 [( e
- static volatile int irqraised1 = 0;% B) ^8 g2 C9 v$ t' ^; d
- static volatile int irqraised2 = 0;) l; T/ p% Z3 ?! W/ f: a
- - B" n. X& R! _$ \ D$ p& L# C2 q
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 Z$ M, {. G3 Z/ K' l - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 H* v! f% T8 S8 \3 b6 u - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% G* G$ B: {" _% Q1 Q - ; U; l4 o# |6 F0 `
- dma_addr_t dmaphyssrc1 = 0;. h/ V: x! E* e) F l0 A; i
- dma_addr_t dmaphyssrc2 = 0;
D3 G- ~% m q1 a - dma_addr_t dmaphysdest1 = 0;
$ h1 U# [7 j: T8 S/ q$ h3 v - dma_addr_t dmaphysdest2 = 0;% t4 V# _! k" @
- ! W1 o+ |( {! l
- char *dmabufsrc1 = NULL;# Y7 w8 `3 c7 T6 n* D) ~: d
- char *dmabufsrc2 = NULL;
# o T1 r4 y' ^" e7 ], u- T - char *dmabufdest1 = NULL;
( \/ X- @6 [- j3 ] - char *dmabufdest2 = NULL;
: Z. J4 t" I4 i" T6 F8 T - * Y( b0 C; U9 n" u! e4 i
- static int acnt = 512;5 p \' ]. I7 ^5 S* X% O" R* [
- static int bcnt = 8;
% J- ~* ]9 @! |3 {4 B4 A - static int ccnt = 8;1 h% L2 M9 t7 f* C! n2 F# l
: ~$ R% t$ @) q6 m, L6 S9 k- module_param(acnt, int, S_IRUGO);% l$ C1 E! x, M2 Y( b2 W
- module_param(bcnt, int, S_IRUGO);6 D) q3 \6 ~9 `& D9 \ N% ~
- module_param(ccnt, int, S_IRUGO);
复制代码
4 I* Q1 D0 b3 v" W- F
1 L) _0 t* z' t. |7 _ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 k. l$ P0 K8 S3 r9 k
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; e: I; A, m0 p 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; x3 k" P( @% m; u: A4 r# L- K! H9 [/ f4 `7 o4 R" o6 \# ^
) E! h& o+ p; n, v8 v w |
|