|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
0 R6 \. |4 {1 u4 Z. K8 {- [code]EDMA sample test application4 N- {$ F/ T0 m4 v" J/ X
- /*
8 U( o0 L2 k/ x1 k; `9 Y - * edma_test.c
, k0 |8 p3 v- [1 ?2 v; e - *" ?) }" Z; Z7 U+ s
- * brief EDMA3 Test Application1 ~* b! s$ G; p1 ^( e" r; T
- *+ c8 D2 [+ G. E# g5 [+ o% [
- * This file contains EDMA3 Test code.
' `5 K/ _& L- X$ d) ?6 v - *
8 Q5 V: y4 Y3 s4 V, |3 ~) W - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, @8 K& {3 A9 G* h3 g w% Q
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
! v. I) d, j3 i/ Z2 u$ ~ - * TO CHANGE.
0 h, b X/ i4 w - *
' Y0 d5 x6 ~$ W' ]! h0 C+ l - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" k) G* F$ E+ l
- *
# m8 w# a. w/ h+ ]! P - * This program is free software; you can redistribute it and/or8 M4 z+ J+ n" i, H, l
- * modify it under the terms of the GNU General Public License as
: q/ ~4 Q) w+ q. P) G e - * published by the Free Software Foundation version 2.
( f* L% K: J5 Q! n" Z - *
. c3 N/ y2 b, U - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
) V! h+ Y P6 X! y" M& X$ Z - * kind, whether express or implied; without even the implied warranty
- w& j# a8 l/ D+ V3 }) H - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the) w0 s- J$ y! |' x$ n
- * GNU General Public License for more details.
$ M/ j1 n$ K w' |7 R8 T, _8 H: f - */* u4 g( U, j8 R( u6 I
; p) f, ]& |: w- M! D: M- #include <linux/module.h>
# }4 d% z) o5 m - #include <linux/init.h>/ E2 c8 e) E' [! C H: u" c+ [0 W
- #include <linux/errno.h>
$ j7 C" E- O; }, ~ - #include <linux/types.h>
/ X/ k! D) l; a& X8 T - #include <linux/interrupt.h>7 N8 L3 O% |) S0 t( {0 b# X8 _
- #include <asm/io.h>" E' J" [8 w0 [3 U. n. W2 H! `
- #include <linux/moduleparam.h>
) B+ a' g. A1 z' z" @' U - #include <linux/sysctl.h>4 l/ I$ ]! x7 @* J8 I- m
- #include <linux/mm.h>
0 [8 V5 H. D* B, k" O - #include <linux/dma-mapping.h>3 w3 S- ^/ l9 o4 g4 f
5 T p2 F& Z8 T: |- #include <mach/memory.h>
% y7 e, C- X& w, u) J1 m4 E - #include <mach/hardware.h>
) F% Z- t# \+ q6 o5 F - #include <mach/irqs.h>
. l6 t1 ~; \0 s; \( `1 f - #include <asm/hardware/edma.h>
, e5 E$ ]! ?% G! G
$ K4 i8 I; \! p2 \9 Y- #undef EDMA3_DEBUG( a4 A" K2 W! x- }& m6 V
- /*#define EDMA3_DEBUG*/% z; c B7 m4 D, i
3 ]+ k b/ t. t- #ifdef EDMA3_DEBUG
! ]' a6 w1 y' q+ x# J - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). d, l9 ? I9 y) S. B1 O* e: l
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' m+ U8 |% v+ s8 N. H$ O* _
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! O& W9 T T- Y% n1 L+ Y* g4 `" W
- #else
. `" Z9 b$ u& G" j! J# g - #define DMA_PRINTK( x... )$ W, x! [8 o$ H# g' t
- #define DMA_FN_IN
; Z% K: O8 m* L) ^, B& \* A - #define DMA_FN_OUT
% R- h$ f. |. \6 M' W# E - #endif
! X: u# i5 R5 F2 X, ~& ~ - 4 a( d) }) J$ v: X. Y' O
- #define MAX_DMA_TRANSFER_IN_BYTES (32768); J4 K( J3 U; e( Q: l! C
- #define STATIC_SHIFT 3, c0 @' \. H) n
- #define TCINTEN_SHIFT 20: [: Y3 _$ i2 F; y# O5 f# J; g3 F
- #define ITCINTEN_SHIFT 217 D* o9 l4 n3 I8 {2 G1 c) T( X
- #define TCCHEN_SHIFT 22# A2 d ^. D$ n0 n j# m |
- #define ITCCHEN_SHIFT 23! M ? y& q0 |) n( X5 N" Q* Y- l
5 w0 x N% L* X, T' K4 a- static volatile int irqraised1 = 0;2 J" x) z( x: O% @9 O2 t% R; G
- static volatile int irqraised2 = 0;
, P! t) m$ L; t* V) B
0 S1 g9 R, |+ f- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- D, e. ~$ u0 I0 N+ S - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ B- o6 B3 g9 @7 c+ i+ W8 Y* s - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ W. n" M& |. b: @
& }$ ?. _6 ~0 G7 D: V- dma_addr_t dmaphyssrc1 = 0;
: Q! W7 Y7 Y( }+ z" a6 g - dma_addr_t dmaphyssrc2 = 0;5 T+ Q5 X3 j# K9 I6 f
- dma_addr_t dmaphysdest1 = 0;
9 _1 R' l3 m' Z/ N/ k - dma_addr_t dmaphysdest2 = 0;) k# G& V: v, f% f& ?1 m' i
- 3 } x0 Z8 F* j2 o3 g
- char *dmabufsrc1 = NULL;
: q2 B- q0 u" f - char *dmabufsrc2 = NULL;1 f% y* U9 i# {7 W# R2 C- T4 T; }
- char *dmabufdest1 = NULL;# a0 F1 H w' |5 @
- char *dmabufdest2 = NULL;
0 s9 t0 P6 C. Q2 G* U1 o% T
% a# ^& b8 K E' y& e# K/ q- static int acnt = 512;& K. y6 H- z! g; L. Z4 F" C
- static int bcnt = 8;- Z5 [+ u; L/ C+ a6 }2 [
- static int ccnt = 8;4 S3 X' u3 U2 }% @# k
- : [. Q" u" h$ h9 d4 G2 G* c% e
- module_param(acnt, int, S_IRUGO);
$ z& O, `! M0 B9 X3 }+ J& H - module_param(bcnt, int, S_IRUGO);8 d& d3 W/ l' [( X) i
- module_param(ccnt, int, S_IRUGO);
复制代码
' z& S* R" @ S6 X. O( b7 |# }3 P+ x* k0 @. W/ q0 _# `
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- X; k' r- r4 i; g0 X, G. 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ _$ M. j M5 L. r2 j7 b
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. Y U3 U# I, ~+ [
; e$ n7 b$ v8 `- B* g
) H9 D. U% k1 Q7 l' e" @, T/ X; L |
|