|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 P8 A6 I& B- v/ X, p8 _; R
- [code]EDMA sample test application4 S' [9 P% _) f- P, @9 s1 r! s
- /*2 n. Z) l9 j! ^- o
- * edma_test.c
9 Y% V/ z9 D, V& F$ ^ - *- c N$ L9 E* y3 E; z) ?
- * brief EDMA3 Test Application
: |. s, p; ]; |' e - *) k6 l' ^5 y/ c
- * This file contains EDMA3 Test code.
9 Z% o$ }; x) f: Z* q& b: N' [* n0 h - *. W, V: Y6 O' h1 `. W( r) g5 K
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ }* L5 C; e4 B7 ?# a- U% b9 U
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
% T2 V% H9 F/ x& X- P - * TO CHANGE.$ i; x( h+ X6 a0 s3 p) E
- *3 f/ V$ ^ V5 w
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: \8 G. x' l, g% }1 T
- *) |/ o3 \ B" x/ ]" t1 b* D H
- * This program is free software; you can redistribute it and/or
/ @* ~# @" ^* i1 L1 q - * modify it under the terms of the GNU General Public License as
' t. D, Q5 x& l1 o: P' ` - * published by the Free Software Foundation version 2., T# Z2 r$ k+ r9 M' t5 M' Q4 N
- *
2 A8 S( e1 N) O& a# |; J, X - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
8 o" Z0 v' d$ `6 a. b - * kind, whether express or implied; without even the implied warranty
0 _: T& s5 f+ K3 J+ P2 Q - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5 u* p& \, Y4 P9 c5 }) E' u - * GNU General Public License for more details.
2 d9 D& H- r2 e% G3 e3 g$ y - */
" C. x: I) B$ p( E
3 W+ L0 X( D! `) v( y" |- #include <linux/module.h>: a z) m8 k F4 N* l
- #include <linux/init.h> n( z r) _1 @: l- W" g
- #include <linux/errno.h>$ @6 }" \; w z5 p" {! I D# l
- #include <linux/types.h>
, I! x. h# m! ~7 F - #include <linux/interrupt.h>
7 O4 F& G3 o- b" V - #include <asm/io.h>6 Q% Q X! W/ W- l
- #include <linux/moduleparam.h>9 S) L: T! h: }8 J- ~
- #include <linux/sysctl.h>, _* G9 l3 z! {" h. P8 H
- #include <linux/mm.h>
; H, m5 \9 h- Z: U - #include <linux/dma-mapping.h>* N+ x7 ]# p( O' V
- , v2 b: h% l4 V8 d
- #include <mach/memory.h>" a7 q H" u1 _( M' A% `' ^' a
- #include <mach/hardware.h>. v4 j. r h: [; }) f
- #include <mach/irqs.h>
: h8 c& j# | ?# y - #include <asm/hardware/edma.h>" Q, A7 x8 q* L% p* t
- ' M5 A( X+ @5 k2 x9 j
- #undef EDMA3_DEBUG. B( r6 G0 J! ?6 x$ t$ V
- /*#define EDMA3_DEBUG*/2 X& Z0 E2 x, `
- 0 g( m8 E3 b: {( l# R _
- #ifdef EDMA3_DEBUG
8 `5 @# X' n, v, ]% b - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 @% P+ T. [4 z4 O# D+ @
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 I8 q3 \+ q1 o. L5 P6 |7 Y
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
; q' n( ]# x! t9 j8 A% `; s, S0 b6 h - #else7 r, e# O. k3 {# |
- #define DMA_PRINTK( x... )* Q1 b6 S7 u3 \4 k. Q: P
- #define DMA_FN_IN' h0 A# y: O$ _6 i; w
- #define DMA_FN_OUT
' r6 S5 B* O8 p2 X$ H - #endif& f2 @$ ~$ k- Y5 a3 R& f, E# @; ]
- 5 E0 P% W1 V1 z! c2 e
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)& M" o* n/ H4 n, T
- #define STATIC_SHIFT 31 b" k5 F# K+ Q$ p4 U* W
- #define TCINTEN_SHIFT 209 Y$ e1 J- J/ d+ B
- #define ITCINTEN_SHIFT 21
& Q" L1 e w7 |1 {& o4 u# L) e - #define TCCHEN_SHIFT 22
' L! e7 V1 E1 k: t; a+ P6 g: C - #define ITCCHEN_SHIFT 23
" B7 l- g" w- q! ?2 Q' N( d - * C. w' C8 J- G t {, o; V: p1 w: L+ @
- static volatile int irqraised1 = 0;
3 }: W( V# G: u7 R9 r! t* K; V - static volatile int irqraised2 = 0;
: o, w4 h9 `* P+ L0 `6 q% S0 T - 7 `# `5 j) u m N7 h
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
J* \0 P# j! K- [ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ k6 }; l @/ { - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* u2 y, y4 }0 J' j9 J! c- i8 ]. S
9 c& J1 Q# K# C3 E2 S- dma_addr_t dmaphyssrc1 = 0;
# Z& A0 x( E$ }- Z- X - dma_addr_t dmaphyssrc2 = 0;# {' [9 R m6 I! }. n$ ~
- dma_addr_t dmaphysdest1 = 0;
- @8 V* ^) I5 s; w/ t - dma_addr_t dmaphysdest2 = 0;) x+ r$ _- Y4 Z4 Q {0 `+ |0 u: m
7 p# Z! ]# L; F. [- char *dmabufsrc1 = NULL;
2 j2 M& @9 P0 M- [. v - char *dmabufsrc2 = NULL;
6 y0 h" K8 _9 [! m5 u9 |1 E2 g B - char *dmabufdest1 = NULL;8 I4 F$ f9 g$ M2 |, P
- char *dmabufdest2 = NULL;
# B6 f u/ c Z; i( E
# F9 d- {5 F% }* x2 e9 u, U- static int acnt = 512;
/ ~0 [' l5 i+ Y - static int bcnt = 8;
+ v) X8 T& L6 J. J3 P& A" q - static int ccnt = 8;% M7 F1 @; J1 v% Y$ J
- " x" @4 t* b/ O: D4 L. [9 _
- module_param(acnt, int, S_IRUGO);( J4 K2 V0 ~6 ~7 L# q: |5 g6 x5 g
- module_param(bcnt, int, S_IRUGO);+ n+ |6 U: { A
- module_param(ccnt, int, S_IRUGO);
复制代码
4 v; X' M: {! ~9 Y
# ^/ W% M' g$ x T9 n 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' \ W% j: g5 m$ W1 E3 B0 @3 E5 v
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# u' P) s! s$ ?# i6 M1 C 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ M& P% k0 ?: N$ _/ m2 R" M
. t% x- h/ N' U- O1 M- J+ ~
2 B l/ R) T' C. B
|
|