|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
0 Q5 I+ j) W& v2 |% l; |- [code]EDMA sample test application- s6 X4 s! g0 v
- /*7 ?. \$ r+ O# M1 b3 a+ m
- * edma_test.c6 t9 |& T2 t3 L" k" P8 L' b& L4 j
- *& ?; k4 M6 z/ \
- * brief EDMA3 Test Application; |9 z; e. K" L7 W
- */ M5 g8 c/ y. i m) I
- * This file contains EDMA3 Test code.
' g9 o/ c* d7 j7 L - *
) X* _1 A# B- L- ^" X. H0 X - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% ]# E E2 `" s2 L4 { Y( m- ]
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: w; p( S' ~+ w
- * TO CHANGE.3 Z1 S6 l4 ~$ G$ M
- *
% f' c$ x9 y+ f6 |8 X7 z! L1 C; y - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 N* ^6 P( F- Y O! b: [ {
- *7 G5 c& k6 ]. E: Z
- * This program is free software; you can redistribute it and/or& ^& p$ ~6 l2 c e0 v% Y+ e: X8 h
- * modify it under the terms of the GNU General Public License as
) Y7 @) N$ n" ^7 \; B - * published by the Free Software Foundation version 2.
% J4 {4 D+ m" V) _: j& m( ` - *( `; `" Y. @1 y3 C
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
! a0 w" H% d$ d - * kind, whether express or implied; without even the implied warranty
* J8 Y7 e2 i% ` - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3 L8 t8 h9 g$ V/ C - * GNU General Public License for more details.
! v/ A! F' r9 S: I - */4 D3 D r4 q5 c/ R$ a1 h/ Y( t
2 Q$ P n4 p) e- A3 J$ o' k1 Q+ a% U& e- #include <linux/module.h>
3 P; t! y' c2 C6 E - #include <linux/init.h>
6 |8 }5 x0 _" R( a+ e# L5 B - #include <linux/errno.h>
K l1 L* @% y" }$ @4 ~& i1 Q - #include <linux/types.h>
; D8 ] @# `0 e) x% d0 x - #include <linux/interrupt.h>7 r& B( T) G" \9 X
- #include <asm/io.h>3 l: F" b, v/ n# {5 l
- #include <linux/moduleparam.h>
m0 C* L1 K& s - #include <linux/sysctl.h>
5 C I( Q I* ` - #include <linux/mm.h>/ m# r/ `4 z# t
- #include <linux/dma-mapping.h>1 \8 s$ Y5 J4 s
/ N4 O; \% O* O6 c N2 j" B7 B* r0 w- #include <mach/memory.h>
. B3 z' @! |# k- | - #include <mach/hardware.h>
. G3 d# n. r, T3 n- ]* k: [0 K9 A M4 R - #include <mach/irqs.h>% C8 D/ }; W8 Y/ b; V! d! y) d
- #include <asm/hardware/edma.h> h0 A, g6 \; v# H9 M+ s# Z
1 I5 Z; q" \0 ?2 u/ H9 m$ ?) K- #undef EDMA3_DEBUG/ U2 G1 |6 V; g* }* o; g
- /*#define EDMA3_DEBUG*/
9 @7 Z0 J, L9 A3 ^6 | - , X, E+ S4 ~, Y& `
- #ifdef EDMA3_DEBUG# _1 e' C1 s p- R
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
B$ B8 {9 N% U; l# |$ c6 Z - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
* y' h) U( J" ?5 x# {3 u" T - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
$ x- c, Z- @ c9 w - #else
: w0 V( k [2 F - #define DMA_PRINTK( x... )4 m# f8 d, Q2 ^( ^
- #define DMA_FN_IN
/ ?7 D1 n9 `3 y& Y: i s+ c8 [ - #define DMA_FN_OUT
/ r4 `3 |" b- q( Z+ v. {% _# E - #endif
5 ~) c8 M. }! z( ?5 a0 v+ ^
+ m3 V. ]' G& H' |% Q- #define MAX_DMA_TRANSFER_IN_BYTES (32768)2 s" N/ o$ H: ~) ^* {
- #define STATIC_SHIFT 3' o" k7 O ^2 O$ u
- #define TCINTEN_SHIFT 20
) e/ N) Y) E6 e7 G - #define ITCINTEN_SHIFT 214 {/ z$ b1 I! \3 R- p% v
- #define TCCHEN_SHIFT 22
0 c3 t% }: y+ `, E, Y - #define ITCCHEN_SHIFT 23" V/ m, E$ i- F
- 7 M' N; ^- U s+ ^" Y1 |
- static volatile int irqraised1 = 0;$ a; v: i8 C! L4 K* M6 q
- static volatile int irqraised2 = 0;
. j2 K% g! b5 |( z - ( l7 U" C' S) z; }5 h7 }- y+ e @
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: W; e" f" @! o9 g+ E4 q6 N - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& P0 n$ w3 G J: ^& |0 @% | - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; l- f( Y) [& p0 l
* ?* `- h' R) h2 M2 _1 k1 E( ]/ e- dma_addr_t dmaphyssrc1 = 0;
/ }' a# P* d9 ?" M - dma_addr_t dmaphyssrc2 = 0; Z! o2 W* E* }3 ^
- dma_addr_t dmaphysdest1 = 0; Q4 m3 J& T* b. y! q, t' u* d
- dma_addr_t dmaphysdest2 = 0;
( Z! O2 j- J: F' ^' t/ d% a$ F# V
) r, \8 [ B1 K! M3 f0 U- char *dmabufsrc1 = NULL;: L" G% w# |& d
- char *dmabufsrc2 = NULL;2 Q9 D6 }" Q, B6 |0 i; X3 p+ k2 z
- char *dmabufdest1 = NULL;6 N3 P" k3 m4 [! x, |$ H2 M5 O
- char *dmabufdest2 = NULL;" T3 H; ^* j' T* ?, {3 V4 R
- # ]+ a1 a% {+ o4 `: }
- static int acnt = 512;
4 C. w/ x, h8 U5 Y( ~! | - static int bcnt = 8;6 s$ \) O! k. t( I
- static int ccnt = 8;# ^7 h4 A3 L0 I& R' h4 I- V
- ' c4 N6 e" g4 P' n2 V: T
- module_param(acnt, int, S_IRUGO);
( L' S" x' A7 W - module_param(bcnt, int, S_IRUGO); c# Y. G5 y, m0 t
- module_param(ccnt, int, S_IRUGO);
复制代码 5 s3 u0 y5 a' E) b
1 a* i* i n. x7 z" [( f
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# O n& \5 S2 C
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ m( C$ k2 Y+ h9 N6 m
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 u1 `/ y) _( V: D' B" n/ N3 Q/ |( p" Z
; j) y" }& Q6 ^1 L6 h4 ^9 A |
|