|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 l: h. h1 O0 m
- [code]EDMA sample test application, y) L3 D1 H3 f4 ^
- /*
9 q7 l0 P4 Y- k& h S$ K$ J - * edma_test.c+ E5 [* {- E5 S" N: @1 g( d, c
- *- Y5 X Q# d8 D3 g8 e' l
- * brief EDMA3 Test Application
" n6 a( [6 P+ t. k" J - *7 v9 \1 q7 b& j; n C! `0 M
- * This file contains EDMA3 Test code.3 A5 f% w" S% ]3 L
- *
% n( S/ C# Q9 d: C [* O - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# V2 o( t2 x# @% e- F
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 ?6 d2 b& O$ [1 D8 A
- * TO CHANGE.! L7 S2 f* w+ ^0 L& V
- *( R5 i% u: x, A
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
6 k5 u' e9 X% k) E - *
L* c% f# _, ] - * This program is free software; you can redistribute it and/or
$ d* @: @ h) u$ N9 @8 { - * modify it under the terms of the GNU General Public License as( M$ d/ U- `$ x( V! B+ e2 \
- * published by the Free Software Foundation version 2.+ {& ^! y+ `0 u& p0 \4 M! r
- *) I, m% y" {9 m9 B( ` u" B. o3 Z
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
8 c( B- q* Y l - * kind, whether express or implied; without even the implied warranty
7 c4 s- n% [7 U% I; `1 m - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the v9 e. q1 k" E; P; N; K
- * GNU General Public License for more details.+ Q: t6 o* P/ @$ a. a" p8 C$ |& ?
- */
' g9 o% s5 k" ]' k( F
- U9 h/ v7 n! G9 L- u. D- #include <linux/module.h>
- J# x1 m7 v5 \4 C$ f - #include <linux/init.h>
4 I, f" V. u* E& [6 r - #include <linux/errno.h>
) B1 B4 ?4 J; k* ~ - #include <linux/types.h>
( W. s* H* X! H1 i; h) o - #include <linux/interrupt.h># r8 W, e y9 L$ U
- #include <asm/io.h>
7 N2 C) [+ g# Y - #include <linux/moduleparam.h>% |/ y; ^+ N1 n# V9 V3 ~( `4 o
- #include <linux/sysctl.h>" e2 M: ^8 \, P, T) I v$ n
- #include <linux/mm.h>
1 V% b+ Z+ g" J6 \2 Z x. Z5 V - #include <linux/dma-mapping.h>) b( o3 n' q' x% J4 G
- 6 ~( ]3 L& b* o; |
- #include <mach/memory.h> S: ~" n# x7 `
- #include <mach/hardware.h>( z2 N& v$ j3 I# Y/ H# p }: g5 Q+ g
- #include <mach/irqs.h>/ y$ W6 ^8 g; Y( }) o: U% n
- #include <asm/hardware/edma.h>
- J7 ]; a* \2 H# D
( q! E; H: b% C2 i- #undef EDMA3_DEBUG
( a1 {' F2 |- @7 u$ Z" Q, H - /*#define EDMA3_DEBUG*/& I; c3 n) H7 I" V2 r* B
- @# t. ~. Q( u5 Q/ L% x& @
- #ifdef EDMA3_DEBUG0 t! E. t- C% \; ?/ {- {$ l
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
' d0 F2 _7 X7 K7 \ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" V9 }. w$ V# s% w/ _& F- O# ]
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
7 V9 j. h+ ?7 v- a" `' L - #else: m# O! f% O. O# W8 K2 @) m
- #define DMA_PRINTK( x... )
: I8 _: o* z# a - #define DMA_FN_IN
7 ~7 K9 |8 h% m - #define DMA_FN_OUT9 A; X! Q* D9 n
- #endif
# j& \( t3 z K( u: h9 f - & B- ` l' b" u- S+ g9 N* p6 e' _
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
2 [4 D8 H6 O5 E, _6 ]5 E - #define STATIC_SHIFT 3; U( q5 T: ]8 C3 I3 \9 U, E
- #define TCINTEN_SHIFT 20- c4 Y: t0 {7 A3 {1 r6 j& H
- #define ITCINTEN_SHIFT 21( M7 V/ H" A; h# R$ ^6 K0 h
- #define TCCHEN_SHIFT 22& i. C8 A+ ^( B: O/ C. C- ?
- #define ITCCHEN_SHIFT 23
! Z o4 c' u8 q( z2 k - 8 ~+ J5 j/ I) b( ^0 ^
- static volatile int irqraised1 = 0;3 v- ^0 \* S: m# i5 X
- static volatile int irqraised2 = 0;( b' R H3 H \& _" N' l
- ! K; a' j8 p3 A9 U
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* W5 d7 g) k I R7 A
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 K3 B3 W4 `- [- c6 u
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ C, {7 c* d& G" z( M$ V6 T - n8 ?* B, E k: n: x# u
- dma_addr_t dmaphyssrc1 = 0;8 N7 ?/ P7 u& o5 B
- dma_addr_t dmaphyssrc2 = 0;
' Q# |$ n; M2 g$ I B - dma_addr_t dmaphysdest1 = 0;
* ^, ~9 I7 m. K. G9 t. R8 T - dma_addr_t dmaphysdest2 = 0;+ |% N( a o, a& b, L
- " |. v; l7 \0 o5 H0 d
- char *dmabufsrc1 = NULL;
# {% u) V& i+ [ h! E - char *dmabufsrc2 = NULL;1 ~* I3 w- P& M9 j s* Y3 Q
- char *dmabufdest1 = NULL;
1 N# H% [, l, N E - char *dmabufdest2 = NULL;
8 n& r1 t9 ]1 X( ]
+ M$ n! B+ m% ^2 p- static int acnt = 512;" P% R1 o2 ^# [; O
- static int bcnt = 8;
5 H4 c% ]: @: ?1 ~$ l* { - static int ccnt = 8;
2 O% e/ m _8 y" K# p1 |
2 L6 m' K" R3 R' X9 |0 c6 g i R, g$ j- module_param(acnt, int, S_IRUGO);
9 H: {* Y* C) N8 o6 W: a4 K: H - module_param(bcnt, int, S_IRUGO);
7 s/ F* O! g! G - module_param(ccnt, int, S_IRUGO);
复制代码
$ {% \- \8 }! i' w; J- y) X) \2 i- p
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' U: |7 i4 |' `% a8 q. p& c
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 y4 U! C3 ~- T( B
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( f3 J$ U0 ^/ |8 ?; G1 `" }
' L2 C8 ?# l# b( m0 U; w& f/ d& D% I& v7 l. |
|
|