|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' t' y) K: z7 N6 x, r; U: l
- [code]EDMA sample test application
h) S- U9 G- C* K% p% R: C - /*
& P B7 s+ J ?) { - * edma_test.c
0 N& S/ r# R% N" X2 K+ }! v ~ - *8 h! }( y. f% v6 `
- * brief EDMA3 Test Application
$ ^: N3 w: `7 p: K7 A' X) l - *
' Y% M- c' O0 ~3 N4 ?, u - * This file contains EDMA3 Test code.2 W3 c& V2 N5 ^( [8 P
- *
2 B4 Q6 X" f3 V) l# E3 \, G. Q; h6 u - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
7 N+ N, G" K, n7 P - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
( ^- {) N$ R Y$ z - * TO CHANGE.
. c7 N* k, c- \( G - *
8 I. ^$ c- z. A/ D - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
" y3 d6 w' l4 S* w; a7 y4 T) e - *
" R% {& d/ i' @3 V) n - * This program is free software; you can redistribute it and/or
- \# a9 s: A. H - * modify it under the terms of the GNU General Public License as
9 M, ^) O! N8 b9 f/ O - * published by the Free Software Foundation version 2.' P) y6 n+ S& i4 u' I0 v
- *
V* A3 {4 P1 Y8 ]6 O8 n7 m& c - * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ m2 ]( R8 R! O! G- g7 \+ w
- * kind, whether express or implied; without even the implied warranty W4 s0 |$ T: V/ ^6 }: T
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/ s# a$ m7 [0 m, L1 { - * GNU General Public License for more details.5 Z( P3 V+ k' b& [7 p/ g
- */$ ^# r% A; s# `8 k7 b- I! F
- 2 v! b: E5 I) A- @$ m3 G3 w
- #include <linux/module.h>
% F. q7 _- W. I' b - #include <linux/init.h>$ E. [. @. | e1 {
- #include <linux/errno.h>
5 N. J& n: v- S' s - #include <linux/types.h>% K5 O& @3 n$ ?; }1 p# m
- #include <linux/interrupt.h>5 j; h& W4 \# P' S
- #include <asm/io.h>$ v" c2 [" K$ K/ g9 E
- #include <linux/moduleparam.h>
: S, \- E, U/ c2 f5 t. O - #include <linux/sysctl.h>4 I% K0 n5 g. j1 G) }- U Z
- #include <linux/mm.h>7 v( c# G+ U `4 K6 U
- #include <linux/dma-mapping.h>
1 f+ |$ j$ U+ w! D2 J - ) l. c) T0 ]% ]/ X9 b6 \
- #include <mach/memory.h>
, n- G+ W+ K9 ]4 M - #include <mach/hardware.h>
8 P6 r g* A/ `% U( Q( f - #include <mach/irqs.h># k2 ]) F4 ~9 V" M4 B; K' A
- #include <asm/hardware/edma.h>
* P, O5 V" X } - ! X( R, M4 S/ b& W
- #undef EDMA3_DEBUG) f( n1 D; ?% T' K% }2 A! ?
- /*#define EDMA3_DEBUG*/; [! N. z' h. b- [! B( V
* ~' B( m9 q) T* S- #ifdef EDMA3_DEBUG! ?: a! X9 m" f! w) t! ]
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* M M& h# f1 n8 d
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% T- {" T9 n# v1 V& K# o& x$ W
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 v7 ]4 j+ D" q3 p
- #else; ?( F2 ~0 u/ E# d- s$ Q G/ A, i5 X
- #define DMA_PRINTK( x... )
' B4 N3 ^8 v4 o& n2 D - #define DMA_FN_IN
9 X$ h. H5 i" z6 f1 ^, [ - #define DMA_FN_OUT
" \# _/ _. ~( \4 }" V) n - #endif: [/ B! |! u/ Y; \5 i" t
% Q: I, u% V, x6 M- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
3 j& O1 p, T/ l, j9 u. b7 ` - #define STATIC_SHIFT 3: f+ I- ?1 D- E5 R" ]) ~
- #define TCINTEN_SHIFT 20
+ ]4 d( T" N& y/ c Z - #define ITCINTEN_SHIFT 21
$ y# D1 ]! R9 C8 X( k& n# ^$ [ - #define TCCHEN_SHIFT 220 ^/ [: r; t! a3 `1 O4 @/ N) z/ G
- #define ITCCHEN_SHIFT 23 ?" m `- t( o$ I; m
- % @: j; L$ [! l
- static volatile int irqraised1 = 0;; ]# l6 u1 i) j6 o. F
- static volatile int irqraised2 = 0;
9 [/ ]$ b! T! k' G Z# \ - * F, L4 N2 o) T/ q9 {8 R3 T
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) u3 z4 n5 E, ?! W8 L9 U$ } - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 v" v3 |" r6 \7 `# k
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 {) b% C, c2 }. e5 x" i
2 X( X. h1 x6 Q' x: r3 S- dma_addr_t dmaphyssrc1 = 0;
! p* _* e$ N7 W) A# N+ v( h - dma_addr_t dmaphyssrc2 = 0;3 Z, o7 g8 S& Z
- dma_addr_t dmaphysdest1 = 0; Y4 z8 R' M. ?4 y: G
- dma_addr_t dmaphysdest2 = 0;6 ~4 i/ s. D6 A2 ^5 Q2 K( j+ U
- & G. R% b- B) U4 N# s! p
- char *dmabufsrc1 = NULL;
' C- N6 Z. T) b2 J - char *dmabufsrc2 = NULL;
6 f$ l6 B. \- |6 Z* M - char *dmabufdest1 = NULL;. q( E) L, X o8 m
- char *dmabufdest2 = NULL;! x! Y( G! I- o7 J% j
- : d; ?8 s% E; p1 G7 s+ _
- static int acnt = 512;- z9 n5 m+ Z, j0 `4 ^
- static int bcnt = 8; `1 b) t* r, l3 b6 m* U
- static int ccnt = 8;- {8 w2 \' I6 O
- + f7 X8 ~; }4 n8 n; S% w
- module_param(acnt, int, S_IRUGO);) {+ x6 [' {3 @. b
- module_param(bcnt, int, S_IRUGO);- K7 O' g- Q/ f+ [/ n: y" a
- module_param(ccnt, int, S_IRUGO);
复制代码
# @2 [! s# w7 X/ f4 ]
7 S, i7 c% P& q8 k5 o- {0 u& E 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 }* I0 W5 g+ n! N7 F# d4 X; z+ s" m
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ |: P1 I$ G- o+ [' T3 }% Q( ?% N 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& ^. `( O* h$ C' |: [# j5 ?3 h! x' q) U
( b5 s Y Z* V ^5 C3 E |
|