|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
+ h- s4 q9 {. S; b5 M- [code]EDMA sample test application
; ~. z, y* k# \+ @ - /*1 u1 n+ x2 L# o& Y1 O+ ~
- * edma_test.c |% R: [0 c/ d- G6 @( `7 \$ K; P% \
- *; @. B6 Q: n! g5 s1 B
- * brief EDMA3 Test Application
2 U& Y1 E A! Q - *
+ E: [/ ?9 e: v6 ]7 r. h - * This file contains EDMA3 Test code.
% B" |( w" ]: `2 ~0 B - *! h" Y1 N- t8 \4 K+ M1 x1 i0 j
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% Z) v6 \/ l5 ~ x
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
, O* `7 ]) \ x' V8 ~4 T6 A5 B - * TO CHANGE.
, E2 y; L6 L6 B I - *
$ ?, k5 ~' R* @ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
7 J0 j$ m" L) h+ l - *0 s# L% r5 {, n ]4 p
- * This program is free software; you can redistribute it and/or& n7 _9 s" ~, K. L$ u8 k
- * modify it under the terms of the GNU General Public License as
. g# ?6 S: s) t7 j4 T& G1 C8 s: c - * published by the Free Software Foundation version 2.
" s# D) n$ p4 [# k8 { - *
4 a( `0 ?/ ~5 H# ^) k3 s' h0 Q - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
8 ?1 t% T4 F- ]8 ]/ u' x5 W# P - * kind, whether express or implied; without even the implied warranty& Q6 Y1 {& e% m( M- v- v
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/ M; Z) M4 h& ^. o% q; C - * GNU General Public License for more details.
( q f, F$ v' k" p' C - *// q( d- K8 E. m _. v
5 j+ Y2 M% Y1 r. d4 a! @; B- #include <linux/module.h>
- }7 V% W4 W- B( c- s& _ - #include <linux/init.h>" `4 u' a. i* g1 n2 B
- #include <linux/errno.h>
0 _) m" A0 S" k - #include <linux/types.h>2 ], u, V5 k% m' }! j0 r O
- #include <linux/interrupt.h>. T, H9 x. F; [8 {
- #include <asm/io.h>: e; Z7 l6 F$ Y; z; q- l) ~
- #include <linux/moduleparam.h>
' c; r4 I3 v K% X; e9 K - #include <linux/sysctl.h>) x# _9 V6 Q& s; f# {; q( ]- V9 H( C
- #include <linux/mm.h>
( o3 [7 c6 m- l1 ~ - #include <linux/dma-mapping.h>. w }0 [/ K: R7 B4 }
/ Y) x8 J4 k$ K$ i3 |' I- #include <mach/memory.h>
7 w+ I2 c0 h, R0 V" {: B' i - #include <mach/hardware.h>4 ]0 k6 K; l* h
- #include <mach/irqs.h>1 `4 m: r; @2 d2 Z$ T8 B, _$ h
- #include <asm/hardware/edma.h>( K( K4 Y4 c+ z" n
6 @9 `/ t8 @4 {0 h0 q) U- #undef EDMA3_DEBUG
, ?* K N1 L9 o; a t, c+ X! j$ R - /*#define EDMA3_DEBUG*/
# e4 J X( f2 i: k7 G - ( a, y0 H! ]$ h) d! R" A
- #ifdef EDMA3_DEBUG
$ ^" w6 d" i) K8 K% R - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
# u# m9 x! y: M1 a; m - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
! Q: @% |2 q Y: E% G6 m - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 `) I5 r+ J+ d
- #else8 X* j+ d: P. S
- #define DMA_PRINTK( x... )- _' c y! U2 E& @$ d3 V& q
- #define DMA_FN_IN
0 y) U" l! Y, X - #define DMA_FN_OUT
$ m% ~- t. ?% T - #endif
5 r+ m" V' [+ {1 b" t" W - ) I# j, |2 `' O6 |; {: G( R! ?/ i
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)& S2 n2 H) k- A( Y* n
- #define STATIC_SHIFT 3
: q$ S, |. |3 x8 } - #define TCINTEN_SHIFT 208 c( \7 h9 K) q. D( S+ g P
- #define ITCINTEN_SHIFT 21
9 y' n: k" R6 D7 a4 O' v/ I8 X - #define TCCHEN_SHIFT 22
) p8 s g7 @9 U* q1 B* {; U+ p3 m - #define ITCCHEN_SHIFT 23
` ^( m8 n( o: l/ Z: [: H - ( \# F5 K. d7 t7 S+ b
- static volatile int irqraised1 = 0;, A- `7 g4 k k3 D% {: F% T" w
- static volatile int irqraised2 = 0;
* q7 j; e3 S/ N
$ D" p. N* x& p5 }# F- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! p$ {( T! w" |0 k6 }7 T - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) B2 d# S, f' o3 U+ M3 t5 q - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) k/ a; F8 Y% Q
- 7 ^0 `( A4 M/ e6 {- i5 K
- dma_addr_t dmaphyssrc1 = 0;
5 U! n% F# r4 @1 l n, w0 t - dma_addr_t dmaphyssrc2 = 0;0 Y) f, \1 a% U, v& X W9 r/ n7 g
- dma_addr_t dmaphysdest1 = 0;
2 ], v: Y1 [8 c3 w; R2 i - dma_addr_t dmaphysdest2 = 0;
3 ?7 s Y. P5 K: M - / _: y ]9 U( v" Q' h
- char *dmabufsrc1 = NULL; `' `- V; Q5 T, h6 d& @. P
- char *dmabufsrc2 = NULL;$ y6 Q) E r+ q" u" F
- char *dmabufdest1 = NULL;( q( q) V4 b: X& F% I
- char *dmabufdest2 = NULL;% @9 Q$ U. R) F* t, y. h" T" I
' w- F. V9 M. F: J0 Z- static int acnt = 512;* |) t! _ V8 b5 G! H
- static int bcnt = 8;
) _; A3 {. B' t" k$ N - static int ccnt = 8;- A) O, h. |3 R/ _5 ~
: F- ~" B( n7 y, s8 ^! {, s- module_param(acnt, int, S_IRUGO);
' i/ p! c; t! x0 _0 F - module_param(bcnt, int, S_IRUGO);3 {4 y* Z9 M5 |8 \) {
- module_param(ccnt, int, S_IRUGO);
复制代码 ) l8 w. c& Y i4 X% w- d/ C' w
1 F6 j) h4 ^: G% H
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 L# C+ y; U0 F# `2 sarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. K; x+ I8 ?) X2 ^
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* R! F8 t- \1 x) C2 p k0 q6 z' Z' f: G7 s0 W
, o V6 g- r4 y! O2 \7 j' \) m |
|