|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: z; v2 R' W9 A. U* F, G, A) L- [code]EDMA sample test application
" X: h P+ }$ g7 c6 } - /*/ @/ v4 L/ Q; W" Z4 S
- * edma_test.c
) g; {' Y3 X U1 C+ V L - *$ C. W, Y' C, E$ `
- * brief EDMA3 Test Application
% t4 M/ L9 a6 |5 s# c: U - *- v# j6 H, M, h' C
- * This file contains EDMA3 Test code.
: V# X# i3 L2 e' y/ K4 @( V - *# ~7 M" D% I% u* U; E- B/ U I
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
! E* x( Q5 Z& T* A - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 H" m3 G _& X1 Y1 @5 u3 ^
- * TO CHANGE.4 V) s0 q7 Y& k1 Q
- *
: E, H8 Y4 ?* L5 C" C - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: l) N8 r: a- B: K
- *4 U3 K8 K& _+ l$ u' H
- * This program is free software; you can redistribute it and/or
( a& B K7 R1 z0 w, b; k. I - * modify it under the terms of the GNU General Public License as2 y6 h' e0 M$ u% `
- * published by the Free Software Foundation version 2.
( o/ _, _4 q0 |2 d) z - *6 L8 {' h. a4 v- C. S8 J
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any& Q) P: u! A: B
- * kind, whether express or implied; without even the implied warranty
( \ C" @1 x# @* s1 y9 [ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
& B4 g& |: u5 b/ t, Z& l! r - * GNU General Public License for more details.
* S# _2 @. F- j3 n$ a8 E2 F3 m2 h! r - */) O! n9 `. i# K; [
+ e# G7 A) U% d' m T( w- #include <linux/module.h>
4 X* M) ]: V, v9 f( @ - #include <linux/init.h># w5 }/ I" B8 C0 t
- #include <linux/errno.h>
; I; Y# g9 I/ Y5 |- o - #include <linux/types.h>
' _) n' ^3 e" S0 w, U# B: [( X - #include <linux/interrupt.h>/ }% I, r% d# e; E$ M* `1 M* E
- #include <asm/io.h>& `7 Q9 h$ N3 O
- #include <linux/moduleparam.h>
& Q% w/ J' \9 y4 p8 ]4 {& } - #include <linux/sysctl.h>8 d, Z* O* f* J8 }& f0 j
- #include <linux/mm.h>! V+ f/ j N t) Y% D" u' k% C+ i
- #include <linux/dma-mapping.h>
! F# [' G( W6 {4 ^( Y5 ? - # v3 J9 G6 e( G$ t4 ?) W3 x
- #include <mach/memory.h>
. \1 x) D+ e. t( ]4 D3 u: Z8 j" K - #include <mach/hardware.h>& W( {1 T3 @; M; k( a$ \" H
- #include <mach/irqs.h>: w3 D* a# K4 C- Q& X; F! @
- #include <asm/hardware/edma.h>/ X9 _8 F) l4 V( ^% F4 Y* j
- 8 k+ c5 h5 @8 T* a/ n7 f
- #undef EDMA3_DEBUG4 a# g- l5 C, G" z1 I0 Q4 y4 j
- /*#define EDMA3_DEBUG*/. ~5 R% E" t4 t6 p* _' g% n
5 b: ?! D) Y8 ?$ O* [$ U* \- #ifdef EDMA3_DEBUG
9 z5 x: v0 f* B: c2 R w2 ], n# L8 J - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
% v3 R8 q! J2 e# M+ C; M' ~1 h - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
1 L1 B" I# n( | - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
4 @4 o, z. @0 T" B5 j9 ? - #else2 N" R% s3 q# z7 S* @
- #define DMA_PRINTK( x... )
, C/ M1 @! o. i+ S0 { d! W - #define DMA_FN_IN
6 f7 @; d8 E9 E- n5 e+ U* } - #define DMA_FN_OUT$ n$ t5 @& V/ |1 M2 e
- #endif
: V; c2 r. L9 [& u) k% X
; t& Z7 l% v5 ?1 @0 D6 A7 p- #define MAX_DMA_TRANSFER_IN_BYTES (32768)2 H r Q/ i$ V
- #define STATIC_SHIFT 3
. _3 v8 {) j: M5 E: m9 {- X0 ? - #define TCINTEN_SHIFT 202 h6 y$ X8 `8 x
- #define ITCINTEN_SHIFT 21
' G; X9 n' Q" l5 d3 l& }' m - #define TCCHEN_SHIFT 229 Q. R$ h" g5 t$ l3 h
- #define ITCCHEN_SHIFT 23
) j' q- ]$ A6 B6 s ?3 D2 {
8 q$ f0 M+ R8 f$ z- static volatile int irqraised1 = 0;
( t) q1 E9 J. Z% n$ s8 y - static volatile int irqraised2 = 0;# X# q/ M4 S( q6 \, p5 I+ o* x) E) P
8 l- N {3 L/ }& h5 ]0 T- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 v0 i/ Y" ]# T6 @2 Q+ [ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 B$ s6 V! x' u. o, } - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 M. T3 H, i$ W0 K
1 r- _9 X5 v+ j/ t9 q- dma_addr_t dmaphyssrc1 = 0;
" C- P, B! f t1 w) m& v8 q - dma_addr_t dmaphyssrc2 = 0;
1 f% U( z1 E; W6 w - dma_addr_t dmaphysdest1 = 0;
; S. g, {3 w: @ - dma_addr_t dmaphysdest2 = 0;* ~7 W! b( c3 T( ]
- ! v( c, |4 [4 X
- char *dmabufsrc1 = NULL;
. N) j" f8 L8 k8 Z( M, P# Q - char *dmabufsrc2 = NULL;
+ ` z6 E5 {, B% m6 R - char *dmabufdest1 = NULL;1 }" i- J/ R- J3 ^8 n
- char *dmabufdest2 = NULL;
8 {& e3 a. i4 n' o0 L - ' S m3 c; [" l+ {+ E
- static int acnt = 512;
$ F6 c2 K) o0 S0 x f3 N' n" d) u - static int bcnt = 8;
' i! x7 Q- W$ M8 J - static int ccnt = 8;
% e6 Q6 J* J( i# D, l' R
3 I. d. ~, k3 H5 C& |- module_param(acnt, int, S_IRUGO);
* U; b$ g, g( l - module_param(bcnt, int, S_IRUGO);8 y/ R6 w% q6 l
- module_param(ccnt, int, S_IRUGO);
复制代码
0 _5 o2 P% A" Y3 [6 E( E/ X% k0 n) l
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用 m, Z5 z9 j9 b( ^$ ~
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 `8 w4 o) A" a# F' m! V 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* ]% }1 X1 u5 u' y4 O' R
* T6 Q% V! `& {1 ~% b: K* e2 e" G: q/ D
; y' o' ]" g, |+ m+ U, H$ w- q$ L |
|