|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' [- K8 r5 C; v& x9 J- [code]EDMA sample test application
; F+ u0 ]/ ` P3 u1 V2 @" o - /*- p5 b* l; l- {
- * edma_test.c
1 }0 h- C' Y' T7 P) r6 V - *
( b/ `2 k' X' N, \9 L2 I - * brief EDMA3 Test Application3 S3 B* a. R( o0 U
- *
( K& X$ A* U! k8 { - * This file contains EDMA3 Test code.- h4 S& a% [! G y8 n
- *+ s n8 {" c5 C$ }0 M* e
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# s% \: @* _ ^, k% q! ?
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 |4 Q/ t2 I+ u m
- * TO CHANGE./ q. _; {) `5 T C% D
- *# R* B# Q: x h$ T
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// z8 P1 \* s$ |6 Z# Q5 I* i8 c
- *1 p8 h7 M1 ~$ \) r: S/ g. ~( }7 k
- * This program is free software; you can redistribute it and/or8 }6 Z& r3 b( [* F: k6 q" H6 C
- * modify it under the terms of the GNU General Public License as
3 p3 N: _. ?1 N - * published by the Free Software Foundation version 2.
. V* ]4 r6 N$ Z! G1 K - *9 h! v. n- A9 W* j" F
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any, p u' u8 `1 E
- * kind, whether express or implied; without even the implied warranty% W) F. ?4 L; j* \' G: @
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0 D2 e3 I# U C! v - * GNU General Public License for more details.4 i$ {: W, |7 V
- */: G B+ i: V2 ?1 g% g. e5 |* A
- 6 L8 L! t) Z" m& c1 _6 s, `- b
- #include <linux/module.h>; w$ K1 w9 ^: m7 r% @2 o2 T
- #include <linux/init.h>4 k( x' M1 f" O" `2 b
- #include <linux/errno.h>8 {4 v& L+ a9 g
- #include <linux/types.h>0 J+ l$ U9 e$ e/ L5 {2 u
- #include <linux/interrupt.h>
: H0 F) R9 Q2 a# z' i1 X - #include <asm/io.h>
2 f* {+ |) `# ]' w3 l+ l" e - #include <linux/moduleparam.h>$ F; i+ P8 [- ~
- #include <linux/sysctl.h>8 c9 Q2 v* c; L
- #include <linux/mm.h>
* a2 l0 a- k, [: g+ e' q - #include <linux/dma-mapping.h>/ x# _, l5 Q- @
4 ?2 B) d5 l7 J) ^- #include <mach/memory.h>
; A# J3 o2 k6 u6 h - #include <mach/hardware.h>
: u' p6 x/ y9 h6 j7 N* B - #include <mach/irqs.h>6 P Y" ~5 b1 ~4 X" R G2 M# K
- #include <asm/hardware/edma.h> R" g+ Z; K( O8 o/ R+ M3 J
- 5 L$ H3 h* c4 ?( b& o
- #undef EDMA3_DEBUG
2 I5 V: |- }' G* l - /*#define EDMA3_DEBUG*/
8 T- a/ [' R; r - - c* y( t1 ]3 z% p& z6 b: n
- #ifdef EDMA3_DEBUG
4 @. I% \0 L# X: w- Y2 l - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% o& H* f. F2 y2 C/ ?! A1 n3 u
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
: {0 a% V7 d6 h- [+ X - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' u0 ^$ v2 c* ~
- #else$ u% c. _* _: u; E/ F% w
- #define DMA_PRINTK( x... )
! a# }' F9 s j. c+ m; u - #define DMA_FN_IN
B; u- \$ i" G4 F u" X/ \9 w- { - #define DMA_FN_OUT
, [7 ]* q) `3 U9 d+ k - #endif0 c# `! H; s) [2 l: ^
7 } |4 M% }. s9 q- D/ u- #define MAX_DMA_TRANSFER_IN_BYTES (32768)) |7 l; v7 `" n, b% J# i: Y- A9 s' D! s
- #define STATIC_SHIFT 3
6 d' q0 `' b0 ~; Q3 e- T2 Y - #define TCINTEN_SHIFT 20
( D7 B6 p$ ?5 o0 P& U& Q7 p - #define ITCINTEN_SHIFT 21
' A) ^+ T( ]# K( @3 | - #define TCCHEN_SHIFT 22- O, ]2 k. C; s9 H$ T: G
- #define ITCCHEN_SHIFT 23
, p. o9 G6 k; r- [1 G+ |+ G' B - 6 e: V6 Z V5 V: Y& D _
- static volatile int irqraised1 = 0;
# E6 H" |+ D; n) n- n3 j - static volatile int irqraised2 = 0;
/ P( c4 z% V/ @; m) Z
/ l7 S& d4 U" x( o2 B6 y' D- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! A( L8 c5 `* s/ Q6 c
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. i6 r: v9 q+ ~ V, Y. Y; m
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( z/ X$ f% k% o- @; D/ x3 B
7 w; ^1 x( L" }/ y& Y6 l- dma_addr_t dmaphyssrc1 = 0;
0 A5 q- L. t4 j. p - dma_addr_t dmaphyssrc2 = 0;! [) n P E; {2 G
- dma_addr_t dmaphysdest1 = 0;
9 U0 S, [( @" r6 ~. Q1 n - dma_addr_t dmaphysdest2 = 0;
* f" i5 D% P+ c. y - + }5 ^+ O- V6 `1 R5 V7 i* g
- char *dmabufsrc1 = NULL;
% U& ^1 f, S3 n) [/ w5 _! _ - char *dmabufsrc2 = NULL;
' E: v" c) W8 S2 e! l, ]" l - char *dmabufdest1 = NULL;
) l* z9 i( X& p! T6 y% w - char *dmabufdest2 = NULL;
7 z0 X" H! ?9 H* I; p: T - , H) s) s U6 N G! W0 \ C* F
- static int acnt = 512;6 v) u4 A, B* @3 i4 y) i8 y
- static int bcnt = 8;+ o7 G9 p& c& ]2 G+ [0 F8 S3 E/ \
- static int ccnt = 8;
5 M- }) \8 S- h$ z; D+ q, P
7 \1 w- V' H) E' G- module_param(acnt, int, S_IRUGO);) \ ]% H$ G; _# Y! @6 g
- module_param(bcnt, int, S_IRUGO);; c( R5 y/ t* n( n( d
- module_param(ccnt, int, S_IRUGO);
复制代码 0 |- c9 y2 _4 O v
* ~! E+ [1 z& W* k 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 u( ~3 Q0 A$ O
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: o8 Z: J+ }, H
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ x% J3 Y/ a2 E+ x# Q! b1 m0 ~6 n+ z! d- u0 f# g: g
/ Y* B3 Y7 Q) a* D( g |
|