|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 ~. k# ?7 E- B0 {0 [# P- [code]EDMA sample test application2 n/ X- m3 `( }
- /*
. V5 d b# n7 W: B) X4 W, a6 c - * edma_test.c
# o/ b+ {9 U1 j, [+ O - *
+ f2 o; `! U9 m5 y2 F* [5 l - * brief EDMA3 Test Application
- Z9 _9 V6 L8 f+ A# }, d - *: Q* m1 x/ }; H7 A$ X3 Q6 W; b4 x
- * This file contains EDMA3 Test code.
( T5 n8 B1 \. q7 l5 f% I - *
T5 b5 H3 G; C - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
& k, e! i+ I) f) } - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
, C. Q% y r6 r/ t! v - * TO CHANGE.
% R# M/ @5 b# H/ f - *
8 G- k5 n5 O% \, X - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 G4 Z+ y# _) Q; V7 p2 k
- *
8 E$ V, w$ [+ ^. ~/ V" F' R( ^( F - * This program is free software; you can redistribute it and/or
' c. i2 s- S. \& M9 t" u5 y - * modify it under the terms of the GNU General Public License as+ j+ m3 m4 R/ k0 ^8 ^
- * published by the Free Software Foundation version 2.- k. I( V6 z, _
- *- |+ j3 c1 Z. c- b8 u0 ^
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any" y6 u; v! b( W3 y3 ^
- * kind, whether express or implied; without even the implied warranty; Q% T; P* i! r2 a: [
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; d+ O& x8 f; U9 p8 W' n/ ^7 o - * GNU General Public License for more details.
4 @8 h) |# u9 N1 Q - */
) S2 X. m& g) s6 f
/ F3 X2 k& @) h7 }- #include <linux/module.h>5 Y7 i V) ]% y2 i* {2 o& N
- #include <linux/init.h>1 H0 h5 V! Y* N7 t( T" U
- #include <linux/errno.h>
2 C8 a0 h. f& M5 f' C" P - #include <linux/types.h>
! ~+ o4 K/ D6 x# T3 X: { - #include <linux/interrupt.h>6 \8 z7 J+ K3 t8 B5 {& Q
- #include <asm/io.h>
* a6 ?2 r( ?4 i/ b Z - #include <linux/moduleparam.h>
+ ^. C' a) e' Y2 n1 e - #include <linux/sysctl.h>
( c* R8 F+ A& g& T# i5 L - #include <linux/mm.h>
* K' ^3 A1 i, K7 \ - #include <linux/dma-mapping.h>+ q# i0 ~0 B0 u! m+ H3 b
- 2 ^7 e! t2 T( A/ U; P6 r: e/ f& }* V3 t
- #include <mach/memory.h>
7 x+ k7 L d* O* G - #include <mach/hardware.h>4 Z* Z+ D1 u" x e, |
- #include <mach/irqs.h>
4 }! \6 l/ q+ N( b( ` o" Y" D1 h - #include <asm/hardware/edma.h>
- X# \( o+ c0 e) @ { - " j9 L- f" r# Q2 ?
- #undef EDMA3_DEBUG/ T' h: o7 }* M
- /*#define EDMA3_DEBUG*/2 G" x4 u; I( z6 } |
- ( I. l# ~8 S' t9 m
- #ifdef EDMA3_DEBUG
8 J0 Y# ?* g8 O, | - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
, u' A& O7 F5 H& {( z! g8 b. Y8 R$ | - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
5 N2 l/ t% L' Y+ D2 c& K - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* u @7 [, c$ Q
- #else. W/ z% A' Q+ W! Z C5 P' [7 g
- #define DMA_PRINTK( x... ), Y7 c1 d$ Z$ |
- #define DMA_FN_IN
/ {4 N Y& Z, i0 Z. o" _$ O - #define DMA_FN_OUT
6 C% U4 V9 C& U$ q- R5 L2 y - #endif1 N4 V; F7 m C" r. s( e
( |& ~+ d7 F- F8 Q- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
6 |: h9 V( @8 f- I) M- @# w - #define STATIC_SHIFT 3
' R( V8 N2 u% ?0 i3 g. k' d - #define TCINTEN_SHIFT 20
+ ]) ?. x$ x, R6 X" F% L - #define ITCINTEN_SHIFT 21
8 u; H* ]7 g6 ?/ z/ c$ [ Y m, m - #define TCCHEN_SHIFT 22% X- E0 ^( M! R9 E% B
- #define ITCCHEN_SHIFT 23
" w5 R; P6 c& @! b) Z
0 c$ s9 g3 n: a$ X5 T- static volatile int irqraised1 = 0;
% s$ x6 B: W/ {6 ^7 Z - static volatile int irqraised2 = 0;2 W: g% u$ D7 ~% d. Q! ^0 d4 n/ R N0 h
- u) V: X4 c# X2 I! S8 n
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! N: D/ @, t! X. [
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# ?* d0 L) \/ N3 v4 g) s+ H5 p, L% W
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' d. l/ G, a4 Y2 H1 d( x3 _( G; d
+ R9 o" e& Y, s, _. k- dma_addr_t dmaphyssrc1 = 0;
3 _. s& C+ }7 I - dma_addr_t dmaphyssrc2 = 0;
! i4 d8 p0 ?4 [ k8 | - dma_addr_t dmaphysdest1 = 0;0 Z; i: V0 t4 r
- dma_addr_t dmaphysdest2 = 0;7 J# [0 ?4 o( g- ^7 e& v2 y
- ( m1 [& U5 E- r2 z, f
- char *dmabufsrc1 = NULL;2 \5 J2 f3 E5 L9 |! a
- char *dmabufsrc2 = NULL; a( E0 A3 {/ H( R
- char *dmabufdest1 = NULL;
6 q( |% K0 r$ q* G, _$ m& e - char *dmabufdest2 = NULL;( W) B, E7 m. K; }8 C) b
]1 M% C- a8 x7 e) n9 I; f( c- static int acnt = 512;
8 D/ K- W4 G& ?1 o - static int bcnt = 8;$ u( i6 N( U" u/ H3 E
- static int ccnt = 8;8 A: d3 f9 P( k9 W
- 7 S' S) H) V& e+ Z5 Y: j
- module_param(acnt, int, S_IRUGO);) d( n$ e7 {" `4 @: q
- module_param(bcnt, int, S_IRUGO);0 L6 z8 W- r0 v; m' y+ H6 G
- module_param(ccnt, int, S_IRUGO);
复制代码 # E: b0 \8 @1 P% D& r7 D$ A
) J. `7 `3 W3 b 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 z# E7 d6 T+ ]2 w; M4 E/ [
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 E0 x0 d4 R; i k7 p# Y' H 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ K4 J6 X! x) h1 w. j5 ?; m3 o
4 q3 l6 j+ v/ q6 G
. G6 R0 u8 k4 o' t1 s0 ?, ] |
|