|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 J/ I0 W4 g* w* z- [code]EDMA sample test application' O% S# o, t0 M9 f
- /*
9 {* e+ Z1 o- i9 e - * edma_test.c
: f( t1 @' s6 x. T$ X# @* Z# D - *( d+ Y1 y0 J) e2 w; R, o2 s
- * brief EDMA3 Test Application$ \( m/ ]* Z% T( O
- *
: f6 z+ }. W7 _1 C& S - * This file contains EDMA3 Test code.& k6 I# W# h: p
- */ s3 ]# i" Y4 k
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; C! a" G0 C4 x y& u \
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 l3 H- F8 A- S3 {. V4 x
- * TO CHANGE.( v, k1 Q2 `; [# x
- *
2 ], g& J3 k( D* o& o - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! v0 O9 r. |6 T
- *6 |! j5 k7 n. c8 Z
- * This program is free software; you can redistribute it and/or# O- v( e+ _9 n% o) I8 n
- * modify it under the terms of the GNU General Public License as/ R! }" s$ V9 ^; ]% z0 p. ?. {
- * published by the Free Software Foundation version 2.
6 p( |+ e5 K9 t% M3 _1 q - *
/ P% t) y0 D* _/ k; o7 D - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
7 I D' S* q$ W" d ? - * kind, whether express or implied; without even the implied warranty2 u9 C) e4 u/ J3 x* o1 R4 U+ h! u
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ R* I. y: D3 x! f; _- ` H - * GNU General Public License for more details.
/ u V4 c6 G4 h - */
8 Y7 A8 r4 c5 N1 Z( q - - e! w' T6 W! A- ]1 B& j
- #include <linux/module.h>6 q+ z" A( T0 w5 d5 @" e" Q
- #include <linux/init.h>! c# U; G5 x% q, n3 B' o& j
- #include <linux/errno.h> V9 N, v' q8 C" \
- #include <linux/types.h>$ y; h: p( A1 t0 i
- #include <linux/interrupt.h>
1 ~, ]; D* P" q, ?0 b - #include <asm/io.h>
4 m- Q4 N9 Z* \ s5 {" ? - #include <linux/moduleparam.h>
3 ]2 e1 b7 J: @0 X& Y# H1 D8 l - #include <linux/sysctl.h>
6 c1 @ K1 q' A: Q2 |7 { - #include <linux/mm.h> B& _& L% n5 ]8 b
- #include <linux/dma-mapping.h>
& n: y4 ^; E7 I1 ? - + H# a$ _( S, ^: P: V
- #include <mach/memory.h>
6 z8 `* }( |$ C: U - #include <mach/hardware.h>- {/ r/ d5 ? @" }6 L6 b* y
- #include <mach/irqs.h>" Z, |! i# x$ b9 \- v5 O$ f0 f
- #include <asm/hardware/edma.h>
; {% | P2 h1 ] - ; ? g/ `% ^* c4 ]& V$ g4 D, ?' u4 u
- #undef EDMA3_DEBUG+ F, r; I. q/ u/ C1 o; O+ v5 M) s
- /*#define EDMA3_DEBUG*/
0 y+ e& n4 |+ G% K! j }# b
4 H$ j4 w3 H5 R0 ~7 u- #ifdef EDMA3_DEBUG0 W7 ?% K7 T: m# m- n
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
% U' O! Z2 s1 J' [' A9 N% v - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
9 }- k/ `. _% K& x4 n& q1 y - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
% U8 U0 `! q( ?7 T6 g - #else
) `, K$ ?0 S# C- ]* U - #define DMA_PRINTK( x... )
' _2 T: W; ^1 r- I - #define DMA_FN_IN
& G% K( @3 {+ e, _$ ? - #define DMA_FN_OUT' T% l2 S) d. V! \, d/ E. ]5 S
- #endif
- W; K0 O, C2 f; q" t y
! \, A! L1 s$ f0 \- #define MAX_DMA_TRANSFER_IN_BYTES (32768)+ y4 {+ C0 q% W/ X9 A
- #define STATIC_SHIFT 3
3 u6 f( n: y, s) t' o' u% j0 i - #define TCINTEN_SHIFT 20
+ l2 H6 D* o( i, Q - #define ITCINTEN_SHIFT 21
2 N4 b8 D% H: W7 t# C t& u9 e - #define TCCHEN_SHIFT 22
" g0 g; O$ i# n3 F* x - #define ITCCHEN_SHIFT 23
. _: u- I; i. z4 J7 w$ C9 k - 3 k& J; M- \( X% J
- static volatile int irqraised1 = 0;: }8 M0 l6 }' C& G
- static volatile int irqraised2 = 0;: R6 t3 w! D3 ?: S" l D/ \& m. A k
$ X) [. `+ L, F7 L. ]$ T- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ o" S% o7 ^4 s; k; s: ?
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ m9 X* m) ?. S) ?& ?
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 ^7 g- c5 k: v( c
, ~7 ?* V6 t1 y& V6 Z+ ^: I2 j5 i0 t- dma_addr_t dmaphyssrc1 = 0;9 G+ d, R% |- m8 r9 m C( p
- dma_addr_t dmaphyssrc2 = 0;6 |$ O" r/ e8 |, ?* E
- dma_addr_t dmaphysdest1 = 0;
: n2 m7 f$ C. s* I F - dma_addr_t dmaphysdest2 = 0;
8 O9 W' f) t+ D1 i1 E- z - 3 X* C" F0 X3 x8 ^% G# A
- char *dmabufsrc1 = NULL;% S( h4 } ~0 Z3 R, y" G2 J
- char *dmabufsrc2 = NULL;
! X$ [) e i" ~* U) X: \0 m - char *dmabufdest1 = NULL;
1 v7 q% l, |( ^& ?" u, ~ - char *dmabufdest2 = NULL;
$ x# k. g$ z X) I' i - 8 L) u8 Q0 [! I: @
- static int acnt = 512;
- i4 F# l Y: r/ z - static int bcnt = 8;
1 u4 j1 q, U' o Q2 z% r5 L+ G - static int ccnt = 8;5 x- M) l1 p7 A
0 P: b: T- h+ P% k% o- module_param(acnt, int, S_IRUGO);
4 ~+ k2 d' c [5 s2 J - module_param(bcnt, int, S_IRUGO);1 I+ G; u( M6 w- _" q6 F" A6 O
- module_param(ccnt, int, S_IRUGO);
复制代码
* a' D: ^0 w7 h; x, X5 y7 Y$ U% h: }
6 E4 f3 [! X- r& ? 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% S2 t# C* R4 |$ sarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) W- E) p$ G# {% G 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 a" f# o \8 d* r8 |' K4 r v
0 f' a4 y: X) Y2 G
0 u# p" k( Q/ b- t2 G" E |
|