|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 M, l' c4 E4 x, w( ]
- [code]EDMA sample test application
& T+ d0 q+ O' _0 d4 v' R - /*7 `0 x0 T& P! |" } \
- * edma_test.c
: b% p, Y( W5 ^0 n( I/ L - *. v8 g$ b9 v& C* S, P) r1 j
- * brief EDMA3 Test Application2 D5 A& s1 }) ~; j ~ Z! f) j
- *, l$ I- F& t( A9 S
- * This file contains EDMA3 Test code.
% g# {: A4 R' A/ h+ E! X+ d. o/ Q - *: {; w# ]1 s$ a T% Y* U! D2 a$ ~
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
, B7 F. ? h' c. L1 U* o - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. M+ Y5 V5 d) c: ?* z! m
- * TO CHANGE.% K4 P! f+ V: K5 E. B0 v
- *
+ ]2 p \1 \: Y# S o8 W& p8 y# R - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
" w, `# C9 e" R3 `; @" S - *- m8 A8 r6 P; y: w( F5 r
- * This program is free software; you can redistribute it and/or# Y, F; S" T3 h! M' i/ A1 V
- * modify it under the terms of the GNU General Public License as" x# L' S- t6 P* q; d) a% n+ T' W
- * published by the Free Software Foundation version 2.2 x+ o1 Y& a) i
- */ J; h: s6 p' _9 c4 i5 H2 d
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any% K9 f; X; H* C. d5 \( [
- * kind, whether express or implied; without even the implied warranty
' {# |/ G. O; f: I - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
& a2 y% ?6 p% q$ r - * GNU General Public License for more details.# v. q0 \+ C+ _5 q# P
- */2 _! j! P! ]6 a1 T& S) N' ^, [4 k
- ; w2 y# G4 F5 M5 [* k: J
- #include <linux/module.h>
% a, t4 B9 }2 I - #include <linux/init.h>
7 J l, e: F1 X4 A - #include <linux/errno.h>% X+ _; k! }0 W) j
- #include <linux/types.h>
% g/ S4 X, C: P% p- w - #include <linux/interrupt.h>
+ {. k) y7 E. U2 C/ f/ B - #include <asm/io.h>
+ J/ f$ r9 L1 L9 J" p - #include <linux/moduleparam.h>3 D% ~) J. y6 u' h
- #include <linux/sysctl.h>
6 v) l \* ?3 B1 N4 S! X0 ^ - #include <linux/mm.h>' H$ N6 d. A; c' p0 `) k) T
- #include <linux/dma-mapping.h>: ^/ ]$ y+ s: X2 J' ?5 Q V, K/ Z
; T3 |0 s9 c# C: j- #include <mach/memory.h>, x- R: `; w0 W/ P
- #include <mach/hardware.h>
; S3 K- A& a/ X" h6 |% X; Y - #include <mach/irqs.h>
3 @- {7 b D8 D - #include <asm/hardware/edma.h>4 U! ~/ E% R8 }
- 9 D$ n$ G9 }$ P
- #undef EDMA3_DEBUG; z! j0 B4 Z8 `! e y. M
- /*#define EDMA3_DEBUG*/ m6 X- s: O, J2 o$ }' [
- # t# ^0 L: j6 R8 }. \
- #ifdef EDMA3_DEBUG/ d! I1 C5 z" i) x4 A! ^% N; e
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 O+ `6 q& V1 m" o/ c
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
1 Y5 g, }8 ~# T1 T; _. u - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( G d' r5 o! s3 Z/ y; h( p
- #else
2 B! c. |* a5 L - #define DMA_PRINTK( x... )
9 P* q M+ t: O9 U! F% x - #define DMA_FN_IN. T2 x \5 E3 L
- #define DMA_FN_OUT- U" R- w4 | q2 X1 V
- #endif/ S. Y4 P- h% U) \ p
- . f! {0 m* S) c+ f
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)8 b9 _% o6 y: o( T+ i1 [
- #define STATIC_SHIFT 3
( y E6 z" ?* ^* ^* f C6 D, n6 A - #define TCINTEN_SHIFT 205 M) ~% m% R; ] m# k/ i
- #define ITCINTEN_SHIFT 21
& z, N# }! B5 E6 Q) h - #define TCCHEN_SHIFT 22
) \7 F# t" J6 ]# p* W - #define ITCCHEN_SHIFT 230 g0 G1 u" j T' V9 ]" q
- ; S4 Q. x) T" x+ H
- static volatile int irqraised1 = 0;
8 L; I- Q+ M0 s9 E# R z - static volatile int irqraised2 = 0;
1 P$ X; i* U. s$ o
6 l+ k, Y, ^; Z7 `$ r8 v: Z- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. k& a1 [; b2 O( P3 Q4 c# h0 r# @ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 m O7 H3 O1 w& l* ^ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 |6 J2 M. m; ?) G- Z, M
) b$ F% F+ P' G( {2 Z- dma_addr_t dmaphyssrc1 = 0;
9 N/ v+ j/ f& e7 t1 o - dma_addr_t dmaphyssrc2 = 0;
$ ~4 \1 d7 z8 M - dma_addr_t dmaphysdest1 = 0;
; j, A4 v5 t+ }1 h2 j8 l" q - dma_addr_t dmaphysdest2 = 0;6 a$ N; p! V3 ^3 f Z- u# {6 Q
- : ?4 Z/ l; T- \5 k* L) u
- char *dmabufsrc1 = NULL;
7 q+ n& b* O0 g" `" \: N; L( }2 e - char *dmabufsrc2 = NULL;
2 G6 |* `5 q. Z S - char *dmabufdest1 = NULL;) |9 {5 }5 v7 L2 o& A4 d; T
- char *dmabufdest2 = NULL;
( p. G7 P0 S! f0 }3 a - 0 u# [- `/ l n2 [# r0 `& g9 b3 w( k
- static int acnt = 512;3 v3 c! _# z: d! ^+ h, D/ @: L
- static int bcnt = 8;; ^4 y6 N3 N8 Y0 A, o6 [
- static int ccnt = 8;
, g/ C$ f3 ?- J4 C1 n2 ~( }4 C2 Y! d - $ v8 {: V" m" Y: s; u b6 Q
- module_param(acnt, int, S_IRUGO);
8 R. G2 f4 E/ Z0 r - module_param(bcnt, int, S_IRUGO);
$ k3 J% [' K7 r; G2 V: U- } - module_param(ccnt, int, S_IRUGO);
复制代码
4 e: o8 e& S% |5 s" r3 [) @" V
4 a+ z8 Q3 B1 Y 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 k. H1 L& v1 U0 q1 l7 }2 garm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% e7 ]$ W7 s# y# r4 o' d 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ `" h! p+ W8 l4 u7 K1 [3 l9 K5 ^3 `( C% h4 x& ~8 ]
% k c7 P" P9 l( Q2 F7 H6 x7 } |
|