|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 z' E1 I% j8 i: Y% Y5 K5 x9 o: s& J; n
- [code]EDMA sample test application
% [& B' v" s8 F- Y5 z9 b - /*
( x8 g# i7 f/ d8 o - * edma_test.c
- F" O( O2 I5 X- I& u& D - *2 ?! S- k7 H1 \# T" X5 Z8 r
- * brief EDMA3 Test Application' y) i0 ^3 [# `" X
- *
' @: Y2 d/ ^+ S* K0 d - * This file contains EDMA3 Test code.
" X. N5 H0 i& M - *
. I7 U+ c2 H# r- D - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% {- r; T/ [9 e$ \
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
; b# I }" @* M, E - * TO CHANGE." B# u! F: T% G+ m
- *
( g5 S+ v \- H - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
5 u- h% b- ]# |' R R/ D - *
/ u7 x! Z5 ?7 s3 E$ D3 {- R - * This program is free software; you can redistribute it and/or) o7 F' d% `9 |$ F W3 K) e
- * modify it under the terms of the GNU General Public License as
1 @ i/ T2 q% T7 F% W- v$ l+ \ - * published by the Free Software Foundation version 2.; Z- N0 g/ M8 F: b# H
- *
3 H: D1 s$ {4 A, c5 Z - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
3 Y5 t$ S* ]3 ?; w1 m6 \8 b1 [ - * kind, whether express or implied; without even the implied warranty+ R3 V; ` H E. w# e% M; Z
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the# {" ]3 q7 l. |6 Q& C# p8 e3 J
- * GNU General Public License for more details.5 h0 g2 {; x3 K5 U2 \( d! O. K
- */& ~ O/ l2 r- W0 \, k
2 \. m S }, y# E8 o- #include <linux/module.h>6 j, M+ D( W. E
- #include <linux/init.h>
/ c- H+ \4 `. R7 D! m - #include <linux/errno.h>! k' J* {8 q( b" K" [! b9 s$ I, } ^$ K
- #include <linux/types.h>
h' |# a/ i; S' g - #include <linux/interrupt.h>: A3 M! M/ k; g, P& n8 W: L7 Y% B
- #include <asm/io.h>
! h7 r* d9 h3 q5 i" {1 ]& ] - #include <linux/moduleparam.h>
: `' N/ g3 m v8 Q - #include <linux/sysctl.h>
0 \5 \# a) l% r# D) Q$ e6 H, B - #include <linux/mm.h>
/ p. D2 F$ E. s1 L0 i - #include <linux/dma-mapping.h># H( O! x2 Z2 Q
% I4 x( q: S9 Z5 L" t- #include <mach/memory.h>+ R" ^2 M9 `3 O' r# x
- #include <mach/hardware.h> \8 V* {2 l/ c8 j2 V' J
- #include <mach/irqs.h>
- @# U4 y U, s; p - #include <asm/hardware/edma.h>
& X0 |9 O3 a2 i8 X0 C! D8 V& [ - " B7 x8 v# @. a; {: s! g" e0 u
- #undef EDMA3_DEBUG) C. r! c; j7 I: K% y [0 D$ F
- /*#define EDMA3_DEBUG*/
8 N4 T4 L+ e- N( F
; Q' P! [$ t; l$ J K- ^. A/ ^- #ifdef EDMA3_DEBUG
) \9 T+ I7 Q( r! c' O6 r, N: X - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). f/ s% c: q/ B* P- @+ T( M
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). F" P( Q% D* _; r9 {9 b+ d
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)4 E0 P1 h/ F- }" ^6 u
- #else
# n5 h# u- Y) Y) ~# [3 W$ @ - #define DMA_PRINTK( x... )/ D- i ~% d1 P; s; W% L
- #define DMA_FN_IN9 Y: A$ m4 N1 Y! N
- #define DMA_FN_OUT d# |3 B- E' l1 K
- #endif3 m6 c/ K. S6 v% u& e$ V" }
- # t0 f) }; T9 v2 {! g- F8 s
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)! ]: P) f4 f- I& Y9 t) e2 l
- #define STATIC_SHIFT 3
' O% @) s4 i; L - #define TCINTEN_SHIFT 20
8 L% T0 [0 ~* ]: _3 N h - #define ITCINTEN_SHIFT 218 T* o" p3 L7 V* ^* _; e
- #define TCCHEN_SHIFT 22
( g) c3 D& l' Y$ k# t, ] - #define ITCCHEN_SHIFT 23, p$ H9 z; `* }7 ~3 [
4 H# p. l3 B6 d2 R4 h; E1 B- static volatile int irqraised1 = 0;
; u- F, g8 c. \4 G - static volatile int irqraised2 = 0;
7 E* L7 Q9 F1 B4 B* x' u - # F# P$ @- q# T: r! ^/ o( ]
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. v0 H4 C, t% a. J. {! \ t
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 P. y) l* t; ?
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& {- E) D; |7 X4 K: s: X: i
- 8 x3 O: k9 G. }9 K
- dma_addr_t dmaphyssrc1 = 0;$ ~: {* u- ~5 y
- dma_addr_t dmaphyssrc2 = 0;3 p( k2 n0 d8 N3 d% [, q
- dma_addr_t dmaphysdest1 = 0;- ]/ Y: U9 f: _5 Q% g
- dma_addr_t dmaphysdest2 = 0;
9 N& y- D- u4 F4 M; | - $ @( I' _' G$ @" O
- char *dmabufsrc1 = NULL;2 @- w& U2 V. ?' ~0 i- a, X
- char *dmabufsrc2 = NULL;
& |3 R" b# z) ?) d T - char *dmabufdest1 = NULL;
0 ]3 D5 N9 z! ]" ~& d - char *dmabufdest2 = NULL;1 H$ \0 c$ ]5 d' [ B
- ( N! M5 K' W. y
- static int acnt = 512;
- r7 P3 l3 |9 { D& x# ` - static int bcnt = 8;4 O2 x" E( k! X# f* k
- static int ccnt = 8;3 ^ m( `3 ~( P$ l q6 s( `6 J. g
, @; [; s4 j2 ?0 f( u7 n- module_param(acnt, int, S_IRUGO);1 A n5 Z' Z2 \& F
- module_param(bcnt, int, S_IRUGO);$ m {2 h) _% E! [1 m3 U
- module_param(ccnt, int, S_IRUGO);
复制代码 9 ^% D9 `- t- O, c7 W
/ x3 r1 l/ ^9 z' d( B% e' X3 {
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ r, j7 ?5 a8 \* F3 h6 D3 Y8 uarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, Z% V9 n- @# F6 |
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: V1 s" f3 K( m9 ?
5 G- `' f2 c9 c1 {. f' Y# r1 V6 Q( S9 P1 ^% s
|
|