|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% N- V/ q# @9 |: e; j8 x- [code]EDMA sample test application
; }& t1 z, U! V! Q- X - /*
9 ^) H& _, r3 [+ K1 @) t& l4 N - * edma_test.c" O, x- _6 s8 q4 {' a& f
- *
5 o0 c! h) S2 y! _! o, ~3 | - * brief EDMA3 Test Application
: I' v1 P c5 M# e - *
( n1 N9 J n8 } - * This file contains EDMA3 Test code.' z V0 s, B+ A
- *7 l0 g6 g! E$ f' k
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% t s5 n/ Z1 P; U) y( Y6 g0 ^
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: W$ R8 o" X) n0 p5 s4 r
- * TO CHANGE.2 h* R9 W6 N3 N' q4 K% f
- *0 s! Z) N9 [. s; H! x" V
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 ?6 Z' y; h3 P/ u" p( I
- *9 ~+ U! `, ~# l8 H: r! {
- * This program is free software; you can redistribute it and/or1 {- p9 b9 P ~0 k( Z& H" U" T0 F$ d
- * modify it under the terms of the GNU General Public License as
6 C6 i8 n! L. X! K - * published by the Free Software Foundation version 2.
6 B" }' W% p6 A, ? - *2 h# |. L4 {2 @
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any [, f9 d1 }% \2 O
- * kind, whether express or implied; without even the implied warranty
; M! V! Y7 H' l# n6 T3 ?$ S& _ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the8 H) ^& N3 \! V5 h& P
- * GNU General Public License for more details.; @. o8 ]! R1 ^' a
- */; Q; }* j& t( i+ L$ ]
- ! v& [2 C3 ?9 P' E9 M
- #include <linux/module.h>
4 C4 y/ P9 X+ A% A1 r8 o - #include <linux/init.h>
; {# F0 M+ j) F5 ~$ P1 \7 @ - #include <linux/errno.h>
+ }: T7 }' ]. v) _ - #include <linux/types.h>
2 T3 Z+ E+ F8 [ - #include <linux/interrupt.h>
3 o6 @8 F/ V% _9 i$ x4 | - #include <asm/io.h>
1 m1 `2 C6 s! R, ~8 E - #include <linux/moduleparam.h>
1 @/ v+ u1 J4 {( K* X - #include <linux/sysctl.h>
5 m/ D! l# v$ {1 Q. j/ a* i - #include <linux/mm.h>& r! k7 c1 A& o- r; ]
- #include <linux/dma-mapping.h>+ q4 ^' @0 X: B: f: z3 V
- 2 s3 V0 S6 F4 u2 a5 `6 K6 ~4 d
- #include <mach/memory.h>6 K* S9 \ N( R2 M/ F# ^" W
- #include <mach/hardware.h>
5 }* g X4 z1 k - #include <mach/irqs.h>* m$ p2 J3 W, _$ D" [
- #include <asm/hardware/edma.h>2 [$ G, m6 k" C7 x3 s* T
% u: _! {8 [ b* _/ Q/ n. K( y- #undef EDMA3_DEBUG- x9 S8 L7 Z( C$ @/ F' N- w
- /*#define EDMA3_DEBUG*/
; ^6 r+ W: D* x - % @( e% _ s5 m' a
- #ifdef EDMA3_DEBUG ^; G U C9 c* k( C; p3 G
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 T$ R1 v/ b. U' i4 g7 o
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) e6 ?; ]5 q) ?4 y1 ]4 d
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
" K% D6 c4 K5 u" B2 | - #else- g2 W6 M1 d O8 D2 n
- #define DMA_PRINTK( x... )
$ H4 C, ?4 I+ {' ?; e - #define DMA_FN_IN/ G$ E' O$ [' G2 m! ~( _
- #define DMA_FN_OUT) G6 I! t! b9 Y. x
- #endif' k8 i( A: W8 D/ u! l* N$ U/ f0 \
- / S8 i3 x) `5 d- L" @4 M
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)1 [) i! w* x; S
- #define STATIC_SHIFT 3/ i& m. q2 L7 |' _* b+ w
- #define TCINTEN_SHIFT 20$ F* O& S; j6 y1 X5 S
- #define ITCINTEN_SHIFT 21
0 M0 V k, g! y/ S7 a# p0 C - #define TCCHEN_SHIFT 22
+ e2 U& ?8 G9 | - #define ITCCHEN_SHIFT 23
6 U" O0 q# S* b- J: |9 |; g - % U! h" O. v1 ]: g, d
- static volatile int irqraised1 = 0;
+ p- X% y$ S% K* T# b$ ^- a - static volatile int irqraised2 = 0;, W. P- Y: C: T: y; i3 k$ T: y. o7 ~. c
' |5 Q' z# l, h* `. s( E2 E- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 ]2 w. ?' B0 F+ Y: g2 [ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! _. _& k0 g/ W
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 l' s! G% F# N6 t% _
6 p& ?( I4 }( n$ Z2 r" C4 Y4 D, T+ I- dma_addr_t dmaphyssrc1 = 0;. L* k$ y, X; q+ s) O1 Y3 z9 T ?
- dma_addr_t dmaphyssrc2 = 0;
9 F$ V! I" p9 g2 x6 u; i3 L9 [ - dma_addr_t dmaphysdest1 = 0;( I6 R: t, v. i) v6 X7 t
- dma_addr_t dmaphysdest2 = 0;% z2 W# W8 r, z. d1 J* M
- / {- A4 a/ S2 O2 D' |
- char *dmabufsrc1 = NULL;% z8 R. Z# A9 z* V7 g# f
- char *dmabufsrc2 = NULL;5 \1 M. f8 Z w* d: o
- char *dmabufdest1 = NULL;! E* J3 I5 g6 P! x. g; c6 s
- char *dmabufdest2 = NULL;
4 M I3 R6 ^" c$ H
# M# Z7 m8 e ^3 Y- static int acnt = 512;
/ }3 y6 W. N3 J - static int bcnt = 8;; |1 p6 f5 d" ^: }& x* r
- static int ccnt = 8;
) G2 y2 h1 L- f; g - ! q0 {( k: Y/ \3 V
- module_param(acnt, int, S_IRUGO);. J1 {, t9 d& I3 j6 r; v% a
- module_param(bcnt, int, S_IRUGO);9 c! K2 `; D) T. m* `8 L* [
- module_param(ccnt, int, S_IRUGO);
复制代码 2 ^; c: O1 t7 p. T
I$ T, s e# t) {+ w% Z U. M 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% E j4 S( h4 c! E' ^ P
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: p; A" U& C( P
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 _/ E9 y3 K& \' p- i, N5 |" `
6 G. O; G9 Y7 E3 U+ a* M
: |" B3 O- Q1 ?- B2 O( `* s+ } k% w |
|