|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 Q+ m& L1 R- m
- [code]EDMA sample test application1 }# t) o# p8 ~' H9 P1 ~
- /*
( a) X0 A3 g+ O4 B - * edma_test.c. T9 q6 R2 q. d% S9 e
- *
8 K+ n4 t) h: y! C9 _6 B - * brief EDMA3 Test Application9 D# |* g5 o$ e& C0 g* ?
- */ D' f( r7 F7 _* h
- * This file contains EDMA3 Test code.
% p6 t2 i. Y0 O: x0 }$ l$ t - *
, }5 D3 `& B' J7 y, e - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
- B6 x8 f9 e4 p& c( C - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ k. M- X" `3 l( B
- * TO CHANGE.
9 q, C- k+ \* v: G; V+ Z, x - *
7 z+ ?0 y+ D3 H Z8 i - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
6 l( u6 }/ c4 P - *! D6 U g0 @6 R- e) g2 u
- * This program is free software; you can redistribute it and/or
" t, Y- k& ~# z( A# x - * modify it under the terms of the GNU General Public License as/ x0 d% d5 _ Y4 P5 k! P) x
- * published by the Free Software Foundation version 2.* }& x* z# z4 k
- *5 L# h! B% v2 s& O3 P
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any. j+ k; z; w! Z5 L* i0 V b
- * kind, whether express or implied; without even the implied warranty
0 S) q+ |# R9 t* K$ Z - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the5 O2 y y* \0 T
- * GNU General Public License for more details.
6 B- P2 [, J. d8 m4 H - */
6 ]8 N1 N9 Q2 X6 w& R U$ g% S
- U& t" O, f4 j' |, R# q G9 Q- #include <linux/module.h>
1 B9 S" T2 `- z% ?# M, c( m) ?" [ - #include <linux/init.h>2 t% G: l1 k) ]1 @$ Z$ \
- #include <linux/errno.h>3 R, r' L$ h! g3 {( P9 d* J
- #include <linux/types.h>
: r+ ]+ K1 @+ n$ m - #include <linux/interrupt.h>* o0 k/ e1 ~$ n4 i- a4 l6 `
- #include <asm/io.h>
7 x4 t. [2 ~" K" @/ J: W) ~2 I - #include <linux/moduleparam.h>' V6 j/ H$ |- F1 P/ g4 h0 K
- #include <linux/sysctl.h>
0 E8 s1 R; K! N: _5 ^8 U - #include <linux/mm.h>
$ F# i' `% |: ?" u1 t* A6 l+ s6 j" B - #include <linux/dma-mapping.h>5 I/ O" [3 z. S) [
- / d; Y( V8 Z4 _+ S4 w
- #include <mach/memory.h>
5 ]1 n% s( y+ \* {' x6 t' z - #include <mach/hardware.h>
4 G$ V& E- I+ K2 V9 V - #include <mach/irqs.h>
. A+ ]* q1 j; M) ^0 [ - #include <asm/hardware/edma.h>
2 ]; B1 \8 l: a$ e: z$ \! X, {
+ Y& U' }( I- [. q0 Y! {: S2 h" o- X- #undef EDMA3_DEBUG
. f J- {- }) H, c - /*#define EDMA3_DEBUG*/
5 ], `2 Z% R) j; \ - 4 g6 ]& ]+ _# \
- #ifdef EDMA3_DEBUG& W' U+ J i- @
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): O) s9 b( Z4 w5 V9 R% W
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 u- L/ g+ [7 d' H6 Q- ^$ V Z
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
8 { ^2 W( _- D/ b9 ]0 c - #else
# U. a$ S% o; _" N4 C0 Z7 z - #define DMA_PRINTK( x... )
$ j- v1 _2 q9 ]* d; g. F, C9 B - #define DMA_FN_IN& V4 u1 e* B- b6 T( ~
- #define DMA_FN_OUT( \, ~! U0 ?' Q
- #endif6 J8 o, z0 k: Z. l2 W$ j8 m
5 g. `/ o: L, T9 `0 C7 H3 h/ P- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
- _4 ~% M# X- a4 m" f9 x( } - #define STATIC_SHIFT 3
7 p+ g5 ^* c H- e b5 ~ - #define TCINTEN_SHIFT 20) R" f/ n R- b5 q4 Q
- #define ITCINTEN_SHIFT 21
2 H/ R- W6 |9 y$ V# T- j, _ - #define TCCHEN_SHIFT 22
* a8 B+ q. {( ` - #define ITCCHEN_SHIFT 23
# Q. l8 S0 c3 v! T2 c. V0 v6 }& W
9 l* @- Z8 }( l2 H& `* |- static volatile int irqraised1 = 0;
5 {+ S% v6 i: a+ p# Z% E - static volatile int irqraised2 = 0;
, M# x% h8 ?$ N) d6 |& k - 7 L5 e) s3 A; |" M& L; M# r
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. V2 a6 T% `3 s$ r k - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* S, x* E& L. M/ N0 _; m
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% f$ k7 L! u8 {0 \
- * D/ a# w v1 K: l+ j+ x6 w
- dma_addr_t dmaphyssrc1 = 0;
1 d) J6 |/ e: s s0 r6 }! ]$ H - dma_addr_t dmaphyssrc2 = 0;8 s% v) y3 ^4 X$ q
- dma_addr_t dmaphysdest1 = 0;3 z" c4 D1 q! D3 X1 j9 q" L
- dma_addr_t dmaphysdest2 = 0;
3 e. Z; |3 Z) J6 _7 a
. ]7 S0 A' C: g* R- char *dmabufsrc1 = NULL; T4 d, D; Y" x* Z" }( S
- char *dmabufsrc2 = NULL;
3 H. V. Y5 e, b g - char *dmabufdest1 = NULL;4 V; _: _; z+ w3 \, c( g6 Y: L
- char *dmabufdest2 = NULL;
) n" W0 p& c6 n1 @4 q
3 U0 S) H, q/ d+ U+ ^& b- static int acnt = 512;/ k% ]) n+ x, }6 t$ @
- static int bcnt = 8;, j: _7 \" C( z% J
- static int ccnt = 8;/ U" n2 ~: h: A+ D1 M4 B$ J
- 7 x& Z) n3 w& |: z# ^
- module_param(acnt, int, S_IRUGO); g# O( i1 _" j i s5 \
- module_param(bcnt, int, S_IRUGO);
. I6 U) T3 Q- i' @$ G% o - module_param(ccnt, int, S_IRUGO);
复制代码 % n, n3 ~% ^# V7 A# x
7 @& d& B# E `( { b
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 L; E' z% ]1 r2 F5 zarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* h8 W( e1 h# ]: d# _
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* @" q( }$ }& D8 {: x6 N
& ~5 _+ a, h8 o- Y; t% U
# O; J0 D2 A8 V) _7 J6 _
|
|