|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , B, |: }& \% _+ M; g
- [code]EDMA sample test application
( Q N7 N: a& T/ ]" ?) }+ r7 o - /*1 l* Q# g& m& K% }/ z9 V* w
- * edma_test.c
. m% P; |0 f) n# m - *, j: S) p" O, ~7 q: }/ |- f0 i
- * brief EDMA3 Test Application! e* w! B' d1 D- w
- *& v7 U4 w) X# G) X6 k! W* R# Y+ \
- * This file contains EDMA3 Test code.
' }2 m* X/ h1 {. y, G - ** L' h2 N9 z) `: ]) q$ |. Q
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
# t) a: v @$ X; Q T - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! l; i" }9 h( J2 s1 z* M
- * TO CHANGE.5 |0 a7 B M( l: S) y/ ~$ b3 ?5 p
- *
/ |: a, J% W& Z1 W - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
( L: u8 f' h! B. O5 T - *
& E w" o" y) t) b L, v! Y - * This program is free software; you can redistribute it and/or/ K5 m p4 \0 Y1 Z2 L
- * modify it under the terms of the GNU General Public License as' y$ t2 a* h" F0 x
- * published by the Free Software Foundation version 2.' {- Q1 f; P2 K( l
- *
3 M. s& C0 Y$ G - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
, d9 @# B' c' p3 A - * kind, whether express or implied; without even the implied warranty
; O( T3 p# q7 G g/ i - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ]0 ] B0 T, t# n
- * GNU General Public License for more details.
) e3 }7 e9 ]9 Z; e/ ]5 d - */3 e; U& Z I- R7 K' W! E8 G4 i. E
- ' _( m6 q, j; D6 u1 J5 q8 S
- #include <linux/module.h>$ Z$ H0 x t j+ d# ]1 y
- #include <linux/init.h>
7 p5 [6 r( t" @ - #include <linux/errno.h>
- n% i- m7 R5 @! N" O! c - #include <linux/types.h>& S4 i' k" Q. G9 Q5 P
- #include <linux/interrupt.h>; Y6 i, [' e w7 O' x6 E( P
- #include <asm/io.h>$ M- O5 Y9 r! C' F1 P. G: a# X. V
- #include <linux/moduleparam.h>
2 I. K. p$ _8 q @ - #include <linux/sysctl.h>
9 D; A7 Y. q( Q6 u2 @% _& z7 W - #include <linux/mm.h>
3 A+ ^9 L* c* k( Y - #include <linux/dma-mapping.h>6 Q) Z! o n* F- G1 y
. T7 `' R: l9 Y% T- #include <mach/memory.h>
# @( S- k( D8 \1 n - #include <mach/hardware.h>
# a% `9 \0 g- U" k) z, p+ z - #include <mach/irqs.h>
" i; r! b* S5 s% [% S( x' G4 A' V7 q - #include <asm/hardware/edma.h>7 ^2 q& K( r6 Q% K# q0 D
/ b2 F! h% f. t- V7 N- #undef EDMA3_DEBUG
* I }6 k( _. `& u - /*#define EDMA3_DEBUG*/
" f; |( q' `. j* \# z - S: V& ~$ E3 D5 K
- #ifdef EDMA3_DEBUG
7 K+ T5 ^; K/ r8 @ L( U# S8 | - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
) g ?, m# ^5 {( f7 \ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). v! L7 L4 K; n1 P/ E
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ v* ~' A) S" A, V8 A3 L% E1 Q& o
- #else) a q! v" P5 P+ G( q
- #define DMA_PRINTK( x... )
# B" I, x' R$ H - #define DMA_FN_IN( H5 O3 W4 ]' d$ K- i$ t3 T
- #define DMA_FN_OUT
! }) T) o: {2 O* ] y* m - #endif& p9 p4 d; a) [2 o1 ^% w
3 k8 Z0 [$ W+ \. }$ H7 Q8 Q6 o- #define MAX_DMA_TRANSFER_IN_BYTES (32768)- ~) `0 h" Z; k4 P1 H
- #define STATIC_SHIFT 30 U: C5 [8 }6 k( E
- #define TCINTEN_SHIFT 20. L# q0 o1 @/ l6 `9 A& `
- #define ITCINTEN_SHIFT 21
9 x- O$ f) j3 w# ^" F' p - #define TCCHEN_SHIFT 22
+ ~# R t) H; B# p - #define ITCCHEN_SHIFT 23
- Y' T8 }6 G- v% g% I' v5 X: V - . N. I% ^1 Z' y6 f/ `
- static volatile int irqraised1 = 0;
% H1 A# \$ h- X3 a6 [ - static volatile int irqraised2 = 0;6 R; C& X6 Y# [% G$ E" v
- T( G k0 v& z( F' N0 d
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ D4 S9 N6 {5 E) }- m. \
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# @' T5 X/ |* V; K
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 s1 ~5 w0 |* w7 ] - - z0 G/ B5 A, p9 H
- dma_addr_t dmaphyssrc1 = 0;
, s8 S5 J9 ]* t6 Z8 Z9 [6 G/ O3 ? - dma_addr_t dmaphyssrc2 = 0;5 Q( N' a; B6 e4 {) b4 j4 U" ]
- dma_addr_t dmaphysdest1 = 0;
% g* G! p4 y7 I) |3 | - dma_addr_t dmaphysdest2 = 0;8 ]6 m; v0 r; j7 k5 ~! m
6 B0 l# X! U( Z% i- char *dmabufsrc1 = NULL;# Y& ^' b. i2 a G! k6 u
- char *dmabufsrc2 = NULL;
7 d' x" l8 O7 a9 ]# G/ a, B - char *dmabufdest1 = NULL;. O" I* g, w+ k" g
- char *dmabufdest2 = NULL;4 Q" h. g' x y* x* U. t
- + c$ ^+ g$ }, s, t! x
- static int acnt = 512;
$ i- B: O) K% ? - static int bcnt = 8;
4 X: p* J4 ]6 V0 \( V$ Q: t - static int ccnt = 8;* Z1 t- S% V2 }4 z, `" V5 l# n4 _( N
- ! \: H; M8 W. q3 n9 }
- module_param(acnt, int, S_IRUGO);
5 }6 P# P. i( W& j/ Z - module_param(bcnt, int, S_IRUGO);
* |9 b6 I9 c# u% C5 E - module_param(ccnt, int, S_IRUGO);
复制代码
( t8 ]+ {- l/ `/ C
) r" s9 |3 H* M8 w% z 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 v+ ]% a9 x: Y) N3 sarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。% x* ~* i3 f% @ T
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. [' }/ c) J. K; J( x) m
9 \2 Q" r% b- `7 @
. o, Z5 v" u, y! K$ l% E& q. B |
|