|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 M2 _) J6 l6 Q$ R: p# n- \( X9 j- [code]EDMA sample test application3 N" b( R0 B$ v! Z
- /*
( j& H! z0 M+ r+ n/ R8 p - * edma_test.c
! r3 \6 S6 ]2 t' t6 p - *1 f6 L6 r' _3 J$ N# w
- * brief EDMA3 Test Application
/ `1 A5 Z( p9 t% w* [! e9 | - *
9 s: v1 H/ V% e - * This file contains EDMA3 Test code.8 n. e% q D# w4 e8 ]
- ** z! J* ^6 U# G/ S
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 X5 T' X+ N/ L$ ]; L, U
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' y& G6 n7 j4 D& K* x
- * TO CHANGE.4 Q9 T4 G1 m8 d. [8 q
- *
Y2 O; M: X2 {; h( I - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
1 Q( o# z! r! s3 R - *" X* b8 s5 `% H! B A* U
- * This program is free software; you can redistribute it and/or2 A6 l$ X# X- Q
- * modify it under the terms of the GNU General Public License as
l7 L! o' Y$ T6 }1 L: O h& ~ - * published by the Free Software Foundation version 2.
# o/ O3 \8 P6 ~! l( H - *# C' I9 {* w, U8 P" }
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
- g: [; Y1 M# [ - * kind, whether express or implied; without even the implied warranty7 p: b* J, y N5 p5 O$ m
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the: A- k1 b- N- x0 ?. m7 O1 |! _
- * GNU General Public License for more details.
- {- J( P1 v' K- j0 _ - */
D: S7 M8 Y! a5 X' T. o ` - 3 @- T% w/ {" B* q) _
- #include <linux/module.h>& K1 ], f) w' {$ b5 t. Y2 J
- #include <linux/init.h>
6 _3 G$ c- ~( d( z" |1 D - #include <linux/errno.h>
/ S3 I' V' G; P! j0 _4 J - #include <linux/types.h>
4 c4 D. K/ G+ ~. v, k. b, @. ~ - #include <linux/interrupt.h>
y9 m; o V4 `1 D) [ - #include <asm/io.h>' e+ B$ j( A2 Y: e
- #include <linux/moduleparam.h>
; L& o9 G% C J( x0 M - #include <linux/sysctl.h>
! a& j5 S6 d" r; u( R, l - #include <linux/mm.h>0 A* y e8 ^! A8 {; o
- #include <linux/dma-mapping.h>8 T: ?* U2 B2 p' f2 u+ b* e
- 9 d! i0 y& Y7 v5 L
- #include <mach/memory.h>* S1 v3 |- F9 u: q
- #include <mach/hardware.h>1 z' b) O8 g* p0 B
- #include <mach/irqs.h>
% F, J: f" L1 \* T - #include <asm/hardware/edma.h>( I" J7 m# H% y, ]3 N
- & U$ `( G2 {4 p
- #undef EDMA3_DEBUG
% y& u% v! Q7 Z, e - /*#define EDMA3_DEBUG*/
! F# X, G# G; h% D* ~ {6 m
" H6 B i' ?! T) E- #ifdef EDMA3_DEBUG8 x$ O# _( v- |: X; O0 [, R
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
9 c7 w3 N' w D& C& K) \" Z - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__) @! J/ s! d8 W6 W" ]
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ k# \1 ~, |; I$ a
- #else" n8 L, U7 q) C# w
- #define DMA_PRINTK( x... )
5 I( I4 t0 l6 Z( ?' | - #define DMA_FN_IN* v5 B3 d. L! D/ b
- #define DMA_FN_OUT$ c( c- Z- v# p6 s8 f/ v5 ]
- #endif( \) \3 q5 \# x# f. O- ~" W; k! J8 _8 |
- # Y: G! _# Z/ E
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
) l9 L* q5 o$ T8 C) e2 s. t - #define STATIC_SHIFT 3
; Q {( ^: p0 e; | - #define TCINTEN_SHIFT 20( K2 I. V3 ^( _, F
- #define ITCINTEN_SHIFT 219 G$ G7 g/ L9 f, p( k. k+ d
- #define TCCHEN_SHIFT 22
2 P/ P7 w( o$ b( q) G& u! V - #define ITCCHEN_SHIFT 23
* d0 A) _! R9 _ l - 5 s3 v4 o2 g, ]9 w. a2 f+ R
- static volatile int irqraised1 = 0;
' U) Q! P6 n0 _: n& w4 `+ O+ c5 `3 F - static volatile int irqraised2 = 0;
; o' t; P8 u: t/ @& E$ O1 F( j# M - 7 E4 [# G$ W) C7 M' S
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 u5 X6 `- o4 I( s: m1 O5 L& e
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 A* V7 x9 ~' h; N! O; ]/ |+ n% m
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 v2 L4 c# k5 X4 @% v7 Z
( j( i A3 T+ c; m; C7 @/ a+ S9 v- dma_addr_t dmaphyssrc1 = 0;2 k, _- f# C# o4 J z* {, ]/ ?
- dma_addr_t dmaphyssrc2 = 0;. G7 `2 ]# {3 P
- dma_addr_t dmaphysdest1 = 0;! D v! o( Z" X+ ?- R4 b# P+ d
- dma_addr_t dmaphysdest2 = 0;
4 A$ V9 ]6 m+ w/ M4 i9 T1 V9 I
6 u4 L* N( F* R2 V0 ? r/ U9 E- char *dmabufsrc1 = NULL;% q; U' i1 j; W4 b, y( t
- char *dmabufsrc2 = NULL;4 v" i7 O5 m2 R @
- char *dmabufdest1 = NULL;
: w7 x& M0 m. Y9 S* \ - char *dmabufdest2 = NULL;
C, V% U1 J) n: \: m - ) n/ }$ n; |+ \, c2 X
- static int acnt = 512;0 E4 w8 Y# D3 x. _5 @9 O
- static int bcnt = 8;/ ~: V* k/ i/ o( Y1 S
- static int ccnt = 8;
9 g* H+ y) h" W( q6 T3 k
2 y& y- K5 o- X4 y' i: t B- module_param(acnt, int, S_IRUGO);
) {' p6 K+ b. J. w) `$ m - module_param(bcnt, int, S_IRUGO);1 k' v- w) L9 [& A! x' G
- module_param(ccnt, int, S_IRUGO);
复制代码
5 R$ r& c; O9 D5 @" ]
2 ^* B8 P4 G8 g 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 J+ w, n: @8 z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 O# M; N# i! o6 |4 l1 n
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" N, d! x1 v" W( {( _* ~0 U! u a- c# W% a5 |! I
6 x. d1 L, ?) w: T0 G) D
|
|