|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 P; M1 z# D. I: ]' {8 ? T* s6 q- [code]EDMA sample test application
& v. d0 K. b, l9 e; h P - /*
, n5 \; V- }7 |% x e! g- c - * edma_test.c
+ C; z. [" y7 x8 D5 I - *" o3 E, h: I2 j
- * brief EDMA3 Test Application/ X b2 h* Z7 R
- * l3 F- o' T* n
- * This file contains EDMA3 Test code.
3 V! T" l9 ]% r$ V8 |: a; s - *
: t, ]9 R8 M( h - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
) `8 R" {$ K' h' Q2 ~+ U - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
7 O# f( Y1 k/ Q& L* J5 h - * TO CHANGE.
+ z1 U5 ?: O' H+ |$ {8 w2 P - *8 `! T2 b* w3 k: o" }6 ~
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# J. g9 T) T- K" `, ~+ m- w
- *
/ r% y- s( G6 |, `. a - * This program is free software; you can redistribute it and/or
3 @& W7 } E2 @, m7 T - * modify it under the terms of the GNU General Public License as; S4 d3 w! P, p& h. k& ~! a8 v4 L
- * published by the Free Software Foundation version 2.
* m$ R) a% _3 i# R - *
7 p! o+ p9 J3 g, F) F - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
# F9 j( R( {" y$ l9 K% _ ~! W - * kind, whether express or implied; without even the implied warranty
* C8 }0 E6 p; E, I# x - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
$ G) ^0 q% \1 ^& k8 l" V w4 A0 m - * GNU General Public License for more details.9 Q6 ^8 m; r! z
- */
9 i! u6 c! T/ ]2 e6 y, ^& F2 p
( v; |8 X0 J7 _# C* U! s6 |- #include <linux/module.h>
" J! O% V r9 i. h7 M' G/ N/ ^7 F' i6 M - #include <linux/init.h>/ U4 n- L& \- f
- #include <linux/errno.h>
- P0 J* Y* e- h, v* K - #include <linux/types.h>
# D. L' X1 O' ?1 r- U# ` - #include <linux/interrupt.h>4 b( }8 k$ X7 I6 O; k
- #include <asm/io.h>
$ T; ?4 V8 S8 e: n, S - #include <linux/moduleparam.h>- u$ N$ R2 l5 o! W8 f2 _
- #include <linux/sysctl.h>
$ k0 z1 ~% j- w# K7 w, k$ ^1 q! } - #include <linux/mm.h>0 z7 u$ t8 E) J6 n
- #include <linux/dma-mapping.h>
6 M9 H5 p) @6 k- n8 |# a/ S/ f
- \+ H$ v# x4 }- #include <mach/memory.h>4 t5 z% Y1 b9 y* m" e& X; ^
- #include <mach/hardware.h>7 ?- u' o: S3 N- Q, g
- #include <mach/irqs.h> D, F. Y d$ G% A' ]
- #include <asm/hardware/edma.h>6 ?) y: \" ~' `
- 8 V1 ^/ K# n: E( _$ O
- #undef EDMA3_DEBUG
9 i* ?) I4 r& |" b# X - /*#define EDMA3_DEBUG*/: H* Q) f( P& i$ |
! a, m* x: a- q" c) [- #ifdef EDMA3_DEBUG* x+ T. o' O8 }. U s* a
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
7 d! y0 O/ v1 X! X: q7 z6 `# e - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
/ h* g5 C5 a" @* B' O% }" L6 e* n - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 ?9 f4 i* f2 P" i( o6 a8 H( c3 F
- #else: T, o9 X$ E5 U5 K! ]' u
- #define DMA_PRINTK( x... )3 B* C+ T' l$ v# ? a1 P
- #define DMA_FN_IN, m9 ^3 ?2 @9 e( l
- #define DMA_FN_OUT
7 R4 m, w+ U/ ?# R" S" v; F - #endif
% [9 r7 e/ K9 l - ) v& ?4 ?: |3 E* |
- #define MAX_DMA_TRANSFER_IN_BYTES (32768) v7 H6 w1 N ?$ C' m
- #define STATIC_SHIFT 3
% J, w" ~% o# B0 o# b8 q - #define TCINTEN_SHIFT 20
% A( d. w" o4 Y8 R( F6 L - #define ITCINTEN_SHIFT 21
2 V; F( X3 x; i8 A# y - #define TCCHEN_SHIFT 22
0 G* V5 N- M, v0 o9 q6 I6 y: ~' Y' r - #define ITCCHEN_SHIFT 23/ y, `# }( }$ v! H0 q1 `
- * f _2 Q3 {3 x4 W `) k
- static volatile int irqraised1 = 0;. C/ J5 l0 a3 V/ T" K- t& C
- static volatile int irqraised2 = 0;. I' l' C: E& {9 I) b6 T
- 1 f) Q. a* q3 Z7 W$ V
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( t* [4 a, d# `4 [
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 b0 `. `" d; i/ [7 I V7 R' Q k
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 ^& |5 s8 j @7 D; o+ i5 D/ ^. A8 d
, L8 V+ M- V4 v9 Q: x% {3 a2 L3 I- dma_addr_t dmaphyssrc1 = 0;
0 C* D0 X: d: {% u - dma_addr_t dmaphyssrc2 = 0;
2 t. G1 ?8 @) d; ?6 Q, N - dma_addr_t dmaphysdest1 = 0;* R/ |- n2 s: o1 D
- dma_addr_t dmaphysdest2 = 0;3 n' r+ d" o3 ?; x
* _0 h$ z Y' i; m- char *dmabufsrc1 = NULL;
# v. z9 O5 a- q$ X6 j. E - char *dmabufsrc2 = NULL;- z! R/ s% C$ Y; y0 r
- char *dmabufdest1 = NULL;; {) E! o$ j T* K
- char *dmabufdest2 = NULL;
* e" Z1 S) F0 ^2 C/ E' B$ ]
: Z0 K, L. g$ u5 _5 E, D1 p3 w; P- static int acnt = 512;
1 t4 ]: [: Z) [* x/ K: _$ T - static int bcnt = 8;
+ y. l4 H' k7 Z0 ~5 v4 M - static int ccnt = 8;
* [& ^, j. V; H1 h( k1 C - , M6 |+ n- x7 _+ F
- module_param(acnt, int, S_IRUGO);! W* D% F/ W4 n. K7 S0 t- ?! b
- module_param(bcnt, int, S_IRUGO);
9 \5 x, E% }3 e - module_param(ccnt, int, S_IRUGO);
复制代码 ' Z, h: p1 B; N# r( z9 [
`4 m: k- o( j, Y
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" Y; p+ B! @' t2 I$ J2 n
arm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ m$ v7 H: M, v4 y; s u' K! H8 R
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: K6 l% ?7 Z& }, T5 l( k
6 C7 n% [1 V! W1 k' L
8 ^9 K/ w+ u8 n* a, C E% R
|
|