|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; v" T5 U1 z! u1 w" n6 n n, M- [code]EDMA sample test application0 j$ _ k5 {% X- @) [3 f7 |
- /*
3 ]& { y+ r3 h5 J& h - * edma_test.c6 V; ]1 K t4 X4 e+ o! Y( v* `! O
- *& ?* R3 ?2 f7 g( U. P# c4 r
- * brief EDMA3 Test Application
( a# I$ x$ m. ?- ^3 h5 U: s - *7 K8 `& u: D" R% N+ t
- * This file contains EDMA3 Test code.
! O0 J- X8 d- T; T9 ?6 _0 I$ h0 C' R - *
/ y: S, F0 C3 N - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 h- @+ w5 V! n% c7 n& L: i: B+ z
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
1 A, ~ U$ K% b7 V, { - * TO CHANGE.
) _: A7 W# G( A* O5 h( G0 j - *
, y. H N3 [1 g7 c, ?9 T, b - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
2 Y+ G3 \- T! `& A: F/ A' C" {- X# c0 f - *
9 s. ]7 [+ h- |- { - * This program is free software; you can redistribute it and/or- g9 a6 y l8 D2 W2 K
- * modify it under the terms of the GNU General Public License as3 d# e: b0 \7 e- Q/ n& ]
- * published by the Free Software Foundation version 2.
! ]% {8 m) a( Z7 y l$ N - *- j. q% K4 V0 C
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any; x) O9 y- l! ~$ z3 V* W5 r
- * kind, whether express or implied; without even the implied warranty
6 b: ]; I3 P; p, u2 J7 B - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the3 G: x) Y& E: @+ I
- * GNU General Public License for more details.( V( [# n8 u2 W8 w4 _
- */. u* ?$ O# l; s/ E( {4 Z
- % c/ A# G2 s% q2 f. K9 e9 L
- #include <linux/module.h>3 M4 G9 [8 o; z1 w. y$ g
- #include <linux/init.h>
~/ Q0 v% H0 } - #include <linux/errno.h>
/ D5 P" M! N, B) i1 `. M' p3 R - #include <linux/types.h>
6 t" z# E' x9 { - #include <linux/interrupt.h>
; y4 Z9 ]. ^6 @1 J r2 ~ - #include <asm/io.h>" K, I7 m3 m; z! a
- #include <linux/moduleparam.h>
1 l. o E3 W; ?4 k) I- n* i1 P9 b - #include <linux/sysctl.h>1 o+ p' `4 o5 C: A T
- #include <linux/mm.h>
" N+ B" i9 J: r$ B. h - #include <linux/dma-mapping.h>/ }7 O1 T% ]) O6 o, Y7 I
- 8 E. S/ C( H4 I; _
- #include <mach/memory.h>8 X# w' L$ s6 ?
- #include <mach/hardware.h>
( {; x8 S( Q: Q$ s - #include <mach/irqs.h>
' M7 @# V- m) U- ?( E4 { - #include <asm/hardware/edma.h>9 d; w9 ]8 e2 _4 b6 r" x: v9 \
4 }9 C, p/ z% t9 l- #undef EDMA3_DEBUG
/ W3 a) _6 \) m* ?& b4 m( i! g - /*#define EDMA3_DEBUG*/ O) D2 t: x# Z- F1 I
- M8 B8 ?, X9 |# U' M6 G3 J# p- #ifdef EDMA3_DEBUG* X% s2 t4 m' w9 F5 B2 h) [
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
2 I) a+ Q5 C! C/ u. ^# s - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), Q/ U- c5 F$ q
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 f# a1 w+ Q- N8 y. D; u+ T7 a
- #else. |0 G- C+ e, P: G5 N
- #define DMA_PRINTK( x... )
+ w) ]8 B4 c, s# P( W6 w# v - #define DMA_FN_IN8 _5 @2 @8 M% x! }" s0 t4 w6 P) r
- #define DMA_FN_OUT
. _+ ~) ?* w7 ~8 z! _: o/ @" u6 z - #endif
" v$ I. O. c2 ~ - . k. A- }0 J4 Y t, h1 l4 b
- #define MAX_DMA_TRANSFER_IN_BYTES (32768): E+ r S9 A! |+ m; j
- #define STATIC_SHIFT 3
4 b l1 t$ L; z1 p" i" E6 t( K - #define TCINTEN_SHIFT 203 X; T7 w' S! E" J! W
- #define ITCINTEN_SHIFT 21
$ ?7 ` L( j) W, j, j! y - #define TCCHEN_SHIFT 22# U, c5 E# o+ i+ M$ O% ]. v) E1 ^5 N
- #define ITCCHEN_SHIFT 23; m) }4 @; Q4 N
4 U# C8 ~" B& q' f- static volatile int irqraised1 = 0;
; e2 V/ \- c5 d' r - static volatile int irqraised2 = 0;+ d% ]3 g' }1 y1 t: J% B0 z
, `. A) o# I! ]1 f- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( W! x* D2 @/ ]2 O - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, O9 i) z0 K. n- L ]0 Z
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( e+ S" S9 J' g
9 I5 B5 e2 {5 M7 w! Y2 G- dma_addr_t dmaphyssrc1 = 0;
i: A4 l; R! U# m; Z I - dma_addr_t dmaphyssrc2 = 0;
; f2 @+ L4 ^- V1 D; A - dma_addr_t dmaphysdest1 = 0;" N7 M i# ?+ {2 R
- dma_addr_t dmaphysdest2 = 0;7 R9 }& E2 V( s
- 3 W, h' t/ c* h8 B
- char *dmabufsrc1 = NULL;% a5 m5 `! @# X# o
- char *dmabufsrc2 = NULL;/ H% _4 {4 U$ r0 _
- char *dmabufdest1 = NULL;
7 r, ~- K+ O; C" I5 {: W - char *dmabufdest2 = NULL;
' J# T3 K7 [" K - 8 @/ q: M- v9 a. @' l8 s
- static int acnt = 512;
+ \) f0 b- f0 a9 c' g5 W5 X - static int bcnt = 8;
; D% n% s g5 O7 E - static int ccnt = 8;( c$ N( B' c3 l
- ! |2 t; W4 W: s9 X/ N- E! c9 a8 F* N$ d. k
- module_param(acnt, int, S_IRUGO);
/ g! p" n9 [" y" X& `( O - module_param(bcnt, int, S_IRUGO);% I( ~8 _4 L# k7 z) I. c
- module_param(ccnt, int, S_IRUGO);
复制代码
( ` ^4 t) ~; C3 y2 \3 a& e# \) ` g* J( |5 z
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 K! u% f A' ] H: y+ y- d
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
o5 n' v+ l* o- Z 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 V# k* |. m- T7 o2 ]
0 Z" p; o3 w$ m! W9 b3 R I0 ~, h
- K5 J7 V/ |* D. q }' H/ H5 R |
|