|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / x4 m4 x3 a; T
- [code]EDMA sample test application
$ x# m9 s j9 V/ W6 n2 r - /*: v5 C8 F3 u! T5 e$ @! X- b
- * edma_test.c [- ?# m1 ^/ X/ N- _" O- P
- * g8 F( o& d+ l5 E6 p s: D8 J5 e
- * brief EDMA3 Test Application
0 k: z0 b' l! r7 N: k - *1 M9 m+ R& F( B( {# x9 s) E
- * This file contains EDMA3 Test code.
3 `; a) e) B! G! \4 J6 _ - ** f, J! [0 a+ W; I
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* l4 Q6 D7 U8 b* @) A0 F
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' e9 W9 {% f3 s3 [( y8 y
- * TO CHANGE.
5 h7 }$ A% ~9 q/ y6 `3 y3 S - *
. T4 H4 ?0 P5 ?' ^9 u' ? w% e - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
a; T) A- O9 Z! G( N' s% C1 E - *
8 u) D3 w- s: n - * This program is free software; you can redistribute it and/or
* ?" c" v+ M. h# n - * modify it under the terms of the GNU General Public License as
+ K" R* s# R1 M# G* w - * published by the Free Software Foundation version 2.& k) b* a8 b+ l; h" G; f7 w8 C
- *9 e: k0 j; o! X& l/ o
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 D) V% O8 D4 W( W2 d+ N3 j' e
- * kind, whether express or implied; without even the implied warranty
) U0 l+ l- m# I* t6 S - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the. o( `% G+ g6 p7 K, v$ H2 v
- * GNU General Public License for more details.* g# X4 z) [. _2 s- p
- */
+ q5 j1 G9 W( h2 t7 K4 p
8 }5 j& Q' ?* y7 z% s- #include <linux/module.h>
) K- ~1 N V7 l K - #include <linux/init.h>8 w+ ^1 ~- V: B6 j4 ]8 y- v4 e
- #include <linux/errno.h>
. k" o. b" ]+ |. M1 p6 o - #include <linux/types.h>1 P5 p5 b7 B, A. r, g' \; N* O
- #include <linux/interrupt.h>
; f+ z: G+ ~5 u - #include <asm/io.h>
" T8 q7 C, s, g0 E7 U( F - #include <linux/moduleparam.h>6 i! W& v4 u x( B* [! o5 w5 ~
- #include <linux/sysctl.h>3 n% X5 b; t2 p
- #include <linux/mm.h>
9 u% J" s, F' s8 @. b - #include <linux/dma-mapping.h>
9 \+ _7 ^' ^ ^' w5 x
& x3 X8 R) T5 l8 F! S- #include <mach/memory.h>
+ o3 a; W3 G% ~: i - #include <mach/hardware.h>
5 Y/ ~7 B; @- [ - #include <mach/irqs.h>
" D4 P' K+ o$ I* M2 u: u - #include <asm/hardware/edma.h>: U6 p6 x! q; n( N
7 v0 ]. a4 q1 r- h, b& n- #undef EDMA3_DEBUG0 c! y" K( B& b9 W y
- /*#define EDMA3_DEBUG*/
1 L9 c/ C% x+ W5 ~. J" q - . f. L( G4 j- L' P8 c2 t
- #ifdef EDMA3_DEBUG5 B8 c3 j% }3 X. S, g* ?
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
( ~" i1 W0 `3 e1 p - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
: y. |; \% ~, g2 [% Y/ Z7 D - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% ?/ V0 s1 W1 X$ |5 `
- #else
9 F4 P5 n/ N j* Q9 j; ]9 N- N - #define DMA_PRINTK( x... )
+ b( V% V: U5 ~4 B3 I& w) a - #define DMA_FN_IN; B* ]% G& H3 j1 P0 s$ [" N9 W
- #define DMA_FN_OUT
- I# }6 m0 y. }5 {( X& q+ b- c - #endif8 K, W' I" M; A6 C( I8 c
- + q4 K: f9 \1 k0 I) f
- #define MAX_DMA_TRANSFER_IN_BYTES (32768), B0 [ i7 ^9 P, m, r2 }! _4 W# `; i
- #define STATIC_SHIFT 3
3 G2 Y9 ~) H8 E# y C - #define TCINTEN_SHIFT 20
; }, Z3 R: }0 `1 f ^7 V0 ]& Q - #define ITCINTEN_SHIFT 21
0 i$ d6 o& x4 ]% s) ` - #define TCCHEN_SHIFT 22
! f4 E0 ]5 Q$ k - #define ITCCHEN_SHIFT 23) r7 m' f+ Z( z! e. z
: U9 N. }3 Z) u" S- static volatile int irqraised1 = 0; P9 [( ?6 I8 a% V
- static volatile int irqraised2 = 0;( r9 V( q6 y5 Z' M
- 8 ^1 D+ O# Z" p% `
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# `8 M0 P5 v2 y, B. H) J e - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. |8 ?1 h' {, k. F7 k3 d5 F) ^
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); b( @8 n; t3 N7 ~$ j
- ! ^0 a" T) ]/ n
- dma_addr_t dmaphyssrc1 = 0;
- a- ~& Z3 O% z% y+ o6 n - dma_addr_t dmaphyssrc2 = 0;* S6 M+ N9 t+ A; q C& M$ f8 b
- dma_addr_t dmaphysdest1 = 0;& B+ o# H u1 I4 a& X7 V. k
- dma_addr_t dmaphysdest2 = 0;1 C {* D M" q2 y! O
- ; C# |$ Y1 [. v7 m8 P
- char *dmabufsrc1 = NULL;1 T) E' o! V% i, @
- char *dmabufsrc2 = NULL;4 T$ S$ H+ J1 S4 I# @
- char *dmabufdest1 = NULL;
6 r% ?/ [6 L7 Y& r/ t" y1 K# ~ - char *dmabufdest2 = NULL;
# a/ R6 X5 {% Q; M
4 {. Z8 ^* d9 j5 a- static int acnt = 512;
: P( R$ ~5 U7 Q& N% W - static int bcnt = 8;0 t& w1 C5 L5 Y0 r& \# h
- static int ccnt = 8;
+ q9 |7 ~0 \# ]) F
( p3 u3 o- v1 ]2 x5 m, R5 D4 i- module_param(acnt, int, S_IRUGO);
- k- e. f% Z! k6 u& u9 j1 E: c - module_param(bcnt, int, S_IRUGO);4 B. f; F i& ]- m
- module_param(ccnt, int, S_IRUGO);
复制代码
& D. L$ ^, e9 Y7 b' I( G8 m; O( S2 A' h5 k @5 l
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- {6 f5 A' s+ h: m7 {% Q1 _! 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( |. V* A# G v) l$ U, g
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; `, B$ @" u$ i( W
% i3 v; h0 v3 d8 G9 F4 h k' q; ^1 A7 c' @4 u9 n
|
|