|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* U# g# f' q0 J8 D) }9 K% B8 G- [code]EDMA sample test application+ D0 W* \( z/ l0 x; |. a( J1 s" ^
- /*6 [- j' g& J$ R. j' m0 B; E
- * edma_test.c. n0 e5 Q |' Q! U; \: v5 J/ c) q
- *; I1 I# x( P# `( j" m
- * brief EDMA3 Test Application
& p' X3 T* z. U5 F$ Q. t - *
' A$ v9 J7 D' U6 } - * This file contains EDMA3 Test code." j1 y) G3 a& i2 G. Y6 s1 F% P
- *' j4 Z& l) {' g& }3 R' k5 y
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
& P8 q& J0 |4 q* [ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; B% u3 X7 l4 m8 r" K3 V
- * TO CHANGE.
* ^' P9 q) t9 D1 R: N. V5 X - *" F( S) Q- Z# P9 q8 l2 T
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' ^0 z6 R4 L5 `! g/ {3 x
- *
$ o! z" y3 R6 X* r0 @/ _0 q - * This program is free software; you can redistribute it and/or
6 u8 C2 U2 g4 p5 y- O - * modify it under the terms of the GNU General Public License as
" O4 {: ]0 [' {! G8 _# a - * published by the Free Software Foundation version 2.
4 [" @& A& ~! t2 O - *4 T/ }0 M2 r( @6 f: ^6 X
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any. X9 }4 g5 @* J" h, v, Z, F, T! `
- * kind, whether express or implied; without even the implied warranty9 a" V) a) X1 U& C
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! @2 x( U+ q {9 T( G; e - * GNU General Public License for more details.2 \0 c Y1 L4 e/ T7 n7 W5 H
- */. @2 V' X, r8 A* A8 I
1 t6 I+ T$ P( c1 I- #include <linux/module.h>* R; W2 ]; L" p, z4 S! b2 G) W* H
- #include <linux/init.h>
0 V! ^& j2 S/ c4 c! F - #include <linux/errno.h>7 E( i0 l6 @4 L" |/ X
- #include <linux/types.h>
: d! t3 S% g2 k. Y/ | - #include <linux/interrupt.h>
3 y- ?1 @0 _5 }$ `0 d3 k - #include <asm/io.h>9 P. |+ A. {3 V- d% i& B8 K; a! {8 R
- #include <linux/moduleparam.h>8 U( f) y" q' L4 s) n) X
- #include <linux/sysctl.h>3 l$ d6 C4 o2 ?9 s6 |2 F! h$ Q
- #include <linux/mm.h>
+ W- [5 B8 i/ K+ I - #include <linux/dma-mapping.h>
1 O* N M& z! Q& x - : a W1 U! h; w' G' w0 I, \" S; h
- #include <mach/memory.h>
1 I2 m: W& P! g: [# x - #include <mach/hardware.h>% p5 V/ n4 _. P- ?% v Q
- #include <mach/irqs.h>3 e0 U( c! S- v6 h# x2 ~' c
- #include <asm/hardware/edma.h>
* A& ^( Y5 B5 T4 l, d - ' k& i: S" _4 c
- #undef EDMA3_DEBUG
9 u; P) [$ D+ i9 x - /*#define EDMA3_DEBUG*/. z- D) t: Y" _' c2 i1 s s
1 I- |6 Z% y0 Q; e" \. y3 R- #ifdef EDMA3_DEBUG
# S+ r9 q" H2 i2 v0 N& z0 O - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# D. y8 P# g) E3 ^1 B8 O3 ]
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
F* K+ V* J, X - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 ]7 d# \! \4 {. v( r2 q" I* {
- #else
2 R' {1 E- _3 E9 Q - #define DMA_PRINTK( x... )
; H; W, ?1 {4 G0 v' \ - #define DMA_FN_IN/ E R6 U8 M8 D! Q% N# H. [
- #define DMA_FN_OUT
* X) n# X Y# R( y- [ - #endif+ T5 O* ^, S" u8 U7 H- G0 K. _
- 3 x( S3 B& v: e5 ?
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
; N, X. L1 Z9 t0 n% T - #define STATIC_SHIFT 3
# i( v' T8 n' g- p - #define TCINTEN_SHIFT 20 q/ Z; j" b3 N: J3 f* L$ r
- #define ITCINTEN_SHIFT 21
9 x( N9 _' ^: s, B+ h4 u - #define TCCHEN_SHIFT 221 H; E+ a' g% V
- #define ITCCHEN_SHIFT 23$ X- W- B7 O$ c8 I7 s
1 z- H* [9 S4 F2 y! p; ~- static volatile int irqraised1 = 0; v; ^- ^' _9 s" M, l
- static volatile int irqraised2 = 0;0 Y) n3 r- }& R7 `9 m# Z
- 6 _& S% g5 B# d N i2 u2 Z
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 B. N$ g8 P: A; S. m( S' O
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 z9 n+ c) Q+ ?" i8 R+ B& T3 X - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" N' u$ f" p1 v4 A7 G, m) v2 _
6 I8 O0 M, _1 K, C- dma_addr_t dmaphyssrc1 = 0;4 R0 l, I1 g& `
- dma_addr_t dmaphyssrc2 = 0;
5 q7 r8 `+ O- Q - dma_addr_t dmaphysdest1 = 0;
/ v0 u' H) B, T3 z - dma_addr_t dmaphysdest2 = 0;
$ i! o, L+ Z" A) P% Y9 G - 7 u/ u6 i5 U. {$ D& P' T$ ?
- char *dmabufsrc1 = NULL;6 B- D: J% m# v2 {
- char *dmabufsrc2 = NULL;
6 S$ D: K; G, y r9 g8 ?) E5 `: v - char *dmabufdest1 = NULL;
4 w- T2 n6 y8 i a G: I6 v- v - char *dmabufdest2 = NULL;
' y2 ]2 B4 r4 ~# d2 k6 N; ?
, {1 q- e* {' a2 ^( I0 N$ Q4 B- static int acnt = 512;3 M2 j: T! K: n/ q: C. U2 p- x
- static int bcnt = 8;
9 q4 T o) v3 i# Y0 i; S - static int ccnt = 8;# j, m: ?$ Y2 K% O! X* W$ W! B
6 l0 @, i) Z$ j8 w$ D( |- module_param(acnt, int, S_IRUGO);1 V, ~; w+ |$ T$ \4 R7 O2 G
- module_param(bcnt, int, S_IRUGO);
6 e1 \% v1 e$ ~8 ^8 P% F - module_param(ccnt, int, S_IRUGO);
复制代码
9 [2 a3 Q1 k$ B# p' R; V! F& q9 X' `5 P+ @& g) t) _4 v
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& [# A" @. K9 }. H. z- L1 \
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 k7 @! s" D' O2 a: A
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。; e! P8 e3 s# h2 J' d, r9 ?8 F* L
/ t% {& |2 G- ~5 Y0 Z% c( d. u% g4 P- F1 l# v3 C1 |" e: D& h
|
|