|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ v, W# J3 ]& _ N. k" q2 m/ Z" g+ Z
- [code]EDMA sample test application
. {9 O. I$ q' H7 i+ M - /*
) d& x* h' b7 P& }' L3 G - * edma_test.c
3 B) D2 N3 _+ g3 y7 A - *
3 n( g0 I0 z' G# U. L - * brief EDMA3 Test Application Q5 n5 ^; m" v* ]- B M4 [% i
- *1 y! d0 U; o$ X8 W
- * This file contains EDMA3 Test code.
, f6 ]; o9 G. O7 ?$ i" E - *
$ i2 k: D) e( q' p - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 ?$ r- A8 }+ f. Y
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
l9 V% B) X0 R# C& B: Z* ~- [* [+ B - * TO CHANGE.
% p% C0 g& m( c- v* D8 f - *$ {/ ]2 B% F( V% \0 `4 K2 I+ b
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: Z6 K, i8 O0 z6 G! _/ o
- *
r9 [( i$ a7 e* J3 k" O - * This program is free software; you can redistribute it and/or
4 g& L! {/ W: u, o. Z, P; r" U - * modify it under the terms of the GNU General Public License as
0 y- X0 e) ?* P" r; } - * published by the Free Software Foundation version 2.3 g2 {6 f9 I1 z' n
- *
2 E# m4 q. Z5 y4 a& q - * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 M* m! T K, w+ ?1 r4 K) f2 `& A
- * kind, whether express or implied; without even the implied warranty
* d) f: ?" |& T" k - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
( n; `9 {2 {: }# M, m& D - * GNU General Public License for more details.' G5 g* _7 \0 z3 Q. t& N; u
- */
6 p( ]" |. y3 b9 M
+ I- Y9 X8 V( D( d- #include <linux/module.h># R/ q3 N% p. h* q2 I$ ]/ O
- #include <linux/init.h>0 H m- f( x2 M5 T/ p# Z( J+ m( e* d
- #include <linux/errno.h>
" _) P1 g( F( r { h - #include <linux/types.h>- p, v4 ]& L, V" f; a' k
- #include <linux/interrupt.h>
. x7 S; |' A/ L- T0 p - #include <asm/io.h>7 |& `! a2 D4 R2 B3 F0 S7 ?4 h
- #include <linux/moduleparam.h>6 ?/ K+ {, `, a, [
- #include <linux/sysctl.h>7 _5 k4 n0 I! J6 b( D# B
- #include <linux/mm.h>' h, F2 b! q- ~
- #include <linux/dma-mapping.h>: F: v9 k! e# @9 y
% Z Q4 B' I0 i. P# S- #include <mach/memory.h>
& c" N6 t8 F4 y a* z- ^ - #include <mach/hardware.h>
6 P8 C/ F9 _6 x' H; r. M- Z - #include <mach/irqs.h>: h1 T6 _1 _2 h' u5 D
- #include <asm/hardware/edma.h>
' T" l7 m# D$ j2 M
! c+ \/ n& I& T- #undef EDMA3_DEBUG
0 N7 R% h4 o5 g' X2 H9 r9 D - /*#define EDMA3_DEBUG*/
& O* Q) {3 K% Z( P( J
8 ~6 p. b J/ `) Y- #ifdef EDMA3_DEBUG
* R$ {, f [+ `4 {. M9 g - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
& p. i$ H' O( E4 p - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
7 D+ A9 M- r& l - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
* z) \ {9 U# h$ ^. X8 i - #else+ v; D) G8 s9 B0 C: c
- #define DMA_PRINTK( x... )
" |# F7 C" h9 T - #define DMA_FN_IN3 B. t* E/ o. a0 S R/ J- K0 f
- #define DMA_FN_OUT. M) a7 r% p8 ~# P9 ]
- #endif
2 } T; i5 z1 n& A' k
& {3 ~% [3 r1 [ J& K. l) U, `: F( P+ p- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
, o9 \& Q9 a0 |. v _% N' U; k - #define STATIC_SHIFT 3
/ G7 }9 E- m4 O2 X" Y: e$ T - #define TCINTEN_SHIFT 200 Z& Z, u/ G* D7 R' B" \8 }+ K5 |
- #define ITCINTEN_SHIFT 21
3 f3 x& C/ \; ^ P$ M1 C - #define TCCHEN_SHIFT 22/ u3 D0 c. ~; d$ S, @5 n8 s5 q
- #define ITCCHEN_SHIFT 232 I' y" j* q/ ? D4 y( m
- 4 f+ J; f8 U9 ?6 e' W) g& I1 \
- static volatile int irqraised1 = 0;
" m; V# I" G- x4 H* f" l - static volatile int irqraised2 = 0;9 S/ w8 E0 B. O
* L' ~& j; N, O: c7 z- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 \ R% H$ \. `' v+ j, s - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 x- p! e+ x; t, Q% X$ k4 b7 r
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); \ b8 A2 i; s' @( `/ M' R1 j
/ Y y7 H2 a4 [- dma_addr_t dmaphyssrc1 = 0;
% p: a, K5 }' w, X2 ^+ v/ K - dma_addr_t dmaphyssrc2 = 0;
6 C' V; C0 u( N) r6 g& S - dma_addr_t dmaphysdest1 = 0;
# @" V% j/ S z - dma_addr_t dmaphysdest2 = 0;
5 p& O& y# F* W6 {! L# _$ f - $ P0 s" b1 G2 v% g0 T
- char *dmabufsrc1 = NULL;
. f# o8 E; D$ g; l/ M% W - char *dmabufsrc2 = NULL;6 a! x( r, n. Q' h3 k6 |0 L0 |
- char *dmabufdest1 = NULL;& K; x2 G( s, G: o( R+ F
- char *dmabufdest2 = NULL;
& g4 ]* n9 K' H
+ r% ~0 Y' ?5 T- static int acnt = 512;7 w1 P8 l4 H/ z2 L5 a/ x
- static int bcnt = 8;7 \" t+ P! @; E/ s/ J
- static int ccnt = 8;; N B6 @9 E. ]7 V) p
- . C- Q5 [5 D! A5 b
- module_param(acnt, int, S_IRUGO);
% o, S; b O h8 V0 X2 h, f' Y - module_param(bcnt, int, S_IRUGO);$ ?3 x& P @/ W2 n+ P% L# P
- module_param(ccnt, int, S_IRUGO);
复制代码
c! c2 e6 h9 j# W
' a, z, l9 G) t; Y% X# a- K 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 D6 X9 D g# z% ~! j; m8 {' \
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" l. w7 E; b5 k0 x [& s2 q 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ t8 A* p! g& R, v. [9 o
. {7 A" Q* d7 }' ?! _% q4 v! C. j: B4 O( D
|
|