|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% H$ X9 i6 k1 m2 K/ N- [code]EDMA sample test application$ C$ N k/ K1 n+ [1 E# u5 G/ i
- /*
3 O0 ?' ~+ Q; X9 g0 U4 n1 B - * edma_test.c
+ r5 y+ y7 g+ e: }& p9 S2 [. N3 ^ R - *5 T, X* C( g+ Z& b5 h( d
- * brief EDMA3 Test Application
5 B! X5 Y, n' U# e- L8 m! { - *
4 i, M) h: J8 O# o - * This file contains EDMA3 Test code.
+ u0 q/ U) M9 k0 H6 q - *
; p, D) [4 H6 M2 o( X - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
8 G9 E! A0 k2 m' s7 { - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! H) p" z9 f" Y8 Z# z- x! l- f- h
- * TO CHANGE.+ S1 n- N# V* i% c$ o6 c
- *
% f3 c$ H# \2 ? - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" g+ ^# n# }% R9 m# D; f a
- *0 g4 R7 ^# G" Y
- * This program is free software; you can redistribute it and/or
7 A; ^4 N5 t- g- c6 D - * modify it under the terms of the GNU General Public License as
% I: i" Y; e0 w - * published by the Free Software Foundation version 2.
: E7 H& l$ o& | - *9 a5 r8 x) N" c# Q9 H" H
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
& ~2 b. {( E1 h - * kind, whether express or implied; without even the implied warranty
1 ~2 A% P w1 t3 V; l2 G - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the0 U' k, M, L7 t9 }0 ]! b
- * GNU General Public License for more details.7 c2 ^5 f0 W& m0 M2 w" p
- */( f: {* R0 o+ I* V% G2 V7 F
- : L5 |9 c: \2 x8 n8 O8 m5 E" ~
- #include <linux/module.h>8 U4 X) M' y% c! X2 b {2 o
- #include <linux/init.h>
! v7 k/ A3 }2 z4 h( \ - #include <linux/errno.h>- v( ~" S) A2 `: V7 E
- #include <linux/types.h>5 |& Y, \8 T1 C0 `& Y3 j
- #include <linux/interrupt.h>
. h5 S* h _' q - #include <asm/io.h>, s6 n0 _2 }6 X+ j/ V9 c
- #include <linux/moduleparam.h>
% O1 q3 d7 E6 _9 u - #include <linux/sysctl.h>
/ ^) c# Z# P' t2 Y% z - #include <linux/mm.h>- Z' A' s" V7 Y8 {* t1 f
- #include <linux/dma-mapping.h>
5 K' g5 q- K; i: P4 F - . u, t: Q* D: S$ E( S: i! }- U1 V
- #include <mach/memory.h>) \7 V) p& Z; y0 H5 c
- #include <mach/hardware.h>& b' D$ d, ~. c
- #include <mach/irqs.h>* u1 ^. r4 [! R- }
- #include <asm/hardware/edma.h>: @6 C5 G s- Z+ R% |
3 M+ z: `* y; K3 A n- #undef EDMA3_DEBUG
; U* M% @+ w5 U) z$ V+ N. ] - /*#define EDMA3_DEBUG*/+ g( A: e" e: e( T" z: S+ m
- 9 ?2 x; S2 c+ | q# e5 ]& X' ?0 F
- #ifdef EDMA3_DEBUG0 E6 {% P' [- U; W e3 e9 O
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 y' W; X8 x+ Q3 {( S
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
5 N5 ?% L5 F; C$ U" I$ ?5 Z0 t - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) W# b7 j1 [$ z3 `
- #else, r. o5 n# Y3 L, H# P- V4 |& S' y
- #define DMA_PRINTK( x... )
+ w& R% s% F: @ Y - #define DMA_FN_IN
$ q7 p% a! T8 v/ Y8 ] - #define DMA_FN_OUT
7 f ^; o/ G; w @( R7 R - #endif% c8 E4 T. ^0 z
+ ~: M- Q6 \( C6 H2 I9 y; k4 U- #define MAX_DMA_TRANSFER_IN_BYTES (32768)8 c6 q) P" |! K
- #define STATIC_SHIFT 32 x; Q3 J, j- ^5 U% b: o
- #define TCINTEN_SHIFT 20
- {# G, C+ m' _3 j0 Z) S7 K5 W ]2 J - #define ITCINTEN_SHIFT 21
6 j" S$ ]. S" ?( w9 R& o - #define TCCHEN_SHIFT 22/ r' H2 ^+ a! f* U
- #define ITCCHEN_SHIFT 23' R3 p9 B& P& e; K( w
- ' J2 k V( E! i
- static volatile int irqraised1 = 0;9 q& u7 D& R" @# ^
- static volatile int irqraised2 = 0;! q8 @. U" D' z; j# ~5 n; ]
- & Z& ^, `7 ^8 o; `/ L6 L
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' s) G' G# }3 b! b, R - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- ~; t7 h9 x$ @, U! @& j - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ e& C" k1 y2 N- F- k* \0 X' u
- / s# W3 ^) Y6 N
- dma_addr_t dmaphyssrc1 = 0;, [0 A& I4 Z# g; B4 B T5 ?
- dma_addr_t dmaphyssrc2 = 0;% _/ {, `' |& L% ]6 s1 O
- dma_addr_t dmaphysdest1 = 0;/ Z9 d- M% [4 [5 `% J( Y
- dma_addr_t dmaphysdest2 = 0;
! B( W1 Y" ]$ B9 V- A) } - ; T* U$ J$ N; Q4 t, {* z
- char *dmabufsrc1 = NULL;
' Z, s- r7 L _$ P - char *dmabufsrc2 = NULL;
$ Z: ^4 U# S$ L$ ^/ k! u - char *dmabufdest1 = NULL;5 e3 B3 g( g. D: k; D6 R* N( W3 C1 `6 ?
- char *dmabufdest2 = NULL;
( o1 e- i8 P$ Y3 g) k' h6 N
( T+ i/ f2 Q; a3 E" X- static int acnt = 512;
" @. j7 } C A3 Y% U - static int bcnt = 8;7 e; _; f7 T9 l9 t( a0 s0 e. X
- static int ccnt = 8;0 }( h/ Z/ p0 C4 O
- # s5 Q( H# G1 A+ v# l$ H" C; @
- module_param(acnt, int, S_IRUGO);
8 G n& s$ c* \7 Q( l - module_param(bcnt, int, S_IRUGO);) A! Y" Y$ I9 b7 k8 n
- module_param(ccnt, int, S_IRUGO);
复制代码
1 C6 H8 g; i; d2 T3 u# `% W8 K( w4 G; c& @
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 I' [$ c! t; c7 R4 S! N
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! ~6 E% G; _/ L9 S- d 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" g2 Y% r$ U: Q- C1 M- W
! t. O" c" d. o R
' G) d+ R. J7 F7 W0 P |
|