|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' d4 [( Y4 U9 _$ I. t
- [code]EDMA sample test application( O; q$ G! E3 s& H
- /*- e6 [8 f; Q( f s! W* Q" ~( A1 L
- * edma_test.c
$ f7 z2 O5 g/ c; ` - *4 [, O4 `7 p- B; `9 ^* M6 [
- * brief EDMA3 Test Application# N9 y' E; |$ L3 U
- *
! [1 n& A0 K. y" O D3 y+ u - * This file contains EDMA3 Test code.( W2 H& Q" R% V$ z1 m! O/ M
- *
8 \$ G( h, q* V6 j - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- I0 d" a" G9 ]
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* b; _/ M- O; B; f& a
- * TO CHANGE.7 Q9 f& X% u/ ?0 G0 M, P
- *. r* X* y# ?5 [! E+ L
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
8 Z! s, A0 x! R3 @4 e* L - *
! _% y! l4 u6 \) p - * This program is free software; you can redistribute it and/or
' i$ d: t7 [8 I+ {' `& { - * modify it under the terms of the GNU General Public License as1 Y- \$ U+ f$ i* B% @# @
- * published by the Free Software Foundation version 2.5 I" S$ _9 F: W
- *
x, b% z: N5 k8 i; K6 h - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
. B. f0 Y6 `$ q* A+ } - * kind, whether express or implied; without even the implied warranty' l/ ]% g# B/ [1 b8 z, R
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the6 q0 N8 q. Z# ^, c" ~! Q9 {; H
- * GNU General Public License for more details.
$ Z9 H; q4 J m: P0 p! l' | - */
( Q; Z! ^8 t8 S! f' ~; N% F
0 W% g( I/ O7 S6 ~2 ?$ P, ~* q5 |- #include <linux/module.h>
( W% k+ M+ n/ M$ Q1 L - #include <linux/init.h> Q+ W3 |: g1 e5 z
- #include <linux/errno.h>
, K) U7 b T/ o6 n% ^/ e5 m - #include <linux/types.h>) \* c) a0 D4 k: H# U- i
- #include <linux/interrupt.h>
: F& ]4 a. a4 v7 r% `4 n3 n+ x4 l - #include <asm/io.h>
9 E9 ]# |8 f' V! @4 t& K - #include <linux/moduleparam.h>
$ \9 \$ Z, X; @% e. C; Q) T - #include <linux/sysctl.h>
- ]0 T2 {# ^. n9 a F& c1 M - #include <linux/mm.h>
4 _1 C6 ]; ?4 R& N w! { O - #include <linux/dma-mapping.h>
9 j& E! T4 n6 W0 D3 d! e - , h7 a2 G" s& ?
- #include <mach/memory.h>
/ u; g0 N2 t, B4 ?! b8 S - #include <mach/hardware.h>
! K! A4 f4 G* z: H [+ c( G - #include <mach/irqs.h>
3 ]: ?9 m% [5 W6 ? c - #include <asm/hardware/edma.h>! K4 E/ X2 y; {# |
. W5 {/ T. z8 [8 l M- #undef EDMA3_DEBUG4 C4 j8 G+ j5 U! n" z2 @
- /*#define EDMA3_DEBUG*/0 }6 y# g7 o/ X( \- j
, @/ M/ k+ q' {# m _6 Q3 }- #ifdef EDMA3_DEBUG' S( p# C: D* y% a9 l3 [
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
' g, x: |! n, N3 ]! c% ?# Z - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__) m" M5 H% t# F# p
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* x% [7 T; t' _& o( k0 \
- #else+ t' y6 E4 k3 u/ i( u- H
- #define DMA_PRINTK( x... )
2 V1 Q: e$ T9 S+ W3 J B. d! I - #define DMA_FN_IN
/ v$ h& w* l9 Z9 z% c. q - #define DMA_FN_OUT; L' ? s+ L0 S' [/ j
- #endif
# ^% J# Q1 c- j/ V8 J1 O5 L - 9 F6 G% D, c; X+ k1 X+ L
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
! W% E0 }; x- j5 q+ F2 ?/ c - #define STATIC_SHIFT 3
9 Z0 L$ H& o7 o& `; ]6 X" C - #define TCINTEN_SHIFT 20
6 o" Y, E# l3 F" N; z - #define ITCINTEN_SHIFT 21
- @* S* E P9 U0 }+ r0 T7 E - #define TCCHEN_SHIFT 22" V" j" q: x. |: T1 Z
- #define ITCCHEN_SHIFT 23
; @3 v4 N( A2 k& ?2 L* l
H' _8 D; C5 v. ]9 D. O% e- static volatile int irqraised1 = 0;" ^6 Q+ |; c3 g+ I/ \
- static volatile int irqraised2 = 0;
# `8 f1 u; S% p# P* r6 V
7 u1 n1 }' ` h- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ R$ s" C) |0 i* \# P5 U8 G7 H - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- W- G# T( J! ^# ^2 } - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: f3 O, A7 M& f$ W$ N - % i: J) d" |7 l+ |. c
- dma_addr_t dmaphyssrc1 = 0;
# `: L& c( J% J" z; o - dma_addr_t dmaphyssrc2 = 0;
4 R. M* a' |; u1 G2 }5 ]) P* d - dma_addr_t dmaphysdest1 = 0;% l1 B! I) F' c* N8 ]! t
- dma_addr_t dmaphysdest2 = 0;4 {1 j, m! J* z5 q
( c# O$ ]/ Q& J- char *dmabufsrc1 = NULL;. y2 l2 J f5 T3 Y3 o. a( T- t4 I. b
- char *dmabufsrc2 = NULL;7 O% @& B- @) C$ n% Z6 S
- char *dmabufdest1 = NULL;
( s9 z H, \ i k - char *dmabufdest2 = NULL;& L! u- h; r% b; o" T- l9 j9 _" k
' i" u; i7 K. g! Q- static int acnt = 512;
9 T* [# c! S$ A c9 _0 i - static int bcnt = 8;
( L/ c i8 f* u2 _1 { j9 z - static int ccnt = 8;) a, U: b0 r" B5 `1 E, ~
+ c- C; B' ]6 u q4 f- module_param(acnt, int, S_IRUGO);
* A+ i. X5 b3 c9 e: c - module_param(bcnt, int, S_IRUGO);
B8 L7 B9 q; r: E0 o& l7 u - module_param(ccnt, int, S_IRUGO);
复制代码
: w; Z3 x0 m. y1 @
- y5 D. `3 z/ i: @7 D( Y; K0 r 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
9 Z7 [4 g+ M5 {$ R _8 w; \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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* X& `8 s" b7 a/ |) _
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- e5 J8 g, U- Y q
0 d4 W( B. {9 K! |4 B4 N0 ]' I/ Z+ [$ @
|
|