|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # _3 j% I+ S) O0 j
- [code]EDMA sample test application
, L; X) _6 h" C# P$ g - /*) Z6 E5 E% b: ~& k
- * edma_test.c8 O% S) p/ f7 X F2 y9 s
- *
8 \; J& B' n) b2 V) q& I! B- K - * brief EDMA3 Test Application
% ~) X. I3 C% c+ Q n - *
- p9 J) d" \" e4 G, |, M! U1 ` - * This file contains EDMA3 Test code.( t7 u- r& k6 ^2 `2 [. p
- *
$ @6 O+ b3 w( r" X6 y5 x - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
6 Q" m" A& ~6 D3 j - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 O( X& ^/ \) Z2 C
- * TO CHANGE.
) d5 _- C% Q6 A" s - *: X0 D: D- z& U$ n
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! w! p* P& P. L" u3 A( \
- *4 _" F# c. @0 z: e2 U% v5 R2 }
- * This program is free software; you can redistribute it and/or b" D5 A( r$ F9 I, z8 }
- * modify it under the terms of the GNU General Public License as
2 y5 a" N Y! |. m, Y5 x* h9 J - * published by the Free Software Foundation version 2.
8 I* u* @$ j4 D2 z. ~3 \# { - *2 v" e+ W# |1 n
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any- {2 W+ ^" s U# W6 l
- * kind, whether express or implied; without even the implied warranty
0 y! z! @: R' Y3 H% r8 i1 [8 c - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
, I, [6 Y+ f1 { X# c+ k4 B+ g$ ~ - * GNU General Public License for more details./ ~, F, n* Q4 C& o" |3 @
- */
4 U6 O& C3 ]# d9 T. B% ?1 w - + G+ U3 _& D1 e( Z5 H" \
- #include <linux/module.h>4 { d/ E: I; H% W5 K( ^9 k* z
- #include <linux/init.h>- G- Z: \: g. w& J) G* n {9 g
- #include <linux/errno.h>
C, ^% t* W. @; S) Z* _ - #include <linux/types.h>
. E& M5 k6 f+ [5 s( F - #include <linux/interrupt.h>. ?+ i. w. e" ~) n8 M
- #include <asm/io.h>
) x/ y$ S6 c9 M8 C6 ?6 @2 z - #include <linux/moduleparam.h>
* f+ N* v! Q0 ?7 c& O0 l - #include <linux/sysctl.h>
2 D% p. ]" Y' V) s3 i4 T9 c - #include <linux/mm.h>
" q8 u8 a3 e( x( ?2 b - #include <linux/dma-mapping.h>
" q% l, k+ U. d% j - B4 l9 ]: q7 }8 g r6 y5 |
- #include <mach/memory.h>
, A9 E2 [5 T$ s/ \( t - #include <mach/hardware.h>
8 n# i" C. a7 ] - #include <mach/irqs.h>: l7 `& d0 C' [. r
- #include <asm/hardware/edma.h>
' W; J& s/ D; [! X" u5 K3 `7 t, ^
4 I& h$ w9 w2 H/ {% v# M* _- K* A- #undef EDMA3_DEBUG
" L: B! `' X& O. u( b - /*#define EDMA3_DEBUG*/! b' j- X+ J- [4 V6 C% H0 N
g9 [4 g7 [/ S9 Q! }4 o$ H- #ifdef EDMA3_DEBUG* _' v2 @ @# B; a3 Z* x4 G
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
0 {9 L% Y& L; Y" G! t, P0 A4 ^- ?! F - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). D- m/ x3 L3 c' B7 P* L
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). L3 D( o- ]+ k7 |) O. F& m
- #else
8 d& o' g! I% w0 b - #define DMA_PRINTK( x... )
1 W4 [* Z( F. o+ v" N - #define DMA_FN_IN, S$ u$ [5 |7 O" i# X. o
- #define DMA_FN_OUT& L0 t6 G0 i0 E9 [: w( w
- #endif
/ O( N* P) K. j5 g5 T
/ u; [: W: j: i+ x; h" B5 ~- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
4 U/ [: ?5 W3 p9 C - #define STATIC_SHIFT 3
% |5 |0 G k- _' j7 ` - #define TCINTEN_SHIFT 20* _" P9 x, o8 X4 v! H2 v6 w
- #define ITCINTEN_SHIFT 21
& _: }! V7 H2 W - #define TCCHEN_SHIFT 22- L( o+ a0 j) |4 x4 ~. G: B
- #define ITCCHEN_SHIFT 23
r1 N% t+ _3 J" L& w - 8 j5 W& U1 O5 D9 _7 y6 ?" K9 S
- static volatile int irqraised1 = 0;7 {- j! B* }/ {+ L0 Z k- `
- static volatile int irqraised2 = 0;+ v7 n% d) D9 c2 c$ |0 a
4 s8 e) [9 p' U% M6 U( W( c* v- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( [' K& X9 X5 d# S
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 g3 e$ T% A' O1 k- [) q" ^/ O - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; T4 v- q; U2 d# m% z - 6 a/ T; D5 N- F5 U/ {
- dma_addr_t dmaphyssrc1 = 0;
& A. j, L# F! Q/ l3 K - dma_addr_t dmaphyssrc2 = 0;
2 w6 A' T9 I" ~+ D, ?" \1 \ - dma_addr_t dmaphysdest1 = 0;
* d3 Y' F/ e/ k5 K: T - dma_addr_t dmaphysdest2 = 0;
/ O2 _" u1 U2 s9 W4 |3 P" v/ _* v' M - 1 C; F* C6 ^" U5 |
- char *dmabufsrc1 = NULL;% q$ { a! H' }) d# O
- char *dmabufsrc2 = NULL;
% I3 O0 v1 |3 S+ m8 W4 b - char *dmabufdest1 = NULL;( X$ i# S6 q+ ?( n3 }/ B
- char *dmabufdest2 = NULL;& w4 ^" D" [% y
- 8 N. u# q2 I8 s
- static int acnt = 512;0 M& Z4 d5 a$ h9 Z1 j
- static int bcnt = 8;
4 y+ P: `: D" G3 Q) i - static int ccnt = 8;
* O% r, z" Q. o. c
4 v9 `1 \/ B1 c( y+ m- ^- module_param(acnt, int, S_IRUGO);
4 D2 V, `/ A9 i1 q/ i1 d - module_param(bcnt, int, S_IRUGO);& \7 v9 q! v8 k2 u/ @
- module_param(ccnt, int, S_IRUGO);
复制代码 9 U: x9 ]7 M+ l1 U3 \% h0 f9 d6 Z
- ^& ^& m; r: e m
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 t. n7 @. }& H* |. [' V9 F# Yarm-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/ v9 S# [! E5 w, D
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 X* K" y f- T8 W$ o& P& X. R+ \# s
( R G' ]. Q& M: u
|
|