|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! A8 C- r) t9 n8 C7 H* J, F: n& Z) q
- [code]EDMA sample test application
" \; V. y2 x. H( Q! L4 {1 `6 B - /*' P8 m2 {1 c" w" j
- * edma_test.c
% }6 z o; I w - *
J% B! C0 J9 \* b - * brief EDMA3 Test Application
* ^/ h# o, m; N6 Y: F) ~# ^2 o1 d - *: C1 g3 R( ?7 J0 s
- * This file contains EDMA3 Test code.$ O. l$ N( M+ x. G- J# N
- *; o5 T7 h% L& O: F7 }7 v+ k& _
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, ?* O( Z: E2 A
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
/ M# \; U8 n1 h- e% X- y! ^ - * TO CHANGE.
( w3 z9 ]: E0 u2 _9 ?8 q - *
& @8 j3 c$ @% [2 A {5 l) ~& P - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
) p- m5 h' v8 j7 } - *
$ C8 z$ U4 ~) d5 L$ p. U9 H# j6 w8 F - * This program is free software; you can redistribute it and/or
# X( Z2 W, b/ y# q1 m& C - * modify it under the terms of the GNU General Public License as; i5 s( g c0 w9 a1 n: G/ \5 M
- * published by the Free Software Foundation version 2.4 ~+ L* K2 O7 z1 m$ A1 S
- *8 a5 d% U* ]/ @5 P& N
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any, M& E4 ^. c C1 ^
- * kind, whether express or implied; without even the implied warranty& S0 R0 ]+ k# n
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the p# [$ T7 ?$ L- q- N
- * GNU General Public License for more details.' m7 W0 g D7 l* J
- */( |) t7 o2 `# i$ B, ]. G& a7 A
, p9 r0 V+ v8 a' ^( T1 _- #include <linux/module.h>
, Y' Z) i, y" l( }* \! `7 z - #include <linux/init.h>
; O& }& T& C1 V% c - #include <linux/errno.h>
/ L+ y K' |3 G2 v8 @0 ?' m; ` - #include <linux/types.h>' \: J# A( `& S# x# P
- #include <linux/interrupt.h>$ z H% {6 o0 c/ `' G; D
- #include <asm/io.h>/ h4 }4 A3 \; I8 P9 d9 n9 |
- #include <linux/moduleparam.h>1 K: V0 W! N% {6 w4 @
- #include <linux/sysctl.h>0 I8 T: M1 o, w2 u6 n+ V; h; O
- #include <linux/mm.h>
: n7 p6 n3 k ^' _6 o - #include <linux/dma-mapping.h>
% h1 u6 L. v& \9 b3 T+ P - 2 d' ]: m* L% u, O
- #include <mach/memory.h>
% Z M X0 f* o4 N7 c; C& o - #include <mach/hardware.h>
4 |4 O% S8 t4 p) H @2 e' V - #include <mach/irqs.h>' ?- z+ t/ X! |* @/ g9 X) ?
- #include <asm/hardware/edma.h>8 V3 M, \ s% \9 m% y2 m4 y
4 Y& U7 V0 W& W3 f- #undef EDMA3_DEBUG2 R0 V8 i$ d, J, R. j" P2 C. `
- /*#define EDMA3_DEBUG*/
) X D5 N3 B( j& M! ^! R/ S - 4 _3 s4 o- h- n* _# o
- #ifdef EDMA3_DEBUG
- M! G4 y' u4 p" G% Q `1 z& W - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& e8 q) R* x1 U7 f/ P$ k, l
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ l' R" n8 |$ ^$ t$ _) ^
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
4 i3 t/ w3 o9 P1 j G - #else
0 g- e1 ]9 K) V$ z - #define DMA_PRINTK( x... ): R% o: D' ^7 j) k! _/ {7 U @& h+ V
- #define DMA_FN_IN
4 M- K0 G/ c7 t) c* G- m+ S! p - #define DMA_FN_OUT/ d7 f4 i/ S4 S3 ?2 u" {
- #endif
8 X: o! P, u; a/ P) V# V
4 Z: n$ m N; a9 Y4 p4 h% ^; }- #define MAX_DMA_TRANSFER_IN_BYTES (32768)# \( p! Q6 b% a% N2 K( q4 E; G) q) L8 Z
- #define STATIC_SHIFT 35 F9 I% G2 \, O" c- n- O; y
- #define TCINTEN_SHIFT 20- ?% x; H V9 v; S) d/ W
- #define ITCINTEN_SHIFT 21
# |- k2 G! |2 v( h* C - #define TCCHEN_SHIFT 22: X* d9 J* S$ [
- #define ITCCHEN_SHIFT 23
2 C# H5 e' @: Z6 Z
( T7 S/ _/ Y- E$ d; `" R- static volatile int irqraised1 = 0;9 c* o0 c) v* n, u9 m6 L8 Y0 x2 G
- static volatile int irqraised2 = 0;
6 M# ]- y8 b: k) K# N! H3 M ~9 }( ~ - , `) c) Y% n6 P4 I+ k. g5 e
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. G) M% Q# }* {$ H' w+ m
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( a/ H! b, F( e
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, t" T7 M# N2 v - ; q" F, b! U. s; q& K& M
- dma_addr_t dmaphyssrc1 = 0;2 O% W; E8 {' J! Z( D9 ?3 G
- dma_addr_t dmaphyssrc2 = 0;
0 n6 I0 b. M2 ]# q, O- e* l" ? - dma_addr_t dmaphysdest1 = 0;8 Y4 n" F/ _ ]; |5 F$ {5 V
- dma_addr_t dmaphysdest2 = 0;) U( w! z+ V3 ~
- 4 o1 q( S. T" w0 v
- char *dmabufsrc1 = NULL; U6 S" `1 `, U4 s4 M5 }# B. s4 o# N
- char *dmabufsrc2 = NULL;% t9 h" S) Z, S& Y6 ]; e
- char *dmabufdest1 = NULL;- v8 _- V8 s( x }- H( K
- char *dmabufdest2 = NULL;
6 ?" K9 j! ]# M/ W
& [ a1 z. V/ F( P' S- static int acnt = 512;8 x, N% P3 M# C6 h& T3 W7 }6 L1 P
- static int bcnt = 8;4 P* z2 Z# @: z9 ]
- static int ccnt = 8;
* O, _. M# o2 ]7 @2 J0 Y% H
3 i$ X' M7 O( o5 A1 N' {- module_param(acnt, int, S_IRUGO);" T" ^9 S8 a+ ]8 |7 y, d1 p. {, v
- module_param(bcnt, int, S_IRUGO);0 H! p' V- ]! d4 L# }9 N
- module_param(ccnt, int, S_IRUGO);
复制代码 6 h/ k, p9 b$ D& u5 W
& y& @6 a$ y# i5 w
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) L; U1 f9 h- B
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; o, Z% \- G( ~! H% G( J 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& f, k& ]! j" t! ~' N& G2 i
8 T/ R* A3 q( f4 w* P& b, e5 n' I7 g7 c; @. P2 S& g6 Z) ?, G
|
|