|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) ]; a* h9 b. @0 d- [code]EDMA sample test application
% u+ ]1 {! l/ y; n - /*
- K7 [8 k. E0 ?+ Q1 u - * edma_test.c
) [$ b. C. s. ~ z - *
2 r, r7 C0 Z& _" M7 H - * brief EDMA3 Test Application
) }! \* s7 |3 @3 K. S - *# {$ u# q+ F* \% r" h
- * This file contains EDMA3 Test code.; d# k+ e" S: n J" x4 N
- *5 {3 }8 v( k, P4 O% K: `/ C2 q
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
' ?5 `- }, N/ d3 K$ G - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
@0 f2 @* a7 e - * TO CHANGE.
5 U9 ^( Y0 Q) G+ C- r4 m - *
3 A$ T5 w' @1 `6 D - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
! o, l u' N' d - *
* e% X. S+ e. {$ j - * This program is free software; you can redistribute it and/or" _/ d7 l6 f! Z& ^
- * modify it under the terms of the GNU General Public License as2 ^) y; a9 m' V. t- L1 }
- * published by the Free Software Foundation version 2.8 W/ \' ` l4 n4 q
- *
2 x" H8 G; Q6 P" [4 S1 V# z# | - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
! l8 f" {1 _* \' F! a - * kind, whether express or implied; without even the implied warranty
: C% j: y7 r( b& K, F - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 I5 X: f' b/ h' N - * GNU General Public License for more details.# U. s/ {6 }1 v% D( ~8 B3 c
- */
) F9 ^/ z! Z! t) M
3 U- t7 k' k- D& r" g- #include <linux/module.h>
7 j9 O- [! z" B/ G% j$ k - #include <linux/init.h>
8 H9 L+ X1 Q5 o8 _7 x - #include <linux/errno.h>
) ]+ A4 g2 m( U! o* w - #include <linux/types.h>
7 U4 N2 v* H+ u7 C* n& m: X3 l7 _ - #include <linux/interrupt.h> J$ j0 x* t; ~( ?! d% Z
- #include <asm/io.h>: d* j1 L. g- O! ^, ^7 N5 ^
- #include <linux/moduleparam.h>8 f& H5 u# U3 C
- #include <linux/sysctl.h>
( q4 i/ C$ a ] q - #include <linux/mm.h>
/ S4 t4 k- O7 f1 O' a- j - #include <linux/dma-mapping.h>
! ]+ T* r g. k# I) L0 t - 9 e; E6 o( |( w/ ^5 W9 D$ t
- #include <mach/memory.h>- r: a+ ]1 n7 ]3 q3 l
- #include <mach/hardware.h>+ i* ~5 D0 T) [9 [& L, W
- #include <mach/irqs.h>1 I: a+ G9 n2 t+ g p; f2 ^% U
- #include <asm/hardware/edma.h>
% E B2 G, P! Q- m5 P0 _. Z
& Q+ n! A5 L) X4 R" I; j) x- #undef EDMA3_DEBUG3 B( D# T* E6 c5 U0 C; K' @
- /*#define EDMA3_DEBUG*/
( ]: Q. D# `' l" c( | - + P, @; E2 M' C7 S0 k. B: |
- #ifdef EDMA3_DEBUG
- G: H# ~- y! r' F2 {# ~/ H - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
7 J5 u7 G7 ]; X/ M - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
" q% W: g5 f/ _) I - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 n+ @$ Q/ u1 L8 }( R+ P3 q& ]+ A
- #else
* Y ^+ H$ c+ [7 a' v - #define DMA_PRINTK( x... )) [" h) [/ u3 F, j/ _2 ^* _
- #define DMA_FN_IN
) K$ ~# x" j( b3 V - #define DMA_FN_OUT$ _9 x+ Y, J% [/ Z: G
- #endif \5 J$ F: H7 j! [ V- H
9 _) K5 ^' G1 o" o- #define MAX_DMA_TRANSFER_IN_BYTES (32768)0 Y' Z. t; S9 P; \$ p6 c
- #define STATIC_SHIFT 3
$ a* ^6 D p( }2 Z$ E7 Q$ | - #define TCINTEN_SHIFT 20
/ L' o- |8 m: a/ H- y - #define ITCINTEN_SHIFT 21
: H( r6 b9 N# T% u3 c1 E - #define TCCHEN_SHIFT 22
; e w0 r/ S: n9 d" W - #define ITCCHEN_SHIFT 237 i' I" ?4 x% F% J& h" V0 i) ? X
- ; x8 V! Y. [( r. k) w" J
- static volatile int irqraised1 = 0;6 s+ a! @# _7 Y% T- ^% j
- static volatile int irqraised2 = 0;2 l- y) p/ D' ?; N- w3 V& n1 H
- . W5 | x& i, Y0 e+ f0 j% ]% Q
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ N6 p" `: u+ a" c, H7 f4 v
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* h7 W! J- {' V6 t3 E - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ z4 i: Z/ j& H
- ! ]- G: \' B& _7 a
- dma_addr_t dmaphyssrc1 = 0;) L7 a9 A! Z' B: ] p
- dma_addr_t dmaphyssrc2 = 0;* N/ o# \- B: X* x$ a* }. A* H
- dma_addr_t dmaphysdest1 = 0;
; t% ?) z$ g9 E% P6 E1 `* { - dma_addr_t dmaphysdest2 = 0;
* _$ V1 j7 h' n- s9 s) D1 m; p4 f - 6 Z( R" y2 S6 H: M# c' [5 I# N
- char *dmabufsrc1 = NULL;5 U U$ H( `& R6 w l
- char *dmabufsrc2 = NULL;/ p' {1 S- V" |$ Y/ m
- char *dmabufdest1 = NULL;
" L: G+ b) [8 q! H4 d# ~* X - char *dmabufdest2 = NULL;
& z( y+ {2 A5 t5 T( R
' y* M1 I' C, ^. l- static int acnt = 512;
, a' r. c* a+ n; [ - static int bcnt = 8;" m& K9 d2 w7 l2 m3 o. K4 P
- static int ccnt = 8;" x- Q. X! p7 @1 V6 I. N5 {4 _+ l3 i
- ( x4 g- O1 n9 a( h9 y
- module_param(acnt, int, S_IRUGO);5 H+ N- L+ d1 o) }
- module_param(bcnt, int, S_IRUGO);* S: G6 a" i& g i5 |7 |$ u
- module_param(ccnt, int, S_IRUGO);
复制代码
0 E; O- y | O4 ]
; p! H% c! `. S 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 j4 v& J# @: o& |" W3 H$ z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) X8 K( k5 {; e1 g* e
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 J, v" Y. }) p% S4 Z) H' X2 }, g% ]) b+ \$ W
& f. m" ?1 H2 ?4 P$ b( x; o |
|