|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 u9 f, S4 t: ~9 M5 D8 L
- [code]EDMA sample test application
$ C: g( C" W6 s- o2 M - /*/ p( P/ u1 n( E/ X0 @
- * edma_test.c* u% W3 Q. W; ?% n8 a
- *
! P" X' Q. R$ P0 j+ V - * brief EDMA3 Test Application
; ?. B! t8 p6 A. x& v5 B - *( O. V$ n1 j: B5 E$ m
- * This file contains EDMA3 Test code.
1 E/ _" g2 o! J: l5 z3 t7 f) s - *$ _) p$ o+ |2 S9 J$ F) v
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; g* D! {7 [' V. a6 c
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* [4 Y Z z: v1 q
- * TO CHANGE.
, S% G) i9 s: j% K7 O7 [, W w - *' @5 L$ e. j& |% E9 Q# r# y
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
5 z* i: O$ b0 r3 E# I" [( N - *
1 Q! {" R. B# D - * This program is free software; you can redistribute it and/or
/ @; h9 G2 a1 H& N; Q* u" j! l - * modify it under the terms of the GNU General Public License as
! I* m- G8 O2 b8 o6 ]7 u j - * published by the Free Software Foundation version 2.
4 e9 |) Z' p+ u1 Q - *6 S1 L x( {! g. i9 |' l9 q( a
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ O, e! k6 k; y3 B% w/ I+ F
- * kind, whether express or implied; without even the implied warranty4 f- z3 ^4 q1 m+ l1 h
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the6 w+ Q! G. F- v) x: _) H% w. j
- * GNU General Public License for more details.
! G4 [9 _) h# z6 e0 K - */
/ j% b/ C7 W1 Y# U - 0 e# M! X0 x' J$ A8 f
- #include <linux/module.h>5 R1 f6 e& J% |; d: i5 ]8 r
- #include <linux/init.h>- t( m" Q4 W. E0 }
- #include <linux/errno.h>1 `, D {" i8 L7 V/ |) \, o
- #include <linux/types.h>) e) U9 Y. O* j. J3 L4 R
- #include <linux/interrupt.h>
9 d( Z8 d" F$ u: _ - #include <asm/io.h>) l5 t" ~& x; I) U
- #include <linux/moduleparam.h>
3 p6 d( |& }$ Z6 l! T3 S2 h! C - #include <linux/sysctl.h>; B3 G" I( F m4 u
- #include <linux/mm.h>
* k- m0 _* z2 v) J0 y5 w8 g5 p! b& K - #include <linux/dma-mapping.h>) \+ y- h% A: ?. Q
. K# f/ O) r- p) t* c8 M5 I k* T- #include <mach/memory.h>
6 L; O; ?5 I4 W0 ] - #include <mach/hardware.h>
6 T: P5 f/ d4 Y# [( J - #include <mach/irqs.h>
: @3 N; i* \7 L. m - #include <asm/hardware/edma.h>
% x. b4 P+ Y; I: m4 _) k
T* Y: P3 n& ?9 O. @! T- #undef EDMA3_DEBUG
" h2 @( v4 V3 d - /*#define EDMA3_DEBUG*/& [/ G6 i$ `$ O9 M# g7 Z
. ]) w% G6 \+ k1 {- #ifdef EDMA3_DEBUG5 x- s) s) M- e0 m4 F
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ i8 Z3 i$ n) w q# V
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
/ X& V2 s; p4 d( J# a9 {# |( v. Y - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
3 O* V* Q" C. i - #else2 m2 b2 f' ^4 |+ _% f7 t
- #define DMA_PRINTK( x... )
1 E3 Q6 p% |' J* M0 _" X - #define DMA_FN_IN
9 z) [( y; }- g; w' C4 p i1 T! X/ P, G - #define DMA_FN_OUT
: l+ W- x1 M' f" Y' f5 X' h - #endif5 }3 ?2 e1 J, i7 Y
5 ^( c8 Z0 `! |1 `9 a( m" w- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
: J) o6 R ~2 x. d7 ?. O) {/ t4 K0 M - #define STATIC_SHIFT 3
2 R- B; P6 o* @6 d) ? - #define TCINTEN_SHIFT 20
% V2 T/ I. j' s5 U0 ` - #define ITCINTEN_SHIFT 21
, Z% @' h" t2 F - #define TCCHEN_SHIFT 220 B8 L- F2 u, [. ^% y
- #define ITCCHEN_SHIFT 23! A, l5 O' K3 D: c
6 n7 j/ E7 I/ T6 [* t- static volatile int irqraised1 = 0;
; d4 ?( @) c; k- Z3 R1 N3 ]* Z - static volatile int irqraised2 = 0;
7 e% y* m& \7 p' w5 G0 b - - \, c" v& P8 _4 U
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ e5 q9 ^1 G7 U+ D# d
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# g; M+ I( v& F
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. T, @/ i/ i" g4 I0 [7 ~# Q- h9 o
- & r9 u0 r- P' c' Q; n
- dma_addr_t dmaphyssrc1 = 0;4 T2 r+ ^% a8 W+ u
- dma_addr_t dmaphyssrc2 = 0;) L' w+ P$ |3 K! p7 S) {( ]
- dma_addr_t dmaphysdest1 = 0;+ z; `$ {1 R% f
- dma_addr_t dmaphysdest2 = 0;
3 C/ m4 K* f/ c4 T - ) b8 h1 {3 S9 B5 M3 @6 e2 d
- char *dmabufsrc1 = NULL;
+ }* y2 Y% F1 u8 e: P - char *dmabufsrc2 = NULL;
$ H' _$ W9 N) ^) y - char *dmabufdest1 = NULL;! Q* t! l! I" h, m% i2 m2 c! @
- char *dmabufdest2 = NULL;# O+ I8 f+ a% k: I) |% G
( g3 G0 P% w) |+ x& L2 u- static int acnt = 512;$ t. u7 |! q4 A$ |6 Y' g! b8 a
- static int bcnt = 8;" |% ]/ Y. ^8 O% c
- static int ccnt = 8;
* Q, Q3 ~( u4 ?
- S8 s! s4 l# O8 j, o3 \- module_param(acnt, int, S_IRUGO);1 y+ l8 I8 Y; X# T# M7 _
- module_param(bcnt, int, S_IRUGO);' [+ p! v8 E& c9 k& r* m
- module_param(ccnt, int, S_IRUGO);
复制代码 / i* L" F2 d+ Q$ m+ Q1 j1 r$ {( h
# N, t7 B5 V, A9 O7 l 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ ^! I/ ?: }. `
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 v q' Z4 ^; S/ A 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 H* g$ a l' ], q( Z+ O
- [, ~) y- i3 F9 \
1 X' e6 t% b: x1 B! B1 n- W+ i |
|