|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! z) ]+ l* |/ p- [code]EDMA sample test application3 z7 [3 g, f: X5 A
- /*
3 z2 f4 q6 x5 G. V- x - * edma_test.c
$ f. b/ X# ~% G+ T: Q4 T - *; I8 s" p" c' N2 ^
- * brief EDMA3 Test Application! K. G6 M; T' K6 y" I5 h
- *
$ K' J3 W/ z( H - * This file contains EDMA3 Test code.* L8 f" l) n; @, w. Y, K0 N+ G) @! v
- *& K, h1 P' q% L' x2 q4 U% g
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: P( k: I! T" E, T, r
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
/ P$ |9 f/ Q" t' {9 T# R7 Z+ F( h - * TO CHANGE.
% U0 M* `( d/ S* L, @0 a - *
: X e* v P: y& ?6 o8 { - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 o9 Q ?6 O! ]3 {) g
- *
; h/ E/ z8 e9 W- Y9 i4 Q - * This program is free software; you can redistribute it and/or. e/ O& ~) S% H; v( Z0 P
- * modify it under the terms of the GNU General Public License as% ]! ~* a7 d& c; V- v' ^7 d
- * published by the Free Software Foundation version 2.: F9 N9 B+ b: o& D9 N
- *# a( x- L+ A2 u" X% t
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any( H! F3 K% \+ Y% n7 n! i
- * kind, whether express or implied; without even the implied warranty! i) l! D' J: k6 x5 X8 T5 z
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1 [- ~' I% K" z( { - * GNU General Public License for more details.
* h5 E. \' ]. A6 X2 [' t2 l - */
N% _. `4 K5 R3 T0 A( M& G
' @' t4 r9 ]* L# o2 b: m2 ?& F8 ?- #include <linux/module.h>
/ ^ D& c4 b1 c. V8 B - #include <linux/init.h>$ K, {3 f; s9 ^8 U: G4 \+ [: {
- #include <linux/errno.h>
6 M# R$ `) Y( ]' @8 e - #include <linux/types.h>
" X: q1 E2 Z; h; Q# _/ A - #include <linux/interrupt.h>+ Y2 P5 |. w" L5 {% p2 y
- #include <asm/io.h>7 S$ X1 e7 U/ [
- #include <linux/moduleparam.h>+ [5 @0 R$ ~5 Y9 {' X8 x4 K, b
- #include <linux/sysctl.h>$ f6 V4 ^1 N( \3 J z
- #include <linux/mm.h>& d) z+ u6 i8 d" U3 G
- #include <linux/dma-mapping.h>
9 N0 Q7 r R, O8 J/ S2 q, E
5 i9 F W5 R5 _5 m9 x- #include <mach/memory.h>
|; i: Z0 A& a7 i S1 A - #include <mach/hardware.h>
3 F; D. ^; g' c/ r - #include <mach/irqs.h>
6 ?. W6 i% [$ v* w - #include <asm/hardware/edma.h>4 z( o8 j8 f: n L+ m9 y
7 j6 Z# t2 }6 h) M! o- #undef EDMA3_DEBUG3 b. k* F# P. Z' q- U, Z3 I
- /*#define EDMA3_DEBUG*/
6 e# J6 U$ W6 k1 f2 q- Q1 _ - # p( M6 M7 i, Q1 M7 E3 W' l k
- #ifdef EDMA3_DEBUG
7 W. k- y$ A9 L) |, q$ r - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
1 A7 g7 e- s5 E - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ {+ o) P3 R3 N2 x6 A/ D- g' l
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 [# T2 ^6 `6 c9 r0 I; ^2 ^, `7 u
- #else1 l! b+ I) a! `2 e. `
- #define DMA_PRINTK( x... )4 ^2 L, v; K5 |
- #define DMA_FN_IN% E2 s# J z1 j4 f1 S, \
- #define DMA_FN_OUT
: \7 e7 @5 O. A6 e) c* B - #endif/ P' w6 i6 {2 K1 O
( c: `$ | Z5 R T' f0 V2 r5 {- #define MAX_DMA_TRANSFER_IN_BYTES (32768)# s/ Y% a8 l3 v" U. w' d; W4 }
- #define STATIC_SHIFT 3
$ ?3 c. s5 V% D - #define TCINTEN_SHIFT 20
4 d0 Y8 d& ?( W d6 _ - #define ITCINTEN_SHIFT 21
& c+ H0 ? H/ y7 g7 }& X8 Q - #define TCCHEN_SHIFT 22; A1 Q# B8 e }) P" R$ h
- #define ITCCHEN_SHIFT 23
+ o7 @$ l: M; Y - : I$ G B6 j5 p( @% n& [+ K3 D2 V
- static volatile int irqraised1 = 0;
2 o. O+ q6 n8 d3 Q" R - static volatile int irqraised2 = 0;: ]5 k% `" l5 d; V/ A2 ?
$ g3 I* |3 b5 N2 x2 \- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* z) b% `$ x4 V
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 d% {# U+ R0 z% M, H+ B! ` - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 o6 h( k/ m7 w3 }6 L, u0 K4 D - # J: E: u* O/ B; v% N
- dma_addr_t dmaphyssrc1 = 0;
; H- U* B# v* O5 N& i- G3 J: D3 @ - dma_addr_t dmaphyssrc2 = 0;
5 A1 x6 D" I! W - dma_addr_t dmaphysdest1 = 0;
/ x/ P- h7 ?/ d0 ` - dma_addr_t dmaphysdest2 = 0;! k2 m7 ]( T4 z6 Y
7 z: ~: g- Y6 p( ]- o+ ?: c- char *dmabufsrc1 = NULL;9 t4 L! P4 t, Q! [8 Q! R5 \
- char *dmabufsrc2 = NULL;# P8 r- x9 i& N4 c8 x7 \" I
- char *dmabufdest1 = NULL;
$ J$ x; s1 ^; [2 `9 h! X" D ]4 d! ~ - char *dmabufdest2 = NULL;+ T& {1 l1 G6 j8 Q9 q2 y
- * K3 Y4 d. m3 C" G
- static int acnt = 512;
/ }9 T: z6 r4 D - static int bcnt = 8;
! t4 a1 ~4 Q8 T6 ? - static int ccnt = 8;
% N* j' b' \0 S - + ^8 V; P+ R4 A1 r
- module_param(acnt, int, S_IRUGO);
. p' @ T0 z8 k8 V6 i9 C \ - module_param(bcnt, int, S_IRUGO);
! D' H: v8 p# G+ x2 r# l - module_param(ccnt, int, S_IRUGO);
复制代码
% H% w0 t5 y0 w3 m( h8 i# l" R5 F# ~7 ^% I$ i: e/ L2 D9 Z
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. L$ ^+ ~& q I7 g" \, s/ Zarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- H. {$ W4 M: L0 S" [1 ? 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# p# a/ n7 ]! Q! J9 Q
4 E |4 g0 h/ `* g" q+ s) u* _8 g9 e0 Z6 v
|
|