|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 K; m' K- S) k; L) k- [code]EDMA sample test application
' t: ^- o. f7 } - /*
9 V) {# O T/ H- k* c - * edma_test.c3 M' o! t7 [4 B' H) e
- *8 R+ Z1 ^+ _( H4 k( M
- * brief EDMA3 Test Application1 R: S0 h2 g! w' c
- *2 f$ H; T' I5 ~9 G6 ~1 @, t
- * This file contains EDMA3 Test code.; P! L$ R r7 b: O9 j. L1 o& u
- */ M* J, E& g# G. C
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
+ P$ r) K# }! B e5 ]7 i" d - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; C& F; H: T5 `% r6 t
- * TO CHANGE.
; K# }0 c! w3 H/ z- N& B/ M" ?. G - *
3 e+ I5 I" j. J5 s( |: w - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
- F0 h0 y7 K- l! b0 h* ^ - *
1 w1 S4 P; C% ?, l- a4 m) Y - * This program is free software; you can redistribute it and/or9 t8 x- G8 b# D. [
- * modify it under the terms of the GNU General Public License as
1 d7 a) y( ~0 r) w @' h - * published by the Free Software Foundation version 2.
1 _9 |8 i* c" [& |. E$ { - *" v9 g3 u3 B: A7 O
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
( g" s+ D/ L9 ~( i7 w. h. N/ `/ x - * kind, whether express or implied; without even the implied warranty$ G& M6 @$ r4 u( x9 a i3 E* r- w& _
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the7 l/ N% G' ~. j _% n. o5 ]$ V5 |
- * GNU General Public License for more details. N! I1 J; Q5 l: C
- */
: r( Q3 I/ N/ f' l' u - ! O/ n: v% b# s, W
- #include <linux/module.h>
6 V: d5 V6 B1 @, Z. G- j5 e# B5 z - #include <linux/init.h>
; o- @; ~; x) |. h - #include <linux/errno.h>+ H( c) ?6 r6 \1 p0 `4 Z. P( L) E
- #include <linux/types.h>
! [: ^0 |9 X7 q+ n5 L# r, v( \0 H - #include <linux/interrupt.h>
$ \: n1 l( ~* U, e* V( c% t - #include <asm/io.h>0 O' e: D. a: j: A- k
- #include <linux/moduleparam.h>/ i% G1 n/ {/ e5 D4 C1 h
- #include <linux/sysctl.h>
# j4 W3 {# z& O$ C3 f N - #include <linux/mm.h>
: R' R$ |( g" `; D, N& r - #include <linux/dma-mapping.h> O$ |, t: c+ H
- ) l3 ~# P9 O; C
- #include <mach/memory.h>1 v3 R1 ?! A. T7 d
- #include <mach/hardware.h>: _3 h$ W' {4 a- h, R+ d
- #include <mach/irqs.h>, Z3 Y( r5 O3 {; T3 D
- #include <asm/hardware/edma.h>8 z! C+ j2 n6 s+ @
6 m( J' d4 ~- \, A; a- #undef EDMA3_DEBUG
1 s( u- m$ s; P1 f7 H6 u4 f0 v - /*#define EDMA3_DEBUG*/
) S+ f F, v f! Y0 H$ u - ; e: d& c! H I- I0 k2 N
- #ifdef EDMA3_DEBUG* m9 Y* M! B. \3 u% s$ ~
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 @( ?% O5 }; V% }4 v, T( f
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ u5 T! }0 R- ^( O* O* y
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 t8 Z( q) z5 S5 t0 u9 n
- #else, x+ \, N4 F3 l: q1 Q
- #define DMA_PRINTK( x... )
. B6 r8 x& ?$ A: g# Y- g d5 M* v - #define DMA_FN_IN
& L: J2 {7 O) h2 v$ s - #define DMA_FN_OUT
4 d. }0 s0 k' [1 H5 I6 s - #endif! x! t* F: d8 g( A( r
. T Y$ I$ c( |# [9 R% s- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
5 e) F \% E$ l2 [# @5 e - #define STATIC_SHIFT 3. o8 Q5 V- [, q. V. A" I$ `
- #define TCINTEN_SHIFT 202 w* D7 ~: a# `" k& a
- #define ITCINTEN_SHIFT 21. R% c7 M# w9 c; Z$ P8 X
- #define TCCHEN_SHIFT 22& S- j! A, o9 ^
- #define ITCCHEN_SHIFT 23
' Z7 l8 ~0 E( l6 R7 j$ ?) x* P - 4 B- x, D' D4 Q1 [) f
- static volatile int irqraised1 = 0;; d6 m' e- Y7 M
- static volatile int irqraised2 = 0;' i" W) a/ p4 U7 w0 E9 j
2 Z2 w, f, B( K( c6 ~# B- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; u& Y: g0 w7 F
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& {; H/ f" W$ h, T+ f
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, p; `) q# T* E7 x+ E" I) y* F/ g
( y) { F, C+ {$ i+ ~2 l, b7 w2 `/ n- dma_addr_t dmaphyssrc1 = 0;
6 i( v& t- @6 E# c - dma_addr_t dmaphyssrc2 = 0;
2 T; A( O9 F+ I/ i) V' R' q - dma_addr_t dmaphysdest1 = 0;
s$ v! L" m. o$ }! H+ [ - dma_addr_t dmaphysdest2 = 0;
' y: B0 {3 s% _/ M( i. N9 o
) n* z" e& P* h3 ~+ i0 y- char *dmabufsrc1 = NULL;
5 E, P" D: i% i. g - char *dmabufsrc2 = NULL;
4 Y$ V' `' Z( j& l - char *dmabufdest1 = NULL;, |7 g. h" B: P |( P
- char *dmabufdest2 = NULL;
$ b0 x w4 p- C - ' n! A+ g0 y+ m; t
- static int acnt = 512;# K. s. B& ]: ]9 R" P( j/ |. S
- static int bcnt = 8;
9 R+ [. _+ |. _. G8 t) [ - static int ccnt = 8; D! F# _- G% T5 G
. C4 y+ c' e% \7 ?- module_param(acnt, int, S_IRUGO);
3 d. W, O8 J0 w; q7 @( ~" o - module_param(bcnt, int, S_IRUGO);
y6 L( \# U: |+ h6 V1 \ - module_param(ccnt, int, S_IRUGO);
复制代码
4 o! g) ^- C: T6 l" v9 O Z; O6 Y5 S. e; m: u
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用 j2 P) K v! P# h
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. a1 i: Z7 b! T$ d& j2 K) K5 H5 k! m 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& Y+ R8 c j& i+ ~' |7 H1 Z' ~* _
! f/ L# D' }* `8 c1 Q
" s. n0 i! a2 I: T! p |
|