|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % n& t6 j1 K j; W
- [code]EDMA sample test application
9 n7 w. [. e! \1 \+ P% a* c - /*$ _& P" F7 J, [1 `9 L' l
- * edma_test.c. V( C1 N+ g2 N3 ~9 E, j" W' i" e
- *4 v- r3 F( f- z+ Q8 v5 M n/ O
- * brief EDMA3 Test Application, f l7 [7 L! T$ d7 q: y
- *
( N" S/ @! c7 R6 m x - * This file contains EDMA3 Test code.0 R( e8 H" z7 t* E& j& S
- *, G4 r$ t! J" `/ {) C1 X S
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" J3 K' x# ?' s" R2 a
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 i% t$ v- j0 G4 w5 p; H
- * TO CHANGE.2 ^4 f* {( o$ u' ]/ G" m3 }
- *
, X! r5 Q; I4 G4 t - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
' S6 T* B! a+ c* X, X - *9 V/ M2 {9 {* Y" @* D% Z" t ?0 M
- * This program is free software; you can redistribute it and/or, r" F! z7 u' \; }/ L7 }
- * modify it under the terms of the GNU General Public License as
2 e8 d$ v; ?1 \- G$ W9 w - * published by the Free Software Foundation version 2.
7 g3 x# @9 g- a7 ?- @ - *& k9 g- m* a& D. B3 Y( r# M& b
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 ^: o) I* }0 J0 ^* g; T
- * kind, whether express or implied; without even the implied warranty, @6 `$ G$ C) P8 ?" |
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the& f, ^) F$ K# f0 L8 H! V3 [
- * GNU General Public License for more details.4 F0 c, Q' a+ H4 r
- */
/ X7 A: F- m% Z' r! b5 i0 ]
9 [8 l3 b( O' h- D' _- #include <linux/module.h>" v5 F, U. b, {6 h! k( n
- #include <linux/init.h>
( G# ?2 ?9 @( T2 | - #include <linux/errno.h> L' F, U2 X$ @( ^* M5 g
- #include <linux/types.h># X! @7 M+ I+ _# C! M
- #include <linux/interrupt.h>3 m% d' G: \2 E& L
- #include <asm/io.h>% n% Y4 s( H; ?3 Y }) R
- #include <linux/moduleparam.h>% F$ I! Q( {# u6 w; [+ F
- #include <linux/sysctl.h>
; L; s, B8 h( E2 `$ W% {, O - #include <linux/mm.h>9 E# n" R8 b2 v! b- p6 K/ ^
- #include <linux/dma-mapping.h>2 o- o5 l3 ]3 P6 \4 a! W
- ( ~" N% I! a& n+ D
- #include <mach/memory.h>9 T: d) \& U6 d' l: r) c
- #include <mach/hardware.h>
7 o" q6 K; P4 f - #include <mach/irqs.h>* A* ^7 G. r. Y. \
- #include <asm/hardware/edma.h>) p y& p' o5 b: G+ M
: B2 O8 l8 k. B& [/ q- #undef EDMA3_DEBUG
) ?( ~" L. W+ t0 {5 i% T3 ] - /*#define EDMA3_DEBUG*/+ E; K8 G0 B0 e' ?
$ i `1 M' A3 |4 X# t- #ifdef EDMA3_DEBUG2 N* d* M8 _+ H% u$ C! ?
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
) e* \7 q1 p5 q3 `$ H% g - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
' K% C; g* ~; C3 t - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 D( d7 o& a, D" F/ {/ T
- #else4 K0 J2 H$ D V! G8 c
- #define DMA_PRINTK( x... )
0 c: }# _& ]2 J" t - #define DMA_FN_IN/ O0 k9 A6 B9 [: y3 [5 h1 v
- #define DMA_FN_OUT
+ A( K, ], o0 N# T& J - #endif* h) d' B7 A; y G/ [3 ]3 f4 [1 T
- ( t% O [3 e' q
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)( d* N' [- Z( q/ L4 G0 @' X& G$ q) v
- #define STATIC_SHIFT 3
+ y3 _% L. S1 O& m) U* o l7 t - #define TCINTEN_SHIFT 20
& n& l; A, A4 e7 Q) r - #define ITCINTEN_SHIFT 21
0 _( |" X7 J Z- e$ X - #define TCCHEN_SHIFT 22
3 l# V+ a7 r5 E+ C* t8 s. O) O5 p$ F - #define ITCCHEN_SHIFT 23" w2 X2 p) i" }& m* M7 X
# v$ ^ ^' c- b( x# a! y- static volatile int irqraised1 = 0;1 x0 x7 g- ? b4 x6 d( W
- static volatile int irqraised2 = 0;- q$ N0 x( O; ?" o
5 F; k) M3 [# R- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 I! M, I. @1 e% w, m
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) U; E: p" S" Y8 x4 n1 g7 t
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 z/ s% F3 N! X6 M: W
/ q2 A5 g( Y- y1 Q5 O9 e S- dma_addr_t dmaphyssrc1 = 0;
2 V) S4 j2 o& G# d5 k- s! X - dma_addr_t dmaphyssrc2 = 0;1 s, I. D& [5 {/ D
- dma_addr_t dmaphysdest1 = 0;( b+ l9 }4 @. y# i: [
- dma_addr_t dmaphysdest2 = 0; X& G7 Z. g- g% s
- 5 B5 g; @ X/ C; _/ g% n
- char *dmabufsrc1 = NULL;- H+ Z8 H7 `: L3 Y. g
- char *dmabufsrc2 = NULL;
" y( u$ c, w* {$ Q' l; a+ B - char *dmabufdest1 = NULL;; s+ }7 D% Q* W' S
- char *dmabufdest2 = NULL;2 r4 E) \/ Q; J1 n; j1 ~
- 7 w5 O: n3 N& {6 m: Q1 g
- static int acnt = 512;" S6 `! }, P4 r
- static int bcnt = 8;' U2 \( B9 f3 u- w+ K
- static int ccnt = 8;
/ ?! c8 m. @ K) K+ K - * e& D* |5 a# y8 {" p8 ~( a& M
- module_param(acnt, int, S_IRUGO);
5 ~9 `6 @$ H, e3 W" ~1 ?' n - module_param(bcnt, int, S_IRUGO);& s% U5 e! @, L$ L, T0 A
- module_param(ccnt, int, S_IRUGO);
复制代码 1 F- a1 `# m' H9 Z5 g3 G, G! N! o
^9 |5 o3 ^" B( Y 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ a0 k6 @1 U; X& Warm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 p: j. D; @. e/ W 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ g( n; c* q) H( n
) s6 {: }+ Z% ^: u1 I7 [# C! ^
" F- I# E& k* a |
|