|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) d2 @8 e$ W, h/ w# h4 v+ j f% d, D
- [code]EDMA sample test application. M ?9 J% H. j
- /*. U0 V! O- W4 D+ \
- * edma_test.c# _6 G" i. T5 i, O
- *" S2 t( N# ]; x9 L# M
- * brief EDMA3 Test Application
! p0 b2 `, c( ^' o: T - *
5 v( q9 W# d+ f: T2 o# I7 Z - * This file contains EDMA3 Test code.
5 E+ y% s4 V: U# k - *! _; ^. R8 a9 b* K4 K
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
0 u; M8 H& ~- E$ O - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. n: |6 ~, G( S6 \% n4 D
- * TO CHANGE.
, |3 f8 k( f. y/ T2 {! J - *
7 M7 N" Z/ Q. x - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
+ V8 i2 R) |7 ~& i7 v) j1 h! B - * z' H7 o- n# J6 A$ x4 Y5 K
- * This program is free software; you can redistribute it and/or& J3 r: S) ]& K" h4 n, p6 l
- * modify it under the terms of the GNU General Public License as
" j/ ?8 _$ [) d {, B, M/ E - * published by the Free Software Foundation version 2.
& @" J6 c9 ^+ J: u [5 Z! i8 h - *
: t3 H; d6 p1 k# | - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
6 [. ?. q5 e+ l$ y& }+ E - * kind, whether express or implied; without even the implied warranty, B- ~- ]7 ?7 Y( e7 w5 j7 w8 a
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% F' z# c1 q3 Q% L9 { - * GNU General Public License for more details.
/ Q" e7 E" ^! o# u0 p' G6 a! b - */
! G8 o, ^2 p6 f7 b - 6 C6 n7 K3 @. F5 ?; I8 W
- #include <linux/module.h>
G5 B5 {2 G7 ^/ g Q7 e7 B - #include <linux/init.h>
0 p, m4 ^! {% r# N - #include <linux/errno.h>
9 I8 J- p6 {* |: K* G - #include <linux/types.h>( W( n7 l4 d6 L0 J: ]- r6 `2 [
- #include <linux/interrupt.h>
, s; E3 x- E$ T& _7 N, `4 u, H: A/ Z - #include <asm/io.h>2 n0 \/ l- d8 u6 D3 G; U: p) g
- #include <linux/moduleparam.h>
, e8 R% k( q) G; |8 l, [8 @; `3 c - #include <linux/sysctl.h>
6 Y y" z; Y2 J; g G" k - #include <linux/mm.h>" ?! O7 Y) b( q5 k/ O- @
- #include <linux/dma-mapping.h>
; b$ s# P5 k' H( F; [
" |7 O! y' K8 E& G* [9 d: B. M5 C- #include <mach/memory.h>9 }/ p* L' A! T
- #include <mach/hardware.h>
/ Z+ {# K1 ^, i" b& E( J- m - #include <mach/irqs.h>* x, J& _- k$ q/ q. L% ^
- #include <asm/hardware/edma.h>5 q- _6 y6 p; l* B
- $ N% ?: n4 A. E6 M1 w6 O
- #undef EDMA3_DEBUG
4 Q6 @4 e% `/ d# ?/ J. P - /*#define EDMA3_DEBUG*// ]1 q/ Y9 x8 P# N0 s% k7 A
- 6 m. o: ?3 E# o6 p
- #ifdef EDMA3_DEBUG
* u; y8 ] ~1 F; s @5 v9 _9 K - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 T! ?4 j7 x- q( a3 Y) j
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__) ?: _$ [2 n& x# m
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 F9 t1 O& b/ `- e L3 B
- #else
( ~ \7 W8 s% }: u. X, x - #define DMA_PRINTK( x... )
$ _% |, `" k9 X" T) S - #define DMA_FN_IN* h9 F* r3 A* ?* G: r) E, N" r" X7 j
- #define DMA_FN_OUT5 A3 m9 V6 d3 ]; k/ g5 m# J
- #endif
x: X( g8 z1 ?* h( a
9 G" l7 w6 D/ X) C7 I9 z- #define MAX_DMA_TRANSFER_IN_BYTES (32768)* w3 G2 f2 y. _0 Y1 n
- #define STATIC_SHIFT 3
7 [5 `. V- G2 y( r3 Z - #define TCINTEN_SHIFT 20: Q5 T0 I) Q$ }/ m! u; N2 X
- #define ITCINTEN_SHIFT 21
6 Y) q" v0 s! p0 B# W' ^) h - #define TCCHEN_SHIFT 22
, ^- f+ a/ w" W+ v' e - #define ITCCHEN_SHIFT 23# I' w. w* M7 j4 a$ L( i% O) X1 e
+ ?+ k, m! G* q5 H/ A- static volatile int irqraised1 = 0;, T6 p# f/ A5 m
- static volatile int irqraised2 = 0;
$ X) J. }+ J ]+ ] O
9 y5 V; D8 Y; p# u0 P- N- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 q; L6 d# e0 ]+ U/ t
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: u A: r) G r. l! [' J/ p& k4 \1 H - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ i. E. Z* m! W) O% `
0 m4 T6 j6 O1 `% r: H2 Q- dma_addr_t dmaphyssrc1 = 0;
7 S' F2 @. t( w& D, H& c' x) n. H% I - dma_addr_t dmaphyssrc2 = 0;
& Z/ K' M, a5 a$ | - dma_addr_t dmaphysdest1 = 0;
( ] e: _- f6 N/ q% Q - dma_addr_t dmaphysdest2 = 0;
8 C5 o$ j1 j o. y - * N" v! D+ m4 R8 ~1 D3 k
- char *dmabufsrc1 = NULL;
9 E* y) }/ S( U, X4 _ - char *dmabufsrc2 = NULL;
* `" Q/ e$ F+ S$ g# u$ [ - char *dmabufdest1 = NULL;7 @3 x+ g' ^+ G. Q
- char *dmabufdest2 = NULL;2 V8 k3 z" f7 u9 J9 {! B% n, {
: _2 Q" [3 d, a- static int acnt = 512;
% s# `; f1 B8 M- y - static int bcnt = 8;* F4 Y+ ?5 {& o* p
- static int ccnt = 8;
5 S+ v: R& p2 J; f; Y% v& ^ - 4 z* N* c! E O& x, N0 C k, E
- module_param(acnt, int, S_IRUGO);
! q. Q1 a& O1 @1 G - module_param(bcnt, int, S_IRUGO);8 X; m9 e5 h: r2 ?; p- i* y
- module_param(ccnt, int, S_IRUGO);
复制代码 ! H- M) {: x$ I3 `7 }- V
! ?- Z7 f! T# e9 D6 T: h 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ ]6 Q; t$ H6 n$ V; e- t
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 U7 g1 N9 p% z& b i1 W$ P
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: {( F. q5 ^$ O$ H1 X8 m6 Y
( X! b- O& | G0 u# M* p9 z; F. U
) e* E6 i# H3 s, {. l |
|