|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( c1 B1 B! u7 M+ q5 K8 ]* T0 n* J- [code]EDMA sample test application S" I) [8 \, l
- /*
' I, Q" I8 @ c/ J2 @( Y( A - * edma_test.c$ x( \, Y( R! B* ^) S( b; s( B
- *
# ]/ Q4 \' _/ O9 L! u - * brief EDMA3 Test Application2 X6 B! N+ J. g
- *, T6 Z+ O) h9 O# b4 [
- * This file contains EDMA3 Test code.
0 D2 W- T. Z M$ {# G5 c. B4 U# y - *4 e5 b+ }+ A! Q2 q% X+ \
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
: E! @3 G1 T' U6 i$ z - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
- A+ u: J; |" c: G) S' C# u - * TO CHANGE.
1 {2 ~3 C& C8 [1 ]4 r# z2 e3 { - *' ]+ }8 x& Z. h2 s; j. e' S
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% }& ^8 D- T8 p- { q' z) L4 P
- *
: _0 h4 E! A+ H+ j$ D5 J/ H - * This program is free software; you can redistribute it and/or
: {. B5 U( Z5 G m7 N; d) } - * modify it under the terms of the GNU General Public License as4 {! S1 f" n3 @* `; Z
- * published by the Free Software Foundation version 2.* K, R, x' B% Z, K5 Q
- *
P/ i/ h/ [0 \! w3 l! F f" Z3 q6 R - * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 s0 s8 u; r1 N! G# u
- * kind, whether express or implied; without even the implied warranty7 N; P6 \1 w9 o/ z- r6 w
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the2 P& U+ D ?7 n6 J4 P
- * GNU General Public License for more details.8 j2 e3 W3 G6 h
- */
" p1 l' {# P3 C1 s
7 N% ^1 v3 y2 n' q, h. \- #include <linux/module.h>
! c' }6 V% _# W& O7 l+ J5 J" ^* G - #include <linux/init.h>
6 q+ X1 q1 L, T+ J - #include <linux/errno.h>6 j) a1 \3 o) B1 |9 x* e
- #include <linux/types.h>
( M, I3 p) y; v% o; q% s2 A - #include <linux/interrupt.h>
9 K: E: x* _ q: a7 a - #include <asm/io.h>
1 o) Z+ S1 t) U; ?) @ - #include <linux/moduleparam.h>
) \9 b' ?. h* V8 h7 [0 j% _ - #include <linux/sysctl.h>% `; m( K' O2 k
- #include <linux/mm.h>, N6 |. M) n( J; [' [! J) Z
- #include <linux/dma-mapping.h>
7 p5 O6 F( G4 ^ - " |2 ]% n- B4 o2 X7 Y. K+ a" `
- #include <mach/memory.h>
9 R$ m, ?" q- |, C( U - #include <mach/hardware.h>
) w3 o: _+ Y, z# _0 q$ N6 @) r. I - #include <mach/irqs.h>
6 X& {, Y% v0 s. @ - #include <asm/hardware/edma.h>
# E9 t; K& x! @; R4 r; R* d
$ ^+ Y0 J* X& d" d- #undef EDMA3_DEBUG
$ `% V9 F/ N/ F) P! \- b4 K7 f0 a - /*#define EDMA3_DEBUG*/
/ {: V, F ?( R* g- ^! T
0 O3 `7 Z7 |" \' b# C9 i- #ifdef EDMA3_DEBUG
3 e* O$ x2 g0 M1 u3 _6 G4 ^: I - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! @5 I+ G E5 m
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
( e5 a8 j1 u; C; M6 s8 h - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 J# r- y; G9 R' ~/ S& M8 Z: s! V
- #else% m! ]3 c$ T- R; ?$ S1 b
- #define DMA_PRINTK( x... )
8 G: A7 g; p; m - #define DMA_FN_IN
! A! ^" h$ u! i2 _ - #define DMA_FN_OUT$ z; b% p( E3 _/ h7 j+ C( L
- #endif5 {* G7 h2 j9 |$ J" q
, v6 _% A. ~) V5 J' L, b, ], Q/ @# p- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
0 P1 @) K, Q) x! |, @ - #define STATIC_SHIFT 3
7 P$ C v9 ]* ~" S0 z2 \4 N. Z: Q - #define TCINTEN_SHIFT 20- M0 m5 x( {; c! ]: k: w; x
- #define ITCINTEN_SHIFT 21
1 @3 |, Q+ v: o* d4 y1 f% H% X - #define TCCHEN_SHIFT 22
7 ^ m) y3 Q! x1 S5 ^8 A5 m - #define ITCCHEN_SHIFT 23
, j4 A1 D9 b* r2 R - 2 h. p8 j) I0 c/ s% ]& W/ R
- static volatile int irqraised1 = 0;/ a& _- B" e8 B! u( U0 Y
- static volatile int irqraised2 = 0;. c3 ?* Y6 W/ J% q, `; m! N3 ~
) h1 q$ H7 D; \- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 }: ]+ b$ }/ i! J
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 i' `1 z% M% Y, j7 U
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ m* T# C. W' m0 P
, T# E* v9 Z% U( w ?- dma_addr_t dmaphyssrc1 = 0;
) O, T& l$ `# M* X" u/ b - dma_addr_t dmaphyssrc2 = 0;4 [, p: e* U J' N2 q+ i
- dma_addr_t dmaphysdest1 = 0;. |0 Q$ X4 z0 w3 p6 ~2 N: Y s
- dma_addr_t dmaphysdest2 = 0;
# N" Q6 }7 O$ Q% F4 Y& F0 E- I$ x - 3 }0 [7 E; L. c. V. `( e# U
- char *dmabufsrc1 = NULL;
- R9 J( W% f$ P4 }4 |* J W/ c - char *dmabufsrc2 = NULL;
$ D: B# V2 D( R1 } - char *dmabufdest1 = NULL;
0 k6 Y2 r8 _* N& H3 O# { - char *dmabufdest2 = NULL;
5 \5 @$ n% e6 ?) x, x6 D- x, a
$ \* i. ]4 C \- static int acnt = 512;+ \0 M* U$ K8 j# [7 U( J
- static int bcnt = 8;: k/ K# q4 j/ e3 }
- static int ccnt = 8;
5 ?5 m: L$ G- R) Q - g) O! a* y; x) _. |
- module_param(acnt, int, S_IRUGO);" C6 q( h/ F8 y% t+ ^0 X
- module_param(bcnt, int, S_IRUGO);" g9 }) r' i# O8 t5 P
- module_param(ccnt, int, S_IRUGO);
复制代码 5 h* W7 _2 b$ \8 z
1 E( W8 N% E j# m
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! e* q' o" \2 }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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' j4 m- z4 }2 j 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 y* S! @, ?- o5 g: v0 Y6 y- I F7 X6 ~7 ^) T
' [- w; y* \+ P) k$ U |
|