|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 _/ [3 C1 {0 Q- ^# b0 a6 _8 x$ |, P- [code]EDMA sample test application
; _. L! I: B/ Q4 X {) f - /*
- H* } ^0 L0 E2 Z% O+ F - * edma_test.c6 Z- O) g6 V ?) I: }
- *
& @1 h0 P0 ]. P- ]2 i - * brief EDMA3 Test Application& a6 R; q5 N( w& x* m
- *" s& O3 @6 J$ b( y9 z+ c4 A- B
- * This file contains EDMA3 Test code.: s/ G. D1 n- | I: J
- *
8 f$ g( G) B9 X K - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 s" x2 R3 g0 L6 w
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
$ I9 t! v# w4 U" @9 R - * TO CHANGE., J/ _+ g% P, d
- *
. b) ~' c; t# U$ s7 p; u$ W - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
. Q7 I: ` p7 N4 l9 T, A8 I - *
8 @+ j0 ?& F8 V+ i8 [- I2 M - * This program is free software; you can redistribute it and/or! V1 \% ~6 p i1 t) Z
- * modify it under the terms of the GNU General Public License as9 a7 _. e$ i! ^% I+ c( } |
- * published by the Free Software Foundation version 2.6 u% o; K( j5 X$ t. ~& O" B l
- *
, M4 @. s" v+ \/ N - * This program is distributed "as is" WITHOUT ANY WARRANTY of any% Y R& _- M% C8 V3 r
- * kind, whether express or implied; without even the implied warranty% Q2 ~* h9 ^% ?& I2 F( ^
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the/ E& `# A b m# W- `& @
- * GNU General Public License for more details.* {8 d- b( x8 s$ N( I2 e
- */! n# T2 M, ^% b" m4 u. k
' X0 _% P% P3 u- #include <linux/module.h>9 R. ]5 S( @9 g1 i1 U3 H& s
- #include <linux/init.h>
) n' o4 \) u6 m, X0 ] - #include <linux/errno.h>/ _6 Z; p1 A6 Y* ^1 u3 S- `
- #include <linux/types.h>
+ @2 ?. k& [ q& z% |' |$ Q - #include <linux/interrupt.h>: Q4 A4 j+ x' B# A& L' z
- #include <asm/io.h>: V" |* ^4 ?) O2 {: ^& X: {6 R# ~
- #include <linux/moduleparam.h>
8 e! I/ r7 [% K* B/ E' Q - #include <linux/sysctl.h>8 `; Z8 A0 i. `1 ^* e
- #include <linux/mm.h>
( N7 P L9 w/ X/ [ - #include <linux/dma-mapping.h>
0 z5 S. F" l- P+ ^' E: |+ X. c3 f" A, ?
- f, t- h8 o6 s' i: o& @" [% G- #include <mach/memory.h>8 }2 M( j7 H4 N; f
- #include <mach/hardware.h>
$ R7 z7 W ?# v9 n- o - #include <mach/irqs.h>0 U- g- [ O2 r0 Y# [
- #include <asm/hardware/edma.h>
& Y, p7 b/ G2 \4 Y7 i
/ x8 l) O% R. ~- #undef EDMA3_DEBUG' z# ]! n! f6 F( U
- /*#define EDMA3_DEBUG*/2 c2 h8 t' c& \1 E
- " i1 s2 e6 J6 k- Q# G
- #ifdef EDMA3_DEBUG: C q3 Q5 R; |
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
# Y4 ^7 k& D4 Y7 p% T - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 u* A( f6 ]* t$ ]7 Y1 y3 `
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 M- D2 H" @3 H) a3 E# `
- #else
# x$ f7 }" Q- v4 ? f9 g7 z - #define DMA_PRINTK( x... )
) ^0 O* I( t F2 Z6 @# t - #define DMA_FN_IN
8 I' H! x2 ]$ R( b4 P - #define DMA_FN_OUT* l7 B: W+ v6 z5 x+ G
- #endif
U2 J# M; F6 K. J$ r/ f - : a B8 }7 B5 s# ~- Z
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
0 M; ?! C; L/ f! B - #define STATIC_SHIFT 3* e* e: o' |! e* ?" a! k$ G
- #define TCINTEN_SHIFT 202 e+ z# @9 \7 L' b. L( P; \
- #define ITCINTEN_SHIFT 21
b; z# @8 ~! s/ ^ - #define TCCHEN_SHIFT 22: G# O' X) `% _) w
- #define ITCCHEN_SHIFT 23
8 R! t6 i2 ], ], H0 d
4 O5 p- p5 _4 X9 X- static volatile int irqraised1 = 0;. I6 i- j- P, m% c* g
- static volatile int irqraised2 = 0;
! m) t; a# R7 }3 ^
# q6 E* B T9 Z7 I2 D$ ?8 `. T- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 V% S& x' ~, M/ Q2 p, M1 S - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 p# d! S$ G2 u2 P - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 L4 x' b6 ^; L' b! `
3 ]# N5 J, g+ g/ m( Z- dma_addr_t dmaphyssrc1 = 0;
. _8 t2 Y5 O- a% | - dma_addr_t dmaphyssrc2 = 0;
) d- L; G% P5 d6 k; {# ~/ J) a - dma_addr_t dmaphysdest1 = 0;: u; s/ ^) f: V& S8 @
- dma_addr_t dmaphysdest2 = 0;
. V; P( R8 {' g; x. H2 r. l( d+ t+ O
; f ~0 D a, @; K9 E9 F' @+ q- char *dmabufsrc1 = NULL;: q. v4 S7 K& D
- char *dmabufsrc2 = NULL;5 E! Q* d+ O1 D4 `# Q. J" w0 @
- char *dmabufdest1 = NULL;* s U+ r$ S! f
- char *dmabufdest2 = NULL;
, s" S+ ^+ M$ x1 D - & W/ e8 {7 o0 R+ b, K( P
- static int acnt = 512;+ i) U9 h9 X0 e, @& H8 l
- static int bcnt = 8; B+ }. w" T3 S# ~! S c
- static int ccnt = 8;
+ {5 H, a) b* t m - / Z$ ^% K" l1 Q- w6 _1 [
- module_param(acnt, int, S_IRUGO);
3 T- u/ ~7 i/ g: V5 U - module_param(bcnt, int, S_IRUGO);. g1 f1 A. K4 Z& P
- module_param(ccnt, int, S_IRUGO);
复制代码
: f3 i7 U8 I( y+ q1 X6 {( ~; ^3 [+ e
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 B& t; a/ z5 A9 V+ u! Rarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* J' C! g- O8 }9 _( h
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 N' \/ [+ a3 D3 u! C2 ]* [: q6 W# S
# Y% ]9 n% Z, m; f8 F* ~ |
|