|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 \. ^/ n, K% v- [code]EDMA sample test application
& k6 ?) ?/ K0 [- L - /* p6 p8 o/ |! Z5 q/ }: ~
- * edma_test.c
, V$ n9 w7 w" q6 y" ?9 b% }0 U( B - *4 L! M# m% D& T+ x
- * brief EDMA3 Test Application
# Y; I: V1 X* u- n+ J7 E+ W - *
# l! r! n% K& p# a" t: r - * This file contains EDMA3 Test code.( P; x0 k+ k- D% O4 Y
- *
) @4 |8 a+ w: g+ M - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
( {- d1 R7 Z2 a0 X, ] - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ }4 a- f( n/ G" m/ @
- * TO CHANGE.- g, V7 g$ x( v: c0 J6 v* Z
- *4 Y: x6 a! K" p( e( u7 M! \. c N
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
4 \6 Z$ g/ n0 m$ t& H - *
9 i/ N3 U2 o, z8 j, i - * This program is free software; you can redistribute it and/or. b# o' k+ T0 i
- * modify it under the terms of the GNU General Public License as
' T* `- _9 D l7 ~0 i- m% c$ @ - * published by the Free Software Foundation version 2.
* o9 q$ {. |" m# } - *6 ~7 |- i% ]/ P2 X' ]7 k' N& N
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any. d3 F2 V& M+ p# o# m# i; X
- * kind, whether express or implied; without even the implied warranty
, [( i1 q# S2 d4 M% d - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the) m0 B6 u& ~, A$ _# H
- * GNU General Public License for more details.
- l3 O$ b/ T/ y - */' x. D) o9 F$ K A( d
- ) |+ [0 i" h/ r4 Q$ j
- #include <linux/module.h>, t S* ~& c4 V0 t: `
- #include <linux/init.h>6 j9 ^- b2 ?2 V* W) s# s J
- #include <linux/errno.h>
' {# J% H, \! O. X4 n+ i5 y - #include <linux/types.h>/ F- j& O$ n- m0 q1 P
- #include <linux/interrupt.h>- C! `& I( u8 U9 L% X; y
- #include <asm/io.h>/ D) b5 {( O% w) k! m% o3 B
- #include <linux/moduleparam.h>
- U5 ~# E4 r6 k4 s - #include <linux/sysctl.h>
2 C7 q' Z2 e! M+ O7 V% A - #include <linux/mm.h>
( T6 W6 a& H7 I6 p - #include <linux/dma-mapping.h>, D6 f' v7 r4 ]- E6 [* I# c
% b- Q, W# N& i/ V- #include <mach/memory.h>
* o; D* S- T4 k5 g; Z4 S - #include <mach/hardware.h>
& D6 v4 _; R) U/ P - #include <mach/irqs.h>1 [: D0 E$ e/ E
- #include <asm/hardware/edma.h>
/ Z" _ J; k7 f9 \ - ' I, Z. d2 ?. ~
- #undef EDMA3_DEBUG9 @0 Y+ B( y& D/ a; e8 D
- /*#define EDMA3_DEBUG*/) t4 J" d3 N' X6 |% m7 p
- 9 c- j+ Q; l! p6 H* m
- #ifdef EDMA3_DEBUG
4 ?# ~0 q6 b: G7 ^6 K - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
% a4 C: n$ m) E) S - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); b2 u3 J" c3 a8 D9 L/ n, J
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
+ \5 e" c \ m R2 D - #else7 C% t/ L* g1 h8 U& E" I3 C( G
- #define DMA_PRINTK( x... )
3 e9 ~. q6 w# E6 ^/ q0 F - #define DMA_FN_IN
! ?6 A# T$ k; w+ J. o: t& [ - #define DMA_FN_OUT! G$ x/ u! K) a8 ~& M- Z
- #endif' F. W' @( d, @' y3 A5 ]; _
- / W) T# f# t; E `/ d( S
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
, Y5 {4 j9 T! h1 M; w m - #define STATIC_SHIFT 3+ Y7 s( `7 V0 w4 K2 g& Q3 ~
- #define TCINTEN_SHIFT 20# e1 s# i4 F2 n- a
- #define ITCINTEN_SHIFT 211 b+ l4 G/ l" [8 \4 {& ~, n0 t. r
- #define TCCHEN_SHIFT 22
7 c! s' [ ~- w2 o! R - #define ITCCHEN_SHIFT 23
5 d; ]( ^/ S$ D( ?' j - " Q; D' m0 A* ?! y
- static volatile int irqraised1 = 0;
& t5 T4 R8 }7 Z% x+ m$ Z } - static volatile int irqraised2 = 0;6 \. W2 V8 m% |
- 6 Y! h: A# K0 s: O
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: j3 \; J3 B/ v }2 Z9 H% o
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 e* W' k( F8 D
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, t) k# O' Y* ?4 n
- 1 T6 _2 ~: Y% t9 |9 S9 \( H; O: F
- dma_addr_t dmaphyssrc1 = 0;; n! `5 J1 Z7 |1 B, M( @( Q
- dma_addr_t dmaphyssrc2 = 0;
0 `2 i O) U) l! g - dma_addr_t dmaphysdest1 = 0;
4 X V1 W9 v# i2 w& ?9 D - dma_addr_t dmaphysdest2 = 0;# O# e7 G* Y6 R" l. k' i% i
3 J$ t8 K" ^* B0 u r2 `- char *dmabufsrc1 = NULL;
! d& S7 {; j9 F! [# u - char *dmabufsrc2 = NULL;
# U$ u6 f% G+ F! T4 C% { - char *dmabufdest1 = NULL;
" ~ J8 Q1 O/ |2 l0 s - char *dmabufdest2 = NULL;9 U1 w( G4 D* w4 x- p4 k$ e
- $ `2 D6 [( B( N- Z2 ]3 y
- static int acnt = 512;
0 y0 w1 n" z( R5 a, i - static int bcnt = 8;4 a/ P5 w9 J* ~+ O* f7 B* |7 j
- static int ccnt = 8;
0 ]) P0 b( r- v( |: y3 f* k - 1 z8 _7 d; ~% i7 s* ^; F
- module_param(acnt, int, S_IRUGO);$ `) K4 O7 B* q/ ~" r# g+ B
- module_param(bcnt, int, S_IRUGO);
8 c# M3 _- O6 u- J - module_param(ccnt, int, S_IRUGO);
复制代码 ) ]9 ? M/ l8 l9 u J& Y: Q
% \0 P8 G/ ^: ^3 B, [, f5 R" _# I6 y& K 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; u9 u# h3 q5 d. W" Aarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( d9 n3 W' Z, \* E 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 b. ~5 n3 C/ o* k& s) K$ n6 e4 l+ a; [" W& K1 d6 i% E- a3 V
/ ~- _4 I' i- {2 m9 s9 l
|
|