|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 P1 \2 @! e) r4 Z
- [code]EDMA sample test application
" m6 N1 g7 z. [+ A* m - /*
0 J& C d# r4 n5 o - * edma_test.c( ` W% o# S8 g1 a
- *& Q8 l- p) ~( j1 h9 H6 Y
- * brief EDMA3 Test Application
+ T- T4 X; B# A* s5 K - *
* v B/ d Z% y2 S3 ^" d - * This file contains EDMA3 Test code.
0 d6 j; S5 m1 p& ? ]3 A - *
3 O5 z/ A* B: ?; r( y; U1 L - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
( O% F. T2 u. S) O* @' J - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
5 \/ e0 S: u6 Y4 D - * TO CHANGE.1 M* X( V8 F' k( ?, Z
- *' K: ~" C; H8 M2 m0 o! I4 W9 M
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% h* z* A1 N5 _- M
- *
, ]% V' m' s- W# `" z: D' v0 P- k - * This program is free software; you can redistribute it and/or
# j5 A9 Y# X5 [8 ] - * modify it under the terms of the GNU General Public License as6 e) n& y; v1 a7 i! A& t
- * published by the Free Software Foundation version 2.6 P/ d* S% F9 p R( Z* `8 _7 G9 h7 O
- *+ u5 U9 I" f; l# D# f: Y
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
' F$ ~3 r6 O/ `, s. G( ?! l$ ?$ o0 ` T - * kind, whether express or implied; without even the implied warranty5 h; _9 Y- }) ?5 F
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5 L# u; L/ ~4 p! v - * GNU General Public License for more details.
/ i7 l# D' D' ?/ g - */
% j8 z) W- d- X8 Q - $ |# ~3 d4 K: T- L* c
- #include <linux/module.h>
2 `: n# ^* M' d! q, i: X4 l - #include <linux/init.h># `* t, \4 s' h
- #include <linux/errno.h>
7 M7 k2 w! }* c5 F, L - #include <linux/types.h>
4 g! h: i" \5 ^' w+ ^# _* C - #include <linux/interrupt.h>2 \) a' H6 M$ m/ l5 f" C7 V1 s; z
- #include <asm/io.h>
/ ?, n2 T# }/ [; u! y# ~5 m - #include <linux/moduleparam.h>
9 x" N# w* f% u6 p x - #include <linux/sysctl.h>
8 a: g, M& p- ]% a% K - #include <linux/mm.h>% A2 G) J2 G% V/ S3 z2 ^; F
- #include <linux/dma-mapping.h>% F: O/ e/ o4 @& i
- 3 m, p2 l6 m* v( u" A0 y$ O6 x, p2 q
- #include <mach/memory.h>
3 _$ o6 F) w/ R* c: i5 o7 M - #include <mach/hardware.h>+ g o5 f* T& m/ B7 o2 ~7 T! u
- #include <mach/irqs.h>0 F( N7 g' N' C8 o9 p3 W
- #include <asm/hardware/edma.h>7 {! ]% U1 k3 _& Q7 i
- & ^7 M! ~1 p% I. m+ R/ r6 a$ _
- #undef EDMA3_DEBUG6 B' O$ e1 `& x7 f8 h
- /*#define EDMA3_DEBUG*/
( Y1 o6 I& K5 f; ^* b' d1 u - ) p& ?/ j' f4 R v. m3 d# e1 M5 D
- #ifdef EDMA3_DEBUG, X' i* D1 M# T
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
: w3 t* B: Y$ a3 f& l' [ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& n$ o ] t% U8 Y/ u6 n
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ A. o' S& V2 A3 \: {- o
- #else
$ a0 G+ h c* R1 J1 [" s# ] - #define DMA_PRINTK( x... )
$ Y+ X/ ]+ x8 a4 B' d$ B2 ?2 u0 v - #define DMA_FN_IN& n' ~; Z- p1 L) z1 P& U
- #define DMA_FN_OUT7 M; S) z) d5 P0 I7 q2 U0 y
- #endif
9 i+ n7 _, f( @2 E! y: r8 K+ n - ! x2 ]9 U4 z" P% `9 e
- #define MAX_DMA_TRANSFER_IN_BYTES (32768). A" H/ `& ~6 Q/ D$ Z3 H3 [1 j
- #define STATIC_SHIFT 3. F# x5 _6 m# z/ c* F) l/ v
- #define TCINTEN_SHIFT 20
. ^. D6 Z( w! X% V$ E - #define ITCINTEN_SHIFT 21
. }" b; O, J" E0 z* w - #define TCCHEN_SHIFT 22
2 k; B% q" z* {3 d7 J& z. r - #define ITCCHEN_SHIFT 23$ Q$ @7 ~, y7 O" Q# D: _7 ^
( }( g! Z+ z; x3 R' F6 C- static volatile int irqraised1 = 0;
4 K: p5 u6 r* e+ \ - static volatile int irqraised2 = 0;
5 ? b' A U! E5 S f9 l - 6 P. I4 q+ }; _! q) o* Y
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 ~% k# ?( s% v% P1 f1 p: Z - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: G& j1 h4 R/ g0 A - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" {4 J6 V$ Q+ D4 W
9 l$ b* W, ?- y" L0 _5 y4 l% H- dma_addr_t dmaphyssrc1 = 0;5 G5 ]' x* _, O& |4 p
- dma_addr_t dmaphyssrc2 = 0;
# `. q, |7 B4 G9 Z- r R# R - dma_addr_t dmaphysdest1 = 0;
* X4 e- a/ H# B$ j - dma_addr_t dmaphysdest2 = 0;
" ?/ ^' a- V+ @ v - " V8 n% b! h. E. Q8 G
- char *dmabufsrc1 = NULL;( }! ~+ q! Q& {( m
- char *dmabufsrc2 = NULL;1 N' O- t, f1 X" @. ~
- char *dmabufdest1 = NULL;8 y# D# z- a$ ~0 l5 T+ W2 w5 e
- char *dmabufdest2 = NULL;: W$ ]. s _' w. D# E
- # r" F/ R! F& ]2 z. ?
- static int acnt = 512;! {! L- V2 d) o) T
- static int bcnt = 8;
- D. }; E! S( X - static int ccnt = 8;
0 N4 V Y! F% Z4 |9 ~4 f - & b: ?$ J! U& W+ _
- module_param(acnt, int, S_IRUGO);
0 D* v5 q3 V& _( E7 H+ ] - module_param(bcnt, int, S_IRUGO);
; S/ r& v7 K& @) t - module_param(ccnt, int, S_IRUGO);
复制代码
$ M: m& Z! T7 U ^3 ^& G. D3 Y& s; U2 T2 }1 `7 `$ }
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ J& g* [+ Q% H& ]
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 G0 v) U/ J0 X# Y; Q1 T5 [* C
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 V) G5 w" ^2 M+ p
4 @" k/ x. C5 x) g4 Q* v2 Q i m/ i
|
|