|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' j; m$ b M# F( a, d! y
- [code]EDMA sample test application9 W$ [* J/ h9 c; ?
- /*$ E/ P& w6 P. q( Y
- * edma_test.c! y1 n' J2 d3 y7 G
- *
) P8 m) c$ z) H5 t% J- f9 q( k* m - * brief EDMA3 Test Application
. Y* H- G" B2 V6 P* B- \1 r( z0 } - *; A! m _! M% A4 `+ L1 Z( Y2 W
- * This file contains EDMA3 Test code.
& \% L5 y' A4 c! Y- @; t' N1 H - *
2 ^; a% ?3 @; }1 v, I" g - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ z, v* Q6 S E# F& w N
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
3 ^( C: i1 _! |7 g! ] - * TO CHANGE.
) e* L- X7 U1 n! e+ @ - *
: m+ N2 n* g; k - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
! o( |+ v# S/ {* l/ o% T7 ~- C - *
& a( f/ o9 d0 K% { - * This program is free software; you can redistribute it and/or. j6 [- e" N+ N- ~3 X: F( `4 @5 [
- * modify it under the terms of the GNU General Public License as, \) `( i( D9 W8 ~9 w# _3 n! n' ~
- * published by the Free Software Foundation version 2.0 S9 l( U& f2 F8 x0 i( `; A$ B
- *" b+ v; w+ k" K4 [+ i" s2 n
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any- p; `2 y# B/ P6 o0 j7 Y, i1 Q# H) o
- * kind, whether express or implied; without even the implied warranty
( @" \, X \* M7 s! h( n6 p - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
& |! ?5 [0 N5 J4 I+ S+ Y2 \ F - * GNU General Public License for more details.
2 [3 z% B$ G* W' J - */4 C$ ?" Y$ R; o4 c7 o/ N/ }
- 1 U# {) Z( D- }
- #include <linux/module.h>
/ Q3 U+ h! Z4 u5 a" M2 f! W8 s - #include <linux/init.h>
4 @$ l: z. W( x: [ \: ? - #include <linux/errno.h>
6 q$ I5 `) T# n9 F' _& v x - #include <linux/types.h>+ l/ B* g3 q2 M G$ s: ]7 f( s
- #include <linux/interrupt.h>
3 m, A: {% j7 ~' u - #include <asm/io.h>+ i8 r g/ l F$ B& D4 y* D Z. @
- #include <linux/moduleparam.h>
' J1 _ p& x) H% j: ] - #include <linux/sysctl.h>& w$ f& j% O' q4 y
- #include <linux/mm.h>: ~2 v& G3 Z; g- R& n" B/ U
- #include <linux/dma-mapping.h>6 z; v7 ^! _" x
/ x+ ~5 e# v0 U F! G6 \0 r2 i- #include <mach/memory.h>
3 {6 s% u8 p' ^% j0 o" q$ } - #include <mach/hardware.h>
5 ?( f. q% d4 Y) a0 g. d - #include <mach/irqs.h>$ g. k3 R5 E" c0 i3 j, F r
- #include <asm/hardware/edma.h>
+ r ~* ]# @8 l- j; V9 K1 g* j# p - ( `6 K9 L% a% v0 s9 a+ ^6 Q! K! r7 y! |
- #undef EDMA3_DEBUG/ H; p$ q4 D5 F$ c2 R1 S+ J/ g! I
- /*#define EDMA3_DEBUG*/
7 k' {& x( R' J0 E5 ]' K* V
; d& j9 g5 ]$ i- #ifdef EDMA3_DEBUG: {/ i' `; @ y4 M: K( J
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) [( G: b$ k; F6 N5 H
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& L- C1 w: K/ h }# ]2 s- r* I/ {
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 ?. r" ]3 e' K6 B+ Y6 Z7 Z" k
- #else
; l" q6 T/ U4 X; \ \3 O8 ~ - #define DMA_PRINTK( x... )- e8 w7 e' M# d" \. n! l4 \" @
- #define DMA_FN_IN" w6 f2 C- x% D
- #define DMA_FN_OUT
$ C3 Q7 X( V" w9 f - #endif
6 D; w0 A$ j n/ L& Z$ v) I* f0 a
* G9 \) z f# ^4 ?2 ^2 E# q- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
5 o4 J6 q3 W; w H6 Q - #define STATIC_SHIFT 30 q8 X; t9 [7 X C+ T# u4 j% M* b
- #define TCINTEN_SHIFT 20+ k7 x8 t0 X) _
- #define ITCINTEN_SHIFT 21
* a; Y/ k$ X7 }- W2 _% }# k - #define TCCHEN_SHIFT 22
/ d9 v7 ^6 w3 y) V/ [ - #define ITCCHEN_SHIFT 23
3 q- C0 A1 x0 ?/ j" T$ C5 x9 F( d - 1 o0 T# f+ X7 S
- static volatile int irqraised1 = 0;
7 S' A$ k, i X) }+ c - static volatile int irqraised2 = 0;. P/ n% w% `" K3 j' O3 M, w7 `
% J) W% g$ }. Y" w1 ^0 t% l; n$ X) Z- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) Q, c, Y4 x) v, S! P/ C
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: [# O& Q. c6 R) Z1 ~4 x" R4 y
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* y7 |$ y7 a, H$ s: f3 i! W- S9 s) i
6 H- [4 T, _; w4 |$ S2 Q- dma_addr_t dmaphyssrc1 = 0;1 P% t" M" h+ g7 g9 f
- dma_addr_t dmaphyssrc2 = 0;
2 h% D8 Y2 [. _0 E - dma_addr_t dmaphysdest1 = 0;
' Y$ X( }; \$ o, n7 [0 b% A# N - dma_addr_t dmaphysdest2 = 0;
7 x! P8 I! j; B% E& t# t( i
. v/ i. A) @6 \2 J: z- char *dmabufsrc1 = NULL;
% ]; v0 p# S1 \: z! v: g6 V - char *dmabufsrc2 = NULL;
) ~/ }' J7 v& |2 P8 l - char *dmabufdest1 = NULL;* x2 N9 ?( |0 x3 F$ s- l
- char *dmabufdest2 = NULL;4 l1 I& W w8 Q! ?1 }3 @. P
- * u5 c" f* \% ^8 O
- static int acnt = 512;9 Q4 E5 O) f) N9 d6 c3 v$ e1 m
- static int bcnt = 8;. z! a" r/ a3 r1 p6 |0 X
- static int ccnt = 8;8 I$ Q4 I' D% C. p) R2 u
. g; T4 \9 y' c; G- module_param(acnt, int, S_IRUGO);+ `) k( K2 `0 ]% b3 A1 l8 Q8 v
- module_param(bcnt, int, S_IRUGO);
* `- M! |% e! Q0 {2 o - module_param(ccnt, int, S_IRUGO);
复制代码 6 X, `; P; _' [1 }- T) Y
# ]* S( r# e) ]
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% K! o3 y9 k7 S% {
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- H& d1 {, n2 a y' s( v& [ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 l" C* L7 v) ]. b7 u, [
- H& ?1 e! F9 t0 s4 `" p0 Y6 i3 l. Z+ _. i" H$ ^
|
|