|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 c9 K: {8 n+ k9 }5 p; _
- [code]EDMA sample test application
2 x- \, r% B, t - /*' c1 e8 P1 K0 Z( p% `9 d
- * edma_test.c* x; P' l' @0 N. m! e! t8 Y. I
- *
' c2 M1 ?6 C0 _; P- F - * brief EDMA3 Test Application8 e& w- ?) H1 U8 i
- *
. C' c6 b3 q, W5 C - * This file contains EDMA3 Test code., u, ]" G, C) w- v. z* _
- *' X( f* b7 \" K! T5 B+ d' s e
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
" S5 C, r9 ?! R0 f: ?) q - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
0 {( ^6 l- S; ?7 U1 w - * TO CHANGE.. L. S5 D1 T _8 o8 D# h4 u3 t
- *
5 D4 |3 {$ b: q* C - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 t7 A' W, {! G, z, e6 D
- *
" J; t0 _/ w3 `( ^8 k6 u5 f - * This program is free software; you can redistribute it and/or
4 n5 n; \2 M! r6 B - * modify it under the terms of the GNU General Public License as
: V% S: t }7 ^( k+ [4 B - * published by the Free Software Foundation version 2.
( C: x' T% O1 {* j5 N8 K - *
8 K! e! M3 J9 Z! v9 a - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
8 o: s6 @& j9 b" j2 h - * kind, whether express or implied; without even the implied warranty
1 d9 H6 [# M% ]& ~( Z - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the' f6 p' ^' C/ l$ l
- * GNU General Public License for more details.
4 |4 _ l3 N) e+ v+ u" V5 F - */
6 i/ H. G$ a- p y; c! X. G5 \ - $ q. P$ ^% a8 k( ]
- #include <linux/module.h>
# s/ a* D# y1 U$ r% Y - #include <linux/init.h>
0 f3 u4 c- Q" Z& b! _; m+ C - #include <linux/errno.h>
% f( b$ a0 k+ k b# X - #include <linux/types.h>" T8 a/ g s$ \2 r: H
- #include <linux/interrupt.h>6 f* D4 D4 v# P' J0 M+ N. z
- #include <asm/io.h>) j5 q; G$ L3 \5 Z
- #include <linux/moduleparam.h>
+ {4 ]0 u6 u2 l% X' I - #include <linux/sysctl.h>5 M. e/ K6 e/ o. ]* Q" T$ K% f# E1 B
- #include <linux/mm.h>
) M' F* }8 Z* c7 ^/ x/ }3 M - #include <linux/dma-mapping.h>
1 E8 m9 e1 M/ y - + M8 N5 q, w% ~$ X3 q
- #include <mach/memory.h>
' T" L9 ~, P3 \! M" j8 b - #include <mach/hardware.h>
6 l* i7 Z% m+ T; Z - #include <mach/irqs.h>
' K) [! o; W3 I4 {9 E' v - #include <asm/hardware/edma.h>3 G$ a4 c6 H' I% ]
- * f# j: r/ `( o* r8 q1 ]$ p3 r. w
- #undef EDMA3_DEBUG
( v- T: j" D: ?5 q- S - /*#define EDMA3_DEBUG*/) G5 _* s; Q1 n7 l5 z
$ _, R( ?5 T4 O, Y& i- #ifdef EDMA3_DEBUG; m9 |) k/ I0 z5 E( n: a* A% Z
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
; ]- ~8 x) {: z4 z, J& B - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ I4 ]6 @' x- s- H
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* J8 f4 h) Z+ ?
- #else) d r M. c" \# g
- #define DMA_PRINTK( x... )
- g- q; F, h+ H' M - #define DMA_FN_IN$ f' \/ d4 c9 R; V5 w
- #define DMA_FN_OUT. }" D! o4 g# K5 v4 D* Z
- #endif8 \1 [% T' a" m$ O( e* T
- 5 D s( r. y/ c" z {2 W% E4 M
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)+ q, @, L( T3 V) l; J
- #define STATIC_SHIFT 3" x3 I4 o. E% p
- #define TCINTEN_SHIFT 20
3 b. O: E! D7 F' A& z0 y; g - #define ITCINTEN_SHIFT 21# H/ s+ d3 f* H$ T* n1 m
- #define TCCHEN_SHIFT 228 G0 y% y# D* z+ y0 G8 p; r
- #define ITCCHEN_SHIFT 23
8 M6 B. Q9 ]' G# G# n - * y) V* }' Q Z8 X* D
- static volatile int irqraised1 = 0;! f. U: {1 l, N' T4 }: a! ?9 I! D
- static volatile int irqraised2 = 0;: w+ z+ q: N8 l$ N7 m
- ' K0 e2 H* s$ d# W
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; t- N0 g' ?# {/ K3 O - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 p3 X! h$ s/ {7 O- C- Y ~) G - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ W N- @( `6 Y
) \) D; E) h) g: W$ Z- dma_addr_t dmaphyssrc1 = 0;
1 K2 l+ J! K; p9 L, G- j3 e0 i - dma_addr_t dmaphyssrc2 = 0;
" d% ]$ a) Z7 A+ U* T! q5 a - dma_addr_t dmaphysdest1 = 0;
4 j2 }9 L0 P' [* D - dma_addr_t dmaphysdest2 = 0;( Z! Z' C$ |; `# F' f/ r1 d3 p
7 x4 h* _' D- ?8 z& t- char *dmabufsrc1 = NULL;# C0 c) i; @# ?( @! U
- char *dmabufsrc2 = NULL;* B4 l2 s: k) ^: ]& J( x6 G
- char *dmabufdest1 = NULL;
( m+ Z& K- i+ `" L) G! z5 z$ @ - char *dmabufdest2 = NULL;
' O" u6 b. ?% h2 C9 ]! @9 Z3 k- y
' l* n' R+ z, M1 q3 ?5 l- static int acnt = 512;& z' U I! w+ _5 V# k5 T
- static int bcnt = 8;( E& ?, \# K) }/ S2 {; L0 |6 ]) R
- static int ccnt = 8;
' U, D- B# F1 l" V' q9 ` - 6 s: M4 f8 `( k- Z. Y9 u( e( I2 e
- module_param(acnt, int, S_IRUGO);
1 o S8 f! D0 Q! Z. F$ y( i - module_param(bcnt, int, S_IRUGO);7 z0 z7 N5 D* w# [1 L; g
- module_param(ccnt, int, S_IRUGO);
复制代码
( s% n8 y: T, _- x) ~* c
0 ?5 h F# L: V/ w# o2 g9 L 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) L5 k9 k5 L4 x) J! l7 q/ t6 k
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 Y& W9 |( F, ~6 Y6 w, ? 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 s( p! K& _" G! c, H( T) d
& v, Y9 S+ }4 }% _9 J o
7 ^0 u( K9 \& E$ R& f |
|