|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& ~0 ^, u( Q" Z s+ j$ \% S R2 ]- [code]EDMA sample test application
( y; }( a. g7 Y2 H - /*
* W8 `0 r9 b1 D0 m: J! v3 E - * edma_test.c
* o3 `5 ~5 |" K* o" a. C! j - *1 P, e2 i6 _/ M
- * brief EDMA3 Test Application
( h0 J+ n: c8 S; z }4 x" G - *, d6 H9 i# z2 K% x
- * This file contains EDMA3 Test code.; A7 Z" P6 I4 J1 i( J7 W1 e
- *
. g- z- `0 t& d7 C - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
( p, M/ G, u5 Z% I - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- ^9 H2 Y) e$ I$ q3 s
- * TO CHANGE.) ]2 J$ w5 i5 o D9 p3 `5 j9 O9 i8 Q
- *
, u1 E" E! I9 Y) ]1 W9 U5 m - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! g0 `3 X( l8 A8 w- U' `" X% ~
- *+ B* z) k) z7 i- s
- * This program is free software; you can redistribute it and/or( @ |8 c( e& B& l0 j
- * modify it under the terms of the GNU General Public License as
% E+ `/ ]+ B0 P* w. m - * published by the Free Software Foundation version 2.
* M/ L9 p0 Y8 b# ~) m. E - *
# M7 m$ f. s3 n* ~ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any w) T/ p1 O( `( b
- * kind, whether express or implied; without even the implied warranty, a/ B- H+ a- D' K
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ |/ z/ J& |2 T; g7 {+ F- O8 O - * GNU General Public License for more details.
& T( z- t0 w! i) i1 h/ b8 x+ d! k - */
" f* y- K# A0 \! S2 x# \ - + d, z: k6 k8 X! B$ K- A
- #include <linux/module.h>
5 F1 J s+ [/ ]% ]: T D$ a - #include <linux/init.h>
' a+ p, P1 L6 I2 y) U - #include <linux/errno.h>; m+ W" n% W. L7 [( Y
- #include <linux/types.h>, P l3 X) h( i: K+ o1 k
- #include <linux/interrupt.h>) |% L. m7 k: n( o, U5 ~" i8 B' Y" N
- #include <asm/io.h>$ q- Y, M8 A' g3 x8 l/ b" ?
- #include <linux/moduleparam.h>
. {; r! C2 h# \3 P; P - #include <linux/sysctl.h>. W) a O! E0 c. T
- #include <linux/mm.h>2 Z5 d8 _8 ~# G( X# A. O
- #include <linux/dma-mapping.h>, U; n0 r" x% r% L8 T/ _( b
- + N6 k" J4 Q1 \/ I$ h
- #include <mach/memory.h>
0 G7 `( G3 `. R( c- S - #include <mach/hardware.h>7 t7 `) P+ {: i9 S( t
- #include <mach/irqs.h>
" U$ j, n: \* b2 g f - #include <asm/hardware/edma.h>
$ @4 V0 n3 J* L) U# z- S - 5 w! q' s* t7 F' d! U9 K
- #undef EDMA3_DEBUG
$ i- u" b4 F( z" X. \3 Q$ } - /*#define EDMA3_DEBUG*/
0 I( \7 A" t: d1 A6 x
. M: V4 T9 s) f) F- #ifdef EDMA3_DEBUG) Y. `+ P0 V; j
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
9 ?; L* h% L. G' F# k S# Q% D - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
) [$ b' ~" q$ ^6 W - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ U1 Q1 r7 i) ^0 l+ g# Q
- #else1 b1 k" {4 K) ]4 e
- #define DMA_PRINTK( x... )
i; p5 Q8 Q! _ b$ m - #define DMA_FN_IN6 ~% O* |7 v5 Q. v+ M( q
- #define DMA_FN_OUT
% x4 w, N" U `( w0 ~ - #endif
6 S' r+ ?. _) a! a5 c1 B' G
# X5 L# H% f4 l7 l/ T; _3 o2 i- #define MAX_DMA_TRANSFER_IN_BYTES (32768)# u- w" b2 c7 o6 I7 s/ P4 [2 ]
- #define STATIC_SHIFT 3
; p4 D5 c9 f6 I* |& n9 B% F) D% z) C8 ^ - #define TCINTEN_SHIFT 20" b" q4 E* P6 N: P; _! \
- #define ITCINTEN_SHIFT 21$ [; l' ]: Z) g
- #define TCCHEN_SHIFT 225 W% N7 f8 j! P
- #define ITCCHEN_SHIFT 23- y8 Y+ Q! T% L8 Y
/ c! A9 P6 ]% i4 R5 s# X2 c- static volatile int irqraised1 = 0; U6 V* j6 {0 \8 y" k! H( F3 L
- static volatile int irqraised2 = 0;
6 S' {2 c* H4 Y" q0 e! b1 P
/ L' ]# P) A4 v$ t2 `: `7 T7 ~; V3 q! l- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ R ]: D% O. ~# [ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ k2 m' u: ^' S - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 n2 I4 ~2 L& A% G3 S6 i
6 f) o& |5 a. N- k. K# Z- dma_addr_t dmaphyssrc1 = 0;5 S( l6 t2 v, l% b- d7 [( ~
- dma_addr_t dmaphyssrc2 = 0;
! Q- b- b. J( G% Q9 s, E+ D+ C - dma_addr_t dmaphysdest1 = 0;* O( R( M) C! @. W* i! z' {3 B
- dma_addr_t dmaphysdest2 = 0;0 {& @1 n3 p: ^) p! H& d
- 9 j1 D3 Q7 G# D, _' N, S5 W
- char *dmabufsrc1 = NULL;" n# T0 F' y9 u2 o I# h. i" h% x- A
- char *dmabufsrc2 = NULL;4 t0 ]2 J1 l, q# V6 j y3 c7 y
- char *dmabufdest1 = NULL;
1 h2 U0 e( ]+ e+ w! d9 k7 e2 F - char *dmabufdest2 = NULL;
/ M# j/ ^" [4 C - - S, `7 }/ k& Q% x
- static int acnt = 512;( W6 u( n0 }2 _. M, c7 E
- static int bcnt = 8; a; {& F: X! \# J& U; _* y
- static int ccnt = 8;
8 Y5 J* Y8 a* T+ [9 u* v3 H- l
5 [- _; G3 e5 g) A! A; o( i- module_param(acnt, int, S_IRUGO);: x/ L: F6 `0 W% X# c
- module_param(bcnt, int, S_IRUGO);3 _6 V: v! q) P- V/ v# V |1 v
- module_param(ccnt, int, S_IRUGO);
复制代码
* c; D& \1 \+ e3 r* O/ d7 {2 u2 ^& D. @2 C) b" b
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 @5 R# u( c3 S9 V; H
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ `8 d c9 X3 r0 i
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 M9 J. P+ G2 K& ?, y3 M$ `7 [5 C* U- |5 e
% `& U1 }8 z# `0 @" Y2 W |
|