|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 t |: z; _6 F' N' w. }" L1 _- [code]EDMA sample test application! w7 ]( e B) J+ S
- /*3 G. G: H4 b( ?1 l' z
- * edma_test.c
& @- A3 @3 Y& ?* x L j: |4 O - *
5 Z& `0 S: R9 l& p! s3 ?. s" x, T/ L - * brief EDMA3 Test Application: s o" x- ~+ M
- *, p# m1 }3 U' ~1 t2 ~/ O) F# u+ ]( z
- * This file contains EDMA3 Test code.! D% [3 ~. c) a( p" u
- *
. e! M; u1 \( v1 d - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
. N b- F, {9 Q% ^6 T, r - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! ]) u( M8 z' z9 u" T. Y
- * TO CHANGE.
' Y- J, n' x/ D - *
' o( \) k% N( ~) c9 v3 \ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- i7 N' r0 I0 |5 t( m8 C
- *
: U8 [8 O+ B4 P! {* b* Q2 Z- K- b* X% W, ` - * This program is free software; you can redistribute it and/or, }% J4 J2 }+ N5 x
- * modify it under the terms of the GNU General Public License as
8 Z% n/ }: H, g7 V+ s - * published by the Free Software Foundation version 2.
+ h: i d( A9 F; ?& _3 l - *
0 r& E9 [6 e1 Y% L+ u - * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 }+ J$ k3 s! d% u' Z, x. W
- * kind, whether express or implied; without even the implied warranty
* ^# L T9 o# u; \2 o( k - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
' F! b8 ?& ^9 w+ h' V6 B! a - * GNU General Public License for more details.
* H/ [7 F9 O e4 t - */6 e$ H$ `- K9 ]3 Z, O% \
- " t' u% p: F0 I! M! a
- #include <linux/module.h>$ |' {2 \' L; t. ^
- #include <linux/init.h>0 H n- I; Z( X
- #include <linux/errno.h>7 u. a8 R) `% C
- #include <linux/types.h>
6 h# ~9 E; G; A4 }8 f+ H0 n - #include <linux/interrupt.h>
. |7 r% d- F5 z0 f' W - #include <asm/io.h>9 w+ R* ~( F$ }
- #include <linux/moduleparam.h>
5 I) T% x& q6 w& e' W' e$ q1 a/ P - #include <linux/sysctl.h>
- z7 P6 F' }! _5 c/ g2 N- ` - #include <linux/mm.h>
' X' \) n; O$ e7 [+ o# R w4 f - #include <linux/dma-mapping.h>8 M" ]; K) k a b0 Q& R
- : F; L4 r: T+ Y- f( u6 j+ I8 F
- #include <mach/memory.h>
9 ]1 P1 c; J8 O7 b5 J8 s - #include <mach/hardware.h>0 Z y8 b, {# M" L
- #include <mach/irqs.h>
1 g! I. ~7 n) p- ~1 `0 S - #include <asm/hardware/edma.h>
8 n2 q9 {" ]2 G" ? - 8 Y( I/ u! C1 I8 O% ?
- #undef EDMA3_DEBUG% ]3 K* b" J+ m1 K9 J) B
- /*#define EDMA3_DEBUG*/
! b' U+ {$ a" Q2 z) s
, d) L/ G( B3 `& p* K" G- k8 V- #ifdef EDMA3_DEBUG
( p# P0 ]8 Q k$ E - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
2 ]5 g2 F. ^/ J$ O6 M - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! e1 ^' ?- B- C" M4 b3 F
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
) j; N! l! s& W! d- x+ n+ |( C1 | - #else
; l- E7 k, S$ Z, x# S - #define DMA_PRINTK( x... )! V& S3 u6 Z0 J' B' T4 X
- #define DMA_FN_IN
6 O$ ^ p I& `2 j - #define DMA_FN_OUT+ w- j/ t1 v2 j. C, t! G) ?# U2 R! Q/ [5 a
- #endif) v% i5 f3 J# k4 G+ q* [5 P$ y
- ' w4 U0 \6 L5 }0 i$ y$ V* ]
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
/ H0 W! T0 o. q - #define STATIC_SHIFT 3
% \$ U- e, W+ }$ y8 y1 q$ y - #define TCINTEN_SHIFT 20
; j1 Z$ d1 E. W1 q - #define ITCINTEN_SHIFT 21
1 m7 i) L3 Z4 y& G X, m/ F - #define TCCHEN_SHIFT 22. P- R. X& ]0 b# {% J% b0 i) x4 Z
- #define ITCCHEN_SHIFT 235 z9 B. F, U, y3 g" G, ?
- 4 N+ o' P/ A7 T3 m
- static volatile int irqraised1 = 0;
% l% `# W; T* j2 K7 z - static volatile int irqraised2 = 0;; a6 X9 m& _# d) u: {
p q8 ~/ _) y2 C8 ~3 T- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% \7 O9 L2 w( g5 x
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( W; A- _9 {1 {0 O3 Z6 u5 H _5 H
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% t3 c0 t8 L! ^; h - 8 c8 _$ I% O/ D% P7 P+ y
- dma_addr_t dmaphyssrc1 = 0;6 l {0 J' T/ }
- dma_addr_t dmaphyssrc2 = 0;
& ]! G) Q3 O- `4 K - dma_addr_t dmaphysdest1 = 0;0 e8 L+ q4 ?+ o, J' h# P
- dma_addr_t dmaphysdest2 = 0;
) a- h! r. O( D1 f - 6 a T7 i& v: c/ p
- char *dmabufsrc1 = NULL;% s$ I. {( W4 p. ?* u
- char *dmabufsrc2 = NULL;5 T6 r6 k# V$ E' P: G- t0 ~" Q
- char *dmabufdest1 = NULL;' e( J4 K7 l8 q. D: P; N
- char *dmabufdest2 = NULL;
1 U$ G! M- [$ F
2 O+ W, A7 A' P- static int acnt = 512;6 \6 ?6 U; ^ r+ h* v( m( _6 U
- static int bcnt = 8;
4 D9 b+ t$ h+ F' m% A - static int ccnt = 8;; @) Q' }, K" h2 ? ?
- % L% c, R2 L5 t. L/ ?# I! h
- module_param(acnt, int, S_IRUGO);
4 T6 s2 T3 z# u$ z; [8 u2 S+ D* B - module_param(bcnt, int, S_IRUGO);5 X9 M1 P3 l; b! B7 t. S: j
- module_param(ccnt, int, S_IRUGO);
复制代码
; m( [7 e, B+ u( r: x7 ?* O; X/ i$ L4 k. k' a' e( t2 H& K* q
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! Z) ~9 @9 c* v1 S7 G" iarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' e3 @! A) Q" _8 _; h 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 |! ?& Z8 ?) l3 W$ T& M
, }8 T0 s; ?& g. C M% T8 _# G& V1 V4 \, z
|
|