|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( k- z2 u$ v! p1 _& S( R( V
- [code]EDMA sample test application
: G. Y0 `4 l% w; I7 X* @. t) E6 v - /*
" z8 B* l% s6 n& Y8 e - * edma_test.c
; \9 S8 Q; [! Y4 y& @: L - *
, ~& K- C* p3 H* O; s# q - * brief EDMA3 Test Application9 | p' h J$ h8 C; C
- *
( {& G2 r/ t2 i) \. T+ Y) r - * This file contains EDMA3 Test code.
' w/ \ A4 C7 j A! n+ l - *
8 q% _2 I, r: |. e5 M - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! W- f6 i" R; N9 r/ Q) ~
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ C* i0 c/ P0 O% K
- * TO CHANGE.
# u2 P3 O. {/ X0 Z: W# I - *2 c% O* R7 }* @9 q) z4 k: e
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 ~2 Y: z3 J: t. X
- *$ {6 e1 v; l7 u( j! p( \9 a
- * This program is free software; you can redistribute it and/or
1 }) l% i1 t3 }2 N - * modify it under the terms of the GNU General Public License as
6 W: }3 X9 X/ Z4 ^2 S# | - * published by the Free Software Foundation version 2.
; O% R! E1 C: W% w& Z. R - *, O: G# [) o: k$ U2 O6 }
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any# }9 D5 {0 r4 h @6 r
- * kind, whether express or implied; without even the implied warranty
0 Q( l1 V% D% c' t" k- M8 ~* g - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the! t0 l; C' S5 d$ G8 G7 M
- * GNU General Public License for more details.
+ Q0 Z* |# V; u5 D - */- F2 v! m; q! s e" [
- ( o4 F* Y* R1 s- Q- Y5 ~+ w
- #include <linux/module.h>. h8 J' @ D$ s( [* y( y5 [% q: [
- #include <linux/init.h>
( b8 z5 W; N& R, W - #include <linux/errno.h>
. ~" X+ [$ s9 K* ]( h - #include <linux/types.h>
6 l# u$ D$ s! d! f& h - #include <linux/interrupt.h>
, R; B3 ~9 Y6 A4 Z; c" F& ~" W - #include <asm/io.h>
1 N( S0 O4 B+ t) z- g - #include <linux/moduleparam.h>
. `2 I$ q- a4 \ - #include <linux/sysctl.h>
, e0 W' h8 f# Y. b0 E' K - #include <linux/mm.h># p- d6 o& G6 n
- #include <linux/dma-mapping.h> J5 J- ]9 ?8 J- j# a+ V* [* P; @
- 2 v s+ u6 M, @6 T4 v
- #include <mach/memory.h>3 x! e% a: Q* N1 D
- #include <mach/hardware.h>0 J" g& _$ |3 y
- #include <mach/irqs.h>
m3 H& R6 P; E# `8 K - #include <asm/hardware/edma.h>2 y: K1 ]* O! N0 `/ V3 A; b
2 a. y. ?) C8 q4 x6 [4 G" W: l- #undef EDMA3_DEBUG( Y5 F$ m6 ^" P3 R' i( E
- /*#define EDMA3_DEBUG*/6 D) p3 B0 l, R
- # h3 |- j8 A$ {5 W$ D9 ]
- #ifdef EDMA3_DEBUG
- K9 a2 Q, q( x s( _' Z$ a - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) P( n1 S0 Y0 f+ [9 q9 }* N, t0 z
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 d; y4 N, Z4 x i3 o7 }
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 `) G$ j1 A+ q& U$ }$ A' i6 }
- #else
" ~: ]4 g' D1 I) E/ p+ n/ K - #define DMA_PRINTK( x... )
" e' B$ a$ a3 ~) l7 U. u9 D - #define DMA_FN_IN
" f) P; L. G/ }& L - #define DMA_FN_OUT/ F6 F" F/ L( N: ]$ m( \
- #endif- v+ |- U0 C [' S8 D& H
3 k/ j' E" g, p! g/ l- #define MAX_DMA_TRANSFER_IN_BYTES (32768)+ p, n, z0 E8 _( j# g' h- H3 c7 ^
- #define STATIC_SHIFT 32 ?$ D0 B7 B& ?4 C8 a2 h8 W' X8 v9 U
- #define TCINTEN_SHIFT 20
: o) i2 `& h1 |: `8 w* v- s8 F$ T - #define ITCINTEN_SHIFT 217 X4 \/ o/ I! D6 ?" R
- #define TCCHEN_SHIFT 22
! @8 O( b7 s) x: H - #define ITCCHEN_SHIFT 239 k/ \* B! G+ Q8 R
- 8 ~4 B* |# T$ P4 k/ p( K1 p
- static volatile int irqraised1 = 0;
# v# y% W" S/ ^+ D8 V" L - static volatile int irqraised2 = 0;7 v7 \, i6 `2 I5 e. L, \5 {
- 6 E. j% L# I6 i8 @; { Q
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 s; r4 f# ^. @! Q: L' { - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 B* |* J5 g( k - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* A9 B7 m' N4 `+ ~0 I
/ S0 a% v/ J0 L' [3 T- dma_addr_t dmaphyssrc1 = 0;, a: u. K* U4 z6 T6 [- Q- p
- dma_addr_t dmaphyssrc2 = 0;( C: d! o# s4 J" ]9 O
- dma_addr_t dmaphysdest1 = 0;/ w" J! n5 s+ ^ K9 v& g) q( x6 ~
- dma_addr_t dmaphysdest2 = 0;
1 L. x# M( b0 U- [- X" {! ? - B8 _8 I$ F& c
- char *dmabufsrc1 = NULL;
9 {0 g3 _: N j* {* ? W% h - char *dmabufsrc2 = NULL;1 _4 A: U1 S1 K- q9 J
- char *dmabufdest1 = NULL;+ \8 z* M- o, S8 t
- char *dmabufdest2 = NULL;
. a% |% o: i: l! k/ T1 d) l: K - / }. m) L4 W- a3 ~1 }0 y9 {: m8 T
- static int acnt = 512;
! p S! q! L8 t& a+ z0 \% y - static int bcnt = 8;
" F u7 B' O- m# A3 A0 k - static int ccnt = 8;9 C$ G1 O$ o! r3 z
- . J# i& n2 n$ y- W' G% v& Z$ p
- module_param(acnt, int, S_IRUGO);
( `- M5 {' I- S& k% S0 n1 { - module_param(bcnt, int, S_IRUGO);
: l; J: I4 t/ [$ W - module_param(ccnt, int, S_IRUGO);
复制代码
$ x. U8 ~" g( X% U! {3 E9 _2 R g y' O
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
w+ _- k L6 K4 Tarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 r# E$ u, M+ O3 X+ A a: W3 m6 @
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, z* `* y0 @0 V o5 b
, X/ l8 \1 R: g1 o# M- `
* _) K5 P5 l/ Y+ u$ a1 ~+ m! B
|
|