|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# W# h, |6 n% e2 t9 H, s0 x! V- [code]EDMA sample test application6 h7 l1 t, @, p( f" X
- /*+ f+ W( }0 d s$ P
- * edma_test.c
g' X( M- g3 V0 X: H: z! [ - *: ^' [. `) d+ N5 l' M/ E6 N4 h
- * brief EDMA3 Test Application
. U6 C: C% _% ^7 w* s - *
9 R0 }* ? G5 z8 A/ X - * This file contains EDMA3 Test code.
5 B8 _4 f$ a! J* O; J: C3 { - *2 _5 |8 e" ` c
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
Q, T3 c; C) [" S- x+ R - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
7 J9 y! N1 c" N6 E x; ^ - * TO CHANGE.0 f: W$ p- k: y6 @* C1 e, z
- *1 U# d& M7 e- [/ \- D( G
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 ~9 j9 S/ v& [! K1 Z: z
- *
9 O" J& w4 U( |7 D1 L8 S) T& w# e - * This program is free software; you can redistribute it and/or' L+ \+ v: u! h5 x
- * modify it under the terms of the GNU General Public License as" U0 \9 e1 ]4 Y7 ]9 q" ]1 Z. y5 f7 P0 h
- * published by the Free Software Foundation version 2.( k z: T# O/ t ~. P
- *
, G v. I0 U9 Y2 S" r9 \# e - * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 E/ h! E6 c4 T4 w/ m
- * kind, whether express or implied; without even the implied warranty, l4 `, G# ~+ V2 ?- X; _, W( e
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the' t7 ` A) u1 t. o
- * GNU General Public License for more details., d+ t2 S @: |% |- H
- */. G7 Z" B7 P# ^& q" C& t( j! N
- % Q' m0 w( G+ X; t
- #include <linux/module.h>
3 a8 p* l! u$ ] |* Z, ^, f8 x( a - #include <linux/init.h>
1 ]7 }8 q8 A: n( L: q- M7 k, a - #include <linux/errno.h>+ Z. Y1 h8 O2 K& y6 s
- #include <linux/types.h>
! E1 d1 Y' \- \1 y, [3 k1 j - #include <linux/interrupt.h>
! N5 k& Y: I* o! U0 c- O/ S - #include <asm/io.h>9 `/ D4 J K/ M4 U$ T" F5 j
- #include <linux/moduleparam.h>0 A9 S1 K7 q# x+ ]3 Q2 K
- #include <linux/sysctl.h>
: ^# Z+ L1 y' S, |+ Y' O2 T2 {+ ` - #include <linux/mm.h>
" g7 i5 r$ z b( U @- [% y4 w - #include <linux/dma-mapping.h>
8 T* N i* L" A - ( K( l. }% w% f9 A
- #include <mach/memory.h>
0 [) j* y, |; u" `, j+ \ - #include <mach/hardware.h>
/ O' }- t8 e, e. r# c6 U - #include <mach/irqs.h>0 Y4 P9 v' f3 J* S0 g
- #include <asm/hardware/edma.h>
$ X0 P: n# G4 t+ p1 Q3 O5 T1 ? - 4 r0 M# S$ M3 h- L" h
- #undef EDMA3_DEBUG
# O# }( x' D* Q3 Z0 f - /*#define EDMA3_DEBUG*/
$ c+ ]$ X3 N% ]% r; D/ ~ - + O# k: s* P) q% M! f2 G$ U
- #ifdef EDMA3_DEBUG& p; i7 W$ g& I2 d) O1 O! k
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
3 o: [! Z* Y. n4 k: B. Y - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
1 G2 O1 I# Z8 @ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
) g& d$ K$ ^8 P4 q: ^; c4 i# { - #else. I2 w+ M: `* V
- #define DMA_PRINTK( x... )
1 G( N% U# [4 k) C5 O - #define DMA_FN_IN. T, Q0 u N1 |' M: v$ g7 J
- #define DMA_FN_OUT
: H( {7 B; ]) v9 o9 k9 F - #endif
; _9 M* ]1 a$ w8 U7 j
4 ^( w: T: g( J( P7 n- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
: w$ l* ^7 C6 A3 ~ - #define STATIC_SHIFT 3
& b7 G8 m) U5 k" Z - #define TCINTEN_SHIFT 20
* V2 Y5 R/ i# Z+ P! k9 i - #define ITCINTEN_SHIFT 216 `8 M' A+ k# s4 \
- #define TCCHEN_SHIFT 22# _0 [9 `0 ]" ^
- #define ITCCHEN_SHIFT 23- Y7 a5 I( }8 f, H- ]5 o, }
- ; P% V) y" i/ i8 [2 z: P* U
- static volatile int irqraised1 = 0;/ m6 t- m4 S2 r& j) V
- static volatile int irqraised2 = 0;/ {- a+ v5 i, I$ ^# m, Q
9 [5 c& Z1 K' R6 |- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. x" E5 H/ |* U6 R5 }
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 ^1 @& @' P5 d0 C/ h - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); g- |4 o: B$ [$ j& j3 ^& e
- 0 [/ \9 k& B+ R5 s" H
- dma_addr_t dmaphyssrc1 = 0;
: M& V6 S. ^/ p) E" l3 F - dma_addr_t dmaphyssrc2 = 0;
- R4 n+ J6 N, y# H - dma_addr_t dmaphysdest1 = 0;# U) M& V; G# K3 t5 N& M/ I
- dma_addr_t dmaphysdest2 = 0;. m6 a. K5 x9 A' \8 j' N L- t
2 O$ p. x" [) ?! c+ n- char *dmabufsrc1 = NULL;& j) x8 q8 c( _4 B* v
- char *dmabufsrc2 = NULL;
1 I) y0 E+ w, H - char *dmabufdest1 = NULL;
" j) d5 y# N3 A) \+ [5 J - char *dmabufdest2 = NULL;
^! u1 s' d, G y5 [
$ V# U+ v. Z: v8 Z- static int acnt = 512;) O! l& X7 Y6 |9 _0 W3 i7 H! y
- static int bcnt = 8;! J! L# q* @4 z: E' {- I' e: h9 V( d
- static int ccnt = 8;/ h9 L7 w) q2 s; M7 ]
+ i4 ~( z& y+ F2 F- module_param(acnt, int, S_IRUGO);
$ n, u8 w0 e* B: n0 v, H - module_param(bcnt, int, S_IRUGO);
& T) ^5 N. K! O! ?- R( k - module_param(ccnt, int, S_IRUGO);
复制代码
* ]2 ?7 b/ Z; U$ R
+ Z+ d& L8 t2 z6 o! T! h; M H 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ j6 p+ g6 a' r( I, J& 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" w/ a7 J/ X0 W+ v: L5 Q; o% _
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* v% o0 ]: \! A3 I
7 j3 R- @4 G: Q6 o
: e* W9 d: c# i7 e# a+ J% m0 ^ |
|