|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 m" x; C$ Z: k7 r4 E4 Y! ?
- [code]EDMA sample test application P/ D) T! t6 G
- /*
) x4 }+ m; _* @% J" E& s, P - * edma_test.c* Y, |2 C4 z+ w: r4 O+ U: f
- *
0 F4 G: H; }" y/ b0 ~9 k - * brief EDMA3 Test Application
, W' i4 `8 @8 K' e6 c) ~1 x2 i - *
! B+ k5 Y k& z+ E+ z - * This file contains EDMA3 Test code.
4 @: \2 f. o+ h! l4 C - *
& s K2 N6 |: I. r! E) T& A - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
/ [! _& H4 k e - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% s3 P1 O7 _( p& @; z$ m9 @
- * TO CHANGE.
- z3 s7 z1 l% v) p - *+ a5 |1 g0 P N, N
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
a" a: @5 k$ H. }& C - *
' o1 [3 P% i1 I- O' D: m - * This program is free software; you can redistribute it and/or, G/ i$ s% P3 F3 a2 g6 N
- * modify it under the terms of the GNU General Public License as
. U$ W+ @1 e$ S( g8 i - * published by the Free Software Foundation version 2.3 s( A& R2 h" I- ~8 ?% Z, h8 Z' a' q
- *
# _9 {( r" z4 m) B& |4 ? - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
, Z8 B, n1 U8 K3 B5 r - * kind, whether express or implied; without even the implied warranty
: P: k1 C* h0 h3 {$ R+ ` - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- t& H# a! y; D. @3 o4 e( N N" C& } - * GNU General Public License for more details. j5 M$ u6 w1 {' n/ |3 C. A
- */
3 D! v% K7 `$ S& [% _0 ] - % M, m" e3 U8 s4 Q
- #include <linux/module.h>3 I1 _2 a2 r( Y$ l2 t/ G! k+ p
- #include <linux/init.h>; u& A7 J4 O8 j( S$ J: N" x
- #include <linux/errno.h>
3 d0 V9 }+ Z& j. N - #include <linux/types.h>
+ n5 a+ |$ k+ q* @: u- [ - #include <linux/interrupt.h># d1 _7 \& Q A. q: \
- #include <asm/io.h>% n, m# S7 M1 k1 t
- #include <linux/moduleparam.h>* @9 p; |" T4 {* o* X. l' {
- #include <linux/sysctl.h>
. i3 \+ c8 X8 T0 j - #include <linux/mm.h>
4 V$ n( K6 x, ]6 |4 e& O - #include <linux/dma-mapping.h>8 B; S. k) K) Q
$ b0 A" L2 W& j% B6 g! I- |- #include <mach/memory.h>
: y7 g v4 i2 @& a% P/ D - #include <mach/hardware.h>+ @3 g. B7 T; P
- #include <mach/irqs.h>3 ^, U" c6 A8 J, Y( U9 Z! s
- #include <asm/hardware/edma.h>4 M8 v, }# [& V" }2 x% i
- T" `& b' M( J3 P8 t; m- #undef EDMA3_DEBUG8 x1 C) B( u; p1 u6 S0 X
- /*#define EDMA3_DEBUG*/& b3 K, m# d, u( f
- % O5 ^4 p7 v7 r1 G9 I
- #ifdef EDMA3_DEBUG
+ F/ x2 L) K! c8 p! P k - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) Y+ `) }6 j: _3 m& O% m9 P' G
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
% J& f7 c. d5 Q - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
; G; O: S5 |, a1 q; v - #else
) h+ a" |5 a, ^+ B! R P/ c2 H - #define DMA_PRINTK( x... )5 s' X) t( @ V
- #define DMA_FN_IN' B' T0 u r& p5 T- E; Z
- #define DMA_FN_OUT. p% ]* z$ G/ {+ G/ l
- #endif
\) u7 `& o/ w. I1 V; t, \8 q1 p( z
6 G) U6 q; W6 c- ?- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
. q# k5 h! `5 p& ~6 l - #define STATIC_SHIFT 3
' S5 i) @7 B; H7 T5 B - #define TCINTEN_SHIFT 20
& s& ]. i% Q4 z4 i2 H+ j - #define ITCINTEN_SHIFT 21# }6 `) B( p$ x; E$ [' p
- #define TCCHEN_SHIFT 22. T; ^$ l6 g3 t8 m
- #define ITCCHEN_SHIFT 233 U8 S# ~9 y5 ]; A; E. f1 S* \7 v
- , i/ j2 e2 B' Y6 N2 V
- static volatile int irqraised1 = 0;
, c3 I- Y) r7 v; X( f1 z - static volatile int irqraised2 = 0;- F0 \9 Q! g* ^1 ?8 t
8 O! N7 S* d' k/ l- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ z9 w/ ]' h4 y) v4 X: n: E
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* H5 S& X0 T. I' l
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 Q4 T1 q7 f+ [: B. o/ d' K- ~
. K1 Z6 @+ s$ R! Y; `7 W' l- dma_addr_t dmaphyssrc1 = 0;9 h9 l5 `' W/ G/ [2 h
- dma_addr_t dmaphyssrc2 = 0;$ C# K: ]3 a; \, a' E+ G
- dma_addr_t dmaphysdest1 = 0;
: p8 y z" ?- v, I: M9 U8 A l) f - dma_addr_t dmaphysdest2 = 0;, d$ h* ?. `8 `
* ~5 q: I2 b& Z+ D8 ^- char *dmabufsrc1 = NULL;
0 [# Q4 d- z) J* ?1 Q - char *dmabufsrc2 = NULL;
4 C; ?, b( {$ o9 i1 F! S - char *dmabufdest1 = NULL; r, g# ^4 d) X
- char *dmabufdest2 = NULL;, Y1 K1 H- m+ G, ~* N |
% l7 F% c& j, x* T; `! P; V- static int acnt = 512;
0 Q3 |; a( n) A3 E+ z1 u( E - static int bcnt = 8;
+ c! `8 c n7 R) S3 E - static int ccnt = 8;
# P) o% o. y+ G, }3 b4 c+ X - ; u- k/ ]6 `: l( G( p
- module_param(acnt, int, S_IRUGO);. ?8 g2 n6 Q# F- J$ D
- module_param(bcnt, int, S_IRUGO);
- N+ l. Q9 R3 ^' x - module_param(ccnt, int, S_IRUGO);
复制代码 6 u" c7 @! _6 P% ~/ d" O
2 ]" b2 J. c6 J" g2 ]7 y
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; g e: q0 q1 w; U6 Y9 D0 Barm-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. x! M! } b 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' e: a) r$ G" `8 G/ `7 H7 t8 A3 {4 A) `/ s
7 |$ C7 i* {7 \1 F/ p |
|