|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- S% e+ E9 d5 Y- [code]EDMA sample test application5 `6 s& V9 m) F; |
- /*
& y9 k y( ]2 E8 }% V( R: o - * edma_test.c1 }% l6 Y7 R9 k
- *
' P" `1 j8 }2 O, `3 m - * brief EDMA3 Test Application
3 r- d$ ?1 [9 K - *
+ m1 w* E+ F* U4 O2 D - * This file contains EDMA3 Test code.
) y- t/ n, w: L - *2 ~0 {& G! N2 [' t1 I: }0 g
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
) T( W |/ H1 L- Z - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
1 P' ~8 W7 b1 R; N9 k$ u - * TO CHANGE.. F% C L: A2 U' F+ g
- *6 G+ U0 L! n: ]9 B$ T
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
9 u0 N1 T0 @1 @) R$ X2 O4 Z/ r6 j - *
/ z- O! z7 A; o |' l; l - * This program is free software; you can redistribute it and/or5 A% t# {1 a# r7 V
- * modify it under the terms of the GNU General Public License as
5 I# W) O* r3 u0 b7 y s - * published by the Free Software Foundation version 2.4 x* f; R$ o5 f+ F, P8 \$ R- s
- *
2 o. i% J7 t) ^ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
- \8 V# R$ U6 Z9 l; F - * kind, whether express or implied; without even the implied warranty
% I1 c/ M) I% P& z - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
. z! M' ~: w4 m' c6 C - * GNU General Public License for more details.
M1 k, W7 p2 A+ {3 F6 R - */
( S& r( X3 k( [" U3 S
- R J) U2 N# ?, p) C7 X- #include <linux/module.h> N7 {) W0 A M; y& ~' [
- #include <linux/init.h>) n! ]: y6 E1 f9 e) Q8 k, l
- #include <linux/errno.h>9 ]9 v+ D3 e- }) u: o& P
- #include <linux/types.h>
- i" d! R; x& x' x. O g" p - #include <linux/interrupt.h>5 `- o4 A! t3 p' i% O2 m
- #include <asm/io.h>
/ m! @: W1 X" s4 l) F( T) `5 q - #include <linux/moduleparam.h>
) ~2 }6 T9 f: j: b! F4 N! J9 D+ [ - #include <linux/sysctl.h>
$ o% D5 \. R% C, G3 U. j( J - #include <linux/mm.h>
+ c; n6 ~* T# f7 S' U8 z9 ] - #include <linux/dma-mapping.h>
9 F9 N% K9 O6 O2 ] - 7 U6 A/ Y) B4 |6 Q
- #include <mach/memory.h>
; A5 J1 u3 H" y6 }8 ] - #include <mach/hardware.h>+ k, Z2 V3 s, e; u' @
- #include <mach/irqs.h>
- {( t2 x! n* Q$ p8 j) ] - #include <asm/hardware/edma.h>2 {. g$ C0 k( A6 {3 z' q; t b9 p
- l9 t. x9 x/ H; \+ s% c, A* E) F
- #undef EDMA3_DEBUG
4 n# }7 ]' q* k3 P1 A0 B/ T. N - /*#define EDMA3_DEBUG*/
3 z8 H5 x" y+ D% O
% P/ ^% C; e0 m8 B- #ifdef EDMA3_DEBUG w8 U* |6 |3 o& j6 F$ K" w: ^
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ w: V _% F8 ^& N& P1 o5 x
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 y1 i- |$ f) ?
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) n/ Y. v, d9 f2 I2 Z- k# q
- #else9 ?4 `6 E/ b$ G+ h; s1 o. m
- #define DMA_PRINTK( x... )
4 Q5 X1 S, _' ~& S# L. O - #define DMA_FN_IN8 O5 a2 V# v, Y8 p8 Q
- #define DMA_FN_OUT/ T, W* F+ ?1 I, i) C+ S
- #endif
! p# i' L* x3 c
% O. u; |, H# G* z0 g- #define MAX_DMA_TRANSFER_IN_BYTES (32768)! T6 H" p/ w' V
- #define STATIC_SHIFT 3# W0 A9 m f8 k% F
- #define TCINTEN_SHIFT 20- }" e, Z2 m G( i0 }
- #define ITCINTEN_SHIFT 21
) s* h, y) B" }4 e3 }- ? - #define TCCHEN_SHIFT 22' L% S" e9 k( d6 k" X* {
- #define ITCCHEN_SHIFT 23
0 j9 L! ~1 y8 r/ {
5 O: X$ q# s" j# X, J9 a- static volatile int irqraised1 = 0;
1 N: X5 M2 ]& b5 Z' l - static volatile int irqraised2 = 0;) _2 {6 J( Z1 [! T- f% _
- - U' p1 O9 x* v! w0 g+ d
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) e$ w4 c$ q- y+ Z: N5 { - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! f1 p' ]+ g" r" f" @4 w+ ] e( n - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" [; W2 ]' O' Y3 r S: Z - # `1 J6 _0 N: H$ O* G& U* _
- dma_addr_t dmaphyssrc1 = 0;
* r" o# ?+ e& ]6 z, N - dma_addr_t dmaphyssrc2 = 0;: D5 I' @5 u2 E0 F5 H& j, @
- dma_addr_t dmaphysdest1 = 0;
& I( M5 f& L% @% j - dma_addr_t dmaphysdest2 = 0;
8 o( k5 m" |" Y9 {, |, D8 n - 1 ?& u7 `" T! v
- char *dmabufsrc1 = NULL;$ u% J2 V3 a3 E# x. } U' w
- char *dmabufsrc2 = NULL;
1 |6 v7 S: w- K9 ]4 k, ` - char *dmabufdest1 = NULL;
$ c' e* ?2 Q0 W - char *dmabufdest2 = NULL;) b) G# c* A7 r+ Q* e
- ; V; h! n# |+ z5 V$ H- r' O
- static int acnt = 512;
" w9 r. w8 V3 Y - static int bcnt = 8;
& {- L. D5 n9 z) S - static int ccnt = 8;. i' |7 V4 ?5 z8 G7 x# f* n) P
- & o" ~5 R5 J* C1 B1 C1 g7 O4 A) ~
- module_param(acnt, int, S_IRUGO);9 `. t: C5 [: o% w( k" Z/ T
- module_param(bcnt, int, S_IRUGO);
O# k! d& s X) h - module_param(ccnt, int, S_IRUGO);
复制代码
5 Y# e& z5 D% Y) v* s/ S
& P- @% D; H0 \2 {; C; g# H 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 G5 i0 C0 Y+ A- n; {. Oarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, i P8 y5 \$ ]$ [0 }5 I 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' Z$ b$ R9 o9 i- g- S% T) f# t8 n4 s* p# {8 k; \# g, ^
( V2 Z9 S4 G( a! f! ?' G# k2 O+ Y
|
|