|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 }' d4 D. G# S2 X# l5 j
- [code]EDMA sample test application+ U9 v. v. }0 Y( w$ Y) U
- /*
! y& h) \& @$ y. J - * edma_test.c
: U. Q/ A9 N, X. N% P - *. E9 ]$ q# L9 E/ H
- * brief EDMA3 Test Application
8 j5 B+ c! g" G! w" ^ - *6 J* u6 w( T/ a+ |% ^& Y
- * This file contains EDMA3 Test code.
# C6 f) [4 A' w' ]0 x - *# F7 r1 h7 U8 e2 A9 u
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
; U4 d) ?6 }: `- t0 t, X - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
+ `/ }+ q9 f8 h4 I3 W - * TO CHANGE.
! h# }0 a% _( S( M2 ]) z* i - *$ ~, f! H2 L. z3 u- d/ Z3 L
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
+ [6 F' T$ H+ G; F" m. E4 T - * I% g1 ? I1 U8 [
- * This program is free software; you can redistribute it and/or
9 L. o" U7 a' t% O - * modify it under the terms of the GNU General Public License as% [' }; y3 i* M2 t1 N
- * published by the Free Software Foundation version 2." s( k9 Q: j6 K7 U/ R& V$ Y, G
- *
* X( Q5 ?/ E0 J1 k8 r - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
, {5 M( M* ?0 w$ l3 L+ V" G! B - * kind, whether express or implied; without even the implied warranty# N7 M9 D3 U% @3 b+ y. t P# ?4 F, b
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the: ~* g, W$ y) ~! b) H# U. ]! @
- * GNU General Public License for more details.1 o# N( Y* ~% B. u8 E
- */0 t9 K5 a. I# d
- $ L$ w. R( @) t+ ^4 N6 ?
- #include <linux/module.h> {( T- f0 \% B6 ~
- #include <linux/init.h>1 [1 ~- V- P" d7 }- b' o4 e" S
- #include <linux/errno.h>( |: n2 t5 W1 z& d
- #include <linux/types.h>
$ e% j. A% |' C1 Z8 |3 I0 E& z. v - #include <linux/interrupt.h>
6 v# Q' I7 I9 U- M$ W' m% L - #include <asm/io.h>
: T! Y1 \7 U% g* m9 Y+ A - #include <linux/moduleparam.h>
" N& } e# R: W - #include <linux/sysctl.h>: Q+ l6 E1 c: J' \
- #include <linux/mm.h>& h4 t9 z7 i3 n# {# k
- #include <linux/dma-mapping.h> ^! @- |4 h% ?9 x) v2 ]
- ' ]9 R$ b& Q- Z2 K. K, \; z5 B; x
- #include <mach/memory.h>
0 v! w0 v7 M2 F8 h [ - #include <mach/hardware.h>
/ I( e! R$ _$ J5 r# @ - #include <mach/irqs.h>' b7 z z; K7 g' [$ }
- #include <asm/hardware/edma.h>! q# G, V0 _: _- w O" N
- o5 j2 Y$ m$ X- #undef EDMA3_DEBUG
2 }1 S* h# M) l o4 u$ t+ I' E - /*#define EDMA3_DEBUG*/
: e4 c+ v9 V. c, E( K" s
9 \- y) Q; t6 L0 i7 P- #ifdef EDMA3_DEBUG- ] {1 ] y% j" ] |- c/ c% u
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 a: ]# N8 E5 ^" W7 G
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 d# _: Y2 Z* P& c9 a8 w
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
+ U9 o5 w- R& d. h) L4 O$ L - #else
0 `$ U* D+ ^/ @& y - #define DMA_PRINTK( x... )% Q7 l v6 ^; G% r7 @" O/ O/ I
- #define DMA_FN_IN4 l/ ]0 p# c! g
- #define DMA_FN_OUT+ J9 J( R2 \' J7 A
- #endif) o6 R/ F! p7 P& [9 V
- ' w( O ~2 H" H8 J) G$ S. s
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
: [+ ^% t8 |/ D( k - #define STATIC_SHIFT 3
! e' u( E& F( W/ A D5 U - #define TCINTEN_SHIFT 201 P! M- v) z, l* W) N: O' x, d3 I
- #define ITCINTEN_SHIFT 21& m; Z, z& U! }: G V) M+ `
- #define TCCHEN_SHIFT 22
! M9 U6 W, M3 K0 `$ e - #define ITCCHEN_SHIFT 236 q- g2 P7 N: z( y7 G h
- 4 q7 e" t7 M* y; t; Q, G
- static volatile int irqraised1 = 0;
. s7 K9 u( {& U3 Z - static volatile int irqraised2 = 0;
$ ~* |/ K d; c. O* E3 j; r/ x - 8 t: k3 C9 i2 I9 m
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ ^4 y6 L ^: q: V/ @# z; T - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! C/ {2 i/ V- m2 ?
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 B% z' Y4 L5 I0 s7 H3 T - 1 \; A) W* G' v/ M; w
- dma_addr_t dmaphyssrc1 = 0;
! Q1 k5 P. i0 c! j8 N - dma_addr_t dmaphyssrc2 = 0;; I( D0 `9 {$ ]$ W1 { H
- dma_addr_t dmaphysdest1 = 0;
; i0 o# c/ O& k) d# K. J8 n2 c - dma_addr_t dmaphysdest2 = 0;# @. F0 g7 {+ h
- 4 a u- a: l9 |( v r, j0 x) {
- char *dmabufsrc1 = NULL;
* ]9 Y& Z3 S; K8 I7 L$ M+ Z - char *dmabufsrc2 = NULL;- h+ G, s0 @. f) b! s' _
- char *dmabufdest1 = NULL;9 C; U! }! g! c' z+ Q
- char *dmabufdest2 = NULL;6 q+ v' }( x2 m4 U
- 2 `" z: Q( S A- p9 _2 L
- static int acnt = 512;0 I) ~0 m; [" e# V4 N/ h A+ L1 ]
- static int bcnt = 8;# s$ P% |0 Q% k$ _) @) I$ O
- static int ccnt = 8;6 T# i5 [. R1 Y q$ {. v9 Q5 m& T
( o' X3 F% M9 P/ f, M6 {- module_param(acnt, int, S_IRUGO);
$ k/ j U+ c+ o$ s - module_param(bcnt, int, S_IRUGO);9 r( p- I5 t5 w# O: R. \/ L ^
- module_param(ccnt, int, S_IRUGO);
复制代码
$ f$ W% u7 J! v- ]1 \" y
. ~% I- L( X0 j3 E2 ?& a 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ G) i/ [4 c: d' Karm-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' g$ ?# w. ~ K
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ F* b7 V+ ~0 w& Q2 k0 e; g7 M6 ]
7 L' [; f8 o+ E" {) h W' Z |
|