|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - Y) H/ X9 o4 w* M( Z5 W5 B8 B
- [code]EDMA sample test application
4 h) \% B! ^4 P/ b4 H( [) Y - /*
! [8 t1 o! q) N( R) t3 n - * edma_test.c( j, h n6 V& @# Y- ~0 L& O
- *, B8 |5 Y4 w/ l7 X1 ?, V
- * brief EDMA3 Test Application9 C) L: {" ~( j; Z
- */ C- U$ V8 [+ y" m! p
- * This file contains EDMA3 Test code.+ a) `8 z m1 `
- *! ?4 x7 E, E! i
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ _* y& {! N, u0 w" Z
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 O9 g( u, e# V* C1 w: Y
- * TO CHANGE.
8 `1 Q% I; D* Q+ p5 F - *
2 C. q1 |* I0 e; G: O - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 Z( D% A0 S' j# w, w3 `; U
- *
" C7 C. }; Z+ z$ M* d! B - * This program is free software; you can redistribute it and/or
1 U/ j' A/ Y8 \! f% { - * modify it under the terms of the GNU General Public License as ^% V8 D1 h( k( u8 h5 D
- * published by the Free Software Foundation version 2. n' n8 M" l" g1 L
- *
2 ~( }2 z# ]% @/ R/ M' z4 y# N - * This program is distributed "as is" WITHOUT ANY WARRANTY of any! g0 Z. l1 g) k S
- * kind, whether express or implied; without even the implied warranty
' v; }' A+ v. V1 O/ I - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the" E$ m+ O2 }2 @5 T. n( t
- * GNU General Public License for more details.
1 A! Y" C- m6 L0 x1 ? - */
/ }6 d* ^) q) O
- a6 B5 { a& T- #include <linux/module.h>) d. B- {: E: S( A j6 D" b
- #include <linux/init.h>3 C$ }; T$ `! ^6 \0 i) A' v
- #include <linux/errno.h>4 ~% D& E* N/ G% P( ?! c" k# t
- #include <linux/types.h>
* }) n: ^8 u8 [0 ]/ l1 ^$ z/ y - #include <linux/interrupt.h>
* @$ b; ]4 {" O - #include <asm/io.h>
. G( ?% j% M& _0 {0 J5 p7 X) { - #include <linux/moduleparam.h>
3 H$ M8 x2 C) J. z0 [' H; C - #include <linux/sysctl.h>
: g! M3 Y' n9 t: \ - #include <linux/mm.h>
8 u7 o: z/ V F - #include <linux/dma-mapping.h>
; y0 l- x. I5 A+ h1 \: a% O3 \ - : j+ z' s7 j6 Z* T c& d5 d
- #include <mach/memory.h>
/ g5 W4 M3 }& w - #include <mach/hardware.h>/ \3 _7 \; s) G6 v
- #include <mach/irqs.h>3 ?- `5 ~& I9 s% d$ S- X/ L7 S
- #include <asm/hardware/edma.h>
( \/ Z4 r) x' c3 C1 c
8 q+ g Z& F4 N- k3 K. I3 P, h- #undef EDMA3_DEBUG
) S# b: e& Z- [% I" d: Z+ | - /*#define EDMA3_DEBUG*/
! N1 e1 n4 X0 w7 l$ Q6 J4 [: }0 E) i
8 @4 n3 z/ S; w4 [# k9 e N9 l- #ifdef EDMA3_DEBUG6 U4 u1 [4 E; q7 h$ V4 ~
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
1 z6 x8 V+ p8 E) d - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
4 T& f) A' U" w3 g+ W - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
+ A/ s- M3 @3 A; b( N0 O( D - #else# _% P4 j- u# V9 g
- #define DMA_PRINTK( x... )
6 E" |- s& g' X* A9 T; U3 a - #define DMA_FN_IN$ b }9 G8 e5 D" z6 A. M
- #define DMA_FN_OUT
4 W' \8 l3 b4 m7 \, B - #endif, ^0 I/ G' b4 k! p, J5 e: E. Q$ j+ b
- " V' A" G- a) g* F9 P7 W& B0 i
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
1 ]3 Q& U2 x8 I4 v - #define STATIC_SHIFT 3
5 q) n& B( y( M1 A, B' n - #define TCINTEN_SHIFT 20: M, k+ a1 j( c1 V
- #define ITCINTEN_SHIFT 216 i \9 E2 i' o2 f
- #define TCCHEN_SHIFT 22
" [% U/ X, w2 B' o- ^7 X1 u - #define ITCCHEN_SHIFT 23
0 h C) { J8 T4 v$ O- d
: Q: M3 J+ D# z8 ]- static volatile int irqraised1 = 0;( e3 R1 {$ M# {
- static volatile int irqraised2 = 0;
; d/ i5 C* L% u
) q6 U7 [% y# Z- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) {8 i# M0 f' R$ O5 ~3 v - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 L3 A- f" }9 u - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, c$ N' N: V/ Q' `! F- A
5 o3 X a4 l, C6 w- dma_addr_t dmaphyssrc1 = 0;8 \: s, N$ ~/ l7 t) {
- dma_addr_t dmaphyssrc2 = 0;* \# O* T) f1 }( R! h
- dma_addr_t dmaphysdest1 = 0;
; g6 G* H3 ~0 u7 d9 v - dma_addr_t dmaphysdest2 = 0;
) C ]: A. f2 ^5 ] M - 1 }& s8 E& U; U; Y. G3 }" [7 F- x( p
- char *dmabufsrc1 = NULL;
0 e5 S/ l$ W3 H% f9 Q: |0 x - char *dmabufsrc2 = NULL;0 X8 J G: p0 g% w( T
- char *dmabufdest1 = NULL;
% q4 _; X) \" Z4 x! w' b - char *dmabufdest2 = NULL;5 t* D- c$ p/ u, x6 N2 G) L
- 8 s$ x3 D6 }1 A' O0 h
- static int acnt = 512;
/ j4 a t# i X( h1 y - static int bcnt = 8;0 N( Q) p/ V! s% S) F
- static int ccnt = 8;
4 V) @* y6 K1 v* w6 B - , p' y8 K( R7 C- z, v9 H5 y- e
- module_param(acnt, int, S_IRUGO);
+ u% {3 j* _& E8 r. Q - module_param(bcnt, int, S_IRUGO);
3 S% h" v6 U6 ?* f+ k - module_param(ccnt, int, S_IRUGO);
复制代码
8 ]% H+ L, e0 P# g
; u, t7 R6 R0 x" s$ j 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# x' k5 O ?( T2 g2 L4 `# @# Y8 U0 E
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ T2 Z# D& O* s" V- J3 I1 i 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: j0 H% A9 l/ Q: X& {( X
& G6 f9 ^! D+ B7 \3 C' l+ F, }/ \8 |! B
|
|