|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ v! r0 j- i# A6 O/ H2 W" t
- [code]EDMA sample test application
( T3 f) n/ z6 F; ^ n f: {( ` - /*
2 q9 c9 y+ f2 c - * edma_test.c
9 b H) N% F) ~ }' H9 z( f% v - *9 s$ T. ]9 o( I/ Z' @% W! v4 J
- * brief EDMA3 Test Application6 h" l9 L3 j/ b9 }" p9 p# e
- *
/ K9 }, x" H6 M" s; c - * This file contains EDMA3 Test code.
. u3 h) [0 g# C6 c - *5 k8 X& W/ x$ f$ e
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# ]/ B/ ?/ e& q
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 ~8 q* N& _$ W: W3 f
- * TO CHANGE.
4 W4 n, c1 j+ a: z& S! Z, T - *% t' A' l" Q' K, C9 S, s
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// h' D5 x' {1 N( T+ E8 F8 O8 U8 x' k
- *% T- r- H4 }7 Q3 v: ^5 h# G
- * This program is free software; you can redistribute it and/or
! @: d8 Y' K' Q# ]! g# p - * modify it under the terms of the GNU General Public License as
$ N& f! o0 A& b# |- x - * published by the Free Software Foundation version 2.
: \% R# R& ?) `5 @; j. M - *9 k# o' j4 v- c
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any% ~7 ]) Q) Y! R# @- C
- * kind, whether express or implied; without even the implied warranty
5 i' P# X+ F) R6 i' [4 y - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6 }& W. @9 j$ o$ N, _& K: y+ t u - * GNU General Public License for more details.+ e4 J) r' Z4 I/ P1 j8 Z J' ^
- */+ U0 n& T* Y% ^+ D% n- q
% n* L) Z! C8 O a- #include <linux/module.h>
& X6 e7 a9 \7 i4 k5 l: K+ { - #include <linux/init.h>3 S" Z. ^4 I9 Z( A
- #include <linux/errno.h>
7 v* {5 k, O9 W" Q# i - #include <linux/types.h>; Z5 l3 G+ {1 E4 n: q. r' N
- #include <linux/interrupt.h>
. ~5 |& B# j; u* R - #include <asm/io.h>2 a8 |5 T" u$ P7 G/ M ?
- #include <linux/moduleparam.h>0 \/ z+ D" _# m2 f7 o/ u
- #include <linux/sysctl.h>5 z6 Y' r" c; L t
- #include <linux/mm.h>
$ n# Y! a* z1 f7 t - #include <linux/dma-mapping.h>
. J+ N3 `/ ]( e0 c, E$ H
8 x# b, I) p+ ` ~% ~# T- #include <mach/memory.h>* T* l0 N& Q$ a0 I7 f
- #include <mach/hardware.h>: {' n$ j2 \4 G/ ~( Z3 m- C
- #include <mach/irqs.h>
* o4 T4 I4 K8 q# S3 { A - #include <asm/hardware/edma.h>4 _/ g) Q/ W. M. x
- ~! {# }" s# r5 Z* k- #undef EDMA3_DEBUG; D; w0 ^) M: j4 S
- /*#define EDMA3_DEBUG*/
) }+ j, l, B) L! `* V8 i. c' F
, S( G; ?4 G. N* s0 g9 J# l- #ifdef EDMA3_DEBUG" v8 t4 h% z- E* e) ^- W' L
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
% `5 u% W) ~* Q - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ g- y8 N$ `; b2 z4 ?( V7 N% u
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); H) w, v2 S! f0 `7 _
- #else
0 Z* L6 o0 I! O7 Y* L" x! N) Y" t - #define DMA_PRINTK( x... )$ G% N' C0 J% B) ^$ O3 o
- #define DMA_FN_IN
$ d4 A g5 A `( m. B/ \- {; D7 N! h - #define DMA_FN_OUT
F) K7 g% r# V2 u' \. W - #endif5 T1 u! V e' l: T9 }
" y4 G3 K# i5 f/ ^3 e- #define MAX_DMA_TRANSFER_IN_BYTES (32768)% f2 s) J5 b2 F5 Z3 s
- #define STATIC_SHIFT 3' O1 T0 y6 |. v1 {
- #define TCINTEN_SHIFT 208 u) N1 S) x9 Y1 T7 A; L, o
- #define ITCINTEN_SHIFT 21$ }; b- I9 {) f0 K# v
- #define TCCHEN_SHIFT 224 m' c' m6 y, |" i
- #define ITCCHEN_SHIFT 23
* z3 j2 E, ^4 G$ ^- c. a
1 Y* S7 S8 V3 T, v1 n- static volatile int irqraised1 = 0;
0 _6 B4 U5 u+ B - static volatile int irqraised2 = 0;2 ]' k2 \6 r! m( A; ?
# |% w. z9 M% M, [. }6 U- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ a4 [( Q. p+ @; w' C - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 e) ^# B% y0 M$ F- ^: E - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
K# u- D# ]' \) |7 D% b - 8 h: [$ p5 O1 I1 |, N
- dma_addr_t dmaphyssrc1 = 0;) @) L P: n/ t# t: d% n
- dma_addr_t dmaphyssrc2 = 0;9 e. o9 t6 b8 e$ r
- dma_addr_t dmaphysdest1 = 0;$ B: v/ z; X3 t" b g( [- W0 O
- dma_addr_t dmaphysdest2 = 0;; |0 A# @7 b3 G {( i% t
) v, z% `2 G! j, {5 c) m- char *dmabufsrc1 = NULL;- l$ E' n: n. C; n- h% x0 `, x
- char *dmabufsrc2 = NULL;. j! S9 q$ ]; K
- char *dmabufdest1 = NULL;
# H$ f" `, P0 F- F+ g - char *dmabufdest2 = NULL;5 n: ?7 j8 j1 }( L# a/ u
- 8 t" j0 M) s. Y( S! @
- static int acnt = 512;; S1 ?; b; v& X' q* \
- static int bcnt = 8;# j2 m3 M( }7 f& e. N- ^
- static int ccnt = 8;
* }6 f) N0 n5 u1 I - 8 ^6 ]% {3 l2 W# w6 N; o4 V9 t
- module_param(acnt, int, S_IRUGO);9 Z2 {8 ^6 ?1 C/ y1 ~
- module_param(bcnt, int, S_IRUGO);
# m8 ~7 T; N8 ?' e; |5 O* } - module_param(ccnt, int, S_IRUGO);
复制代码 & L% q2 l7 p" M1 @4 `! b- ~ D
4 \8 n+ U& F: G( j; c
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' }9 M! P# r& P" Rarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 \4 w7 \ T. O6 D% ?' h1 v 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 V A) g2 L+ @6 Z7 R
' X6 a+ U4 _0 ]
, i x d. T0 @; x |
|