|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 V( p: L% c7 w, I m
- [code]EDMA sample test application2 s1 E! Q9 i: T: Z, h( h' R- ?) F
- /*
- O* B( k; I% w; j - * edma_test.c
: x2 ^, v1 R' C) \9 G2 ? - *: F+ S0 J% o$ D' J
- * brief EDMA3 Test Application5 F+ i2 H- j+ a
- *) Q* F3 R) W) Q6 { ?3 @/ D7 B
- * This file contains EDMA3 Test code.: y) x1 v' q* T- K- d
- *
* U$ E& g8 q. i3 U B - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
' m5 ]$ o* e$ x7 U, p8 f - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
& O w, t9 T/ n/ O) u - * TO CHANGE.' t7 Z/ |" M; l* V/ A
- *
5 {* N8 Y' O, j+ \ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
! t8 P1 E' X5 _6 }# {' D - *
; B) }) W6 \$ n, {0 r - * This program is free software; you can redistribute it and/or- c5 G8 S$ Z: t7 s& ?
- * modify it under the terms of the GNU General Public License as6 R6 `3 [. M5 j( w
- * published by the Free Software Foundation version 2.* W/ k3 ^( J4 @1 V. }
- *3 \/ g. N2 G7 u% j# [# S7 i9 t
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
. ?+ `% W8 x8 G - * kind, whether express or implied; without even the implied warranty% V3 w4 N5 S! N M- x- Y# @
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 B2 e, K" ?5 x' }& H+ X; E - * GNU General Public License for more details.9 m( L! U1 d, F- `. R
- */8 _! Y! V2 H# G% I* S
- ' u# j; k3 D# G% H m$ x
- #include <linux/module.h>) j3 a( }# I) _1 L9 e
- #include <linux/init.h>
% U. |6 d5 X+ P$ c/ _" Y) c - #include <linux/errno.h>
" r U/ y2 T' Z6 L( w - #include <linux/types.h>6 M+ D+ t" k% \/ k' v3 K) f# u
- #include <linux/interrupt.h>( F, E* d3 ^. C" l- `5 M
- #include <asm/io.h>" \2 P1 L# b' ^ j9 d! {7 Y% H
- #include <linux/moduleparam.h>
6 c! M4 R9 @* d+ j$ |2 c) c o - #include <linux/sysctl.h>9 G- d0 }" m5 {* F$ U
- #include <linux/mm.h>8 @5 Z" ?* U5 z1 g! j8 F
- #include <linux/dma-mapping.h>
8 c( l( v6 @4 i) ^( B: g* B6 G9 o% v - 0 f; W% `4 B& R9 I
- #include <mach/memory.h>
, u0 ~/ [# a- g; N - #include <mach/hardware.h>
/ N. {, P5 ^1 P# |- Z - #include <mach/irqs.h>5 l: S# |! z9 G) ~7 F4 s$ y
- #include <asm/hardware/edma.h># n, S0 I: h o0 H. G: Y! @
' M: h* q! f( B7 s3 z9 o8 f- #undef EDMA3_DEBUG
6 O9 i+ N0 L3 p& O - /*#define EDMA3_DEBUG*/) U: e! ~) g \ L2 b s" a0 D
- & r( O7 E9 O4 F. D
- #ifdef EDMA3_DEBUG
2 B% O. Z4 F0 y4 y6 w5 u5 R - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
! d0 ]8 o+ K3 w' c# }# s1 e0 B - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* Q, r5 _' L) B6 O- q5 D
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( I: l0 L0 `6 x7 c5 S, ]. v
- #else" h8 t7 t3 @- f
- #define DMA_PRINTK( x... )8 L5 }3 M$ `8 V+ R; c9 C0 B$ h
- #define DMA_FN_IN1 ~ p$ q Q5 o1 K% {; e
- #define DMA_FN_OUT
! G) T8 k7 U0 M/ x2 y - #endif
1 x! N. o; X; H1 G) I% R
8 o0 f2 I5 S$ C: ~6 n& V- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
' _* p3 }+ G; | - #define STATIC_SHIFT 32 R* r; i, }0 s+ L! |8 i5 j3 k
- #define TCINTEN_SHIFT 202 U$ t I+ t6 }# n/ L3 ~
- #define ITCINTEN_SHIFT 21; O; M) \) m7 `, Y+ p) e& n
- #define TCCHEN_SHIFT 22
: d. s1 E0 k0 f5 | { - #define ITCCHEN_SHIFT 23
; p! m- I3 U- ]7 I& y8 a/ _ P - ' G; F" M1 l- n. ~+ y% ^5 P" _
- static volatile int irqraised1 = 0;
W$ F3 T4 a* b* f' l2 `6 k - static volatile int irqraised2 = 0;
1 t$ ?* c0 p2 s3 u% _9 E
, r' d* a4 G* S3 t* N. K- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ Z/ T5 F, R5 {' n
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: J w( V; E }
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) g8 q% R+ A& V4 q9 P# N$ o7 L& R7 t - * g9 e# y3 M3 j4 B$ p
- dma_addr_t dmaphyssrc1 = 0;. X3 @ \" p. ^ N" x$ e
- dma_addr_t dmaphyssrc2 = 0;) s: ~( z2 I$ s
- dma_addr_t dmaphysdest1 = 0;
/ N0 l4 }5 o# i. i8 ]% ? - dma_addr_t dmaphysdest2 = 0;
) \ b4 Q7 }( T$ O! P6 H - 1 @& t* C/ s; L: U _
- char *dmabufsrc1 = NULL;
& F1 g8 Z* G/ i- g - char *dmabufsrc2 = NULL;' e% Y1 }8 n. T" H. ^' m7 X
- char *dmabufdest1 = NULL;) n9 ?3 J: P1 I. n8 n6 v
- char *dmabufdest2 = NULL;2 t5 c7 K4 M' |1 y: C, Q
- ( a% R' g+ |' f! {" T+ T
- static int acnt = 512;
1 U H- j( g- F' f& k& | X7 A - static int bcnt = 8;: \ f: ^0 h8 k: r
- static int ccnt = 8; A& i2 D5 ]+ c( j
. {' s0 S2 Z4 T' R- module_param(acnt, int, S_IRUGO);
6 R3 p, L! |' {& L6 e3 p% H! e6 K - module_param(bcnt, int, S_IRUGO);# @% b. @% ?: s3 m$ F) a, A' o# q
- module_param(ccnt, int, S_IRUGO);
复制代码 % d. J3 {( b/ r% s* @
5 }! r4 H+ n+ _" m X
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- A; o* q) _ S3 C/ k: k+ P$ ?4 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, M7 z! n# G! [& p2 e! b. D
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. g; ?5 @. z/ [. g$ w
; y4 Q- M8 P2 t3 C
0 ~' C, Z6 C- Z( o" c0 g- _1 ~' G
|
|