|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 s) w! R* M8 y- _' c- P) I- [code]EDMA sample test application5 e$ w/ t, K$ v N7 I+ C6 a% B7 |& |
- /*
3 ^- h6 J: I3 l# M - * edma_test.c% M) J: ]! h" _# H
- *9 X( r+ \6 i( H1 R' F! W
- * brief EDMA3 Test Application9 h+ g8 S p5 t
- *
! T, E) l& A" F* g% ` - * This file contains EDMA3 Test code.
' t+ q- _ q& t. U - *1 W# z* I: u/ w6 F$ q& _4 z& ]
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 m$ x( _& e: o8 k/ ]" i3 V L
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ q- l" W1 @9 C
- * TO CHANGE.: q% u1 X4 w' F e5 ~( F$ M
- * d q" f8 A2 @% ]- ]' Y8 c
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; @, c% L" B: J5 g
- *
; g! D4 s* v1 J/ s. O - * This program is free software; you can redistribute it and/or, n, J* q0 Z* F# V) S
- * modify it under the terms of the GNU General Public License as6 A! S$ Z# _4 p. T! X
- * published by the Free Software Foundation version 2.
: T: |% Z5 u. ^+ u" K2 W - *; c. T. u, K1 o
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any( h( c% j+ T. s2 a" [
- * kind, whether express or implied; without even the implied warranty
/ X; O" Y5 h; Q/ c - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the) f' t& q# D8 L/ \# p9 t
- * GNU General Public License for more details.5 o+ s1 c# t) {: D0 Q( @
- */7 Y: e$ e4 ]$ i; m6 ~
% @ w4 h4 H8 M5 u- #include <linux/module.h>8 b b2 _* n6 \: Q$ Y+ T# u
- #include <linux/init.h>: d$ d6 D) S0 E& H6 b
- #include <linux/errno.h>8 E; ~5 v4 M. {# v6 a
- #include <linux/types.h>
1 W7 L% J; n0 Z! V: O - #include <linux/interrupt.h>
! v+ t3 A! w+ P( U - #include <asm/io.h>9 |- |$ f6 x. w @
- #include <linux/moduleparam.h>
& o. p. U4 t3 |. U - #include <linux/sysctl.h>) T k( H/ D" A9 y, A' M
- #include <linux/mm.h>( M/ ~, ^8 S+ [- B
- #include <linux/dma-mapping.h>
1 {5 n0 a( N' @! i- {, Z+ |
$ u" v& z0 _+ S! ~- #include <mach/memory.h>
4 A& g# h/ E3 o: {& k/ U, t - #include <mach/hardware.h>/ x0 F7 G ^8 d$ T! r
- #include <mach/irqs.h>
# N& K3 @. o8 }; l - #include <asm/hardware/edma.h>
+ f' N; L6 d! G* Z& b9 h7 ?
/ \& e% {/ p l$ v d- #undef EDMA3_DEBUG
$ y- M) L0 \: B - /*#define EDMA3_DEBUG*/, l$ C. D& q+ I- ?( L; q/ m
; U7 K) N7 X |* z- #ifdef EDMA3_DEBUG2 o' U4 [- E$ V7 _- o
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS) i1 z8 w2 i9 S. ^9 e
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- j2 I$ _& u7 U, R
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" x7 H/ ?; u7 Q) v* V1 [0 F# O
- #else0 m6 S# D' ~8 p3 V3 A# J+ D
- #define DMA_PRINTK( x... )4 i( ^1 _( z& ^; [3 X. b4 {
- #define DMA_FN_IN$ P! A F2 \4 m9 k
- #define DMA_FN_OUT
5 y; K f" u$ {7 k - #endif4 h# w6 `" L6 T4 V# i' s. M
- # b; F. J6 ]! y; C# X) p
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
# w: F8 l2 }8 ]1 a - #define STATIC_SHIFT 3
+ g, J1 {: l. f2 I6 Z+ k3 a5 U - #define TCINTEN_SHIFT 20
4 _3 \0 e1 B& `1 S0 [3 H! _3 H - #define ITCINTEN_SHIFT 218 o! G: e8 b2 F$ I2 p
- #define TCCHEN_SHIFT 22
: k7 R9 N: q+ M+ A - #define ITCCHEN_SHIFT 23
; m4 Z( }6 W5 m# E9 N+ G9 ^- f - ) y( r, O( _3 W# O& Q6 a& R3 c; f$ n
- static volatile int irqraised1 = 0;
2 K3 A' H. f% L9 V! l2 y- l% { - static volatile int irqraised2 = 0;
8 h- i7 K* S! [ - 2 d( d4 K+ W2 e) i
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 Z; _& ^0 { B
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- H9 o# x' t$ B" J9 G% o
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; h) ?( l" Z; D. n3 l) C' H% i/ x - 5 J' Q+ p7 r. {
- dma_addr_t dmaphyssrc1 = 0;% D2 e P+ N4 ~
- dma_addr_t dmaphyssrc2 = 0;2 v# O- I1 G/ _5 q+ P
- dma_addr_t dmaphysdest1 = 0;+ c* a: ?+ ^4 @! M& c
- dma_addr_t dmaphysdest2 = 0;
! ?5 _% R, G# n, `/ @- d) j
v8 q6 p3 e. E' n+ p/ V* |0 n- char *dmabufsrc1 = NULL;
4 T3 O8 _5 |+ v. U1 i7 ] - char *dmabufsrc2 = NULL;7 P; A3 t# Q1 N9 N" P
- char *dmabufdest1 = NULL;% x5 [+ X) F+ E1 R" i
- char *dmabufdest2 = NULL;
! O9 I2 s1 Z7 Q2 ] - ! m2 B! {, o" K
- static int acnt = 512; E: B: w4 J( M3 t
- static int bcnt = 8;
) [. X7 Z' o) T5 R, ^6 m! d - static int ccnt = 8;
4 V3 n, b+ ^6 d( S9 k - " }/ Z9 {) f& I; l! r, y
- module_param(acnt, int, S_IRUGO); ^8 x( Q6 s) G
- module_param(bcnt, int, S_IRUGO);
6 V, l$ K* ~6 U' b9 Z - module_param(ccnt, int, S_IRUGO);
复制代码
2 v1 R; [* J- M+ G9 Z+ n; M4 b, V; ^. S- B# ]% b# t9 d
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 R% U/ Y0 S# [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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
3 P$ L( d1 n8 t; l 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 a& o0 x& M+ z; J# B0 S$ _0 u8 R. k1 ~' }
2 N+ L8 O5 ^6 X |
|