|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 o- m; \" W5 {; S F# f- [code]EDMA sample test application
% \! }+ l C' D' B+ @7 T8 W - /*
4 {$ a% d+ c% y5 _ - * edma_test.c5 x# p `7 B* Q% E2 c, x
- *
: x. Q( o U4 W+ Z9 ~, i! F1 c - * brief EDMA3 Test Application& G; j& ]3 m0 s, K- `
- *: T% F# M3 d7 h$ @: _! |# |
- * This file contains EDMA3 Test code.
* f% z) f8 z* y& q% \! G: j) p( q - *3 I! W: f Z* I2 @$ s
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ M: D) i, t. N1 b W
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 ]' T+ l" W% w1 p
- * TO CHANGE.) C6 U9 k5 M8 u& f8 u
- *
. s$ D: w$ Y; h. ^ } - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" A0 D! W, ~( y2 F1 c1 c0 F: Q
- *5 } f1 G6 T: k1 S9 C/ Y
- * This program is free software; you can redistribute it and/or' x$ K/ B4 E9 q% Y# Z9 L/ K
- * modify it under the terms of the GNU General Public License as0 _& A+ w3 A, y5 Y. r
- * published by the Free Software Foundation version 2.
5 l! ~" X% E, e, t - *
5 `$ f: H6 J" ?# z8 A" Y - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
7 i# w, r$ |3 D6 Y2 h - * kind, whether express or implied; without even the implied warranty
3 ~7 ^ [, Z1 _5 `* p0 Y4 i - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the* A5 ]. ?6 \: G
- * GNU General Public License for more details.
, ]- X: S4 l9 A9 ~6 V* x& w - */
- @8 E/ I4 C, C8 [. y# T - 5 r9 M$ i7 r5 [ A4 U5 [8 z; y) }
- #include <linux/module.h>
2 w2 q4 J: N4 C! r# T/ }1 {! a - #include <linux/init.h>
$ g! A$ j+ F6 D& {0 u - #include <linux/errno.h>
# L: C, n, e+ e/ `, S" n$ l4 m - #include <linux/types.h>
$ ]+ w7 p% U( c: [* }% p/ D - #include <linux/interrupt.h>
/ E3 E( G, x- Q" ^2 m' | - #include <asm/io.h>
! ^& p5 N+ B& @ A - #include <linux/moduleparam.h>
+ x( x$ l" \$ v% J4 r - #include <linux/sysctl.h>: w) ]2 b& f0 D- H
- #include <linux/mm.h>
8 H+ e* I( f4 Q) s, t! G! n - #include <linux/dma-mapping.h>
' N( i' Y7 b. r: i# C( h
! C4 K9 @3 X5 L5 }4 R% E- #include <mach/memory.h>
7 I. E; W4 i0 d5 A; } - #include <mach/hardware.h>0 g8 w, p! v. Q+ f0 D ]. L+ U7 b6 s
- #include <mach/irqs.h>
; w' D) }$ I1 K- z8 I: ]6 L - #include <asm/hardware/edma.h>
4 K$ S# B0 T3 ~& E" @: h1 ]
2 ?' g7 F- { Z+ ^( C( ]* ?- #undef EDMA3_DEBUG
* H2 b4 G3 f8 N( y# L( L - /*#define EDMA3_DEBUG*/
/ l) G; p6 V. w7 K( J& m. N - 4 M$ w: x7 y/ q, C1 a7 b% l
- #ifdef EDMA3_DEBUG
8 K7 W1 F" a5 T% F1 W' [ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
& U5 P: w% X3 ?/ { - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 g( k9 a0 {+ x& K$ l
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
! {' v2 f, o' I' ?" k% d/ e/ }4 _) a - #else- s' B. Y9 Q- c
- #define DMA_PRINTK( x... ): }; f7 Z/ N; C* d; y0 x
- #define DMA_FN_IN
{' Z& y% k7 C6 a: N4 t. j) R - #define DMA_FN_OUT
1 l! \" w" m3 ~4 ]% f - #endif
* U, W/ q2 ~1 U
0 I/ i% v& D' j7 T k# q/ P4 Z- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
& i7 m# d. ~7 Y( L! Z7 I; t8 p - #define STATIC_SHIFT 3
+ ]3 p" o8 Z/ o - #define TCINTEN_SHIFT 201 X; }! W# Q" r& e
- #define ITCINTEN_SHIFT 21
- r. d% H1 ]- ^4 a: V - #define TCCHEN_SHIFT 22' e( W/ K* y! ~1 l8 L y( c; s$ c
- #define ITCCHEN_SHIFT 233 _# H8 B: U5 s7 }
- ( [# m6 R, E' q- L8 Y
- static volatile int irqraised1 = 0;
% |8 @$ Z. r1 O- i- M# `0 X - static volatile int irqraised2 = 0;
5 e0 L' I* X( S$ o+ S S5 o
4 A% S1 e% q+ d: r. t0 W- d- Q% E- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 C' ]" c. f5 U; C% j4 N - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ c. Y: n: d$ x L5 [ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: b- u% X# p/ A' x" E7 T ]6 E
- ' G' p, D( c4 z+ ]7 p0 E; ^$ Y3 {
- dma_addr_t dmaphyssrc1 = 0;
0 W$ ~) Q4 Q. I) M6 j6 Y( b+ Q! Z - dma_addr_t dmaphyssrc2 = 0;
; {; V+ k% X5 a" u - dma_addr_t dmaphysdest1 = 0;4 u( G: S$ h% R$ |
- dma_addr_t dmaphysdest2 = 0;
8 o2 _* \, _1 b' `9 Q& j
3 I0 w- B$ z. V1 l d/ A5 J- char *dmabufsrc1 = NULL;
b- f% y& n. y8 W6 Q' v7 d+ y - char *dmabufsrc2 = NULL;( Q9 Q; C7 ]2 S) P. \5 M
- char *dmabufdest1 = NULL;$ F0 u$ J5 ?$ u( t- N7 } `
- char *dmabufdest2 = NULL;
) [9 ?( |# x1 m, h1 } v - z6 w2 B! s0 J
- static int acnt = 512;
( ?! f8 `2 B2 B, v - static int bcnt = 8;; u1 }4 D* [' w! i
- static int ccnt = 8;
: e! p' t3 I( n- t7 d/ v( B6 j
: B/ O5 c( w) B9 a8 m3 ?- module_param(acnt, int, S_IRUGO);# J* G9 p: t3 U2 |6 p
- module_param(bcnt, int, S_IRUGO);
/ j' B1 a4 F9 Q0 Y e - module_param(ccnt, int, S_IRUGO);
复制代码 4 {2 d1 f0 t6 z2 R; k
6 `& D; _3 J3 W$ R2 O# w
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 a# h$ }+ O! k0 z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 Q) D/ U' m6 z! R& z* D2 `* R 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ x! J( u/ X4 j* H& i1 `7 Q
9 P/ \% h w8 L% i6 o) B/ w' x7 T8 Z \' l5 A
|
|