|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- ]) v/ r, f$ w' c$ ?- [code]EDMA sample test application
0 h; x. X8 A _. X) n8 {: n - /*6 b! i' k0 s3 o5 r6 r
- * edma_test.c
5 _# f8 n* F& @6 I7 E' ^3 h - *1 @+ d+ G: [7 j" E6 N7 q) }, u
- * brief EDMA3 Test Application
3 f5 `4 ?- q8 Y6 h - *
, C: @8 ^: L( x: N$ V- o+ P - * This file contains EDMA3 Test code.) @: u; T V5 u2 y; v/ E" q% H" L$ h/ Z
- *( k! a/ y: a9 N. T" \0 b, }4 f" Q
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 g2 ^: ` R; x* a
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
% d0 X7 D; }" \, C; x3 ?, h - * TO CHANGE.
4 t6 F7 e: I- G+ E1 ` - *
6 P+ ]) z" C+ C* r1 G8 H; b! r5 n - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" @' `+ H" x& g( [9 R+ q7 Q
- *
& O2 k0 t4 {) i6 c9 z& @' Q7 y9 V - * This program is free software; you can redistribute it and/or/ M# e' G; p5 L( P9 I! g: C
- * modify it under the terms of the GNU General Public License as
" F9 a" H+ x$ ~ c; j - * published by the Free Software Foundation version 2.
) I, g4 s9 W8 D% M - *2 O2 A) U" p, I& ]& t. f' s, o
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 f2 i4 A9 T, `6 {1 `9 r
- * kind, whether express or implied; without even the implied warranty; s0 j/ B# a9 q1 a0 k- E; e) @
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the/ G! @, J, D5 n" ]
- * GNU General Public License for more details. d* b$ W9 y& _$ w9 B1 q% W
- */
% x0 v* e% Y3 @' r3 g - ; Y3 e' L2 w9 S9 P) y6 {
- #include <linux/module.h>
3 `8 g# V: t- K! z( F - #include <linux/init.h>
; @' K1 E' `0 O7 G - #include <linux/errno.h>0 X; n4 ]/ L) ?2 L* r4 ~
- #include <linux/types.h>
& r/ p* V6 }' l' Q5 D* f6 ] - #include <linux/interrupt.h>3 [- P& g$ A+ W
- #include <asm/io.h># H) ^& E8 }0 @) Q$ u6 n4 A
- #include <linux/moduleparam.h>
9 B2 O2 P- S5 {$ r' ] - #include <linux/sysctl.h>
" { p7 ?0 Z- T2 h" n( H - #include <linux/mm.h>
7 I; U5 g3 n* w, x2 F* i - #include <linux/dma-mapping.h>
' @8 {( V/ b% Z, B$ B
* n5 ~8 }$ e3 f# ~5 g* S& b- #include <mach/memory.h>
8 E8 T _0 L2 n. m! u& J$ i - #include <mach/hardware.h>
( F9 R% u) C0 M7 E0 q$ ^) K2 R& D - #include <mach/irqs.h>
1 v+ g$ c" J% [6 e% e - #include <asm/hardware/edma.h>
6 T1 t* L/ m$ @0 W" N" j - " L; O$ X1 ~5 K, R* c
- #undef EDMA3_DEBUG+ n/ b" C5 d% p' c
- /*#define EDMA3_DEBUG*/
; h# @! ?: F1 p8 k) n - , x+ A$ c% ?1 m- O
- #ifdef EDMA3_DEBUG- I3 |0 F7 O0 b% L
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
0 }4 B( J8 h. Y7 `1 b- d - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
: x7 C; ^( q, ]* W2 e - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). Q4 }1 r$ a+ y. G! r
- #else7 @0 c. D! S$ o" ^& S1 t# k
- #define DMA_PRINTK( x... )* }$ l5 r$ v3 }- ]3 D4 f
- #define DMA_FN_IN
, j J q( C* E4 A# |; F - #define DMA_FN_OUT7 P8 N1 t8 `7 Q
- #endif( ], b) [7 o, m: _# X, Z2 Z; Q6 K* e
- * K) k! [) l2 t2 b9 ]; e
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
" w1 x+ j% {. j$ l7 j8 W m - #define STATIC_SHIFT 3
! h6 U! M' e8 v# o6 z0 u" Z - #define TCINTEN_SHIFT 20- g1 K$ D# L5 ^4 q; k! ?, H" {
- #define ITCINTEN_SHIFT 21
' }/ b' t6 H& H! Y; o% Q - #define TCCHEN_SHIFT 22# ~$ Y: e4 \8 ~' f2 c# s4 U
- #define ITCCHEN_SHIFT 23# Y) @5 d2 h! V1 T' N
- 3 e0 ^- f% N g
- static volatile int irqraised1 = 0;" x( }% i. Z! \* F. \4 Y$ y! w6 x' H
- static volatile int irqraised2 = 0;. K# K/ c& m$ x: m8 j7 q
( p+ I; v% Z7 P- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); K0 O' R# L! o" W
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 ?) {+ L, `1 ?4 Q+ `
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 S, e4 O# n1 b, x$ V8 f) q
* S0 Z( P% v/ a8 A& c( S- dma_addr_t dmaphyssrc1 = 0;. F4 P1 W) S3 }$ d7 Z
- dma_addr_t dmaphyssrc2 = 0;0 I; M5 j4 M& k/ F. [( d
- dma_addr_t dmaphysdest1 = 0;
5 C$ E1 j' q, @- R9 F# D g - dma_addr_t dmaphysdest2 = 0;# p5 ^& i! h+ `2 R) F; K
: v/ X, ~ Z, m) L- char *dmabufsrc1 = NULL;- ~7 I' }9 x; j. a3 j
- char *dmabufsrc2 = NULL;% e) J ~( g% \( r5 t; S6 [5 x
- char *dmabufdest1 = NULL;
% h q. F# l% j, E' \# V, Y4 O, | - char *dmabufdest2 = NULL;. a }$ e2 p9 b
- 6 c% @6 x [+ N( D5 A
- static int acnt = 512;5 w& s- g/ E% Z" l
- static int bcnt = 8;* l( B( r: u9 m- m- S
- static int ccnt = 8;! b5 l9 M# ^1 R9 t" Y
- [% r/ }+ B! E! m' `4 m% X: _$ m- module_param(acnt, int, S_IRUGO);
3 m% N0 e, W+ |+ c( A% w7 S* _ - module_param(bcnt, int, S_IRUGO);1 ^ k- ^" B% h5 _
- module_param(ccnt, int, S_IRUGO);
复制代码 O9 O% y. J. m
, V4 |' M8 l0 Y6 P- c
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- b, P' e: h5 g) n$ F
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 h! \7 P! j k; ~, i {* i6 b 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 G) o& G: q8 C1 j p! J2 z r2 [
/ o `/ ^5 R6 P
! d& ]6 A$ U* f |
|