|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 W+ s0 a2 n0 }8 G' o
- [code]EDMA sample test application
$ `0 D3 F0 x. `% x& H* N1 t: p - /*. O# Q0 j+ q E6 T$ I S N
- * edma_test.c
% ^- G/ ^( V1 q: f - *" G8 r# d% m& D3 R3 b
- * brief EDMA3 Test Application
; f( B2 T7 E/ g* W" F' K# ^# Y7 b - *
8 d# K5 e+ F( S, v& ?$ U; u - * This file contains EDMA3 Test code.
: W$ Q! @2 y- s* ~: L - * N; b5 ?$ [7 m8 }
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* t1 u6 |; z, [3 F5 i, ~# Y
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
5 o. Y. W4 h* e7 d - * TO CHANGE.& B D b% N* e! A, {( r
- *5 ?- B& Q9 w0 K5 p
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" I$ W3 m8 s" K' W/ V! ~5 l& x
- *5 S+ i0 s* N2 x* \. e
- * This program is free software; you can redistribute it and/or% B6 v* t8 W( Q' Y F4 W) |6 z- V
- * modify it under the terms of the GNU General Public License as
* a% H$ w1 R1 _' E/ M- ~1 w0 N - * published by the Free Software Foundation version 2.2 ]7 o" f* d# [' u- m& I1 [8 g' ^
- *
/ Q) Q$ `! I& S) Q8 x - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
0 L6 Y5 s! ^ H& z5 ^ - * kind, whether express or implied; without even the implied warranty" r5 H4 B9 z* I- V
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
( O8 ^- i' t9 j) M3 l. o; l! h% v - * GNU General Public License for more details.
7 x- P) I$ v5 S" @6 c. W - */
2 r9 N8 `4 |5 F% R/ k4 j- z - ( \8 V3 A X! J# F- U# `
- #include <linux/module.h>6 W7 i' a K- M) N1 t. _
- #include <linux/init.h>. t1 j) f& ~; D- m& ?* {1 J
- #include <linux/errno.h>
4 o2 G o5 z( ] - #include <linux/types.h>
; Z/ |* w# `* V3 S1 z" Y; ] - #include <linux/interrupt.h>
+ W; T$ ?! C3 y, c" p% O' Q - #include <asm/io.h>
3 `* ~ _1 t- k2 Q8 T - #include <linux/moduleparam.h>
/ ]2 z2 I2 m( `( C& e) n - #include <linux/sysctl.h>8 c' Z0 P$ V' T6 f; t; K7 \
- #include <linux/mm.h>4 c6 \% g+ N! P8 c
- #include <linux/dma-mapping.h>+ x. ^$ i2 S0 {5 Q
" ~5 n, W2 a, s0 |8 R- #include <mach/memory.h>
$ f$ x4 I5 p8 X# X Y" G5 {& b - #include <mach/hardware.h>
8 I+ E# J5 E4 t' Y A4 t - #include <mach/irqs.h># J% [! g& @) J% c R2 I$ J5 Y
- #include <asm/hardware/edma.h>- i# i4 W* i- U/ b2 J
" o; S: c- O- |( S( r+ @- #undef EDMA3_DEBUG
8 [* ~7 I5 Q6 i# n% D - /*#define EDMA3_DEBUG*/, {4 [" M' q7 t$ p' O
, ~/ F2 M7 e% n- #ifdef EDMA3_DEBUG2 n6 O& z! @1 @
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): |( R* Q; n5 Q- q/ U2 ~0 ~* F) b
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
2 N0 f+ N+ Y; C - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
# |4 d& c* i) f, B6 r% t - #else: n# C- Z" |9 N: C7 A9 E9 V i
- #define DMA_PRINTK( x... )
8 ` N2 N# y) P! m; T6 a. \. b - #define DMA_FN_IN2 |# x) p# Y1 J( f, n& S
- #define DMA_FN_OUT+ n& u. h1 s. t4 X. c4 b- {9 P
- #endif5 a! T2 J! T5 p' f
/ F- X2 }0 H. |4 k- #define MAX_DMA_TRANSFER_IN_BYTES (32768)* V g3 {/ s8 O" v/ x/ y* H2 u6 E- q' ]* G7 \
- #define STATIC_SHIFT 3
7 } |/ [8 C A" y3 c - #define TCINTEN_SHIFT 20
3 _9 c- ^' \9 W- E) W8 F& [ - #define ITCINTEN_SHIFT 219 L: K, k6 k5 Y. ^. q
- #define TCCHEN_SHIFT 22
$ i/ q! V3 u+ l/ p+ K0 [ - #define ITCCHEN_SHIFT 23" w) j' j! x w r
* F/ n: x+ m. u) V$ R+ I- static volatile int irqraised1 = 0;# ?1 i4 t% G% D0 O
- static volatile int irqraised2 = 0;5 j5 a+ U6 Q+ K8 X3 t( Z
- % t7 |. V$ `; e* m
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ {- c8 ?& c, B' n) t9 D Q - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 L" K3 ^8 P8 e9 Z0 B/ L: i0 {
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ `% L# q+ M7 S
- - b" h" y3 I8 d' O) `
- dma_addr_t dmaphyssrc1 = 0;' C ]8 [/ X& u6 I
- dma_addr_t dmaphyssrc2 = 0;5 p2 o6 T1 x# j& B1 C( W6 J
- dma_addr_t dmaphysdest1 = 0;* y# t J$ G- O( n3 g: i4 ~1 K6 H: e# ~
- dma_addr_t dmaphysdest2 = 0;
4 Z2 k- }, {6 g* A1 M$ }( @8 ]7 Z - ; q2 d4 y6 G+ L. d( z' W: q# a
- char *dmabufsrc1 = NULL;" n- u; x3 x4 D* h5 l% j
- char *dmabufsrc2 = NULL;+ n$ \9 D, p+ W
- char *dmabufdest1 = NULL;
+ j" y; @/ Y, ^% [- h. d - char *dmabufdest2 = NULL;$ P k; J4 Y" }& f. G9 O) h
( N- F; u, F& C" R3 I# l- static int acnt = 512;# _5 J2 r z" F* ^2 o" f. @; x9 p) }
- static int bcnt = 8;$ z: j0 L$ L) V t. z/ \/ L8 l* K
- static int ccnt = 8;$ Y+ ~5 N" m* j+ L. U0 b9 {
8 S5 b! O/ r3 U6 U' _- \5 Y9 o- module_param(acnt, int, S_IRUGO);3 m- G6 g! K3 |" e+ @
- module_param(bcnt, int, S_IRUGO);
7 X* ]! ^6 M) y8 V - module_param(ccnt, int, S_IRUGO);
复制代码 3 L: g' a, Q: R# f( @$ U( V$ l
: P( x8 H0 t0 `" t1 F: o 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) q" t8 I2 C- s! M' ?' K6 qarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 y# y; E) }! e: B# C+ R 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% }4 Y/ V+ a$ y1 A8 x% l" z: o
* z" c& K; `7 }6 _
; v+ R5 Z: e' h1 Q5 Q8 R
|
|