|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 y1 i9 L" s* d( h7 q B+ ^: d% O; K- [code]EDMA sample test application. C) K6 r# B% |. K, F" q
- /*
" N4 M8 n7 F" R# p - * edma_test.c
$ x, K9 L4 ], Q: D - *
5 u# H* h( f+ H) @7 @; O - * brief EDMA3 Test Application( k, c& ]2 Y% `$ W
- *: Y7 g0 P# F1 O) G6 Z: W" p1 Q F+ U
- * This file contains EDMA3 Test code.4 X: Y" P, B6 E) |
- *
0 _. N! M; C7 r! A' a j" | - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
( W$ r" Y- }* y6 F+ V - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 @& K1 M$ f' ^" I/ e' y* I
- * TO CHANGE.
5 [8 _" Y6 F) d* u0 V - *& T- u- c9 D) c2 N6 m/ c: l$ x
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
7 a: o& r+ O; ]: K3 U - *
O' q4 p$ y5 [" {7 P/ k - * This program is free software; you can redistribute it and/or) X+ `2 L+ g' O9 R1 V" }- N
- * modify it under the terms of the GNU General Public License as
% _& S( |; R2 r% j' W" z( w - * published by the Free Software Foundation version 2.
6 P- `$ Q4 k. Q. A) g- m; R' T - *
0 V m$ T" B+ b' L( X - * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 Z0 _1 L( L( V$ P7 e
- * kind, whether express or implied; without even the implied warranty: W$ x! K0 g: }: E/ j6 H
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1 V: |' @$ }$ \ - * GNU General Public License for more details.4 ~! P0 B3 O7 ~ l
- */
# z: }7 K- d, S3 ~2 m8 |
$ x& ^, H0 _: ^5 i0 }" {1 c! Y- #include <linux/module.h>7 l$ M G* U0 c$ r
- #include <linux/init.h>" m; j: x' g+ j& F. v$ s
- #include <linux/errno.h>
2 f1 E- S9 b' l5 C2 a - #include <linux/types.h>3 f( S# q2 L1 y; E$ b
- #include <linux/interrupt.h>5 \6 i& {5 o H9 ^
- #include <asm/io.h>
/ p) S( t/ Z, y' M& f/ ? - #include <linux/moduleparam.h>2 g0 D+ J4 S% T
- #include <linux/sysctl.h>
- n% i y: n: E# h, A5 D8 {) n7 h - #include <linux/mm.h>3 l- j" ?# @/ p5 [' w+ f
- #include <linux/dma-mapping.h>
% n& l, b# I- n+ y( w/ w* `
% _1 P. L# |; l- q7 w- \) b% ]! P- #include <mach/memory.h>
* B3 E- H. Y n+ s/ ^2 Y - #include <mach/hardware.h>
2 j/ I! s* j$ R& z K - #include <mach/irqs.h>
$ Q5 |5 _" R- Z! }) J: x L+ [ - #include <asm/hardware/edma.h>! a$ i9 G, y0 [! a& f
( l! `. A* O0 _5 Q% K! g! G' r- #undef EDMA3_DEBUG5 y# g8 A) _1 q/ i, y& x6 x
- /*#define EDMA3_DEBUG*/
. O/ ^, D/ k) y6 G - " x5 ]/ S0 r! A) q' i. ]3 q/ |! z# |
- #ifdef EDMA3_DEBUG
3 q: Z8 {$ j, l8 Q7 W& _2 _ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
* n" R) Y9 l+ M1 u" A- M/ B - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
1 b0 G6 S: h& U, X& I5 s# f - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# ]* l" e( H" m0 i& R* W- U$ R
- #else* b$ c1 F5 s. U2 }' Q& R) l
- #define DMA_PRINTK( x... )
7 A" U& ~" X0 W" \9 h# ? - #define DMA_FN_IN
& D0 N: \3 a9 C6 @6 x4 U' z5 ^% S - #define DMA_FN_OUT2 c8 A( N J4 w' j5 L6 z7 Y
- #endif4 M: o% ]* I7 f$ g2 J
3 C, I+ O- l7 s6 x: T/ G0 L1 N- #define MAX_DMA_TRANSFER_IN_BYTES (32768)/ j4 W7 C6 ~: y. x* Q$ }* ^
- #define STATIC_SHIFT 3( f9 v* X% B2 ` a
- #define TCINTEN_SHIFT 20
7 c+ Z$ ~" y: }% ?1 z - #define ITCINTEN_SHIFT 21+ a( z$ G" Q# p% w0 k5 L k
- #define TCCHEN_SHIFT 224 R1 I, f7 n c' v# d/ |) [2 ]
- #define ITCCHEN_SHIFT 235 ^7 D2 J: g: k
8 ]9 G5 |0 B- K* _- static volatile int irqraised1 = 0;
Q; M+ [- d# S - static volatile int irqraised2 = 0;
- O, d: b1 l) q' U& b0 f" ~/ n! G7 I - & L# Y/ |) T$ `
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 R `; P( h' c8 e, u" h# i - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, q8 z9 B' Z/ a# n* Q5 T - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. `+ Z' I ~6 D5 j9 m5 A
- 6 a/ g( W! G- I, u8 `5 [9 D* y
- dma_addr_t dmaphyssrc1 = 0;8 p2 F* [, P: ^2 e2 Y$ T
- dma_addr_t dmaphyssrc2 = 0;
5 R7 J( P& |. {9 U) Q6 o - dma_addr_t dmaphysdest1 = 0;0 j' h7 j6 T0 I
- dma_addr_t dmaphysdest2 = 0;0 K! t+ q& V G. p) z8 d
i2 @/ V6 p8 n4 h* G8 C6 X/ m- char *dmabufsrc1 = NULL;) W) `9 J5 Y* L7 z
- char *dmabufsrc2 = NULL;( u! `+ @, d1 Y% c
- char *dmabufdest1 = NULL;
/ }' O% r! ^( f' ~2 c - char *dmabufdest2 = NULL;- m5 {, B _7 b" K# i" O6 o8 e
- 7 ~! G( C4 ?( w7 i3 b
- static int acnt = 512;
K0 C0 l* k1 i! l% g - static int bcnt = 8;
# O3 K1 l/ Z# H/ C* E+ Q - static int ccnt = 8;
5 p6 f& N }. k. x
" {7 k5 k, N9 |/ P- A0 ?- module_param(acnt, int, S_IRUGO);
- v+ J" @/ N; F3 m - module_param(bcnt, int, S_IRUGO);6 i5 \3 C7 A" W9 d: D( X( k* b
- module_param(ccnt, int, S_IRUGO);
复制代码 : o5 N/ ~3 j. T. V5 U
5 \: X/ n" I- s7 ~
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 Z' C7 `) H0 V; Jarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 I' m1 R4 y2 b& N2 W8 `2 s, V+ @8 d 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 z: o3 A. g" Z0 k7 ?8 m5 k4 ^) R# u' v# X9 X+ t
- _8 O9 v) z9 ~" f# c
|
|