|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / F! k- f6 ^/ p7 m. |
- [code]EDMA sample test application
' S7 ^* O, \! D1 r - /*6 ^; `) l L- W7 O
- * edma_test.c$ V6 x1 g! H$ D' @7 x0 e
- *% @' k/ ?* P' ^" ~9 n Q$ m- E; o
- * brief EDMA3 Test Application n! @ a3 F' A) V' I5 B& P# P* h/ D. ^
- *
/ J7 _8 w% [5 O - * This file contains EDMA3 Test code.( ]# C: i% z: j2 @
- *+ V- u: U- J# }' \0 q; u& `
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. N7 K3 Y7 ]: d0 B0 \
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
2 C8 w) C2 O$ @( u0 u$ i - * TO CHANGE.
' ^7 k6 b, v+ z3 K0 [ - *
# K B5 a8 a$ F0 q) |+ @- z% H - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
9 ^1 r: r9 ^# M; H7 s0 ]/ Y; A9 D' g - *& F4 |: c+ \( n" W9 ~* ~( o
- * This program is free software; you can redistribute it and/or
$ l4 b3 w6 S. d$ q - * modify it under the terms of the GNU General Public License as
) _9 b* W, n9 w - * published by the Free Software Foundation version 2.# {/ B$ c; [2 ^, z4 \
- *, o6 [) }: l" Y" j/ F: ?
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 s4 p: E1 x% Y. f
- * kind, whether express or implied; without even the implied warranty6 _. U8 }) x b0 F" a5 v
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the3 w0 O3 Z' c) l6 i+ X Q
- * GNU General Public License for more details.
0 S2 m! ]9 W. {6 I1 M5 x# M - */
7 z1 }. }# V; K2 E7 Q! y' a% v - 4 G# m% V- k n- N
- #include <linux/module.h>* q* B7 ?9 ?4 ~% Y! [
- #include <linux/init.h>* Z) b" s6 e* e# q! K9 `
- #include <linux/errno.h>
6 S- U# c, Q$ K3 D& }; B. b" z - #include <linux/types.h>
: W' b* W( y; ~: D% i4 e! a - #include <linux/interrupt.h>3 Z3 [$ c% A. J7 p
- #include <asm/io.h>
2 R. S! Z2 G8 R$ S# g - #include <linux/moduleparam.h>9 x6 v8 J# r& K! |+ L
- #include <linux/sysctl.h>$ K" t# Z7 U7 Y' _+ h1 q( ^1 {
- #include <linux/mm.h>5 F- J0 Z3 Y9 Q3 \) M# q6 U E
- #include <linux/dma-mapping.h>! T L! i+ O) X% o1 D
* p) c& e! H' U% B% J4 b+ l% ~9 w- #include <mach/memory.h>7 |0 [( T5 d( o. ~2 k
- #include <mach/hardware.h>' W5 [6 J& y5 [0 @
- #include <mach/irqs.h>& g/ [: t8 ?3 C% v6 g# b
- #include <asm/hardware/edma.h>
! j. {1 k; |0 X l
) U8 V+ l: p0 [ `, Z& ]- L- #undef EDMA3_DEBUG5 A* u4 l6 D' W' X0 V" S$ F
- /*#define EDMA3_DEBUG*/
) c* u9 b2 c8 K - 8 n4 W! R" C) z7 ?( }
- #ifdef EDMA3_DEBUG
2 r$ q. W- E R: w - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 n' Z# q* z3 k
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
! L! ]: ?+ V0 B5 K) w. U3 _% J8 V/ Y - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 Y- X5 i2 g3 r! }3 g5 u) e; |+ A4 b2 O
- #else. ]! c- T4 |9 S: \% K8 V# ~. h \. C
- #define DMA_PRINTK( x... )' n# Q% U; m+ f
- #define DMA_FN_IN
% w, A9 A4 p0 e! b" R - #define DMA_FN_OUT9 k9 @. o. w0 q* k' T
- #endif: q* S4 A7 v) t4 ]
4 E0 Q+ ]. I7 W; `6 J- #define MAX_DMA_TRANSFER_IN_BYTES (32768)1 @( s+ z/ ~ W: g- ~
- #define STATIC_SHIFT 3
- Y- N1 s( M& p; W - #define TCINTEN_SHIFT 205 Y" ? E+ Y0 ?- [1 n2 N' |
- #define ITCINTEN_SHIFT 210 l, C4 ]/ x+ j, C; n8 g
- #define TCCHEN_SHIFT 227 j1 e) g0 k* D# _5 b" H" ]8 C: t F
- #define ITCCHEN_SHIFT 23
& N" y2 M; O9 b" J( \/ t' _: N - & f- E1 Y/ j8 @2 ?
- static volatile int irqraised1 = 0;
2 q0 R6 k8 z! N# J) ?% _+ B - static volatile int irqraised2 = 0;- R1 {* C x7 \: A- S- G; \: I
' h! d: M# \$ d. V2 j* {# R4 T/ p- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ C7 q' ~: t( o0 Q8 t
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" q, D- {+ e2 }5 C7 U/ z2 Q, k
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) d9 R3 I# U# s O$ N4 `" y
% Y7 A& V- d6 V; C0 e- dma_addr_t dmaphyssrc1 = 0;
\5 A/ c( J! K/ z1 S' F - dma_addr_t dmaphyssrc2 = 0;
U. g, I+ S! u5 a3 } - dma_addr_t dmaphysdest1 = 0;" ]' D8 ?5 \: j+ |- ^, J, s
- dma_addr_t dmaphysdest2 = 0;
; J: H4 d# } ~9 o( _6 w& F5 W
: s7 W% y* {5 A5 y3 u! [- char *dmabufsrc1 = NULL;; {5 V1 Q; X* Z1 |
- char *dmabufsrc2 = NULL;& _7 x7 {# t$ W# {. J
- char *dmabufdest1 = NULL;0 |1 A% F9 r% o5 W0 E* R- e+ J \
- char *dmabufdest2 = NULL;1 c* M, G1 P' ^; L
. v1 I7 d! A5 `/ I- static int acnt = 512;
; _" W, A: O+ ^# k - static int bcnt = 8;# B& J1 `8 o. x+ n5 c" U
- static int ccnt = 8; j6 t% t# b2 Y; O2 s, j
- 8 L7 _9 j5 `0 i* `5 I
- module_param(acnt, int, S_IRUGO);( _ O. ?2 @$ s# C# l- I
- module_param(bcnt, int, S_IRUGO);
0 I- h! z: v8 n- f( p - module_param(ccnt, int, S_IRUGO);
复制代码
$ ?7 u* d0 n" I6 A
' N* l. U) ~* A0 I. d 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& A5 N2 z3 H1 ~) Uarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
3 V; T& h, r2 M- f 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ t1 ]# _: U# Q. m
- A) J' l2 t$ G4 ?; S# q& \4 x
|
|