|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 O$ B- m! F0 q1 t* E3 [1 a; X- [code]EDMA sample test application, b% M5 g* K" G6 U
- /*
, [: A* H0 b- a! f - * edma_test.c/ W6 J4 h" R& U0 F/ C$ d
- *3 `/ s1 V: y8 X" N' j9 H
- * brief EDMA3 Test Application
7 d$ t# K" E5 m |1 Z* { - *
9 L+ e8 ~) s6 v7 A! u - * This file contains EDMA3 Test code.
. @. Z2 C, G" }: |( f. N - *
2 N3 S, D" [9 e* Y1 I4 E; a$ V. } - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
* u7 V4 A* C+ B) z& A9 x5 X - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 t# ` p$ ^$ t9 \2 t
- * TO CHANGE.* o, r! z. _% e: O s
- *
" t8 M* K2 u5 S - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
/ A+ R; ?3 Q' F/ F2 o8 \ - *
& ?5 e) N( N1 T; y$ d2 @; e- K - * This program is free software; you can redistribute it and/or
# A0 U) M7 h- V6 \# Z- F - * modify it under the terms of the GNU General Public License as
# t/ p$ R: r& ]2 \/ w( s# | - * published by the Free Software Foundation version 2.
6 {9 H3 F& R) { - *8 A$ I7 V2 E7 e9 D9 [2 ?
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 V' d: U5 ~* Y% j: v
- * kind, whether express or implied; without even the implied warranty7 S/ L+ V- U% `6 @; p0 }
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ I+ l! o0 [; q$ r0 Z! ? - * GNU General Public License for more details.' U7 g, h. ]$ @2 [- a5 I; W
- */
: D5 [% l% Z5 T* P5 j& ]! l Y
: {2 [, A {$ E8 \7 t6 Q2 \- D3 L- #include <linux/module.h>
L7 p; H/ |( t - #include <linux/init.h>
- ~% n+ w# V6 _7 ^( W0 c7 n - #include <linux/errno.h>
) e; Z# s9 c- I - #include <linux/types.h>
9 T% ^2 Q4 E0 C( C! Y# e - #include <linux/interrupt.h>! H; \7 n+ D& k1 S1 \: `8 T7 k6 p( @& _
- #include <asm/io.h>
- _! M, \) L0 G; P - #include <linux/moduleparam.h>
0 |1 V5 l" D0 q: y c - #include <linux/sysctl.h>1 Y$ @, X& j0 d+ h
- #include <linux/mm.h>/ \2 H/ f0 e0 X0 ?
- #include <linux/dma-mapping.h>
' v0 P! w9 m3 [1 l. W/ \" S - ; W* o9 D# y- I) n5 W8 Z
- #include <mach/memory.h>
& n. b3 m" v1 l6 W2 t5 ] - #include <mach/hardware.h>
5 D; `8 R+ W9 L( U1 ] - #include <mach/irqs.h>
1 A- z9 `. s! R5 e - #include <asm/hardware/edma.h>4 }: q; P4 E) z ?) p) x' L
- # J9 S+ }5 B$ S
- #undef EDMA3_DEBUG3 ]; R4 o% i! v' ?# @
- /*#define EDMA3_DEBUG*/
9 @. L$ G4 A. S! j
4 o) o7 x. d& \, j: l- #ifdef EDMA3_DEBUG: l$ P* ~' N2 Y3 |
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
n" l) M0 S3 P- j - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
! c1 S% t: k* R0 {* I8 w - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): Z* z6 T" M6 f( G
- #else/ ?% k! b6 d& m+ F: }0 x
- #define DMA_PRINTK( x... ). J3 G" q2 ^/ }* T* [
- #define DMA_FN_IN0 B$ o9 W4 U$ U! V, z2 |2 o8 ~
- #define DMA_FN_OUT
e$ m8 x4 ?5 d- W1 [ - #endif0 d" @7 A ^1 F& Q
: X: B( B+ N! A1 j( j! y- #define MAX_DMA_TRANSFER_IN_BYTES (32768)' |) M+ l& b, E; Q: I, V; t% u3 a5 H
- #define STATIC_SHIFT 3
- L+ t" M) f% p$ O6 i* A& W# D - #define TCINTEN_SHIFT 20$ a) v# {% r" D+ B
- #define ITCINTEN_SHIFT 21$ G3 [1 A& p% ]7 b4 r5 W# U/ N
- #define TCCHEN_SHIFT 22
, C2 F( \, c# C; B/ L! m: W8 h - #define ITCCHEN_SHIFT 230 `4 b0 I1 F* H! t2 R. S1 z; R7 N$ T
2 Z7 H1 J/ F! s$ L; X1 A" R- static volatile int irqraised1 = 0;
( d7 G/ s0 R4 y2 i9 P0 u+ { - static volatile int irqraised2 = 0;: }" w0 ^. _4 Q3 Z1 @5 I
- " X1 |) k2 w, o3 h) I! x1 ~
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& ]# y6 t! K% r+ r6 }6 V
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 [, h. ^7 @% z8 j# Z
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* K* i: j% Z' k3 ^' v6 u4 m. N4 [( x, K
; C d" E& V o% N+ T! j% |- dma_addr_t dmaphyssrc1 = 0;+ I' q! B( I0 F, |
- dma_addr_t dmaphyssrc2 = 0;5 l' @8 s7 ?2 z' J* b1 O+ I5 u
- dma_addr_t dmaphysdest1 = 0;: m. `! m7 L2 |2 X- ]: i
- dma_addr_t dmaphysdest2 = 0;* C6 |1 A4 q$ A' M( s2 g. [2 p' q
- : _/ f0 w2 `0 F5 W+ i6 l
- char *dmabufsrc1 = NULL;0 d* V* P: v/ u4 [2 s( c) \
- char *dmabufsrc2 = NULL;* M3 o, h9 t, r
- char *dmabufdest1 = NULL;) V) u. s9 F8 Y! q4 C
- char *dmabufdest2 = NULL;7 L" z7 e, |# u2 M3 V3 Z8 z0 @: L
& f4 O/ ^3 Q$ e! v/ x! X1 u( I' B- static int acnt = 512;
6 Z) E# W9 H8 Q: R/ f4 R* j6 f - static int bcnt = 8;
# e" U t& Q1 c4 z; U - static int ccnt = 8;
0 r0 A+ Q$ @7 [- I3 \0 l t5 T2 P
N4 e1 ]4 T. t7 S' d+ t8 F- module_param(acnt, int, S_IRUGO);
6 |4 g/ N2 e4 [! f - module_param(bcnt, int, S_IRUGO);; E# [: n: w6 Y6 h! H% H
- module_param(ccnt, int, S_IRUGO);
复制代码 ! @9 ^. j- i8 d
0 r. n% H2 Z1 g2 t2 p$ S# h 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( n5 A% _3 ~- M# |1 P! E, N' c* 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. R" W3 u. B2 [; X 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 p$ x4 `: Q: S
2 z& G# l1 X: n. E9 f( }8 g2 \
0 \% j' u1 Z6 U9 B6 v, f
|
|