|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 c$ u' r! z$ a! J, X4 t- [code]EDMA sample test application6 }+ Y; I0 Z, N2 q1 y" Y$ ?4 `
- /*! [ C' @! w2 r) E) c) r: K) _
- * edma_test.c- Z/ {& C( m4 P9 t# B* x& ?3 h
- *
! o( D; i# V' _/ I5 p - * brief EDMA3 Test Application
. D# c5 G( l- F A) s - ** ~; a4 V2 k7 L" O# D: j
- * This file contains EDMA3 Test code.* E& D8 K8 H3 z5 u4 ~9 y
- *4 p, L% ]$ I: n6 e( v' ^
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ E! U' W+ C8 b' Q$ L
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT a' m; ?/ S, R* a* k
- * TO CHANGE.
/ v! H( N$ I7 I% | - *
8 U/ H1 x- ^* S# X, _3 F9 W' q - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
, K, V1 W0 a4 f$ ? - *
$ A# c7 w- P! ]* X( I2 j - * This program is free software; you can redistribute it and/or7 |( S; H- I' R7 ]; t j4 p8 |/ A
- * modify it under the terms of the GNU General Public License as2 O; @* w( d; g- h5 ^3 C
- * published by the Free Software Foundation version 2.# R# J& S8 W* S- U B7 U
- *
( e& J+ a. j; Z0 W7 t - * This program is distributed "as is" WITHOUT ANY WARRANTY of any; C6 ~. J$ i# k
- * kind, whether express or implied; without even the implied warranty
' Q, Y7 g! Q( B' T - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the# x3 c) W" e( {& t z9 o) Y: e/ |
- * GNU General Public License for more details.# @7 q0 {* A' z1 P9 W
- */0 x* F" J! X" ^1 Y+ g) s
- C6 f3 l( r+ o6 K5 @2 b
- #include <linux/module.h>. W6 }1 ~3 n2 \5 K3 c3 R
- #include <linux/init.h>
, i8 [: |, R; e+ F8 S3 k - #include <linux/errno.h>% P$ u3 s9 p3 \+ ^: v' Q" Z: S
- #include <linux/types.h>
/ c6 d' |6 m4 g4 D$ O - #include <linux/interrupt.h>
' C- N+ U1 {2 o# N6 O" }/ W0 N - #include <asm/io.h>7 G1 |# j) Z- p6 K. h. B
- #include <linux/moduleparam.h>
8 K# p. R5 b1 l - #include <linux/sysctl.h>
B5 ^& h4 j- } - #include <linux/mm.h>! s, R0 c2 d9 f' `; b9 b
- #include <linux/dma-mapping.h># { r6 n! n% z0 t( H' a
+ U4 r+ U2 O( @$ |% c1 e- #include <mach/memory.h>' v( V) I: u' d6 V
- #include <mach/hardware.h>
4 x: W) e7 \! ?* y, u+ d g4 ] - #include <mach/irqs.h>
& A2 I+ w8 `" a; _+ o+ B& m8 o - #include <asm/hardware/edma.h>) d6 b6 d1 Q4 P) s' f% o# g
- A5 d. F9 R- ]* R9 T
- #undef EDMA3_DEBUG
! `3 i5 f( m% x4 ?- ~# W3 j - /*#define EDMA3_DEBUG*/" e; |( S5 v( m6 G# }+ ]" f
: N c1 D9 u# t- #ifdef EDMA3_DEBUG
4 Z) b! ~1 E6 g' L8 q - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
% x& g" A) Y* ^: k& O - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
, t0 J0 ~0 f3 ?, \ z) F; E - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 G6 }+ Z" s5 a+ g5 S( K# h
- #else
: J. A/ ]4 }& C- ^& k, V+ G9 b - #define DMA_PRINTK( x... )4 Y9 W$ L5 \+ F* F* n Y
- #define DMA_FN_IN3 J# T F; P7 u. a
- #define DMA_FN_OUT
/ B( E3 C1 `9 U9 @ - #endif4 U1 }& B* A8 N/ e
- 3 N; g7 @1 X3 i- Z. T1 W- G' [1 T
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)0 Q' N" Q( W: a9 k- j
- #define STATIC_SHIFT 3
2 O" [6 [- P+ Z0 M! ?5 w' A# O - #define TCINTEN_SHIFT 20. Y' m5 M) W$ ]" d
- #define ITCINTEN_SHIFT 21- j, d0 {+ c1 `9 S2 m' q7 l' [
- #define TCCHEN_SHIFT 22
8 ]$ b4 V8 h% B) k- c" m - #define ITCCHEN_SHIFT 23 h6 A# ~! [ i0 V& |
/ l- N3 d, R( V' k, g& z- L- static volatile int irqraised1 = 0;; |4 }' [0 O/ L3 p9 j6 f# F
- static volatile int irqraised2 = 0;' |6 K2 d# |$ t/ b# H8 V" @
- U+ R0 V& j4 S% z- L
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- B( e7 g, S# E0 |3 F* _+ X) ~ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ W. C" e4 X6 {( z4 @' i4 U5 M - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 m" L( f# `! w7 n& k) b - + n. u( b. K% I* @! P
- dma_addr_t dmaphyssrc1 = 0;
. A( }) M8 w6 w4 H) A - dma_addr_t dmaphyssrc2 = 0;' s! P/ @. V2 A
- dma_addr_t dmaphysdest1 = 0;
0 F; C) v' i" Z9 z( r) q8 n+ u+ C2 r - dma_addr_t dmaphysdest2 = 0;# z" F4 w4 f+ g# R1 f- c) E
0 H8 [. M& O. [' V- char *dmabufsrc1 = NULL;
+ h. `2 V% Q5 L: Z - char *dmabufsrc2 = NULL;/ P: _/ [ R4 C8 E) }/ s. x' f
- char *dmabufdest1 = NULL;
/ p8 R& ~6 O9 }4 N! x( I( m6 z - char *dmabufdest2 = NULL;
9 v7 V6 v/ L3 `! ]- d
. c! S6 o+ t6 b9 O- static int acnt = 512;2 _$ i, i" V5 ^- \, y2 j2 v- W
- static int bcnt = 8;
1 }. B3 ~- m% Y+ C4 ?3 S - static int ccnt = 8;" [1 [$ D: E8 h" C: Y1 W
- # L4 P% s& K$ J
- module_param(acnt, int, S_IRUGO);. P0 o9 i# F% G% @
- module_param(bcnt, int, S_IRUGO);" S4 s+ f9 u1 ~+ T
- module_param(ccnt, int, S_IRUGO);
复制代码
9 k% q/ S, Z5 c) u/ b: U0 q! t8 Q B4 f: z) w- J% j5 |8 D
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 }4 ?7 ]$ Y+ Z1 n" q6 y
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! s# U, ~. H$ i1 r; @
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% B8 @3 G# j% F, G' j( g. |" h& [. p! f
' ^# ]; ^9 A/ c2 @8 D" H; j ?/ f8 I
|
|