|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 Q# T' d) i. Z: y) B2 [, ~7 @- [code]EDMA sample test application
" \2 m" }$ m4 i2 O - /*) }9 p; X& ^: u
- * edma_test.c
( p4 ^; N+ Y9 x0 O* l - *
# Q3 f( V }; ^: C1 s) H - * brief EDMA3 Test Application
! ^' k/ P; w! g9 P - *
' \6 n4 q* _) V! T" P - * This file contains EDMA3 Test code.- N5 o4 K9 C4 k3 }1 i$ t+ }
- *. d. }5 H& `9 @/ \% _$ q
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) D U0 b8 h) q. h2 H
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
# |) u7 N4 A2 n' Z7 C2 a - * TO CHANGE.
4 ]' A w& ?+ i2 a - *2 O: I0 u- a* L8 q
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
% {/ W- H6 a; i+ o% X& E) t - *. }, S3 A1 T2 f& ?6 S/ F
- * This program is free software; you can redistribute it and/or% _, C8 w6 R' ~# a* v: Z
- * modify it under the terms of the GNU General Public License as
3 w$ E' L# ^5 c: w- v/ H8 }* m' { - * published by the Free Software Foundation version 2.
) S$ D) c% f$ Z g2 j - *
) S5 {( n# T% ]( l( M - * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 Z1 y/ f9 y i" o) L
- * kind, whether express or implied; without even the implied warranty8 Y9 ~2 E- A: G5 @4 D' G
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
' h1 x( Q$ c- K' [) I - * GNU General Public License for more details.3 L, Q( k4 \1 Y
- */
4 @# E9 s ^- p/ m1 f$ k$ r
- v3 d( P. g# w- #include <linux/module.h>6 j! W$ ~8 n3 R4 ~) j: |' R
- #include <linux/init.h>
# L. O# s" \- L: Y4 ]: t8 `7 [ - #include <linux/errno.h>& t1 Z1 ?& c9 v, C: H
- #include <linux/types.h>0 D, h7 z ?6 n, w: ~" M1 z
- #include <linux/interrupt.h>) G F2 }5 P( W/ _: B3 U
- #include <asm/io.h>
* {- W2 B1 @+ S - #include <linux/moduleparam.h>2 _3 e" _2 p N- l1 j2 d" f
- #include <linux/sysctl.h>
% }9 H0 `7 E' }: {' B' a - #include <linux/mm.h>
5 M# Z) g- Q. w3 U; A - #include <linux/dma-mapping.h>
8 b- G' t: B1 G- K7 y# `% n - - {: I2 U, q* `- j! q5 ?4 l& b
- #include <mach/memory.h>( {; H0 n }/ Y+ _! \# [& c% L
- #include <mach/hardware.h>% @2 ~# u0 P$ M9 ?9 s# c/ ?) Q5 }
- #include <mach/irqs.h>
2 U6 K3 X# r9 u8 D! O - #include <asm/hardware/edma.h>
0 U9 |+ s% W# x' d ` - 6 T! U9 M+ @' I2 t7 n" E- q) W2 X
- #undef EDMA3_DEBUG/ e4 a# k7 o) |. A
- /*#define EDMA3_DEBUG*/
0 i, H" s+ ~9 \
; L# } H' |' ^2 f- e1 ]8 ~- #ifdef EDMA3_DEBUG
2 M* b i5 ~ `' C4 [7 o - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
8 m& s4 G$ ^% X6 I- }8 D& ~) I2 e9 G - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
5 v/ g/ v9 q* K( j2 ~ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
3 E$ V/ }% K- D9 x7 o - #else k- |: h) u1 ~8 f6 l; H
- #define DMA_PRINTK( x... )
, f% `, X# F# n5 f; [/ d - #define DMA_FN_IN' d. Q% y7 t% h6 Y F
- #define DMA_FN_OUT
/ U) _( d0 y5 A. Y9 j; V' O - #endif, \0 F1 a8 _. ]: j
. x, m2 T9 H9 W3 @, b; \6 q- #define MAX_DMA_TRANSFER_IN_BYTES (32768)7 _4 c, E$ K( J: s4 I
- #define STATIC_SHIFT 3
6 B# w. r) m8 N1 I3 D - #define TCINTEN_SHIFT 20
- ]' l( ?& X' Q& N - #define ITCINTEN_SHIFT 21* u. n; E+ D5 q6 i' n2 ?, h) _0 ]
- #define TCCHEN_SHIFT 22
. I! W7 K% F# s$ A7 w) h9 t+ K - #define ITCCHEN_SHIFT 23 X6 S ^ K0 f3 ]( I
- - P6 q4 v' I- A( `5 m
- static volatile int irqraised1 = 0;8 k8 c0 r( n' w& |: g5 K! q" N
- static volatile int irqraised2 = 0;7 H c7 v) M% @! n0 ?! G
- 0 B1 Z3 L$ t3 p6 p8 }$ h
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ z$ }0 Y& |" ?: ~3 @/ b$ t
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- x1 `" A% [7 i; B - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 b# g; D& _; v! ]8 p - 6 f6 ~ q8 ^# @6 { d, w9 F
- dma_addr_t dmaphyssrc1 = 0;
$ v5 a# U: O5 Q - dma_addr_t dmaphyssrc2 = 0;
( c& r. t3 v w8 Y, ~( d1 W - dma_addr_t dmaphysdest1 = 0;$ o! J) d: R; c8 z1 J f) q$ D# J4 ^
- dma_addr_t dmaphysdest2 = 0;
& W$ M, E; F0 w: L. z9 R
( h- D: y6 u0 r+ x- char *dmabufsrc1 = NULL;* Q) y4 t& ?7 v$ u/ m
- char *dmabufsrc2 = NULL;( s& r) M |6 n4 [) o
- char *dmabufdest1 = NULL;
4 i9 A& k2 b: Y+ c& W - char *dmabufdest2 = NULL;
8 [& m0 G& l! ?( \) Y, L - + Z2 H& o' G6 n/ X
- static int acnt = 512;
0 E; _9 Q( h/ a' ?# ^, T - static int bcnt = 8;
. c% B; a; b0 y6 m% M - static int ccnt = 8;
& @/ G! O( m d0 |' | - / Y0 X6 Z+ m0 M8 L% P8 o
- module_param(acnt, int, S_IRUGO);
7 M7 y' c: M' c - module_param(bcnt, int, S_IRUGO);
1 n- N2 Z H: G( Z1 C* m$ M( I - module_param(ccnt, int, S_IRUGO);
复制代码 3 ^' y7 L: F: ]5 r' u+ I
8 V# Q, K y0 I: s6 ~ G 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 |5 ?2 X) \. T
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 a* \8 \8 ?# Y) h& z& k9 o 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* \1 Q9 Y- ~& c& Z# D9 H8 W6 v1 v: ^9 i0 l" p2 N8 h' P; V; c2 {- ^& X
, R9 T+ K4 t' D/ c |
|