|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: b1 N2 }& h& K8 \- n" C- [code]EDMA sample test application& E" @# Q( }, y h) v) r
- /*" n* M% O- N* O5 n8 j' }' P" c
- * edma_test.c$ \5 c2 w X) ^
- *
' W, h0 J/ @+ [) H7 N: Q( k0 c% P1 v - * brief EDMA3 Test Application4 x3 `2 Q+ C8 | { _" e
- *. f8 m9 {6 s. G4 R1 ^; S \% `
- * This file contains EDMA3 Test code.
- J0 Q; K; q, p; _! q - *
' k0 _, l$ ~- K% Q' p - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
" J5 K/ y8 x3 g7 C. F6 t0 d - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. E% X" T! R" p8 @5 F2 P6 p
- * TO CHANGE.
/ I; u5 A9 n3 P$ `: E - *
3 t P2 C% s, ?% l. h3 B - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
! \1 O7 X/ X/ D5 g" i2 v- v6 L - *
8 p. [2 a1 O- n2 B5 F, ` X - * This program is free software; you can redistribute it and/or
' M4 I' e3 |. j7 B - * modify it under the terms of the GNU General Public License as7 i/ g7 X9 P0 y
- * published by the Free Software Foundation version 2.) A1 N: H: e) c3 V" n0 u* K! f. D4 O
- *
, T3 g/ }7 V$ w - * This program is distributed "as is" WITHOUT ANY WARRANTY of any% f$ S5 ~# o: I* y, C$ H1 y h
- * kind, whether express or implied; without even the implied warranty5 f& C$ {1 y! P9 [% M! x* ]
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# k: P3 M2 i- ?# U% U - * GNU General Public License for more details.! \' h' `& ~2 e& }. I# x6 V u0 ?5 K
- */
5 m9 j7 w) l$ o' {% \ E5 P
& Y1 H- K: h# {; v+ E' X- #include <linux/module.h>
& A; h# y" ?$ Y) F9 A - #include <linux/init.h>7 {7 v0 E! ?3 G
- #include <linux/errno.h>& i7 D* Y7 k8 J4 m- g% V
- #include <linux/types.h>1 u. M; t5 H/ T T# R
- #include <linux/interrupt.h> r( j$ ~, W T5 I, }# Z) n
- #include <asm/io.h>
& i( O' r9 Y e& _" l7 w9 n7 W - #include <linux/moduleparam.h>
M+ a/ P1 C$ A) }7 U4 U& L# b/ e - #include <linux/sysctl.h> Q2 U$ b2 w( i* B
- #include <linux/mm.h>
2 B0 ^ r- C" v( I7 T; ` - #include <linux/dma-mapping.h>
# j) f/ [! q. V
9 b3 @( Y3 b* _% n @( \- #include <mach/memory.h>9 y }" ^& Y* v0 [' i
- #include <mach/hardware.h>( m8 x. Z8 f# X j0 {% Q; I! U
- #include <mach/irqs.h>- W. L& b" O* [9 \9 U& \% f# s" c
- #include <asm/hardware/edma.h>
' A1 |" h/ s0 s3 h1 A5 j8 c! j - 8 l R- D" V+ `. `0 @+ b
- #undef EDMA3_DEBUG2 j1 E+ u' v% j1 V8 t
- /*#define EDMA3_DEBUG*/* E8 c( R$ M8 [5 r
! D, Q+ f; C3 W- #ifdef EDMA3_DEBUG
/ b' {) ~6 q# U5 k# |8 y - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# K' A8 w$ G0 D2 g/ c
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" c4 u: Z" P! q" O" k) J
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__) V K7 f8 k$ D$ u$ N! X
- #else7 A0 i7 b* y& R2 i$ o( v
- #define DMA_PRINTK( x... )
6 G% _" m% { U% q$ n" H - #define DMA_FN_IN
6 a" D/ L R! O, ~" { - #define DMA_FN_OUT5 P; U) S; ~8 q: R# j. O; _" X! c- d
- #endif: V8 x, y" Z3 ?7 X3 N1 w6 u8 l9 d
+ x; {8 a& i" [2 N: n H, ^- #define MAX_DMA_TRANSFER_IN_BYTES (32768)0 N0 b, V+ ?8 \# F0 C% {
- #define STATIC_SHIFT 3 d9 u/ T% D0 F6 I0 }
- #define TCINTEN_SHIFT 20
1 G: @* N/ j% P7 k1 s - #define ITCINTEN_SHIFT 21
, t8 k2 V( C' A G8 u4 ]$ ~ - #define TCCHEN_SHIFT 22 _2 ~$ k1 v# _- [
- #define ITCCHEN_SHIFT 23. X* ~( f6 c; s. J' l
" U E3 [ e3 u9 Y- static volatile int irqraised1 = 0;; |. Q- _; _) ?: P& }. y' }
- static volatile int irqraised2 = 0;
, U4 o- F* [% P8 h - ' b9 v/ q0 q) h5 ]$ Y* m
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 a) R& ?5 w O3 e - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% v1 O6 g0 L% B+ o( {$ p$ |
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; \$ L5 t. D' i - 9 ` w& R, F3 A, V% V7 U4 s
- dma_addr_t dmaphyssrc1 = 0;
/ ^$ |; h9 f4 M' N1 i - dma_addr_t dmaphyssrc2 = 0;
6 J! \$ u* T2 f1 c; h! Y9 s; F - dma_addr_t dmaphysdest1 = 0;, H+ j5 X5 x; d1 p
- dma_addr_t dmaphysdest2 = 0;
* J* v" Z; G( Q" i- ~# B - : T: u6 p- J0 P
- char *dmabufsrc1 = NULL;8 R9 @& A& _. i9 a
- char *dmabufsrc2 = NULL;
" b% D5 @ b! I- F# E3 {; ?2 K - char *dmabufdest1 = NULL;
m# q7 o; X5 V: n - char *dmabufdest2 = NULL;2 W7 k1 w. d5 Z. j9 h
+ l0 k! |; m/ A$ _, S+ r1 }- G- static int acnt = 512;
) V, o6 S$ t0 s$ }! z; j7 @ - static int bcnt = 8;* T3 v5 u1 Z' }! n
- static int ccnt = 8;
0 Z3 w0 a" Z( n, ~; X* Z- f
: R% Y, N, I- `( q7 H- module_param(acnt, int, S_IRUGO);
3 y1 z: m4 a/ W7 s1 C3 { - module_param(bcnt, int, S_IRUGO);
" C. O1 t! R2 z2 `5 q: C, N - module_param(ccnt, int, S_IRUGO);
复制代码 c4 \2 l% ~ P8 m: @
( F) V: `7 H4 ?5 T+ U9 G B& C
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 E& c h+ l% p; i& k' }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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 G' y- o# F% u$ x& p: E 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& S- k) {0 G" [) E
6 N; q: l7 G# x2 z
& T4 |7 o( r7 L* L) L% }
|
|