|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , e, R" S) [! O w% `9 M: Q
- [code]EDMA sample test application
& f. S/ v+ k3 q - /*) B1 n# |- Y. s; ^* r3 n% [1 [; j
- * edma_test.c
/ }8 X& A3 J7 ?. }) j, M- W - *6 N4 U+ M; L9 y! r, {
- * brief EDMA3 Test Application3 I5 l. X: f+ z" h4 Z
- *
: L4 |0 t( c% T - * This file contains EDMA3 Test code.
, t- R* r: C. h& I% _ - *+ A; U) f3 a: u$ p8 R) P* S4 k
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ _: \7 b4 Y/ y* } @ I- F
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
i8 Z* u: y; {* p% S5 m: r - * TO CHANGE.3 R8 J& A5 f* c
- *
% x- [3 f% b5 B3 x9 }. w - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
3 v0 m0 S$ |% l - *
' T2 x+ |: s6 E3 F6 a$ J' K - * This program is free software; you can redistribute it and/or
1 I2 b0 P7 ]" ~# i, { - * modify it under the terms of the GNU General Public License as
, u; B6 K# Z, x9 F0 D6 e - * published by the Free Software Foundation version 2.9 W K' P8 o8 z
- *
! ^( e! Y" U/ v0 l0 O# e; t3 K - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
) y8 S9 z1 L: L* [7 `8 }9 b - * kind, whether express or implied; without even the implied warranty x! R' Q1 u7 u6 N5 g
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
" e% H R9 m2 d" F1 R0 `3 t# X. J; b. Y - * GNU General Public License for more details.
9 J) k( H/ [5 R* Z6 Z; a9 @7 i - */* ?2 z- h- h/ h# ^, F* w9 R
- 6 h6 ?5 o3 }3 O. I; x
- #include <linux/module.h>: i& T- b: R% Q; J7 z
- #include <linux/init.h>5 `$ G! w# [9 Z
- #include <linux/errno.h>+ { q2 L4 J& Y; S
- #include <linux/types.h>
' i4 a' j ^) o - #include <linux/interrupt.h>
/ y8 C2 x' p; N- u% s- c+ w0 e$ f - #include <asm/io.h>
# [) {& k* x/ |9 K8 X/ D2 x - #include <linux/moduleparam.h>
% R N6 N4 `: Y; M/ L - #include <linux/sysctl.h>
6 B& \1 M3 J# G; O C8 F/ { - #include <linux/mm.h>
5 m# n9 r3 W1 v% H9 C m - #include <linux/dma-mapping.h>
$ X7 i6 }: w0 e, t( W: j6 l
8 p6 g. a" h* m- #include <mach/memory.h>! w `. _7 m, A5 }8 K
- #include <mach/hardware.h>
3 ~: S9 i$ W! L ? - #include <mach/irqs.h>
* h# R3 L( I' ^6 d, c0 ] - #include <asm/hardware/edma.h>
- E8 O5 A. X: o+ C" B# K0 R N - * P% j' E! ~, [! ^( X8 @# N* n
- #undef EDMA3_DEBUG
3 J% I7 i" a* z4 n9 I8 c' j x6 \( D8 S2 Q* } - /*#define EDMA3_DEBUG*/5 H( w3 v' a: @# j p# t
* A/ S8 p0 R: X; ^! o+ q n% n! j- #ifdef EDMA3_DEBUG5 N/ w1 W# M: y3 Y: [5 i
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
7 L+ d% c" l' Z' g. v; ] - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
: M* z) G3 A" J, _/ t - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
9 ] ?/ `& E5 N! I& @5 [5 |. a - #else7 Q* y) |$ K* V/ g
- #define DMA_PRINTK( x... )
& D6 y( d8 R0 f9 O5 o - #define DMA_FN_IN
) z# |1 z# d4 `9 c - #define DMA_FN_OUT
- d( {* K, v/ w. \9 e+ ?5 K" C - #endif: ~# p, e& H, B/ R9 J4 I2 }
/ J" M2 @1 D9 ?7 `+ F0 [7 I5 L- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
% S+ d L! M* J! J/ u - #define STATIC_SHIFT 39 K6 N9 F; y8 P K% m0 p7 D
- #define TCINTEN_SHIFT 20
# b: y o# x5 S8 `" l* E# C% H - #define ITCINTEN_SHIFT 21
3 {; C5 G: G- c' H) a: t - #define TCCHEN_SHIFT 22
2 ?9 t" M) J& U/ B& }. ?8 Z) D# N - #define ITCCHEN_SHIFT 232 r! }# b2 {4 m
- 4 q% h. K" e) `* Y
- static volatile int irqraised1 = 0;5 i; u; G7 S- O6 [! r U P
- static volatile int irqraised2 = 0;$ O7 G" O% L0 ^$ t# r
7 I# f9 w7 V$ T6 t5 r- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 Z- u: s7 |7 k& X& h# l I
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 A `/ p9 k! F
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( M3 v' A' i3 O* q, s2 A1 ~ - - c8 [8 d ]5 j0 z, s
- dma_addr_t dmaphyssrc1 = 0;
) k, h3 n- `2 w! R% y2 [3 y - dma_addr_t dmaphyssrc2 = 0;
8 D4 Z& \) X1 X1 P" W - dma_addr_t dmaphysdest1 = 0;0 d& P( Z5 J: ?8 }0 b
- dma_addr_t dmaphysdest2 = 0;2 W) Z3 d) c7 ]: X: Y
- j6 l" T5 Y7 k) j4 `5 L. ^) S- a- char *dmabufsrc1 = NULL;/ t9 a* p" q, i1 u8 F5 k
- char *dmabufsrc2 = NULL;
/ M- O& i! u" D0 \# v% E - char *dmabufdest1 = NULL;
& T0 A( s! A) J- k6 `8 ?( o7 T - char *dmabufdest2 = NULL;
9 \" ~' q) r9 S, T
1 r. d8 A8 @" p- static int acnt = 512;5 b+ q) ]7 t6 |* G* q' \5 B
- static int bcnt = 8;+ S% Z9 ? P3 P6 b X! v
- static int ccnt = 8;
$ L, O: m! g G+ x w% [( u0 i
4 l- j. C' w7 k; `5 Y: A& {- module_param(acnt, int, S_IRUGO);( q/ ?- \- L2 @ F
- module_param(bcnt, int, S_IRUGO);
5 I1 c8 e" a5 B/ H - module_param(ccnt, int, S_IRUGO);
复制代码
% Z/ [% F' G3 c% j
4 s% J, L, H" K* G! K. { 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, O8 E) u8 [: D* C" Qarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ k4 e: |9 w" j" ~# s5 e! `5 n 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 @. t2 v, ?5 P' t, ^
4 b, s( a) ?# E6 J) s# B& D; U& a$ N
|
|