|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 d8 A R A5 _% r! N$ k- [code]EDMA sample test application4 K# C# h2 E5 e; w' O# r X
- /*! v/ s) v& U& x; `, u- P8 y
- * edma_test.c! h$ C4 b2 Q! T
- *
8 U& Y- k% c1 a" ?$ c - * brief EDMA3 Test Application* e# Q* [) _$ z+ ]
- ** A* ~5 I- f5 V' q: s
- * This file contains EDMA3 Test code.. F0 A4 x. g, f; g# r
- *
7 v4 m/ c& c+ T: r' z( d - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE O& v& d- k6 @( e6 z" ^
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
+ @' G& _* |( W - * TO CHANGE.
. S; e$ N4 f6 X8 E+ Y9 p, S u - *" \/ h- Q0 g! {4 D
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ r( i! W2 E: L2 W
- *8 o4 Z2 {8 e; ^7 k. v
- * This program is free software; you can redistribute it and/or% \, H1 [6 o4 S" J2 W1 {
- * modify it under the terms of the GNU General Public License as- ]2 V3 H0 |3 S* w1 F+ Y
- * published by the Free Software Foundation version 2./ L' k; K' v3 l
- *
1 q9 E5 _/ m& h6 ~8 J: ] - * This program is distributed "as is" WITHOUT ANY WARRANTY of any) h) E5 j3 F( I! P8 t$ U. ^
- * kind, whether express or implied; without even the implied warranty# l' f4 F8 j3 |8 [7 E; @$ z
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the2 S# ]2 J6 P( M* u3 W2 [2 ^
- * GNU General Public License for more details.2 a. S% e8 a6 c4 S
- */
* u4 P' W: @" W. C - " T5 v! B. c8 k# K! b: ?$ Z
- #include <linux/module.h>' ]2 T" W3 ?. N8 n) P
- #include <linux/init.h>1 k% O2 p0 w$ X l' j4 V; u: S' w
- #include <linux/errno.h>. K: Z; t+ T/ L/ x
- #include <linux/types.h>* i M3 |/ J& X2 ^0 n# W
- #include <linux/interrupt.h>! e F) y" o; M: L
- #include <asm/io.h>
* {( ] q7 K3 M4 N }% n - #include <linux/moduleparam.h>8 n; D: U" z( l5 k9 o
- #include <linux/sysctl.h>+ G: D+ Y- G! P- {& @4 Y9 y" T
- #include <linux/mm.h> |- \1 l: J3 k9 T% n* f# `' A
- #include <linux/dma-mapping.h>
/ e; w; ?# Y& @! z) ]( w - , E' E* g3 {/ r8 d
- #include <mach/memory.h>
. G: o1 {$ p- T" v - #include <mach/hardware.h>
: O$ [, M% E0 d0 K, ~5 o - #include <mach/irqs.h>
) }% x* @2 ?7 t/ Y8 l - #include <asm/hardware/edma.h>
$ F' W9 _3 G$ `+ Q9 |( {
3 a- s7 P$ x# y: q8 A- #undef EDMA3_DEBUG
) T$ {5 B( I$ @) @& {" R" l, [; P+ C - /*#define EDMA3_DEBUG*/
" {; ]$ {6 Q1 j' o8 U9 I8 ~ - ) C) H6 u# j6 [) b
- #ifdef EDMA3_DEBUG
2 x7 s" ~0 Z8 E+ P! y) N - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# q, l3 n/ n1 Y$ t7 \) l
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). k) D' L7 q; i- m) I# G+ _* Z
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# b- v' B! d% p1 y# Y' s
- #else. t* x; o0 q3 o; E# c
- #define DMA_PRINTK( x... )
5 U+ y# r6 p. J$ U1 [) y - #define DMA_FN_IN. R1 |% }5 P! M$ }/ d& k) |* O
- #define DMA_FN_OUT
# N# ]# L1 q, { - #endif+ ]: C3 B- g0 s" L/ f
- 6 l4 u4 A7 m1 U) c" V# T6 A
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)0 q0 a& D) ?' U7 @2 J$ g" x
- #define STATIC_SHIFT 3
( V( P3 d" z6 W+ Z - #define TCINTEN_SHIFT 20
) a* y) B* Z3 n - #define ITCINTEN_SHIFT 21& y$ d) b- R# y% P( z
- #define TCCHEN_SHIFT 22
# M/ I9 Z0 R: [* b - #define ITCCHEN_SHIFT 23
, q" i. n" n, C% i B/ e5 T, |
/ ~# q q% V* O4 B: x' |- static volatile int irqraised1 = 0;9 T5 G; c. i+ K! }. O
- static volatile int irqraised2 = 0;
5 Q; z) w8 M x7 O4 J% ? - 0 z( Z0 G+ N9 E0 ]
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 p' }. r) D$ a% W& c5 _ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 d K- a2 k: g. i% o7 d7 S) {+ M7 ^ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 E) z5 [# \! J; m& K
- 3 P$ Q1 m, r5 U" Z
- dma_addr_t dmaphyssrc1 = 0;1 l1 ?: [/ r! _" W+ k5 s9 L& x( w
- dma_addr_t dmaphyssrc2 = 0;8 _- I, G6 Y$ X; ^" ~$ s
- dma_addr_t dmaphysdest1 = 0;
! O' q( s) a$ |' v - dma_addr_t dmaphysdest2 = 0;
3 E# O' Y) b+ B5 H - 6 F+ j2 H D' b* r
- char *dmabufsrc1 = NULL;* f+ S6 B* O6 a% z/ R8 i; C# Q0 Z
- char *dmabufsrc2 = NULL;
$ {9 z0 H; T8 b# F - char *dmabufdest1 = NULL;
$ G1 i4 E5 u" k" Q - char *dmabufdest2 = NULL;5 T; k6 l& D7 \: Q ^
+ r6 m3 N3 [" { ]) t- static int acnt = 512;8 T+ e# |! U' P; B6 K
- static int bcnt = 8;
% c9 B( ~% [; o O$ a; \ - static int ccnt = 8;5 U; ^; b. D- Q! q
9 i Y5 |: j' T' c8 K$ ^5 E+ [- module_param(acnt, int, S_IRUGO);1 g4 @. O% W Y
- module_param(bcnt, int, S_IRUGO);
( j4 ]# G2 L) i: E* v5 `( _+ m2 d - module_param(ccnt, int, S_IRUGO);
复制代码
y( G1 N; M- x5 _2 O2 m2 @: W0 q/ I' B6 U9 k; ?. s6 ~" Q" n1 \ `
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* H* F7 t1 h9 U3 x/ N; ]
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 s {) b2 G- f
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 o: W4 g7 c3 ^! D" d- y' x7 K5 t6 i0 K0 J
: T# ~9 f3 ?2 L2 I% ~ |
|