|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : g. h* }& @4 [$ S0 b- W
- [code]EDMA sample test application
y9 ^6 e N6 I+ h3 E s - /*
4 j% j6 G4 @( v' X, `* n" W - * edma_test.c7 r/ } n/ }+ b3 E/ ?) n# B
- *) I) Y; K3 x' ^( G( _1 ^
- * brief EDMA3 Test Application$ t+ |1 q8 |! s% |% D8 H
- *% t, {& O7 G7 t& k% Q, |. Y; n
- * This file contains EDMA3 Test code.
. Y- [! J( @. {& x& }2 } - *
5 ~" b) z+ f& C4 n - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- B0 O: G) p" Z5 m( B/ I
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
2 @; b7 J1 W) F, d9 t2 d - * TO CHANGE.
0 k* [+ d: x. A/ E( N, } - *5 [" \- h3 _$ l# ]8 J0 a! N5 {
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
6 F* p+ u6 r# }' i, @& ^ - *1 r2 j4 H: t- u: g7 `
- * This program is free software; you can redistribute it and/or
* Q6 _/ P* A. {( c/ i - * modify it under the terms of the GNU General Public License as
- h/ M+ @5 t9 W4 e - * published by the Free Software Foundation version 2.. T2 S) ~( H8 `
- *9 J, C( `, y; ?$ R% f- e
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
* f$ \( f7 i1 ~0 g - * kind, whether express or implied; without even the implied warranty+ b6 O% W; J3 E) c9 `
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the8 F' S3 V O# y7 F
- * GNU General Public License for more details.
, y; r+ ~, E; n2 ~6 a& S - */
; g. a+ l' {2 t Z& r! X: b - . H. T/ c) {) s" R- H9 v7 B* w
- #include <linux/module.h>; X7 R0 [- I$ T1 \
- #include <linux/init.h>3 @$ `3 h' ?& k
- #include <linux/errno.h>
$ r& {5 l. x9 t: z3 x2 |# A4 ~ d - #include <linux/types.h>
8 a+ ` l0 l( i8 L. y- \ - #include <linux/interrupt.h>* S. `2 X4 W% F/ U7 j! q
- #include <asm/io.h># D, v# { m- P
- #include <linux/moduleparam.h>: ]& x5 ]# N* b6 k% e X) r
- #include <linux/sysctl.h>8 ~0 ?% X( V5 w) X+ [/ J
- #include <linux/mm.h>
2 I u% A4 ~) P8 U, @3 c - #include <linux/dma-mapping.h>
. {- m/ v, g/ C7 w B' ? - - Q( e+ M/ v9 ]
- #include <mach/memory.h># ]$ L% E: F- O% I) j: Y' t
- #include <mach/hardware.h>3 c" P# D* B9 C1 |& u1 x
- #include <mach/irqs.h>
6 c( k1 A- c0 a! q- a; l - #include <asm/hardware/edma.h>( r+ q4 L3 B& ?% N
" o! n/ G0 H0 x6 c( Q" \- #undef EDMA3_DEBUG
& v* I* Z$ C4 ]+ z4 F - /*#define EDMA3_DEBUG*/$ r7 [5 }) \( r8 S5 ?1 X6 s6 u
3 B6 M4 Q" F- Q1 W- #ifdef EDMA3_DEBUG
3 y7 F. Q+ q2 y5 ?, i2 J% N - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 Q; z; ]* @ @: m) t
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# ]; Y) R0 G. F3 |
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
1 O3 l; t1 E! `* r - #else9 g, b' w, ~* ~; T: w! j& A
- #define DMA_PRINTK( x... )
- l8 g( q, o5 s9 f - #define DMA_FN_IN
* l! E) |! Y' o0 R - #define DMA_FN_OUT3 G3 h4 \9 @6 b0 O
- #endif3 F! W4 C& m" s
- 6 O7 a/ S4 l* r1 e; j) k
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)! n) y. P$ @5 }' H/ z4 F( G
- #define STATIC_SHIFT 3
! K" n: e6 `8 B - #define TCINTEN_SHIFT 20( g3 H5 H0 P0 E; x' M1 l q2 e
- #define ITCINTEN_SHIFT 21' Y% F7 L) `; v! T& x
- #define TCCHEN_SHIFT 22# q8 e& H! j! M* n7 q2 F% d
- #define ITCCHEN_SHIFT 23- d! p6 F; G. i. t4 O9 \. N$ R, Q
- ( c1 Z* z r; O. x n
- static volatile int irqraised1 = 0;2 m3 F; B' Z" _/ i( E {
- static volatile int irqraised2 = 0;0 ?! s- l: O5 \
- 0 v0 R. Y3 ^; n- }- @4 k1 a( }, B
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- }: k2 P: f" c. B4 r" A, V
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 D6 f" Z8 B/ G( X' R# _ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( F# x% G; I5 Z. F; z - 5 y2 Z" P2 `/ p
- dma_addr_t dmaphyssrc1 = 0;. R, c$ }, J- i
- dma_addr_t dmaphyssrc2 = 0; J x$ C. z6 b3 s5 |+ g2 e) b
- dma_addr_t dmaphysdest1 = 0;; Q. F1 W9 n2 W# q3 ^) _
- dma_addr_t dmaphysdest2 = 0;
- C! Y0 L2 @9 a( l
; o% m5 a" ?0 C r1 l- char *dmabufsrc1 = NULL;
: f/ y' S ^4 A: i5 i S - char *dmabufsrc2 = NULL;0 h5 q7 y: r0 D+ N
- char *dmabufdest1 = NULL;
# i2 K" f' {: Z( E - char *dmabufdest2 = NULL;+ T- Y! g2 b+ o- i/ }* ~$ P9 `
K' r+ C( U: o+ y, g* ^- static int acnt = 512;# m2 O# w$ W* r3 {% l- D
- static int bcnt = 8;
8 B6 L; r5 K" j& ?* d# j: r7 { - static int ccnt = 8;
6 T9 \* t9 v4 V% y
. } e+ B% a Q$ ?! E3 ^* Q- module_param(acnt, int, S_IRUGO);% |* L3 {! `2 ]6 S' l2 {3 j2 `
- module_param(bcnt, int, S_IRUGO);6 i6 P: w1 ~' W V {
- module_param(ccnt, int, S_IRUGO);
复制代码 % h9 u6 B% _- Z
9 W8 X2 [6 N0 p 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' S, W8 }2 _1 h3 \4 O" X. Zarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, D- y3 `8 N N( g k' W 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; P7 h" Y8 k5 K- P s: C9 X9 t% V2 a% r2 d
4 c7 l3 Z# z* ` |
|