|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , a3 n! u& W. Z$ H
- [code]EDMA sample test application$ [2 ?0 k; C* j8 p& w& D3 I
- /*
! u" P) \4 w* |6 O# q$ Z8 Z/ n - * edma_test.c
, c( P C( K% K2 C2 Y7 O# E; f - *
2 X+ x0 U; K3 o7 c( ? - * brief EDMA3 Test Application
/ X% y1 C/ B* B9 Q5 |2 A* @ - *9 m$ z: Y T3 s) t$ _# C( ^; R
- * This file contains EDMA3 Test code.& |, [. l: s$ {8 I, x
- *
; S' i; s; I2 M! p/ G; P" \ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
c. J* ?- P3 R- R2 I - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* h: H v: o3 J4 r& c
- * TO CHANGE.
! D& ?8 {! Y. n; ?+ C" o- Q8 Y - * h3 _! ]) c5 W( ~5 z
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% L' T% P. h6 k; F" B9 W
- *
1 ]6 U4 ~) ?) h" d! ~6 t - * This program is free software; you can redistribute it and/or/ m0 n. ^; [7 b# p1 w9 |& ?4 @0 W
- * modify it under the terms of the GNU General Public License as
- F6 f5 Y1 ^! F( a' d - * published by the Free Software Foundation version 2.
* @6 S0 o6 U O+ L - *
5 m) J- p# V: ^3 \( T8 S+ L/ ~! s - * This program is distributed "as is" WITHOUT ANY WARRANTY of any, g' _+ d9 l3 N$ u" ~
- * kind, whether express or implied; without even the implied warranty1 Q' P3 n- A: b- P5 b; ?% q
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the* e' X3 X" ]8 `$ r- g4 B8 s. E* Q) N
- * GNU General Public License for more details.
. i0 n9 t1 h) B+ j - */
5 ]& V7 w/ N6 w6 {: m& ^ - ' h- C: `8 f' \% @/ s4 B+ h+ L7 n- Q
- #include <linux/module.h>$ {8 @7 }2 k9 g
- #include <linux/init.h>+ h# R! Z8 Q( k7 G z
- #include <linux/errno.h>3 d# f% N3 s6 y+ Q) G) j7 _
- #include <linux/types.h>: e6 c0 F! |; Y! r( n9 [( {+ H
- #include <linux/interrupt.h>8 w, o- K# S2 G6 f2 l. @9 ]# Q
- #include <asm/io.h>
' `3 |" X6 l; K0 I - #include <linux/moduleparam.h>
( l( W: Q. e) u a, A( o3 ~) O: Y8 x - #include <linux/sysctl.h>
Y9 O9 I2 `# E- ? - #include <linux/mm.h>' I1 c4 a3 G( Q& ^5 s5 O
- #include <linux/dma-mapping.h>
$ `- n, y7 _4 f9 [4 g/ S' A - ' m$ y4 L3 p4 T- u# L% p
- #include <mach/memory.h>
" X+ X3 ]! \5 T - #include <mach/hardware.h>
/ F, I" F2 j) s; C - #include <mach/irqs.h>+ Y! A1 n9 }* o+ `9 ]; I6 E
- #include <asm/hardware/edma.h>' p' d3 H1 P/ V& |" Q$ Y, k' i
# L7 x+ b1 j6 B- #undef EDMA3_DEBUG$ W$ a6 z1 P4 g
- /*#define EDMA3_DEBUG*/, D, X3 z; P L7 E0 g
: L. V$ h% m7 H9 V& V/ L" R- #ifdef EDMA3_DEBUG
/ b; a% P( ]/ R+ d4 q# x4 f - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
' `) Y, h* O( T T7 v5 n, E - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# Y: W9 l2 T; {6 N% X7 `& E$ S
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 v' t9 X, r7 `) z# \" F- T
- #else+ i0 V1 ^5 i/ x# _) A, b
- #define DMA_PRINTK( x... )
, o" C" B$ R; J* N1 B! z$ S/ z - #define DMA_FN_IN
. Z% W, l/ |" y* ?3 H. t! Y - #define DMA_FN_OUT
) C. w1 o+ x0 S$ M - #endif
+ v& ~) i! s8 i. {) N. A9 a5 |
" d. u+ N6 _6 w7 ` `# [4 s- #define MAX_DMA_TRANSFER_IN_BYTES (32768): J8 K, ]1 U; | N6 c6 G
- #define STATIC_SHIFT 3; n! a: Y7 p( l; S2 |6 f" w
- #define TCINTEN_SHIFT 20
4 `: J* }* H! n1 a - #define ITCINTEN_SHIFT 21
( ]4 _3 v5 X8 ` - #define TCCHEN_SHIFT 22
# z$ l+ b, @0 R l8 \ - #define ITCCHEN_SHIFT 23( \. w4 t" B- m2 C J, }6 `
. h: ` ^0 Y" _- R, v! _+ G- static volatile int irqraised1 = 0;
: {2 h+ B% t/ I9 W& R) ]% D* e - static volatile int irqraised2 = 0;
6 O: A0 f9 i! z
8 y: H* G' |/ S9 K) l- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 \% m3 q8 E; M3 q4 k/ F0 i! v4 h
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; m9 x9 n* x8 G% I% Y6 D
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; w D6 ^7 c. e! p# a. D
- * ?& m' {3 ?( `9 M8 h3 w
- dma_addr_t dmaphyssrc1 = 0;
4 b( U; _/ U' a, {+ Y - dma_addr_t dmaphyssrc2 = 0; B# W- Z6 ]8 \/ H1 Q
- dma_addr_t dmaphysdest1 = 0;
* L7 ~" A0 s. L+ ?1 R - dma_addr_t dmaphysdest2 = 0;+ x! E- f0 `: V; q+ x# F
- ) Q( G2 O$ n L+ F% _5 Y+ y
- char *dmabufsrc1 = NULL;+ b9 s! D$ n% S7 k/ F }3 K
- char *dmabufsrc2 = NULL;: V" v, c% I; a7 [8 m k1 {
- char *dmabufdest1 = NULL;
1 @5 K+ W0 G6 Y6 J9 E - char *dmabufdest2 = NULL;/ l8 A1 z5 r) M8 J1 e
/ M: {: L! n7 l2 J5 q- static int acnt = 512;
, D9 b# b* B+ O' J" W - static int bcnt = 8;
; z& L. \8 I; f) M% r/ C. R0 o - static int ccnt = 8;$ Q8 B: s4 ~' r
0 t, _" ? p0 h* }; a- n1 j1 Q4 Z( p- module_param(acnt, int, S_IRUGO);
! M2 J |& ~0 d' J% N, N - module_param(bcnt, int, S_IRUGO);
; h$ k4 j: I* l% Y% n6 W - module_param(ccnt, int, S_IRUGO);
复制代码
7 X" W- z$ h6 B8 i) D
% n1 |6 S# h) l& [7 v 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# b9 Y+ G" g8 g9 i; c- b3 t/ F) earm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- d' s0 ]% z1 S' g& Q6 D: [
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- d6 n1 K, J. h; H% H7 a
( L) j9 K9 M. M2 {' y+ _1 }' O
/ [! q" s, \7 R' U; l I
|
|