|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ T+ V( L1 F9 U' [- U2 {$ G4 v( h- [code]EDMA sample test application
: b a- s* V+ M& a2 g# w/ T; { - /*
# k6 f+ Q6 r. I; a0 Z4 E _ - * edma_test.c5 u2 C4 \4 m) q! O$ Q
- *
* V# ]1 L, @4 D7 m$ A - * brief EDMA3 Test Application0 [3 V% j; Z7 s Y
- *! O% C' ^6 G/ v3 o
- * This file contains EDMA3 Test code.- H U& s. k$ e
- *' y% z/ v1 [4 v9 T9 [% k9 b
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ L; S4 q C; r( y& k" |4 _+ J
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# P- H) z. W1 _. j( ^- Q
- * TO CHANGE.
. A R2 }7 L$ _) k3 ] - *
' ?$ z! I/ U0 ^/ t9 h' y8 O) } - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 f: w* d9 S/ m8 z
- *' u2 B1 L! u" s; I
- * This program is free software; you can redistribute it and/or% n' p7 B& i0 N3 e; L1 v+ L: y$ m
- * modify it under the terms of the GNU General Public License as
6 Q, Y" v3 @ D) \( x" V* n - * published by the Free Software Foundation version 2.* }0 r4 r/ {5 e1 r
- *
1 q& W0 D& x- A2 y" ^: G - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
6 a, i3 n3 q: ~! y' M6 I - * kind, whether express or implied; without even the implied warranty
/ \6 y% r9 k" H8 k1 S9 A - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- {% k& E4 m+ Z4 A' [$ K/ f5 ?0 W4 w6 F
- * GNU General Public License for more details.
1 w$ y# c3 r& _. P - */
$ m, K- I; f& M9 Q) u+ e
9 c) `, G! V q2 T5 H8 O- #include <linux/module.h>
0 O# R) }2 _! e5 n( U+ L3 y% |+ {2 u - #include <linux/init.h>
( s2 W" u9 n& ?9 I6 W8 U& x1 S# [% D0 q* k - #include <linux/errno.h>
! o8 Y! L1 P: q - #include <linux/types.h>6 a1 C! `9 u4 P4 R- M/ O
- #include <linux/interrupt.h>
5 L* m: o$ M3 |1 A$ I; | - #include <asm/io.h>3 n, y. l0 R; I ?9 N6 A# }
- #include <linux/moduleparam.h>1 R1 [" h/ _) I- w$ F4 h& O4 h
- #include <linux/sysctl.h>
! ^! k: x6 K) {( O# Y3 X+ l - #include <linux/mm.h>
u7 V2 B! E* \3 j0 k2 h* p - #include <linux/dma-mapping.h>1 L, h) b* M: x6 ?1 \; C
- , [( @7 @$ `7 J: ?& [7 q) O ^! o. K
- #include <mach/memory.h>
2 o3 C7 t1 x2 G - #include <mach/hardware.h>
/ A. C# C% q3 A2 ~' K" V - #include <mach/irqs.h>% U: U8 T# w, I; P4 _3 ?
- #include <asm/hardware/edma.h>. ~1 r4 `1 D5 I# U5 w0 [
# _/ B6 f' \- {( w- #undef EDMA3_DEBUG
% z% q+ @8 x! @" ` j - /*#define EDMA3_DEBUG*/
( x, q) ~9 e" Z6 s - 6 n6 ^9 t/ o+ U4 g+ j
- #ifdef EDMA3_DEBUG5 o3 l0 o+ U$ R$ g. q7 P* ~
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 n, q: n8 e! ^0 M* r {
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' M, }5 d [ ~3 {3 c
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 ]8 |2 W/ k( x1 c& l: N5 }
- #else
8 X$ w) P2 m9 R: e) K3 W - #define DMA_PRINTK( x... )
. i B r+ c" f8 i2 ^ - #define DMA_FN_IN3 G; m; N/ P! w: S5 o) d' A
- #define DMA_FN_OUT
5 x% T9 w. A! I, ]- P - #endif
" n" j, S2 b1 V8 _$ i' l# W
3 \0 ^/ [: w$ `1 i& q8 H5 |- #define MAX_DMA_TRANSFER_IN_BYTES (32768)0 Y+ T9 M5 U, L$ |
- #define STATIC_SHIFT 3
# v5 R1 y3 g5 m8 U - #define TCINTEN_SHIFT 20
3 f& {3 i0 F! l3 W& \$ m - #define ITCINTEN_SHIFT 210 b6 A/ J8 T# K: b1 I) {
- #define TCCHEN_SHIFT 22
) Y/ I5 {, d+ S( x; u: w8 m% r" F# E$ J - #define ITCCHEN_SHIFT 235 g- X3 q; v: E7 t3 L: r" C
- / z! ]$ R+ I, A" P6 m4 c6 Z3 e
- static volatile int irqraised1 = 0;
1 K% N6 ~' B% |$ G. c - static volatile int irqraised2 = 0;
$ M1 [% v) G3 m4 z
5 a' A% }; Z- x, q6 d/ p9 x- `- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! o8 ^8 M0 S7 r, g
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ ?% L( d0 {% U9 x- G1 Y6 \# [ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) e1 o- J1 D B, J. L - # G% C5 r9 [) t( v8 x
- dma_addr_t dmaphyssrc1 = 0;2 `' I( o& `* ?. j
- dma_addr_t dmaphyssrc2 = 0;- k j7 X; S4 o
- dma_addr_t dmaphysdest1 = 0; O2 Y( m* T9 J7 {) D' e& c% G4 Y
- dma_addr_t dmaphysdest2 = 0;& |+ v( K. H8 i, P4 }
/ i. z6 t$ \& C; B2 F- char *dmabufsrc1 = NULL;' [! C/ o; k* U3 g4 Q# T( K
- char *dmabufsrc2 = NULL;& Q. K1 m* I) I2 u" e( S2 y, _8 ^
- char *dmabufdest1 = NULL;
2 K9 f2 }! v- ` - char *dmabufdest2 = NULL;
0 e( y0 w% P T% p/ N. u! x9 N3 ] - ' p% Y( q A/ b8 `1 B
- static int acnt = 512;
2 C1 z5 `) D. G - static int bcnt = 8;
* C/ ~2 }" V4 p/ d, f A - static int ccnt = 8;
$ Y" r: r; ^4 O4 Q2 i
V# T- \: j# s) C* S% O, p% r2 d- module_param(acnt, int, S_IRUGO);
" E6 W2 ~* n7 ~( B- `3 v/ Z - module_param(bcnt, int, S_IRUGO);
/ F2 E- Y0 q2 V) j e6 F0 E7 ? - module_param(ccnt, int, S_IRUGO);
复制代码
/ W j& K8 O, a+ y5 a5 a, P( \' K$ m7 i' ~' y) Q5 F$ M' A
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' o; Y) t' Y& }+ B7 @$ _2 h! \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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
3 j1 ^/ I3 J+ N" L. f 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 O, `8 t% S& z; ^) t
/ G1 E: {0 w/ s8 [
- R5 a9 h' ?0 Z# z: S
|
|