|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& i+ X4 G A6 F& j- [code]EDMA sample test application# A$ v6 e1 [* |# C$ C9 F
- /*
* C9 n, ?) {; `8 [' u. O5 t - * edma_test.c8 q3 o" \9 f. o. x: @
- *: {/ Q9 e" i0 s% K
- * brief EDMA3 Test Application
* G% l' o& s5 m - *' C7 _/ w7 |- X' g" U
- * This file contains EDMA3 Test code./ \* O2 `" P) Z) H. } R u# E4 b
- *
7 @( w. z; J0 u8 j2 M - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
n# `- u* C& D' b - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 O4 v: c% ]" S4 [% N& r$ {
- * TO CHANGE.7 c& X8 |, G. V, c- u
- *, [1 k# s# A( e# O
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 u" B, C! V) j4 S( \0 a
- *
A5 w) M+ l; @/ X8 a - * This program is free software; you can redistribute it and/or- A# h% L$ _# O
- * modify it under the terms of the GNU General Public License as
* a5 H, K$ Z# y5 p) O) m - * published by the Free Software Foundation version 2.
- F4 R- R6 n6 [4 j+ O8 Q: u - *
6 ]$ ]0 }; T% O# I1 H6 W$ C: J - * This program is distributed "as is" WITHOUT ANY WARRANTY of any; w, Y( |5 d$ z
- * kind, whether express or implied; without even the implied warranty
& T( ]% ^& q) r; X3 M! L7 C& N - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3 B0 t+ L k* S) U7 L - * GNU General Public License for more details.; A W0 C8 \0 w. [' [
- */
2 w( {# p0 u* x# y) t% ~
; `4 J* P% ^& t- #include <linux/module.h>( ]: v8 p. K( ?' G
- #include <linux/init.h>- o3 X+ V$ F2 c" A
- #include <linux/errno.h> _( ^& ]% b0 U+ t# l! c8 m4 \7 R
- #include <linux/types.h>
# O# W+ }1 }0 o5 G5 h- @# u - #include <linux/interrupt.h>
; p# D1 f. f+ f4 n3 I0 N - #include <asm/io.h>) q' `( E$ Z* A: r/ w
- #include <linux/moduleparam.h>! E7 `. E6 I) j4 P* D, b% [5 u
- #include <linux/sysctl.h>2 g( s. z7 V V: ]0 X5 I
- #include <linux/mm.h>
; V/ W" d- k# M* c$ @6 E - #include <linux/dma-mapping.h> |9 i/ A% U d$ I! [0 m
- $ k6 _9 o* G2 W7 \% I& z
- #include <mach/memory.h>% f. Q) ^+ M$ N
- #include <mach/hardware.h>& }1 \9 T4 k: j7 C8 S( u- H
- #include <mach/irqs.h>8 q% s5 `8 `( C- b
- #include <asm/hardware/edma.h>- s+ c7 I% D& f& U) x+ o2 Y" l
' n4 x% y* R3 g. d! Z- #undef EDMA3_DEBUG
/ J1 j; n! b- ]0 [& S* I/ [2 W* m - /*#define EDMA3_DEBUG*/
* Z6 Y: X4 Q% O0 U' L; L
0 r S- e; \3 B; A% A. U- #ifdef EDMA3_DEBUG
- @- h) c: ~2 Q4 r# X" p$ E5 i+ A8 m - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
) J- p% e8 k) N* ~, x+ ^1 ^; ` - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! P- e, j: }' T4 `0 Q, [$ z
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
6 a1 N3 {! }3 d% Z$ | \1 H. a - #else
7 x2 e7 B; f3 Q- n: } - #define DMA_PRINTK( x... )
& L7 [# O. z; ~/ {4 G7 @9 o. ]( p# e( Z - #define DMA_FN_IN
6 S& ~& P! g* _0 S4 K$ W7 ^ - #define DMA_FN_OUT5 h: a/ M U( v4 x( W
- #endif
x% \6 z# G4 w7 H" ~! Y) h, R - 0 c% F0 E0 y2 a
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
/ K4 Y5 {$ Q0 s0 e7 b% ? - #define STATIC_SHIFT 3
) [/ Y U% u% a8 a) z8 B0 c3 m - #define TCINTEN_SHIFT 20
% l/ T. K5 { G* K' D3 I( g5 i' T6 l - #define ITCINTEN_SHIFT 213 H+ P' {* L. C* t
- #define TCCHEN_SHIFT 22 Y4 W6 H& X9 ^5 q8 t2 j
- #define ITCCHEN_SHIFT 23
. W5 u l8 U+ w" c5 ^* n* D
0 x) u; ~ r& X" {( l( W- static volatile int irqraised1 = 0;
8 s: d7 D- o9 ?& d: G0 i& a4 X7 r2 V0 A - static volatile int irqraised2 = 0;
! ~ x/ q7 I* _8 p- ]
/ D) C _4 I+ n2 r- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: i1 Q& O' ?% w! r
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ j" U2 b6 e; h! E' ~3 Q - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: V1 T' X0 g* {. _8 @- S _
- ! t/ X4 o! C' [, f0 a8 A
- dma_addr_t dmaphyssrc1 = 0;
& [$ `' ^2 |7 X1 ? - dma_addr_t dmaphyssrc2 = 0;
" R8 ^" y( N8 N$ g" E - dma_addr_t dmaphysdest1 = 0;
/ |7 w7 R4 ^- ~: [2 X# }! w - dma_addr_t dmaphysdest2 = 0;- Z3 Z* _" N8 q& z
5 ~. L, M* W m# B' x( e- char *dmabufsrc1 = NULL;
( G+ p8 t# a0 Q) ~4 E# V2 N - char *dmabufsrc2 = NULL;. I- a& S/ A* j& _6 R" X @' t
- char *dmabufdest1 = NULL;* o% N% x: l; `& B$ ?: I
- char *dmabufdest2 = NULL;2 h; |* |/ g' h
4 e* |6 F$ E# [. W7 _- static int acnt = 512;1 \) P9 P6 c/ ?. Q, B6 `
- static int bcnt = 8;
" |# A5 p) N, p, O - static int ccnt = 8;
* }# f' g$ G+ e% C
3 Q: M2 ?$ \0 S6 G& k3 e- module_param(acnt, int, S_IRUGO);
1 D0 N9 y3 a/ h2 [ - module_param(bcnt, int, S_IRUGO);
' o4 S- e1 m3 u' T - module_param(ccnt, int, S_IRUGO);
复制代码
4 |7 P N% Q6 w( |( j& E2 ?
: P! b: [$ g+ |6 ^- A; I2 v 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
9 D; |& Y5 B, tarm-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 e8 j2 A6 [) u; Q
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ o- A: W& [5 E- z/ C# u6 ^* @, J
: ~* C7 i8 E+ s, Z) H0 L! u9 E& [% a- b9 y
|
|