|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 ~% ^) ]3 R6 Z0 G
- [code]EDMA sample test application
; q& L7 V# |9 X( q. _8 D P( A9 \ - /*! f, k/ n h" Q/ n0 e) H
- * edma_test.c. M6 w u7 ]2 _3 c: t+ s3 H
- *
9 S9 Q- v+ p! E" {0 J( \ - * brief EDMA3 Test Application
) N* `3 }7 ~$ i - *
: F1 ?. ^9 x6 h8 o4 ~4 p6 E - * This file contains EDMA3 Test code.
: N+ K( E, S6 l8 x; ` - *3 d, E5 b4 s: s7 U6 W+ U" ~
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- \" b! Z2 h, @: V: m0 n: ~
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
0 `& I8 |* ?% w$ N - * TO CHANGE.0 z$ q! y# g; [2 x" f2 O
- * G) m; Y- x5 e/ j2 V9 j, k
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
5 Y: }9 s& X0 X `+ f - *4 h: E" t+ O! c0 V, x; H& ~9 J
- * This program is free software; you can redistribute it and/or
. x5 p/ D" f- x! k% ^5 t - * modify it under the terms of the GNU General Public License as* M+ W5 o' o. Z* a
- * published by the Free Software Foundation version 2.
- [# A( P/ r2 l! f - *
+ a9 o$ y- z8 @" l8 `2 |$ g% _ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
3 I8 V! z) r I7 @6 z! [2 c' L8 g - * kind, whether express or implied; without even the implied warranty
8 n7 d0 Z* Y3 F j2 c5 p - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the5 W/ B0 ~$ X! U! M4 l: k8 o
- * GNU General Public License for more details.
+ u7 T( U$ p, a: x' r+ k - */
4 x, T8 ?5 |( g0 Q) h - , C0 x) Z g5 I' c: V' n# a
- #include <linux/module.h>0 m7 h: j) [5 A! n* W: }5 W& W
- #include <linux/init.h>7 R: w n0 z1 b9 a( j, {& q
- #include <linux/errno.h>9 d7 b6 Z- q& {
- #include <linux/types.h>
) E! l; l6 r9 w+ T+ l) g$ g - #include <linux/interrupt.h>' d6 I# \9 L+ W1 W
- #include <asm/io.h>( O5 U2 X& [0 E4 n, }
- #include <linux/moduleparam.h>
9 K" F/ g7 I! t) f0 W. n - #include <linux/sysctl.h>5 f/ ^) K1 K, ^
- #include <linux/mm.h>. \, V8 U! d' I% C p/ u
- #include <linux/dma-mapping.h>9 H1 ^/ p/ G2 e
- 2 q4 W8 k8 ^, ~ V0 ~
- #include <mach/memory.h>) S5 h4 t; G- B1 c
- #include <mach/hardware.h>
" d3 o- Z) \1 X - #include <mach/irqs.h>
9 S' `/ f- U: _* |- {2 m1 X, U) | - #include <asm/hardware/edma.h>
3 v6 C- ^2 t% x* z8 Y- Z' a
! v" a6 u% V% a: U5 _* H8 E- #undef EDMA3_DEBUG
2 E% V3 X/ k6 D5 o- [ - /*#define EDMA3_DEBUG*/
1 u( `3 {$ X8 v Y2 m/ N5 w) H8 u
! T( T8 l3 L" n, o. i. b3 T- #ifdef EDMA3_DEBUG
# p v) I6 [3 H6 i - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) ?8 M0 k; e, E# j- t! A9 H
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 F' U( Z5 b; | X, p# E; X) i5 X
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
/ u, M! j, q* V D1 K- G8 [ - #else
5 b/ b. c# M4 d - #define DMA_PRINTK( x... )7 ^8 M+ S$ D) Y
- #define DMA_FN_IN- X+ q5 q: L5 T" N
- #define DMA_FN_OUT
; v; y$ Y4 p' ` N" ^6 B - #endif
! R9 D) J! v: Q2 ? - $ q$ g& X6 n9 x) l$ U
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
3 }. E% e! |% D - #define STATIC_SHIFT 35 K, X* L* }) s- x4 \3 g0 z9 n4 R
- #define TCINTEN_SHIFT 20( U- g0 T+ x6 M' ?& K
- #define ITCINTEN_SHIFT 21: M* j3 R5 j0 n! ^9 u m
- #define TCCHEN_SHIFT 22
1 s( s8 w- @) A - #define ITCCHEN_SHIFT 23
+ f! v7 U$ U2 B) C) ]# S - " X& q6 p4 X+ x
- static volatile int irqraised1 = 0;' ]3 C, g! O- C& l0 [( h6 G8 p6 G7 V
- static volatile int irqraised2 = 0;
4 u- d# P: c$ v! x
- C, o8 V+ D7 s( V0 F- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ v) d! ?8 Q& ?4 d3 e
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* |6 ~3 O, ]7 I7 v - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 @/ S2 X" P9 Q( s7 O9 L3 h
* v0 W. P" z" L) r2 i2 E5 o- dma_addr_t dmaphyssrc1 = 0;1 S [& K! j% I2 C' d! r* a# N8 r
- dma_addr_t dmaphyssrc2 = 0;
3 ^4 K. v; }% o7 e1 f9 C - dma_addr_t dmaphysdest1 = 0;
4 ]8 d# h$ p, f d- E# |/ m - dma_addr_t dmaphysdest2 = 0;
: j/ O9 j7 C* D
1 b. `+ k6 E4 G4 B* A2 S- char *dmabufsrc1 = NULL;
+ N6 J3 T* X h0 a- W - char *dmabufsrc2 = NULL;
* H$ j8 v- G) W% L - char *dmabufdest1 = NULL;
5 q8 `( E5 W" B - char *dmabufdest2 = NULL;5 j( |, b, ~! {2 {4 R$ ]' ?
0 [$ ^; c- w, z0 W0 U! M- static int acnt = 512;
8 E" x* k; S) H/ S* e - static int bcnt = 8;; u1 c, _9 N( a! N. n! v0 B: u3 X% t
- static int ccnt = 8;
( W" U* U# \( V+ {. M
8 Q# Z6 v* t) T5 G( C' m4 Q- module_param(acnt, int, S_IRUGO);( l6 c; K" m/ T) A9 O
- module_param(bcnt, int, S_IRUGO);9 c$ w) \- l k+ x& A5 B' N: G, u8 p* w
- module_param(ccnt, int, S_IRUGO);
复制代码
' @0 x$ O. u- J) t. |% t7 p. L7 i) b% N) {
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) @6 M) U- S6 n1 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* o9 d# s" ^* ~) ?/ z
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 ?9 l$ H6 V' O( }3 s4 k& }
' R" V3 }5 A) J3 \ b0 k. ?% Q% q
|
|