|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % L! J( q: I7 O d! C3 V
- [code]EDMA sample test application
4 V# z# x% B6 M# p/ _ - /*- N4 P4 w7 x/ K) _9 Z. F* t9 L. x
- * edma_test.c
2 B! T, d7 {& Z' Y7 w" } - *& i s0 g2 _' z8 q/ G% K6 k
- * brief EDMA3 Test Application
7 ?, f, A# M! T7 T4 p) | - *
- |# v, B7 t9 F - * This file contains EDMA3 Test code.
! ~4 r/ l: k; [4 ]7 \' m, O) e - *
% V" P [( `) m9 u0 J - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
* y- K! y8 D4 Z# f - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* R; N$ G- a- r' y* ]
- * TO CHANGE.
; r# H* ^4 O! K - ** w& `' f7 Y- E1 ?1 a2 i w
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
& [' {/ {7 o- C) m, m' f( t+ G5 y# h - *; ` u; o5 _) F3 c
- * This program is free software; you can redistribute it and/or0 [+ ?, ]4 z* M9 a7 v7 Z
- * modify it under the terms of the GNU General Public License as
4 `9 E4 g- N& _ S- }( ~* m" `0 x - * published by the Free Software Foundation version 2.
$ r) K" E: m0 x' L. _5 j - *& L S% f: i0 j& r
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any: F$ u+ Y$ b, z
- * kind, whether express or implied; without even the implied warranty8 m. P. \, z, Z* f g; y' V
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the) K9 T/ V5 O! c d. _
- * GNU General Public License for more details.
" F* t# P1 t+ N4 p2 \7 _ - */$ b% {5 C, |/ a7 V3 O( d
. S: h3 U! G5 Q- #include <linux/module.h> T# m' z% o' d. W7 C6 k( O) z0 t' b
- #include <linux/init.h> w$ T( b) D4 [1 g% Q4 D
- #include <linux/errno.h>
1 c4 O' D4 ~* g0 J$ _0 z; ~ - #include <linux/types.h> m. M2 y3 S1 K9 Z! O
- #include <linux/interrupt.h>- N& |* G+ s9 _+ g, ]- Z
- #include <asm/io.h>
$ e! u1 V. ^: [& u - #include <linux/moduleparam.h>
3 L' T7 K* r) ]! q+ E, ? - #include <linux/sysctl.h>
I, ^5 w9 [8 a' a - #include <linux/mm.h>. w6 A$ B: I) Y' f( P
- #include <linux/dma-mapping.h>
w4 N. X# x, h - * t6 T( v7 L5 p \! _. t- j
- #include <mach/memory.h>
0 X. G9 [1 _ v) u: g" Z1 I - #include <mach/hardware.h>2 ]& D& Y8 e& E' L, u7 u
- #include <mach/irqs.h>
+ @- f: v+ {: x$ |" W+ G - #include <asm/hardware/edma.h>
5 _. J1 b, @, X
( }* f+ X8 Y+ t- #undef EDMA3_DEBUG
A, x3 a4 e3 w+ C2 q - /*#define EDMA3_DEBUG*/
1 K5 l6 E9 b; C7 j - 4 Q" g. a, C6 t% O9 F
- #ifdef EDMA3_DEBUG
- N5 m7 |1 {, k, m - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" e7 w0 A% t/ E* D( w# U
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
' P0 U2 e- `1 W8 \1 r8 W - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
( Y3 f w* _0 e' z+ R; N, ? - #else
8 R' W& w$ a+ A6 { - #define DMA_PRINTK( x... )
& Z9 X" Q5 T8 D/ d7 n6 m" j- K - #define DMA_FN_IN
# ?, c- _4 T4 M. y$ H0 i4 W5 D3 ? - #define DMA_FN_OUT( v7 Y3 c4 I, z3 J9 c: K
- #endif+ R {' X: `7 e8 R- o* n) ?
- % y0 e) @& M7 ?5 a. q
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
0 d1 m- j; _7 L. `3 _% K# | - #define STATIC_SHIFT 3# g6 h+ \0 Z: r3 l- e
- #define TCINTEN_SHIFT 20
3 |5 @4 J5 K$ v- c) p3 | - #define ITCINTEN_SHIFT 214 ?- X9 G# X$ V& n n& O" o
- #define TCCHEN_SHIFT 22
2 A+ U' J8 ], d _" k - #define ITCCHEN_SHIFT 232 ~+ O7 b) F! e W- i
: d9 Z; j" o$ @* N" a7 C1 j" A- static volatile int irqraised1 = 0;! P) C% t: i, T1 L2 {
- static volatile int irqraised2 = 0; |: o' W y: Z8 h
- $ B+ q9 E1 g/ }. M* F' O8 D
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ C9 c q; _! y& i7 L: r, N& o - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 R7 ^& c# U8 _: F7 e7 O
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 @6 ~9 T7 a! B4 d8 T( M" {
/ X; t) V* s7 Q6 D7 J! `9 u3 t+ Y- dma_addr_t dmaphyssrc1 = 0;
1 t7 k+ `* ^2 q1 }, r5 J6 V8 d - dma_addr_t dmaphyssrc2 = 0;
" G0 Y6 z8 I! Q+ W4 x0 q' _# W* G4 @ - dma_addr_t dmaphysdest1 = 0;
* H$ ?8 G0 k9 t" R3 R - dma_addr_t dmaphysdest2 = 0;
# l7 l8 j. d! @7 H0 Q0 ?6 {* a9 o - 7 J" ]0 d. c# p
- char *dmabufsrc1 = NULL;
]) q8 y) \1 W" }& U$ E5 a - char *dmabufsrc2 = NULL;1 G2 u5 T* v% ?$ E- k% h' h
- char *dmabufdest1 = NULL;
6 x6 r9 O# t; u( \/ R; E# t! g - char *dmabufdest2 = NULL;
7 ~5 _7 W3 @4 o( H7 ^5 H - # B* ]1 `# |" |, ^6 s
- static int acnt = 512;
, d- ?1 ~; a: B. K7 l - static int bcnt = 8;+ q% }& x& {& A, ~" s* A
- static int ccnt = 8;
# `2 s9 F8 [- n- q8 h - 4 B( S! q3 y1 c6 E7 u2 N
- module_param(acnt, int, S_IRUGO);
( z/ T8 w& |( | x" B1 ?: Z8 U - module_param(bcnt, int, S_IRUGO);( A% j0 v1 _- @& Y& k/ N- a1 h
- module_param(ccnt, int, S_IRUGO);
复制代码
! t* }6 ~* P9 |5 G( t/ H4 H$ `$ K1 y
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 B& J8 Z6 b0 T" W
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 g/ i6 ]1 T) Y( o }
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; I4 m" D W- |! S1 u1 J" V7 [7 h& X A' a, N7 D c0 D2 ?& }, b
3 X. V6 F3 F, z2 K! z0 D
|
|