|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 d1 o2 m# V y# n9 G- [code]EDMA sample test application
. g' O9 Q# I% |1 _* D" j* p- p# k - /*
: }9 u1 {9 L0 t$ o/ Z - * edma_test.c
# @) d$ \! Q! k. Y: `, r - *
2 l) d/ }/ @& H: A7 ^; Q - * brief EDMA3 Test Application! g1 o6 P0 e9 V6 c( Y: R6 L+ o0 i1 Q
- *
6 P4 `$ v1 j, r/ w - * This file contains EDMA3 Test code.% f1 L& s, Y) p4 }( e* }: U( [
- * R4 ?1 }9 ]! N! G+ K
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
& _3 H: y4 v+ Y" u3 q. x - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
! M$ F: Q( q% _ G! Z1 h - * TO CHANGE.
4 L$ i2 w4 Q- T8 O - *& o* I! ~: z) j5 f J. o+ q' F
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
$ v2 m; z; v3 Q; T/ k# h - *9 D0 m9 w1 ^5 w3 j4 M( l
- * This program is free software; you can redistribute it and/or7 c! ?- r/ m9 }" l$ I: b) ~
- * modify it under the terms of the GNU General Public License as0 V& l& S' `! o: k3 p
- * published by the Free Software Foundation version 2.
* G9 s3 q) a. X* M9 m# [ - *
- c7 W7 M: c! F) ]/ K; k - * This program is distributed "as is" WITHOUT ANY WARRANTY of any& w( A, A6 J9 p
- * kind, whether express or implied; without even the implied warranty/ c' o) n" M+ e7 e3 \1 D" x
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the7 h5 r. W/ x7 w4 w, U- d* m7 N/ W
- * GNU General Public License for more details.* T" R* L) X/ v- K
- */3 y; P, G' _: f- x B; J
" {! h$ I" S( A( F4 |8 o* N- #include <linux/module.h>* T, {9 Q9 c6 w# o B: M9 _
- #include <linux/init.h>5 F. h2 {. c; D( q0 H' @" ] @+ E
- #include <linux/errno.h>
1 L5 ~$ |/ C4 @3 B - #include <linux/types.h>+ I7 G/ a& Y2 N4 T
- #include <linux/interrupt.h>+ E7 s+ T4 M( p+ E" f
- #include <asm/io.h>
5 w" c2 h2 A$ l2 u* ]- D, | - #include <linux/moduleparam.h>
4 R% T% k* \+ M1 R* D - #include <linux/sysctl.h># x: D6 T h' v
- #include <linux/mm.h>! Y% s+ ?; [' S& I3 j
- #include <linux/dma-mapping.h>5 F3 D) l. U' n8 g' W6 \, G6 R
- 7 ]! u! C8 @; M% M) e8 D( [
- #include <mach/memory.h>
8 I6 Z' B# o7 I/ G( h$ d+ l - #include <mach/hardware.h>
7 w$ u. a( \8 Z/ V# ` - #include <mach/irqs.h>
% [, j) ?, H/ c4 o { - #include <asm/hardware/edma.h>
& p$ G0 I2 F, X5 n
) U7 z' C& l8 M! x8 v, {+ ^# m- #undef EDMA3_DEBUG8 O% z# j! h5 W3 _( N3 F& [4 [3 Z
- /*#define EDMA3_DEBUG*/
8 f% H) G5 T1 w; V, S0 ~# F - , O7 U% ?# x3 x# ~' P
- #ifdef EDMA3_DEBUG
% J# D4 g' p6 X7 Z5 i - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 X' G, f$ Z# @4 h( X# z+ H
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
0 `2 N+ F- x0 q* t0 i9 A- P - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! v" O5 r+ |9 V' b5 b* K0 R# z
- #else3 l' p8 F& K# o! H9 o7 l
- #define DMA_PRINTK( x... )4 V8 H2 @3 l( N: Q. E4 Q- c. S
- #define DMA_FN_IN1 n) h8 }# [5 p% x
- #define DMA_FN_OUT% s8 ?9 H. p; {8 w( k7 I
- #endif
! k8 U$ u% c1 s3 W9 C - % b+ Q- q5 _( {
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
2 S) J5 V$ e( F" N3 s; d) V0 S - #define STATIC_SHIFT 3
+ ^/ u; y; H7 g6 g3 E3 A/ G, m - #define TCINTEN_SHIFT 20
. k- T+ W$ X2 x9 N6 Z- z# g. b - #define ITCINTEN_SHIFT 21# S8 ], ?& z* ?7 J. u, r G
- #define TCCHEN_SHIFT 22+ t3 u4 \4 P2 P" c8 S0 V
- #define ITCCHEN_SHIFT 23
, F8 U) ^' G* x( v! y! U+ ^
; d) D( N/ O# W( H' l- static volatile int irqraised1 = 0;3 P! _' |# }0 q2 k2 m
- static volatile int irqraised2 = 0;% r6 n+ E; ^/ }8 I" O; Y( Q
, H: T8 I5 N) i* A. w- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: g9 d' H! ]: d* Z1 y. V& A5 ^ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- p: p/ m8 U: T k3 M9 e" W; f
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 p# G/ O6 m3 g5 }% y- B9 ~$ r
- ) x) L/ T4 ^9 ~* D: T
- dma_addr_t dmaphyssrc1 = 0;! J0 r9 ~0 K9 J% P! d S
- dma_addr_t dmaphyssrc2 = 0;
j6 a9 G6 ?( h8 \, w% t. Z4 Z - dma_addr_t dmaphysdest1 = 0;
8 |7 f' M% o! A0 r - dma_addr_t dmaphysdest2 = 0;5 b# d: g3 h2 F6 l' I
, j' S% {" q& L! M2 x$ C( l# n7 X- char *dmabufsrc1 = NULL;
; r- f; S. Y$ E - char *dmabufsrc2 = NULL;
) ]5 Z% x% C/ @! k - char *dmabufdest1 = NULL;6 d& ]+ k. t8 x2 N& ^3 ?, B3 h/ l
- char *dmabufdest2 = NULL;
( o# D+ T) L$ n/ v" y. C - 1 ^+ O8 \; l6 Z& `- _! Z; k9 u- ~
- static int acnt = 512;
' X0 W6 C; m7 i) g: ]9 A. k [ - static int bcnt = 8;4 b9 s4 r! C- p. B, P
- static int ccnt = 8;
. s. H. _3 [3 H% h7 H( O: W
' _( A! l6 p( ^0 U; c- module_param(acnt, int, S_IRUGO);
, g6 J$ B' G& t; N) U ~5 {/ l - module_param(bcnt, int, S_IRUGO);: ?/ \8 H: v/ {! c1 a0 `/ h4 G
- module_param(ccnt, int, S_IRUGO);
复制代码
' s/ s6 d; h/ R+ ]" n9 }6 w ]1 I6 c8 P) X
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& @$ o( ~' Q# s/ A. garm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ r$ T* K! M; g3 J, V 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ q; c8 v+ Y- ~8 M
: c* O ^& z8 {) d6 C
+ K) @- Z* D" F |
|