|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 v# u" B6 d- Y
- [code]EDMA sample test application; {) Y2 x) f5 E6 {
- /*7 M8 B2 `; d" f) y% K
- * edma_test.c
+ N' P8 R$ V4 x/ r& H% U) v - *" m, B( T5 Z5 s- V% h% O
- * brief EDMA3 Test Application
% e7 A) J( Q, g6 B! C% A% c - *8 j# ]: I8 ~) H1 ~* t! `1 C6 P
- * This file contains EDMA3 Test code.. O+ _) \1 t( s% p
- *
# U- X( \7 u3 R( p, ^$ \# a - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 g& ?; N' d: s; @
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 o' X$ a9 c' W0 ^# {
- * TO CHANGE.
( ~5 a/ l# Y6 o) M* t - *
7 {1 u7 w$ x8 Q9 A. f5 @ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& W9 U+ C" l; C" Q
- *
) r6 N. K; v6 a - * This program is free software; you can redistribute it and/or) U+ h' c/ F4 C2 q
- * modify it under the terms of the GNU General Public License as
) g: k" Q( U3 Y8 ]% |/ } - * published by the Free Software Foundation version 2.
! ]6 Z: u1 }6 Q: c w - *+ Q- Q, y0 l5 |, K, z! ]* D' |
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
6 R$ b+ c5 d( K |5 `) X - * kind, whether express or implied; without even the implied warranty A$ L' p; d8 o: D
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0 C- y& `0 B1 v6 e# I3 Z8 K4 G' Z - * GNU General Public License for more details.
# v% u1 D" x a/ R( g3 D5 R" x - */
+ U/ s0 L o- \# e0 o' _+ e' O - ' }1 [% C8 d0 [2 H% G+ F1 N V
- #include <linux/module.h>7 s# d! o- W/ T5 D
- #include <linux/init.h>
* Q4 J! A& m: s: E# Z* H/ H$ u - #include <linux/errno.h>
9 c7 `! Q L) ~! \ - #include <linux/types.h>% Z. L1 t4 k; t1 h2 V" v2 v; P
- #include <linux/interrupt.h>+ Z2 x( _' l( Z3 ?: K( Q4 H
- #include <asm/io.h>+ ^- ?1 c0 ^4 g: }( w3 ?
- #include <linux/moduleparam.h>6 ^# q) r2 V8 T/ M$ f8 J' V
- #include <linux/sysctl.h>
' p( A7 y$ S8 G b. } - #include <linux/mm.h>+ T% p# t3 W, M) L
- #include <linux/dma-mapping.h>% ~& u3 f/ E7 B4 [/ m4 a
- 8 k) x( e8 G a* ]: A8 ~
- #include <mach/memory.h>3 H/ b$ n$ J; O( P+ I: S
- #include <mach/hardware.h> A4 p' @: B3 B( k9 Y) H$ S
- #include <mach/irqs.h>
6 Z6 y6 h# I8 c! N' N1 p& @- U - #include <asm/hardware/edma.h>5 y. p) z9 D; p7 `( o
- . ]/ ?% ^* q8 O& Y3 c! Z0 {
- #undef EDMA3_DEBUG# D$ y: V B5 c& I! _9 J
- /*#define EDMA3_DEBUG*/
' l6 R9 S0 F4 z& C
! o5 N& z' ^9 m" d/ Q0 w- #ifdef EDMA3_DEBUG6 P3 {: l* M0 ^1 @& Q
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" J# {1 H, ?$ L3 @ f7 R
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
2 b9 Z9 O( S8 E7 O+ M - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
8 O3 ?* n' X3 D4 r - #else
$ S1 Z, P {1 p2 R - #define DMA_PRINTK( x... )
' P( F5 Y* y" `" d7 t, ` - #define DMA_FN_IN
# ^* S6 S+ Z# z$ n0 ` - #define DMA_FN_OUT
! z2 u" d8 t( ?: l( @ - #endif
4 r! k- D1 ]. h5 t6 H7 {; q
! G3 e% k9 F R! p- #define MAX_DMA_TRANSFER_IN_BYTES (32768)% t8 y$ M V. ~
- #define STATIC_SHIFT 38 l! s+ V0 \! c
- #define TCINTEN_SHIFT 205 t4 j+ E. ^! x% ~0 G
- #define ITCINTEN_SHIFT 21
) s4 ]) U% L% t1 g' e - #define TCCHEN_SHIFT 22- y! e4 T l3 {
- #define ITCCHEN_SHIFT 23
; z$ K) e: b6 ]4 c6 W1 z
" h* H+ v: [$ b" f- static volatile int irqraised1 = 0;
3 }) a8 V$ L: K% Q7 m) I# U) U4 ^2 S - static volatile int irqraised2 = 0;0 b8 L5 z4 m( z6 B" L' ~7 M% q
- ; F4 C2 d: ?/ f/ H% r. S) m
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ N3 ]: K) X" E7 _
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% ~' E6 E& ?5 @3 y
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 k: P; Q, J, G" l, ?
- " V! [7 F2 I: q. |& O( h
- dma_addr_t dmaphyssrc1 = 0;9 w8 m( O4 g( r; h. d. {
- dma_addr_t dmaphyssrc2 = 0;. B0 ^8 f6 B/ e/ E5 v
- dma_addr_t dmaphysdest1 = 0;& A. c9 Y# {$ N; a/ L
- dma_addr_t dmaphysdest2 = 0;
4 T! F3 A; A2 M% H( D
1 z0 ~; V! {, I1 U) g- char *dmabufsrc1 = NULL;- Q: R" q3 P& h
- char *dmabufsrc2 = NULL;4 a. t/ X3 R" l2 e. M' Q
- char *dmabufdest1 = NULL;
7 d$ c8 \ Q _. p7 `6 ^ - char *dmabufdest2 = NULL;
8 p3 w1 m- f2 n2 J. W' k3 h - # H6 J K' w/ g, Z. F2 x/ ]
- static int acnt = 512;
# R: M( l; q/ O/ x1 T7 q - static int bcnt = 8;) M: k8 R9 U# R6 u& ^
- static int ccnt = 8;5 _5 b H, F7 a u1 l
- i. ?8 Q3 Q6 `# |( J% F1 e
- module_param(acnt, int, S_IRUGO);
+ _( `' B' b! E w4 C - module_param(bcnt, int, S_IRUGO);3 u( _( K- \+ m
- module_param(ccnt, int, S_IRUGO);
复制代码
. S3 S- U6 ]( d' S, E$ Y& M
: s% L+ r1 |) g7 O/ T m 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
g9 |' D3 K( S% y$ a& h2 f. v1 u& Farm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 f# W# F0 [9 V- m5 W7 L
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 h; g A* D. m+ s" {. K% f% A+ k* g' O J' l9 y, x
- F! m9 \" B+ S2 S) | |
|