|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) \- k) I# ]' t
- [code]EDMA sample test application
5 t% h6 r! b8 l2 e; M( v - /*
9 X7 w6 |' {# @' m% S% \ - * edma_test.c1 j- }# ?* B- a) j u0 Y- y% P
- *
* ] f3 Q- ?+ ^ - * brief EDMA3 Test Application8 o+ i! J2 w3 {& P) D4 U# U9 ?
- *
; B$ _. F) A0 t3 y3 v - * This file contains EDMA3 Test code.! O4 E ^! s$ d4 _, H3 Y1 W
- *
; v: l) n: a$ Z6 j- o( _+ I - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
% m/ n. ]) Z8 x9 h8 W1 d! } - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& Q6 ~1 h2 h2 n; P+ s9 L4 b
- * TO CHANGE.8 v/ r' s5 }( @$ R
- *5 P5 S3 n0 r! A: q! D
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& _2 t o5 p8 f* X' M
- *
8 G! ^4 ?& l& P - * This program is free software; you can redistribute it and/or
; x, c' U- N. l - * modify it under the terms of the GNU General Public License as
* ], b7 V4 x. g+ e/ x6 n) h - * published by the Free Software Foundation version 2.
2 V% P+ G2 q& C$ E- N3 ~& W - *" R2 @$ K2 Y) y' n; N
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
* `( d9 W; a. Q - * kind, whether express or implied; without even the implied warranty
5 n7 z8 b" D" u. d0 h4 W1 a5 J - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
: ]" f( j" A8 v8 a - * GNU General Public License for more details.0 E3 j* J8 o- X, k$ a6 c
- */7 Z" l; g- x8 K8 e
/ d6 q; O. h( c! h6 u- T- #include <linux/module.h>
9 O' F( i6 s/ E P* ]* m, |* ?$ Y - #include <linux/init.h>
K( b9 |/ C. v7 ]& Y6 K$ o - #include <linux/errno.h>5 B o- ?; p+ B' j/ s- C. h) ]
- #include <linux/types.h>
0 y0 R6 _/ N4 a, T8 n - #include <linux/interrupt.h>
" k! e( j I: [2 Z% F8 ~2 X [ - #include <asm/io.h>% C+ V7 z7 \( g4 D; K5 ]! Y2 K
- #include <linux/moduleparam.h>
6 B* k2 c6 p, q8 H* e8 O - #include <linux/sysctl.h>$ D0 ~( t. _+ o( F$ M; J. q
- #include <linux/mm.h>
# v& C8 F; L/ W) {. D4 p1 z, x - #include <linux/dma-mapping.h>- m! m/ c+ k+ Q2 c5 q4 H$ Z _
- + \, K) }* d1 U, |) c9 f
- #include <mach/memory.h>
- B' k! ~+ a$ G- ~* N - #include <mach/hardware.h>
3 g8 C7 n! a e. K9 A& } - #include <mach/irqs.h>
) i, F7 w0 c( C* \: h# g - #include <asm/hardware/edma.h>
% T4 Q1 N! a/ P" V( f - 6 a1 D' M* Y' H8 X* {
- #undef EDMA3_DEBUG$ t6 l ^& s9 l8 L2 \* d
- /*#define EDMA3_DEBUG*/
+ \0 W S' R* P' C1 M
( q+ f8 u! Q9 k: D5 w- ^6 \- #ifdef EDMA3_DEBUG3 }! H" r' B; y4 s8 ^
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 A& f. n9 ?$ H* l+ ^
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! }! P/ N1 i n9 |/ f9 e& u8 @
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
9 [" H2 |2 S5 B' C( Y2 W! F) @ - #else
+ R- v; w5 R. w8 N - #define DMA_PRINTK( x... )
) J1 x5 F! T; {; z2 l - #define DMA_FN_IN
& Q8 l! D4 o3 b6 P) } - #define DMA_FN_OUT
3 w7 _$ _- V. |, r3 W - #endif( A" f* U3 v1 y% `# C' k$ o
" G1 Q; x: C% ~ s# F. ^6 z \9 R( h- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
2 t$ E8 v V3 z5 `6 P" b - #define STATIC_SHIFT 3
$ R+ p, y- q/ v" T - #define TCINTEN_SHIFT 208 U* }7 M, O8 e: u8 r* J
- #define ITCINTEN_SHIFT 21% H. N- N6 H/ I5 L8 |) S% M
- #define TCCHEN_SHIFT 22
% K8 s& s9 r' }* \+ Y; \ - #define ITCCHEN_SHIFT 23. H: S* p4 D( S3 |
- 6 J5 ^; D- a/ ]
- static volatile int irqraised1 = 0;
% ~8 I4 N2 A+ X- v! ]5 _ - static volatile int irqraised2 = 0;
) t4 S( `& ?* q$ p* q - ! s9 `, O& T: Z0 z2 ^" U3 V/ {0 L4 \
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 i* @" e4 W! m2 Q. k( f - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' T$ V$ x% i0 d& D+ l5 s
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 _: u- ~. P; S e; B$ I, h
9 O+ o( O3 x# L7 m- dma_addr_t dmaphyssrc1 = 0;, c/ ^$ R. |$ t/ D( R) y: S
- dma_addr_t dmaphyssrc2 = 0;
$ \/ p, j4 D, f9 Q& D2 c - dma_addr_t dmaphysdest1 = 0;9 y) B) X: Z; |+ h2 S' {5 `/ v q
- dma_addr_t dmaphysdest2 = 0;+ a/ I. q; c E& v8 K) u
: p3 S+ ^( R' K- char *dmabufsrc1 = NULL;6 X: I- _! I3 i' n) W7 d+ a5 K9 X+ l
- char *dmabufsrc2 = NULL;
* E( |1 b+ |# A6 ~ - char *dmabufdest1 = NULL;
8 a; J2 ~; Z9 x6 v+ m: I, h# E - char *dmabufdest2 = NULL;
! _8 _) J w( D' N* F - " ?& U2 C: t6 l8 K6 L* @8 r" N9 i- L
- static int acnt = 512;
% Y0 U/ p# B& F3 }; J - static int bcnt = 8;1 u- C& u" i$ p
- static int ccnt = 8;
: K1 K9 i: T* |. B9 Z6 r+ H+ g1 a
4 f0 [7 K, _7 P" E' q- module_param(acnt, int, S_IRUGO); \# u4 Q9 h+ L/ \
- module_param(bcnt, int, S_IRUGO);: U$ I, n7 U' x7 j" X# K% o
- module_param(ccnt, int, S_IRUGO);
复制代码
/ L) c- H4 O8 w. c- j" H# H: U, i5 S( d9 V: h. ~" Y* X
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& B+ v- i7 C2 W% Z# g- U qarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; C" K! A# P) j; p2 T 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" V4 ~4 `. c8 u* m# n! l, E& H8 N9 P- Q& A( C
! I4 k7 h& K5 @3 L0 l |
|