|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( L, C: _' c! S6 F, Q& V- [code]EDMA sample test application
: \6 G3 H6 O \ - /*) [: g9 n! i7 D. g: U* ]% M& J
- * edma_test.c7 f" [6 ~+ {4 X2 @9 E
- *
, b4 @+ W9 z, B8 a* g6 @ - * brief EDMA3 Test Application% Q v9 b9 t7 q
- *
8 {) w3 q9 P- M# n; @ - * This file contains EDMA3 Test code.
* c, y- ?" C: F% h4 a, U5 x- D+ n4 u - *
" m, ^& h1 r: z; O2 b6 k) `8 r - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
3 r' g( v/ [0 f4 l2 E - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) R. k" k8 [. b% o! u% M" G
- * TO CHANGE.
. I2 o' N" N) L" R2 q9 g8 l - */ O7 o' x$ n/ @0 Y, ^: j$ S
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 t7 h8 C( |/ U7 Q- o
- *
% {3 V, y# F- }0 K - * This program is free software; you can redistribute it and/or3 k1 M$ }" A/ V9 J
- * modify it under the terms of the GNU General Public License as
) D$ Y& g# z) E! V - * published by the Free Software Foundation version 2.
! p6 E/ U( d; N: X+ v( L" S, \, G - *
% z, ~0 {2 _$ E! X8 [3 j# G! j/ d - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
6 u8 X; g" E- j1 m3 m! l2 V1 X - * kind, whether express or implied; without even the implied warranty
$ b0 }( U; M2 `% \. w' e0 S1 \ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the! x& G% X" s; a. @- T: x: w# |9 m- S
- * GNU General Public License for more details.5 s9 c1 V% q: X, l6 l
- */" e9 _3 Y2 ~7 ~6 A6 h* o
5 n" N' x: T+ P9 L" P. M- #include <linux/module.h>6 E0 L, x# g6 \' }
- #include <linux/init.h>
* m3 H* Q4 k, E! B - #include <linux/errno.h>, I5 p, O; d$ t4 ^8 ~) ?
- #include <linux/types.h>
! S5 A6 S& |7 q - #include <linux/interrupt.h>
( ^' p' F" Z) F; b - #include <asm/io.h>0 W7 A& V5 @6 T5 G7 Y6 o W
- #include <linux/moduleparam.h>
( B# d# k6 s# L8 R, }4 c) h - #include <linux/sysctl.h>
$ x: B) _& ^- ^5 ?/ J) H8 t- S# I - #include <linux/mm.h>
. j' h6 X1 I$ H4 ~" H8 G - #include <linux/dma-mapping.h>
* r, k, h4 N; U+ M' K
# l2 x4 g* p+ n) J* e& N' k* g- #include <mach/memory.h>% N5 K1 F; _! P- T; E
- #include <mach/hardware.h>
4 a; | w8 F$ X; J/ h7 z/ c0 P - #include <mach/irqs.h>
: X1 J$ w' Z6 K7 F9 j. C - #include <asm/hardware/edma.h>
$ P$ |6 b6 r* z+ N A& {. U
& Q4 `# E/ A6 d0 ?: w% @* E2 f- #undef EDMA3_DEBUG
, E* w6 o! o, N [ - /*#define EDMA3_DEBUG*/
1 o$ G& Y' {: W$ [; v. }( v
) E# ^9 M( s4 G; v2 l0 L5 B. x- #ifdef EDMA3_DEBUG9 P2 t& ]& x: ^: ?! Q
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ N A; H6 f/ g0 s6 o; o5 U
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
' W0 p( h. g: E8 f" c) ` - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! J' V: v8 Y/ _' B1 [
- #else
$ Q g$ U |) W6 K8 M - #define DMA_PRINTK( x... ); N/ b. m* k$ C! E2 B6 B
- #define DMA_FN_IN
0 B3 i) n/ y# r- s! [! n - #define DMA_FN_OUT
. z/ d8 A) P6 E$ R - #endif" Y" r, Z& F0 s" {( \! w; o4 j; w
9 @& K0 ?: T( g, C- #define MAX_DMA_TRANSFER_IN_BYTES (32768). A1 C6 d3 `3 V
- #define STATIC_SHIFT 3
# A% [2 T# z# F - #define TCINTEN_SHIFT 20* `0 n0 ` F+ V; h+ T9 `
- #define ITCINTEN_SHIFT 21
/ j, Q4 t8 b' F. t: C" v) g+ ~. J - #define TCCHEN_SHIFT 22% o4 Z: O( T/ n+ |. m0 n8 B
- #define ITCCHEN_SHIFT 23# s s! c: a5 ]" K3 `8 D' b% F j$ i
- ' _7 D+ l1 s! Y
- static volatile int irqraised1 = 0;
- ]- u0 j& X6 G/ w8 P! _ - static volatile int irqraised2 = 0;
2 r3 P- A; r& F8 v% D4 v- f4 f/ t+ ^ - # Q1 H8 }" ]/ {: E6 F
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* d k+ |) N4 d5 s0 ^1 P! w
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 y6 R, X0 Q" W) _+ b/ E8 u - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ s% p; Y( Y8 R1 [% T
' o# l5 o' N# |7 J5 _* i- dma_addr_t dmaphyssrc1 = 0;: a+ }% j9 `- H" Z. s0 {
- dma_addr_t dmaphyssrc2 = 0;( E b; E) {* @: Y
- dma_addr_t dmaphysdest1 = 0;# g) r. N5 Q$ ~7 V$ L
- dma_addr_t dmaphysdest2 = 0;) C3 B4 K7 k+ d
) A8 j! e w& C) I# L9 @5 ~1 \- char *dmabufsrc1 = NULL;" w) \; A+ b8 ?: Y- N8 s& |4 g, J
- char *dmabufsrc2 = NULL;
" [- a: p+ z X% H8 Q5 o - char *dmabufdest1 = NULL;; `. [5 S) z) _* o# s
- char *dmabufdest2 = NULL;, C$ o7 I, |- L5 |
- * h8 G- `) k" J. h
- static int acnt = 512;1 d. i+ Q7 X, M
- static int bcnt = 8;
7 K4 A! W' U5 m( g. ~- F/ N, `5 P - static int ccnt = 8;
/ ], K+ f" D* |+ H/ v, V6 Q0 t$ E: B - - X) x3 u& P' C4 F& H
- module_param(acnt, int, S_IRUGO);
$ J3 u. r" p0 u7 y- q - module_param(bcnt, int, S_IRUGO);" w4 I, C& d# Q3 B% a; H9 j
- module_param(ccnt, int, S_IRUGO);
复制代码
" r: m% k. R7 X, v8 P* P. o
. U( P! l |+ ^; ~0 V 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% k5 S% }! s" g; ]: aarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' P' C: r" ]1 @( A% k9 {7 D 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 {* x3 O( G& T! ?6 {
, w, q9 `# f9 Q. \
8 l9 l" P1 T' u- `3 b5 O9 c& {. x |
|