|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 U! J) [. D/ P. d1 f
- [code]EDMA sample test application- p! b5 I0 x; q4 p, {0 R' X
- /*& y G0 O' q. Y8 f# R; G% J% g
- * edma_test.c5 r- \1 n& O* I
- *
, V- }) n! O. q$ E - * brief EDMA3 Test Application
1 x- Y4 I; q6 \4 Z" E - */ B3 l' b$ Y" [7 L9 N' {, @
- * This file contains EDMA3 Test code.
, i. T: d4 o7 l3 W* k - *
( P) P+ J0 S6 D# `( [( M, S6 O - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" _/ `) U+ D8 s l# |
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
) ]1 g0 t/ L) y, }6 g& e - * TO CHANGE.$ b9 `* ~6 ]3 L; I8 ^( ]
- * j: h/ t7 v4 a7 t; b. M
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
6 A& E4 A# p' c' i4 k - *
" I, p- u3 A. h1 A o" T - * This program is free software; you can redistribute it and/or
6 t, t) ]0 \0 W2 ~ - * modify it under the terms of the GNU General Public License as! f& O/ ~$ I- x/ h
- * published by the Free Software Foundation version 2./ v0 a; r K+ K. s
- *% C a$ U, x9 e1 V
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 n+ q6 Q' x% K
- * kind, whether express or implied; without even the implied warranty0 n0 D: B. J# W/ Q ^" {4 Z1 y, u9 m$ H
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- }* J& Y3 v/ C; a2 Q9 c4 z) E" Z
- * GNU General Public License for more details.2 U) ^/ R9 P# v4 O5 h: J/ x6 @
- */! X9 e- m! w2 e2 R* P- T
- 1 x" x6 C8 F- H) N. K( e* @$ b: l
- #include <linux/module.h>
: W U4 @- N; I3 \8 A2 |! k - #include <linux/init.h>" _; n/ {) H2 g
- #include <linux/errno.h>$ Y. j* p3 `) c- p& D n
- #include <linux/types.h>
; w6 t+ _1 c5 U3 ~% L- g* g/ Q2 k - #include <linux/interrupt.h>
; B8 X1 \+ Z @# W: ? - #include <asm/io.h>
8 i5 [/ q1 n- d: w, Z, S - #include <linux/moduleparam.h>
: d4 c/ ^# b; j r4 ?) `9 B, x' w - #include <linux/sysctl.h>
% n+ b; C6 b/ F, X - #include <linux/mm.h>! j' c1 s( w; k8 Q
- #include <linux/dma-mapping.h>
) S3 C5 n0 d5 ^6 s
" G% O1 S" S/ E5 N/ c3 ]6 t6 l- #include <mach/memory.h>7 O+ h7 G1 s( z: A% P
- #include <mach/hardware.h>7 v8 Z4 S( h I
- #include <mach/irqs.h>7 N7 B, A# \: T; W1 v6 ?# v
- #include <asm/hardware/edma.h>( x: Q0 b$ L/ C, j% c, h' @
9 z! L0 Y! O# T& _- #undef EDMA3_DEBUG
, ~# g/ Z) d' E1 y - /*#define EDMA3_DEBUG*/
" S- l; y( J5 U% t
) y; o6 ~$ B$ @% o2 X- #ifdef EDMA3_DEBUG7 k2 _2 k$ g* ?1 `/ `; K: N# z5 E0 Z. }
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
9 M5 t: [+ S+ U" H - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 ], k. x2 c$ O' F) @- N
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 _4 I! x: D) f' R- p- B! u
- #else- W7 a5 B/ a$ \0 @
- #define DMA_PRINTK( x... )* @, ]; F5 U4 O# O3 b
- #define DMA_FN_IN7 a% ^& x/ [1 X. U
- #define DMA_FN_OUT
* `: L8 d! J& J# l7 H- t9 a - #endif, h! T; H( P, w6 }
% R# k& [# m8 {+ ~; R# F8 @- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
6 P" h* A% e, N - #define STATIC_SHIFT 3
; Y! Q# P1 n+ P$ b) C2 G( i - #define TCINTEN_SHIFT 203 _9 y" r- q8 {# t. t
- #define ITCINTEN_SHIFT 21( `+ f8 Y1 f4 V+ H5 W K3 ^" M; d
- #define TCCHEN_SHIFT 22+ `4 c% h+ E: y# b& v% z
- #define ITCCHEN_SHIFT 23
0 L" X; p- z+ g) k& u2 N5 w {+ g9 d
+ L- ?0 T7 @' f u% U2 U- static volatile int irqraised1 = 0;
' ~! p+ h; \- A# B1 @/ A7 ~1 T. z - static volatile int irqraised2 = 0;
) ]" `. k" S4 p E) i3 @
+ ^9 k5 ~1 }4 S# V! x* P+ @" r- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) b5 D! S/ Z, \! D0 J
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- x; v* Q$ [, \5 ? - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 e# U* d& H) E4 R$ P - . j1 u* Q) f. H' X' `7 O4 i2 G
- dma_addr_t dmaphyssrc1 = 0;6 _' r q& p ]% d7 G9 C1 w
- dma_addr_t dmaphyssrc2 = 0;8 y2 @$ U5 B4 m6 F3 P
- dma_addr_t dmaphysdest1 = 0;% X8 @1 K; _ z& a ?
- dma_addr_t dmaphysdest2 = 0;
) S4 J3 g3 Z0 W# j2 }6 E - G6 J% _( J$ y# h; [7 ~ T
- char *dmabufsrc1 = NULL;% \# y8 y0 u w T+ q5 w
- char *dmabufsrc2 = NULL;) X" j" j$ ?. {4 j
- char *dmabufdest1 = NULL;
, M8 s! q: x9 D' L - char *dmabufdest2 = NULL;
+ J" w' Z/ J# k6 k. P" v0 P
W% f: }0 ^$ s& f3 l- static int acnt = 512;
& r7 I8 Y, I2 ]" h' k' ^ - static int bcnt = 8;
3 W4 k: v( ]- e9 ~" w: p - static int ccnt = 8;2 ~. d6 ]4 x9 H; g; @9 X7 J* ~1 l# l( A
- & ^& K& V) y& E
- module_param(acnt, int, S_IRUGO);0 R$ O" x) U J+ F0 u
- module_param(bcnt, int, S_IRUGO);
0 V% X7 v; N& E. K. @6 U- J - module_param(ccnt, int, S_IRUGO);
复制代码 0 v b' F- @. ?% s/ N
k1 Y" L; t; K+ C. |+ b* ~
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 c+ M! K- j c: k
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; y" i& D0 v- B: M; v9 R5 j
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 n/ D) l# @! p& E- Z2 P+ L! k3 D- U( e- a3 b5 `
" `4 B* k7 ^0 P v2 }$ D- z) m
|
|