|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 _" E; q- O9 x; D' K8 Q- [code]EDMA sample test application
c4 C, V K2 p - /*
$ T; @; m+ r9 T, h - * edma_test.c
4 r& ]& z! q1 G! }4 ] V& Z5 } - *
- Q. q+ L" r! ~% D/ `( \4 F - * brief EDMA3 Test Application, T* w" I% p; y
- *
# f( ?% o$ f4 F4 o5 B* d6 J- p - * This file contains EDMA3 Test code.
: E& Y! t$ k( _# G' j; I) L V6 K - *
$ h# N, o. U( `) p Q7 i - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. e1 g ^5 i4 K! z8 ^7 @5 ]
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
3 g4 m5 R: `' x2 h+ b6 | - * TO CHANGE.
+ _: E7 T. @ Y8 H* U: l' v$ I' a - *4 t2 j5 m, i4 ^, o- I
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
1 I% b. S6 n4 o, f - *5 l$ i0 Y* I; h: _9 W$ ^' a- j
- * This program is free software; you can redistribute it and/or. O" B/ h; A7 c: S7 F
- * modify it under the terms of the GNU General Public License as
3 n; n4 N% y; O6 ]- W z - * published by the Free Software Foundation version 2.
: Z8 q$ L3 l# b8 X - *9 i: k* n. @' Q4 T$ k. L( p
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
& v; [% W t$ D: X( ]* }7 K' u - * kind, whether express or implied; without even the implied warranty
) O. _( `: J+ z, Z; A - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
( S U4 R, G# C5 d - * GNU General Public License for more details.. v4 Y* J6 n5 |+ c2 E8 s
- */
: i" C( F. }9 p
3 h' U) r6 a" m5 K+ n& H* w- #include <linux/module.h>" H( l0 T! s% w0 Z4 M% H/ ^. c6 S7 I+ j
- #include <linux/init.h>
4 i: g, k1 S: o* h+ Q) @: x0 }* L7 ` - #include <linux/errno.h>0 X \# f- w8 I
- #include <linux/types.h>: R3 o- b8 {- [3 C: K
- #include <linux/interrupt.h>' B1 V/ N+ y3 J8 y [/ W
- #include <asm/io.h>- k* T) ]( c6 @' c) U
- #include <linux/moduleparam.h>
& J3 [( o9 k# [! a9 } - #include <linux/sysctl.h>
z9 ^: r7 u7 ~# ?5 U. Y) t- r& R6 O; E - #include <linux/mm.h>
& v/ l) w7 @' H6 `: Z - #include <linux/dma-mapping.h>
" o. o5 L# Y1 I) h! T0 \
' ^' y; B9 c- J- #include <mach/memory.h>3 { _6 }2 y- V! Z# o/ M
- #include <mach/hardware.h>9 O/ G9 r! i; Q8 |5 G% H/ \
- #include <mach/irqs.h>
/ z7 X; `) C: x: q! y - #include <asm/hardware/edma.h>
' L" J. H1 o1 d
, ? C- u6 `( e" a- #undef EDMA3_DEBUG* s! r3 | W$ N- @. E! T# `+ h
- /*#define EDMA3_DEBUG*/
7 q# e5 r! b3 }) L8 x
; @& \ U Q( P, y3 G; m2 j. l- #ifdef EDMA3_DEBUG2 c* c8 W4 K3 `7 D" J7 x
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
( f4 J7 m, @6 h D8 g - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
8 F+ O4 L5 [8 b5 Y8 E+ m1 m) r# d - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& O0 _$ l3 X4 ~ q3 F3 G
- #else3 z9 y$ I( ~' d6 y1 }- m1 w
- #define DMA_PRINTK( x... ). Y) ?3 T/ o7 q0 I8 S
- #define DMA_FN_IN4 x4 Q2 ]+ A, v' x# a* Z; \
- #define DMA_FN_OUT
- s0 {4 Z& t* F5 |0 K" N- r - #endif7 c( P1 H8 P; M; b% Q4 J) S; y/ H
4 E: U! q4 b. T* f8 X! K( J- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
1 Y h0 ^2 ~! ^- A5 \ - #define STATIC_SHIFT 3, ?0 m9 m* x' U, y. q9 D' b% u9 D
- #define TCINTEN_SHIFT 20
. `$ R5 o( [* ?0 E - #define ITCINTEN_SHIFT 216 O$ I$ U% p/ G3 J: |8 n C
- #define TCCHEN_SHIFT 22: k* n5 |' S9 A2 C" e
- #define ITCCHEN_SHIFT 23
+ k4 C. P7 r E L
! V9 R4 \3 \- k; W" c- static volatile int irqraised1 = 0;7 d, `( h2 @2 x. ~9 M: C; \
- static volatile int irqraised2 = 0;
( L' J& G4 t6 Q p, P
/ Z% D2 P% h6 S/ E% O$ @- {- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! B. @5 D' Y( f, I, j& f; l
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 ~ H8 K0 o; Z& y - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% v7 w" M8 ?' W) G
, p6 T* w! p8 @, S- dma_addr_t dmaphyssrc1 = 0;
& N! _+ ]* U8 A. U* `, p3 O! R - dma_addr_t dmaphyssrc2 = 0;
9 e/ X8 j8 F, s, Q2 O$ c - dma_addr_t dmaphysdest1 = 0;
, N! K3 t, f8 r, I - dma_addr_t dmaphysdest2 = 0;
% v5 C* t: B0 R4 R# \ - - `& ?8 y \! A# P- x0 |$ S
- char *dmabufsrc1 = NULL;- {. ^8 L4 E l) o% X- w* I7 V* G
- char *dmabufsrc2 = NULL;
6 e6 N: R% v* b/ `# B% W7 F - char *dmabufdest1 = NULL;
t% g3 _/ e; R$ }* Y - char *dmabufdest2 = NULL;" ~6 S, S6 Z; m+ a f0 g. i
- * x; R6 d; c. I/ e: {8 u2 J1 x
- static int acnt = 512;. |- J6 W: O# R9 M- E
- static int bcnt = 8;
+ |( v* Z) A, D% b# h* ], c - static int ccnt = 8;" @: ^% t7 \/ ?9 A
- , e. J8 Z1 v# u! C0 n; V0 A
- module_param(acnt, int, S_IRUGO);% h2 x m! D( P0 r. V) z, O0 e
- module_param(bcnt, int, S_IRUGO);% c) ?& Z$ n! P: D- H
- module_param(ccnt, int, S_IRUGO);
复制代码
: Y r3 I, F! X/ d, t( n0 z
" X; N: }2 W0 j' T: a7 h: K. u 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! o& x. g- y7 O, S$ L: ]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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* t8 B# N. {: m0 b X
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
?( E" b! H9 z4 {9 Y/ w
" A8 S7 N& T5 j" U2 N" V6 s" T5 D
. ^4 N- {& U1 ^3 H5 e( G |
|