|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) N8 U3 ~' I2 i2 `- [code]EDMA sample test application( S6 E; |# w$ P# B; |
- /*3 I$ A4 @6 ^7 I2 A
- * edma_test.c
# A4 s/ S' g7 g1 Q% f1 w, l - *
- o0 R( |; k: G( h+ j- Q) z - * brief EDMA3 Test Application
, a3 o% w8 Z: a+ J - *
/ ^1 ~0 h, Q2 v5 t3 u - * This file contains EDMA3 Test code.
! E8 u/ r# M) l! U" L8 R) |. ~* w - *6 @/ H4 h% b! Z3 ]
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 Y5 @& E/ K& M2 H
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
5 ~( P" f& Y; s# \, h - * TO CHANGE.
( F0 f4 I: i: d5 F3 x. }6 X - *! ?0 K) d2 T" x, F* `
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: w. n. T0 i2 V( p- V: W+ M) Q8 d
- *2 t/ g3 e& q6 p7 s5 u1 \; F* n
- * This program is free software; you can redistribute it and/or
& y# U1 Y0 U2 [ [ K - * modify it under the terms of the GNU General Public License as6 m9 R5 p. R) R# j
- * published by the Free Software Foundation version 2.: P# K1 U" S5 Z5 c, A! ~
- *0 g( N. @ T( T
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
$ n8 V1 h6 o3 H% |) r9 Z3 A - * kind, whether express or implied; without even the implied warranty
+ o% i% `. H! J9 W o! b - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7 E+ W; d1 V, W A4 o - * GNU General Public License for more details.
" T; M/ V# d$ H5 N7 r& K5 l) ^: c& ` - */
9 t1 Z& L( K) e, D& J2 O# b- \; z6 R
" v8 K( P; a5 S& S' |7 v- #include <linux/module.h>4 I8 u" R! U/ k
- #include <linux/init.h>% U5 G4 j! z6 L; o! s
- #include <linux/errno.h>* o' r5 k9 E# |* s. Z
- #include <linux/types.h>
& a# m' K, `$ {( W$ l - #include <linux/interrupt.h>
. G$ |( m% {' Q) W6 J' b - #include <asm/io.h>
( S' X0 P/ G( O* Z1 ~3 a( I' |1 i - #include <linux/moduleparam.h>7 S+ O1 l7 m; e3 f5 I# z+ ]
- #include <linux/sysctl.h>
. c. [' T* U% d" ~3 d - #include <linux/mm.h>
; `/ V8 U( z$ D$ r% @; S - #include <linux/dma-mapping.h>
% O. G; P; g# Q9 g
9 g* V. \: Z6 J) ?# |- r- #include <mach/memory.h>
! h* I3 a" G7 P& R. l7 _ - #include <mach/hardware.h>
% D/ @. G0 @. V2 t4 b+ [" ?; |0 t - #include <mach/irqs.h>
/ g2 d& F, t; h ^5 P. A; j - #include <asm/hardware/edma.h>% Y' a G* [1 Y% z, p; X/ d
$ Y+ b& J2 P& u$ }5 Q* q) x, L- #undef EDMA3_DEBUG# B8 W# a: k r, e# @
- /*#define EDMA3_DEBUG*/. F- Z9 v4 y& b! k" |" [6 w, [
" o& ]: M0 C/ K% T- Y- #ifdef EDMA3_DEBUG9 S' o3 f* G4 Y7 I w1 \0 u
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) L$ ?1 f9 t8 p
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
* {# T6 T/ s1 L9 k - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
( ^$ i( Z5 I0 I" ?( v - #else
6 X) Y x# d: ^( _& j3 ` - #define DMA_PRINTK( x... )
5 k; w0 v+ z H5 j) z; L - #define DMA_FN_IN
* @# U+ Y% A' p1 D+ \: B( T* Q1 D - #define DMA_FN_OUT# U; O; S/ {0 Y. C* E; q8 `1 `2 L
- #endif
+ Q1 c& Y/ z: g- w, ~5 z, g - & a X( J6 Q+ U+ Q' N9 b
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
: f; G" l2 _2 x+ J3 ~: s" c' s) U - #define STATIC_SHIFT 3% c. }8 ]4 @$ k/ B+ x3 c4 U
- #define TCINTEN_SHIFT 20) A5 m, g/ I4 s4 k8 o8 t
- #define ITCINTEN_SHIFT 21
* U! F5 z8 G4 p' p - #define TCCHEN_SHIFT 22
( i6 r6 ]9 o( g0 V, O - #define ITCCHEN_SHIFT 23+ g) K/ D% _; c J
; B) I: B# w" q0 z; I! V$ l" u- static volatile int irqraised1 = 0;0 I' M8 c+ O2 P% ~+ O! V
- static volatile int irqraised2 = 0;4 Z9 s( o1 c: a1 b2 f8 d
+ ]# K+ Y3 w: X1 G+ I8 l- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# o3 \4 W! F. e0 E6 }
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 y! p9 s/ z# s; I d - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! ]* \% g8 b- B
/ W+ b6 o1 Q9 v6 E6 f- dma_addr_t dmaphyssrc1 = 0;& |9 _% t) N3 Q+ J: p8 W
- dma_addr_t dmaphyssrc2 = 0;
) G3 ?5 ~3 G$ e) w8 y3 A* A7 x Q; n - dma_addr_t dmaphysdest1 = 0;' o0 k! W U4 L
- dma_addr_t dmaphysdest2 = 0;
7 P6 N2 `5 W8 j& o - 8 D+ V; K! W' X, F- W% B
- char *dmabufsrc1 = NULL;2 b8 h: b0 Q# }4 w' a" q6 w: R# Y
- char *dmabufsrc2 = NULL;
& u" n8 P+ r# E M$ j - char *dmabufdest1 = NULL;
0 R6 K2 u- c5 i; i4 j7 R - char *dmabufdest2 = NULL;
/ u& L8 l, Z1 F% X - ' U! t+ N! o, ]/ q1 }' V0 j W
- static int acnt = 512;
+ c- R7 T5 }; Q( w& ~) g - static int bcnt = 8;
+ y3 X9 d. i3 n7 X4 \3 m. f( \ - static int ccnt = 8;
' f% }8 X/ p4 a+ ~5 z1 r& ]! n1 g6 X
( F% k% z* u8 r- module_param(acnt, int, S_IRUGO);. P W# T) x" H$ C6 Z1 h
- module_param(bcnt, int, S_IRUGO);
` m( |/ T( p7 W - module_param(ccnt, int, S_IRUGO);
复制代码
2 Y7 R/ G3 y9 @( A
8 m5 y f% ?! C( }; K# v" E 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: f: b! T: y% l R' H3 e0 m
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ H P& Q M [7 v! S4 O. V l7 _ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* l* r' g6 t1 @4 j3 s' ?. Z; X+ c! _; s: ?' O f$ y- i4 ^! H1 K, w( W1 b
+ ~" E9 j1 G& K; v
|
|