|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% R8 ?1 f% ]/ K6 m0 Z- [code]EDMA sample test application) R$ n v, W7 k
- /*
0 Y) J/ f4 t, S: {8 Z6 W+ C0 O - * edma_test.c
{/ q! a1 T6 N0 g: R" _ - *
3 e7 n& N: W8 L* K - * brief EDMA3 Test Application
) g: M8 E8 C# Z- z5 v - *
! \& |0 U7 }+ l; ?( \ u - * This file contains EDMA3 Test code.' i& H x% @- b& N& }( L' d6 Y
- *
5 e1 Y; z* c! f. E - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 ]7 F+ q. R9 O9 |: H8 m( X
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" W# A& M( P$ D% Z6 l: J
- * TO CHANGE.
4 t; J m9 U+ P6 }' Q8 E - *
" Z/ {% q2 V! g& P0 Z3 P, C - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 X( f: [: h1 H7 U$ B
- *
$ h' O; X1 `+ L* q# x6 E- h - * This program is free software; you can redistribute it and/or
9 b. Y! X8 X$ w. h1 Z \ - * modify it under the terms of the GNU General Public License as' m# H G% L0 A
- * published by the Free Software Foundation version 2.
, n% f+ @; `0 I9 t J6 {; Z - *
& M! w+ D9 J" n+ P9 N2 K l% X/ d - * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 @' S4 X1 t" W; n- u+ j4 `7 r
- * kind, whether express or implied; without even the implied warranty
2 E) Y$ S% o, a9 N% l - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the8 | s$ u" R* D z. L# {0 u/ V
- * GNU General Public License for more details.
( b% k- P }; Q: T2 j2 f2 V - */- i; A. T) V5 v' G8 e# p5 A
2 |- v: I! Q4 a! g- #include <linux/module.h>+ R; V V: G$ o3 T/ r8 q1 t8 p
- #include <linux/init.h>
( a# e6 z$ b/ { - #include <linux/errno.h>
! `3 `" m4 O; W9 Q- x - #include <linux/types.h>; F" P P1 P2 R# y
- #include <linux/interrupt.h>
4 m3 ^, v% l1 ?- _ y4 ~6 i - #include <asm/io.h>
+ e& p" y& C& T4 v& E - #include <linux/moduleparam.h>
0 s5 T4 G( q# E6 B' w4 l - #include <linux/sysctl.h>& \( \6 ~+ v1 H4 b" f
- #include <linux/mm.h>
( r) Q$ b+ X9 n7 u - #include <linux/dma-mapping.h>: r( v. Z, j5 y$ U
0 \% W# V7 T+ Y# f( `+ ?3 t- #include <mach/memory.h>
( z( {9 q+ K; f% M+ ?, r" Y+ J: h0 ` - #include <mach/hardware.h>: E, Z: N5 V! {$ d7 f
- #include <mach/irqs.h>
a+ J/ I+ ]1 i+ l+ u6 S - #include <asm/hardware/edma.h>
- [1 |7 U( \# f' w - ) \/ F" e4 C) y1 D# `) u0 e
- #undef EDMA3_DEBUG
1 @0 s2 D* [/ m4 F: h - /*#define EDMA3_DEBUG*/
: T) N. i" ?) }1 @
; a5 _0 [0 L# c; |& Y* {- #ifdef EDMA3_DEBUG
* g& `3 H3 L( x! H7 F, t - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
9 p) i5 M$ J& f. @" b+ @8 O, d - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
L/ H9 i5 e' [3 c - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" }; K. b' w( f+ \* ~/ @1 |# z$ v0 Z3 p
- #else
0 H' U6 s- c( K8 i5 Y - #define DMA_PRINTK( x... )
|+ P* \1 q7 s; |) o - #define DMA_FN_IN; C9 b) E- j+ M
- #define DMA_FN_OUT8 k' k5 n+ z. m4 D! {1 F
- #endif; U' @' A# C* j3 l
& B0 C: j# q" u! {' B- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
4 J7 m0 T( r4 J4 X - #define STATIC_SHIFT 3! Y. e7 ?5 ?& P X
- #define TCINTEN_SHIFT 203 g( J) L( Z n- @
- #define ITCINTEN_SHIFT 211 z& z4 e8 ]7 M v/ ~ W
- #define TCCHEN_SHIFT 22* |6 x- N8 K5 b. x) F$ _
- #define ITCCHEN_SHIFT 234 A o/ q2 T" @! }) ~6 t8 r
9 F. y. Z5 m, n4 u4 \- static volatile int irqraised1 = 0;+ J, K8 y( }1 o. ^
- static volatile int irqraised2 = 0;
) ^& b# M/ i/ B* b: ^1 S - 0 V' p9 x3 e7 x3 K
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 _ I Z5 g8 a' U z) m
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- F/ w5 L, [) |# M - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ j3 x) ^4 [% W: ] - , |/ }0 J$ P) V2 S5 g8 P
- dma_addr_t dmaphyssrc1 = 0;
$ F, B" U2 E/ l+ D$ Q! N7 n- v, ^ - dma_addr_t dmaphyssrc2 = 0;3 H/ n# Z9 k% I) H( w. V
- dma_addr_t dmaphysdest1 = 0;! a+ H& \' p. @' t% L
- dma_addr_t dmaphysdest2 = 0;+ F) I% I- m" ~& _
- " e6 ], O4 t8 {
- char *dmabufsrc1 = NULL;- ]+ q* m1 z* m# X) {
- char *dmabufsrc2 = NULL;- A) H& ^, J9 l1 m% V9 L
- char *dmabufdest1 = NULL;6 J. K# n; j+ s1 {: E
- char *dmabufdest2 = NULL;+ ~+ d& [+ A: J) K/ O
# D% g& h" L+ E1 H$ F- static int acnt = 512; ]# W; @, {; L/ V" |, b# ^
- static int bcnt = 8;
; B2 y5 `: |( j1 O; T4 G+ X' T0 @ - static int ccnt = 8;
5 B' e% n; L7 {/ ^7 \' V - 2 }; \& a2 T+ n- R/ R Q( |4 d
- module_param(acnt, int, S_IRUGO);. o- \! c# t6 c2 H
- module_param(bcnt, int, S_IRUGO);% ]5 b: h8 X. O
- module_param(ccnt, int, S_IRUGO);
复制代码 1 m5 g* j5 I7 Y i% q9 z8 k
; d" R( U' s3 I! L/ o 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ J7 ?' `2 s( E5 u4 n+ W9 \- Qarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) M" i% { G/ d8 d, D {& W 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: q9 z( J( ]( v J) G" O
$ s/ L; ^, x; G: y. m! d" ~
7 l$ _' c3 F( Y9 u8 |5 e3 O |
|