|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 \) a+ P, O4 t8 V% R
- [code]EDMA sample test application% y# j/ M# j9 w0 R0 f' v1 M/ `8 y
- /*
/ p' H8 z8 h! b5 q - * edma_test.c
: c6 y3 E- z: d5 E- c8 @4 B6 E - *- w0 R) I- O d' D$ \8 m* o
- * brief EDMA3 Test Application; A, a& T0 x8 p- x2 M/ ~; d
- *
) @$ G* y6 B; l6 b5 X4 Z! t+ q - * This file contains EDMA3 Test code.
5 D6 G) Q# T2 b2 \ - *
{5 t3 I* a9 O4 y+ E* F - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 W2 m7 ]- ^1 K0 V- T# `; d
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. h1 t" I( O5 M1 l# l' d
- * TO CHANGE.
4 { y+ O, l8 X - *
/ }. ^$ o; E- H! A% n8 n# Y! x& X - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
- Z- r/ d. ^: x% W3 X - *. x+ S2 ]. R4 {& r
- * This program is free software; you can redistribute it and/or
, f0 k3 j: g8 T0 f& D - * modify it under the terms of the GNU General Public License as; F P5 A4 V# N; [% o
- * published by the Free Software Foundation version 2.; {$ ?. v# I1 @% j% j9 w- {
- *
0 `( p/ i" e7 {7 L - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
) T% \, t+ a" [$ _ - * kind, whether express or implied; without even the implied warranty
$ R6 e! S8 C, L J* X# V - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# W' D2 f" N5 X0 C - * GNU General Public License for more details.# b8 D9 @ B2 o+ h9 U& Y
- */& [7 G8 `2 q! Z5 k
- ; b* [% r% x! C$ g8 B
- #include <linux/module.h>9 ?& r* a0 a% Q
- #include <linux/init.h>6 N* e0 ?1 t6 \
- #include <linux/errno.h>
" A9 h+ k7 T% Z- x6 K) r' r - #include <linux/types.h>
) L- z: Y4 c+ s7 s, b, j. B - #include <linux/interrupt.h>/ `5 O- Y+ y% n
- #include <asm/io.h># R+ q' _( q7 y1 Q7 ]
- #include <linux/moduleparam.h>/ D: d# O# R! ?) ?$ v T/ U
- #include <linux/sysctl.h>
3 K; c3 i" y* S: O+ w1 v - #include <linux/mm.h>3 R( b+ g! S: q1 F" ~- [. A! i. B
- #include <linux/dma-mapping.h># L0 c2 ?/ D( i) E7 {
' t' F$ } j+ C: m- #include <mach/memory.h>
, x1 x5 L( q& @ - #include <mach/hardware.h>/ r m/ _0 k4 S
- #include <mach/irqs.h>
4 z e A9 N- s/ y - #include <asm/hardware/edma.h>
7 K& x0 S% N+ @, h - , I8 H3 [& q9 }! c
- #undef EDMA3_DEBUG$ z3 U8 K8 R" m4 y p- I
- /*#define EDMA3_DEBUG*/$ | T% D- @" f* |5 f$ u
8 `9 y( s5 X, q4 }* m# r( z- #ifdef EDMA3_DEBUG3 R# H+ y9 Y+ P% c. m$ U8 Z& l
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
& u8 s9 k3 H) D& i: L; ] - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
% T* [! K$ g1 d+ G7 s - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
2 b) I9 ^" a" |$ Y+ W5 i - #else6 C: {# _: L% f. h- I
- #define DMA_PRINTK( x... )
# x! h2 ], p9 L3 [ V - #define DMA_FN_IN5 F/ n, q0 r) K6 L- G
- #define DMA_FN_OUT$ E7 c9 g" k4 ^1 J
- #endif
- ]/ b) }9 d( n! p- z
. I, I% x0 a& Q: w7 t1 z* |- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
2 { i( a* P- r* v' H - #define STATIC_SHIFT 3
' @4 x5 v6 X- p% a - #define TCINTEN_SHIFT 20/ D$ Z8 g' R; U: Z4 i
- #define ITCINTEN_SHIFT 21
% Z8 K: X3 x; }, \- ^! Y - #define TCCHEN_SHIFT 22
6 r# ?2 c B0 X) Z! Q' O# n - #define ITCCHEN_SHIFT 23
3 c8 n d# H- |* G/ N# s. G* u. j - ' X+ n) O8 V- ^: I
- static volatile int irqraised1 = 0;
1 j G- ?. l* J6 G* T# u - static volatile int irqraised2 = 0;% P3 J9 G' _+ a0 I1 `1 z. \
- 7 c5 i9 R- N- D& Z/ ^
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" B+ s. `" h% Y
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: L0 ~2 q: V; l+ b" e; f* [. J+ [ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( |% I. {: ?6 Q% `% ^7 j1 @! n - " _9 a7 q8 {( E% E% [0 r
- dma_addr_t dmaphyssrc1 = 0;9 Z: w& V! t8 Y% N4 P
- dma_addr_t dmaphyssrc2 = 0;
# t* l6 u% n# I5 @; R: f4 I3 P - dma_addr_t dmaphysdest1 = 0;
3 t2 U n, }( D9 F& u7 o* T& d: F - dma_addr_t dmaphysdest2 = 0;9 M! z/ y# M. C- U7 J4 x
- f$ J9 r! m5 F8 N# {% G2 Y: S! M
- char *dmabufsrc1 = NULL;1 `2 c& H# b4 ^( H. l) v
- char *dmabufsrc2 = NULL;. E) r' e" g( F, w Q' ?
- char *dmabufdest1 = NULL; n U! O# @) F8 t3 A
- char *dmabufdest2 = NULL;3 z! p1 L: |) \5 T
: Y+ e0 ^$ h% {3 @, q0 s' R1 a- static int acnt = 512;5 ]3 l9 B2 o0 u5 F
- static int bcnt = 8;/ ] X C) {1 X z6 Z
- static int ccnt = 8;
/ D4 R0 A. u3 \2 q, s3 w - ! u" H0 j2 g% V9 `
- module_param(acnt, int, S_IRUGO);1 l8 n: t, i6 z4 x; p _
- module_param(bcnt, int, S_IRUGO);
+ [) I/ X9 J% Y3 s4 C2 Z) x - module_param(ccnt, int, S_IRUGO);
复制代码
! D, e* ~% H, t9 G1 U/ L/ |" @6 W5 Q! k2 R
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) b/ ^8 f' C, k7 E6 farm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 z! V$ W( p( t8 y' h3 l 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" m V3 D! @8 ~2 W" M6 F
6 Z8 m$ F4 v* h( z) h4 D" b/ W- S& |& \# t1 `3 F! s
|
|