|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 y; H) j A- i* _, e5 p/ `. I$ i- [code]EDMA sample test application1 {+ M+ ^# L/ a! K1 b p
- /*% M: {" K3 L1 N$ R/ i" W1 k% Y
- * edma_test.c- d9 T9 Q; h3 H5 u$ E. Z. f
- *
6 a& ~9 P" Q( l' ~( g) F: r7 w! M- { - * brief EDMA3 Test Application
9 f w% R. Y2 B4 x# B - *
7 x5 b$ y+ a( R% T - * This file contains EDMA3 Test code." g! Y. w' b+ G b$ ~
- *
0 d8 M! I/ B+ d# K" q - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
1 y5 n' n) a6 U$ R( f% S, I* k - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
, q% Z3 s) i9 h - * TO CHANGE.9 {2 j9 L/ l/ G" \% l5 K
- *+ u& \8 C! ]* S9 u& K$ F
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- R& J# `1 x) j: |/ b2 _
- *
$ R0 @0 [$ l* M5 ~% f - * This program is free software; you can redistribute it and/or
$ ~3 o& L6 b& r - * modify it under the terms of the GNU General Public License as
: p! K: T& z- k - * published by the Free Software Foundation version 2.' V% R7 b& b# I; S. u
- *( }- T0 N( i9 h5 ^
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
9 M( ~$ }4 Q& l0 p' K$ a" A - * kind, whether express or implied; without even the implied warranty
6 {# I; ^3 M3 ]& h& B7 B7 K. i- B4 ^ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
" r9 f" M3 d2 J - * GNU General Public License for more details.
8 }1 Q; a0 n: L6 x! C% g - */ E; A4 \( j( g( F
" j, W) |' Y3 y5 t0 s: C! ?- #include <linux/module.h>
! K- \# [ P+ `: L - #include <linux/init.h>
' ?1 o, K4 n4 l$ k. t - #include <linux/errno.h>7 E! E$ T* ?$ C* x; W
- #include <linux/types.h>6 u U4 j W$ B" ~, s: P
- #include <linux/interrupt.h>
/ c! T' C! h6 P4 \ - #include <asm/io.h>1 z( i* K/ [4 b9 e
- #include <linux/moduleparam.h>
$ z$ Z" H1 T5 c& V - #include <linux/sysctl.h>
7 r5 m9 b. C2 i' u$ W l - #include <linux/mm.h>
% a! o5 N5 h8 b2 v' B - #include <linux/dma-mapping.h>
( D, e) q1 n" w% Y1 m
2 P8 ~% K0 m% P* R. ^# ]' g- #include <mach/memory.h>
5 K0 u+ h0 G2 R - #include <mach/hardware.h>
% P9 f m% G( j - #include <mach/irqs.h>
W: ~$ T) @# S k" l - #include <asm/hardware/edma.h>
0 b, H1 [& [" ?7 B/ h4 Z/ k
* k2 Z2 y7 Y8 j3 o! x4 I6 n9 C- #undef EDMA3_DEBUG
0 T- {! p- q/ ?- [1 x1 t - /*#define EDMA3_DEBUG*/
6 \( C5 @4 L9 }$ z' x2 z# |% C! S - " A1 [+ {* i4 V
- #ifdef EDMA3_DEBUG% z6 }8 c. N& J6 b
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), s% w8 B \& v# j+ o2 c: g
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
5 B0 Y2 ]9 P/ ~3 b h - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
* G2 s% c% D7 [3 t - #else
7 P' b& Q$ @8 H7 P! g0 Y( I( V3 [ - #define DMA_PRINTK( x... ); S5 ^# [) @" Z( h3 N% w
- #define DMA_FN_IN4 p! G( t! H/ Q; D' }9 o0 D8 _+ h
- #define DMA_FN_OUT# t( B6 x5 t3 e3 Q/ D) U+ ^3 V
- #endif5 n+ K' N. e* |& }4 O. c, A
3 I3 L) K z5 Z6 i0 s4 @- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
; D" E8 D$ V: v - #define STATIC_SHIFT 3! X' S+ I* s+ y; i
- #define TCINTEN_SHIFT 20' S# {+ U) A* K1 [; x( c8 c& Y+ v
- #define ITCINTEN_SHIFT 21
0 R' e. G! T* @ _' ]& W, ` - #define TCCHEN_SHIFT 22
5 R6 }" O8 u& U' i2 g - #define ITCCHEN_SHIFT 23 }7 }5 S2 e$ J# ?3 H
/ b7 {% p. c( z; W0 n; S- static volatile int irqraised1 = 0;
7 ]) h* O6 z, _4 l9 I1 s7 K/ y - static volatile int irqraised2 = 0;
: f/ n$ U& X8 `3 p: \
1 J6 |, X. V E3 O: G- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( s. r' D# H2 k8 I9 |/ @, T
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ L+ ]. f5 _, U9 ] - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# o, J+ p2 v; c; E) `! i% y
: l$ k. r: x& U* {/ R- dma_addr_t dmaphyssrc1 = 0;
1 O) g3 ]3 [$ w3 H - dma_addr_t dmaphyssrc2 = 0;
+ A! H4 \7 _ B1 E* T; l - dma_addr_t dmaphysdest1 = 0;
$ o0 u3 {8 E2 A4 \( c( C0 }" V - dma_addr_t dmaphysdest2 = 0;9 ~/ G. D8 B- }; \! b9 M8 V& W- A
& P W) ^& I$ j' {. \3 O- char *dmabufsrc1 = NULL;. b& h9 B6 K" J3 ~6 X, X
- char *dmabufsrc2 = NULL;# z2 }, w" Y7 T c* w$ l
- char *dmabufdest1 = NULL;- q' m: F8 E: F7 b7 [
- char *dmabufdest2 = NULL;% e8 O$ l- l/ s- B
- ( c4 N& ?. o. |& K7 D
- static int acnt = 512;+ k! P+ R, D" v5 O& |8 q9 N
- static int bcnt = 8;1 ]) U1 X7 l9 G
- static int ccnt = 8;$ e. g: h% N0 }7 R8 K3 i
" b. L T; T2 N, Q1 x- module_param(acnt, int, S_IRUGO);7 T% d: p3 a( E, s3 ?2 @
- module_param(bcnt, int, S_IRUGO);% [: G2 _& P# n9 ^+ e( j/ k( V
- module_param(ccnt, int, S_IRUGO);
复制代码
+ v3 |- }0 y$ @/ \4 S$ x, B Y9 c
4 n# `: S1 t2 T/ G$ i, E 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' W* H! N3 a3 G$ w2 J9 v0 h4 Parm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& b1 R/ I0 _3 ^/ F; ^ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' d2 {( G1 M) P5 y3 ]' P
7 u# y7 E$ v) _' t: _! ?2 r( h. I2 Q8 i
|
|