|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " [7 J' U( O. M' ]! j
- [code]EDMA sample test application" P& u. }& j) X0 }
- /*5 S6 @: `8 c8 [) z
- * edma_test.c. }/ j" |' f/ L4 o. m. {
- *8 F/ J4 i8 d, c3 O% j
- * brief EDMA3 Test Application
$ p1 {$ ], u; M7 a3 s' V/ t - *3 o2 Q$ {1 H1 q1 t+ r( X
- * This file contains EDMA3 Test code.
! x% T/ Z5 c$ p0 W4 v5 s) U8 F - *, O. n* D Z0 f' D( C& k
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
" f; k% |; \2 D3 C - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
; k3 f0 ?5 j, _1 n# m' @& M - * TO CHANGE.+ `" Y. Q+ g# |* F
- *
" w0 p- c/ y0 V8 U9 a6 } - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
+ s2 [" Z3 P; O z( T! P; K - *, E X( {6 y. r* n1 u$ @# K1 ~
- * This program is free software; you can redistribute it and/or) [ r/ D8 O1 s5 P2 k
- * modify it under the terms of the GNU General Public License as) y9 z+ z& q3 ^) i3 d
- * published by the Free Software Foundation version 2.
) s) D [. L9 _/ V& K - *
3 K# ]. Z2 P! ~( k0 K, F - * This program is distributed "as is" WITHOUT ANY WARRANTY of any; B- P- e& C* H* P5 X
- * kind, whether express or implied; without even the implied warranty
; O2 ~' K6 B# X& c, b1 c - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8 [0 L. O+ P; s8 M9 Z1 x; \8 n' ]- z - * GNU General Public License for more details.2 a/ L) k }% K' C0 B# z' z& `- y
- */
0 L5 l9 R- S2 { - 3 D. G3 R% ]9 L' }# G$ P
- #include <linux/module.h>& s) N' @9 d d) w, ` v
- #include <linux/init.h>0 c' A" K7 J1 e/ L# T, t* Z3 y
- #include <linux/errno.h>
5 O; B( g) X/ _) g' j$ ? \' O. F2 h - #include <linux/types.h>' ?; r. C6 T0 h
- #include <linux/interrupt.h>: E& I$ c @$ z6 z
- #include <asm/io.h>+ [8 _( Z( n7 m8 \9 K, X
- #include <linux/moduleparam.h>
3 b; g' ^# b5 D h4 S# L. @ - #include <linux/sysctl.h># F' ?6 T# X: x) E+ x
- #include <linux/mm.h>% z6 ]# `3 S4 q0 Y. b8 G9 N7 l
- #include <linux/dma-mapping.h>
& p% p) l) |/ c( U - & W1 j/ I! X3 f# K) m, O( G
- #include <mach/memory.h>
$ I6 [/ b, y4 k2 S* B/ ^7 b - #include <mach/hardware.h>7 I9 w+ V( X" i+ T$ M# ]
- #include <mach/irqs.h>
% M, |% ?; Z9 [! s! r- @8 E8 K - #include <asm/hardware/edma.h>9 ] V9 G5 _* {. J
- $ v0 h0 x3 O/ b4 ^% m
- #undef EDMA3_DEBUG
4 v% w7 t9 {9 H, T - /*#define EDMA3_DEBUG*/8 {' |: }# u$ O) L- g: c
- 2 K$ r! b2 p U2 L9 W% {
- #ifdef EDMA3_DEBUG/ N% G% D) ~7 M4 ]- j5 d8 V2 U
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
( K6 Y' j) N" k" Z - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! S! @4 o0 w, m2 n' e7 o
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__) V: Y& J# s5 O7 s" \% \, Q1 x
- #else
) H- O3 t9 J6 f, s; e4 p - #define DMA_PRINTK( x... )) U) A, _8 ~, k1 [2 S5 T
- #define DMA_FN_IN4 i0 N$ G9 G! \2 }" p
- #define DMA_FN_OUT
/ q. c" P0 B! y! s1 L) d* q: i2 q - #endif
; ^( ^/ F. Q& x2 u - 7 L8 q7 t, u6 J% Z6 I: e; f
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)0 O: Z N3 f4 ?9 I1 d4 H
- #define STATIC_SHIFT 3( A# L$ ]* k& ^
- #define TCINTEN_SHIFT 207 C* [( [2 G5 ^% U7 g4 J, b4 Y! I
- #define ITCINTEN_SHIFT 21
0 f. L8 ~: W! a - #define TCCHEN_SHIFT 22# z. @4 \: [! r K
- #define ITCCHEN_SHIFT 23
* R# H) l' k- q0 o* d6 S5 P
6 a( o' N% y8 k! X! p6 M- static volatile int irqraised1 = 0;
* X6 \+ d( N# ^% \( s, c - static volatile int irqraised2 = 0;
1 n1 V+ [4 V3 }2 ]+ \
* o* h" I4 Y, V1 f7 M; N- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 z, j: j' Y8 [, }4 C' h
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 [' n* ?% N4 m- r* K, j6 R/ `+ B
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 L Y$ R7 [4 q! A4 r! q; d5 m
9 f3 e4 y4 q0 U7 f4 G- g- l- dma_addr_t dmaphyssrc1 = 0;
/ d: c1 j5 J) a" b9 V5 P& E1 v3 ~ - dma_addr_t dmaphyssrc2 = 0;4 d( s. n* j! ~3 z
- dma_addr_t dmaphysdest1 = 0;2 e$ Q# x) ^* J. G8 Q+ F
- dma_addr_t dmaphysdest2 = 0;% T8 H6 e" o/ m6 C
- * D* W, U1 ~6 ]& ?
- char *dmabufsrc1 = NULL;% w% q* V5 Q8 z" B
- char *dmabufsrc2 = NULL;
6 f/ U1 h% x9 o* R8 o6 |4 ~$ c$ _ - char *dmabufdest1 = NULL;
# l% S: @! h7 R - char *dmabufdest2 = NULL;
5 o; K; \3 {! L3 |
' a: V0 b, A# f) ^7 B. h9 L, J- static int acnt = 512;3 W$ Z% f) G8 L
- static int bcnt = 8;: C0 _0 M9 U9 x+ X# a* K( _
- static int ccnt = 8;6 d8 ~3 h, C7 O, T9 o- M
- 5 |# O7 V4 }9 O* L$ w% Z2 Q. ~
- module_param(acnt, int, S_IRUGO);
" b% K! `0 y- F% d& P, Y4 o - module_param(bcnt, int, S_IRUGO);: u* M% F7 |( N$ \
- module_param(ccnt, int, S_IRUGO);
复制代码 $ L) ^) k7 c6 I- D$ R6 J/ T
* }8 G; |% j9 e- I* `7 f7 E' D' D 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ u4 W2 g: q8 U% Marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 l1 H Q. S, O0 T7 e4 X( O 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 H; N0 p1 o- Z% g7 f: {! E' f' ^- m9 s o
T; k6 k. j( T% g0 a( A |
|