|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 P' k$ o# }, v
- [code]EDMA sample test application
2 V2 u9 w4 d' v# R$ ^1 i0 ] - /*$ W. U6 B9 l5 y) Z
- * edma_test.c/ C( k+ G# E% R6 U# N( I$ E
- *
( [( Z; m8 y+ [1 S - * brief EDMA3 Test Application
7 |4 T/ S1 a" e+ q5 ?% i - *1 E8 C5 U. q; t
- * This file contains EDMA3 Test code.
) e5 T$ g! U0 R L/ A - *& R$ o; Z( j3 p3 y7 M) t0 e
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
$ x0 n( W+ m: A; L* O, A - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
- d; U2 r9 B C8 H: B; u - * TO CHANGE.& o& `8 N- |- d
- *- w) d8 P5 F9 ~
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
& h5 t1 P' x. A9 u - *
" {* `& i, ?$ \$ @) Y+ Q - * This program is free software; you can redistribute it and/or
0 y9 v) R% ?7 f& a1 q - * modify it under the terms of the GNU General Public License as0 d/ f e1 R' A1 X
- * published by the Free Software Foundation version 2. l! D' i$ H, [( g1 z
- *4 ]+ l: F* {8 A9 h
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
# p6 ~) U- e" v5 ^3 n - * kind, whether express or implied; without even the implied warranty
+ ?9 l# F9 d3 x - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
( U5 s* q& Z0 _ - * GNU General Public License for more details.8 Y3 N. a/ I0 G2 h7 V
- */
4 N( B1 i0 H! j8 o7 B
. c4 ^) |, ? `( ]# D- #include <linux/module.h>
3 B) a# S' R) a( y+ E4 c% P4 u - #include <linux/init.h>
3 }9 T! C! r: v% G0 N - #include <linux/errno.h>3 H8 l6 A# ~# a5 A" m
- #include <linux/types.h>
* i; F1 c( V+ o4 C6 r# i% w - #include <linux/interrupt.h>
+ {6 {0 n' _+ f, O& W5 v - #include <asm/io.h> w" j* S5 x/ [& m3 \
- #include <linux/moduleparam.h>9 d( _% m& o6 V& u
- #include <linux/sysctl.h>
0 Y5 ]5 V, q& j/ t. i7 R& W+ T - #include <linux/mm.h>2 @& W2 |! Z1 L; N: l
- #include <linux/dma-mapping.h>
! Q8 @2 ~! _- X6 e+ ] - $ L- @0 G8 `5 q! |9 E n" O* W
- #include <mach/memory.h>" n: e+ d6 ] n7 ^
- #include <mach/hardware.h>( D: |: ^: L3 r8 T; d5 G" q5 N
- #include <mach/irqs.h>+ K" T4 `5 R* E5 H2 p) d
- #include <asm/hardware/edma.h>
4 O- e* L7 g: N; Y5 {
2 _- d$ j$ f4 K% e- #undef EDMA3_DEBUG
7 D6 ~2 z' e D6 [1 i - /*#define EDMA3_DEBUG*/
6 B$ z& j$ P$ B
: {5 r% H. ?8 T* s3 }- [( U) W- #ifdef EDMA3_DEBUG
H, K2 ]/ |" `% E - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
+ T& x6 ?. h0 S$ O; s - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 [: C% u [7 E2 x
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
! D; w7 W& t( X; g - #else( c9 H* i6 Y) G7 C D* F. |& @
- #define DMA_PRINTK( x... )
2 X+ J2 B# l; H, k0 b - #define DMA_FN_IN
3 x- L. @/ @# u6 ]: f - #define DMA_FN_OUT
/ E3 f( r% M# T T1 i5 ~! u. o& K - #endif
1 G8 G* O$ j1 x - y0 r. O O6 R
- #define MAX_DMA_TRANSFER_IN_BYTES (32768): i. w% Q0 l$ p% W* s7 l
- #define STATIC_SHIFT 3
0 i5 V) x+ N0 I5 h3 X0 Q - #define TCINTEN_SHIFT 20$ u* G# q# ]! s' L8 w! S$ n; C5 e
- #define ITCINTEN_SHIFT 21
( w$ v4 x/ o. t+ I" [2 o - #define TCCHEN_SHIFT 22
% l0 e, c+ I# U6 w0 j - #define ITCCHEN_SHIFT 23# N0 v' [: x: c* h/ n
+ b. P: O9 v$ _- static volatile int irqraised1 = 0;
+ J* h- [) K7 g9 O) c4 f, [1 G5 } - static volatile int irqraised2 = 0;
& S" H+ ]; ?8 M- [+ j: }
! E. K' A2 S8 Q) e' l8 ]7 w; |: x- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 o1 v1 j) M7 g# m
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 \5 K2 l' w3 L( ~$ S& A! {# _, t9 l - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& _2 u7 K; O r H# l: e1 M2 v
* h/ T+ G) q: F- dma_addr_t dmaphyssrc1 = 0;$ T2 H- j) P4 m; X X
- dma_addr_t dmaphyssrc2 = 0;
# d6 |! I3 ]: [8 I - dma_addr_t dmaphysdest1 = 0;
! e, d8 e6 {8 _/ E8 l" V - dma_addr_t dmaphysdest2 = 0;" Q$ Y, Q& A- V. P, J& h
# ? h( k3 B6 s5 d- char *dmabufsrc1 = NULL;
2 e" }7 Y; p3 a - char *dmabufsrc2 = NULL;) D- P1 Z& w( ^
- char *dmabufdest1 = NULL;4 e/ B$ Z) I$ I6 d: r3 E P1 n; r/ d# F
- char *dmabufdest2 = NULL;. X- ^+ e8 Y8 v- c5 E$ x- s7 |# P) D
# n2 v; g1 {% E- d3 y- static int acnt = 512;
8 I R2 v5 `3 X - static int bcnt = 8;$ z( Z- [- z0 |' ?. _! V7 Z
- static int ccnt = 8;
, w8 q t6 o2 h
7 w# }9 `( j% i. X- module_param(acnt, int, S_IRUGO);
/ n8 T* x3 s; W9 J5 ]# ^5 G& \3 [" [ - module_param(bcnt, int, S_IRUGO);
# f U, D2 ?$ T' G C8 d - module_param(ccnt, int, S_IRUGO);
复制代码 3 c6 G- V! h/ |7 o R
8 L7 n9 n' M# G$ Y0 \
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! A- D8 `$ X# q$ ^- \: ~; garm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 q: i# t4 [) W' w 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! j3 ?4 t1 `$ Y7 x% R3 q+ [* O% y) X0 M- e
. O2 p4 z9 V k( Z
|
|