|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 _1 r6 e c& Q# }- l k
- [code]EDMA sample test application/ s3 j' i6 o, B: v
- /*. w4 w& x- R, s4 E, ]! O. ]# ~* l H
- * edma_test.c
1 c6 n. {$ d# R, u9 B, i4 i - *. e& @1 w3 T) R9 a; D3 j3 E9 V
- * brief EDMA3 Test Application1 u4 W! U# ~" _
- *. r( p, L0 ]; i5 y' h; K" K t
- * This file contains EDMA3 Test code.
) p' m6 b- M7 p8 \5 | - *
% g. K+ ?8 z1 U; a( b1 S - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
1 U" ?' ?+ Z8 M, {. [ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
# f m: s/ k7 E) O! x! w - * TO CHANGE.
3 A/ y1 {" d, G1 F. A - *& F. y, @! W2 |/ v; `
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
/ U/ C) ?3 z% Y - *4 P2 f- L2 z! u
- * This program is free software; you can redistribute it and/or
2 u4 t& F( j$ A9 ^ - * modify it under the terms of the GNU General Public License as
- f8 Z% r! v: O( D6 l: C* V! c) n - * published by the Free Software Foundation version 2./ C8 @9 |8 I$ u. W4 g1 g
- *
( \( l" ^6 B! _ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any; E9 I% g7 W+ T0 k* x5 }, g
- * kind, whether express or implied; without even the implied warranty
& s. d5 K7 `+ @/ k5 K/ H/ M; h- e - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the( f9 s3 n, l; s& i
- * GNU General Public License for more details.
* W1 @0 r" G |/ B( I7 t - */
6 d3 K9 f+ Q7 F. p
6 ^# v- H8 T7 x" h$ V/ Z& o- #include <linux/module.h>' c g p: e" g g8 P
- #include <linux/init.h>3 d# D. a0 q) x6 E
- #include <linux/errno.h>' Q8 o: I- C/ S, y! |
- #include <linux/types.h>
2 \: x7 n/ t9 [' D, ` - #include <linux/interrupt.h>
8 W' c7 R6 u5 D5 H( S - #include <asm/io.h>; z) W8 O4 \* F+ L1 R
- #include <linux/moduleparam.h>
5 f% P, C8 f! I C9 ^+ }* L - #include <linux/sysctl.h>
" m% t: }- ~' T! W- N3 c - #include <linux/mm.h>
! O$ s4 h P6 F" I1 D- B4 ?; J, k - #include <linux/dma-mapping.h>
$ B b; e+ [' K9 ^7 B
4 u$ k6 | I9 J! _1 r- #include <mach/memory.h>5 K7 I- s- f, l5 H$ U; w' Y
- #include <mach/hardware.h>
+ D2 V4 W6 N ]9 u! h) d' \! Z - #include <mach/irqs.h>
: K( f) N, b. k; E$ u# h+ Z! }1 Z - #include <asm/hardware/edma.h>
! F4 `1 }; F( L* K# c4 J, N - 8 D" p. S, z1 Y6 E4 j% }' E
- #undef EDMA3_DEBUG
5 D( N( k4 {2 X; t: C: e; q: @ - /*#define EDMA3_DEBUG*/" v' K2 a, t' P: k \. W
0 V7 [. ]7 |6 w0 q7 Q4 L' O- #ifdef EDMA3_DEBUG. }: p( Z- L4 i# Q* C% F
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); n @% K8 {/ w0 L" X' B, W
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 m3 Z5 _* k2 w6 N1 w# ]
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
2 x: Z: @. t# q - #else! w' |4 @ b3 @ H" |* @
- #define DMA_PRINTK( x... )' d5 P4 n8 \( ~8 K0 @
- #define DMA_FN_IN
' E6 e9 C W+ u6 G# j$ @" e p - #define DMA_FN_OUT
$ y& H. P! x) \9 ` - #endif9 r3 V/ m, [ ]3 i
. V2 S+ \" s5 o- #define MAX_DMA_TRANSFER_IN_BYTES (32768)0 g" v3 ?, _ f n
- #define STATIC_SHIFT 3' A/ M1 b- u* j" M/ n; m
- #define TCINTEN_SHIFT 205 Q) I u: s' Z% }( T
- #define ITCINTEN_SHIFT 21
$ ]1 m7 w; K# o( ^4 q' f - #define TCCHEN_SHIFT 22) r# |! f7 L0 F% r, X0 [1 ]% ~
- #define ITCCHEN_SHIFT 23
( G B9 _' Z! i, L0 T F- t
( n9 R4 H4 x; I2 k. R- static volatile int irqraised1 = 0;0 ~6 \2 ?1 ?# n7 F, e
- static volatile int irqraised2 = 0;0 E c3 a* @$ m& |* n2 |
- * x! D+ Y5 O/ t
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ W: d/ v# [( D/ o - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, R+ _6 z# {; T- M* t* u - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ M: V1 |, [; H8 |
/ |5 c/ ]' S- A ]6 q/ k- dma_addr_t dmaphyssrc1 = 0;; P2 E8 n/ j5 F. R/ A
- dma_addr_t dmaphyssrc2 = 0;5 M& `7 T: p! C
- dma_addr_t dmaphysdest1 = 0;
' ^3 c7 M% w4 T8 a+ k& [7 w7 l8 K - dma_addr_t dmaphysdest2 = 0;- G1 P! n2 U5 N" F4 O4 K; c
$ G- V: H/ g8 m1 d6 P- char *dmabufsrc1 = NULL;5 |# |3 @) C7 B' I
- char *dmabufsrc2 = NULL;
/ Y0 B8 h4 u* P1 x( K - char *dmabufdest1 = NULL;
, L4 N5 O& Y, X& d1 q x - char *dmabufdest2 = NULL;1 m8 [! g5 b8 n4 J4 k: F
6 }# \6 _/ h* B- static int acnt = 512;* E7 F7 l! T* @
- static int bcnt = 8;$ H1 [( }- F; n( F3 l6 J. h# H
- static int ccnt = 8;, K3 w8 S% d7 x
. s- S2 O/ b: Y9 a. C$ ^( \- module_param(acnt, int, S_IRUGO);5 D6 }/ s i5 k
- module_param(bcnt, int, S_IRUGO);
4 B( I% E+ j, ]& M8 a - module_param(ccnt, int, S_IRUGO);
复制代码
L3 ~0 y" _# q6 m! u+ @ A) j: K i+ K) C; s( g) H
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* f& ?( \5 } C: l" v" U. G8 }/ ?2 W
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 D5 S& L, N3 L g
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; R6 [/ }+ K& [+ i; } x0 m& L. b* i6 C/ c; D) X4 y2 m% x
7 e: e- ~; s' {* I& D |
|