|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 Z. l& g: f. \& d
- [code]EDMA sample test application% U( W8 X7 r8 W) L: K
- /*! U5 O1 f e& j3 l" ?9 t
- * edma_test.c
) a5 S; y0 L( t - *
' O3 k6 ~1 Z$ _ - * brief EDMA3 Test Application) I7 }* R+ M/ k; v1 h# R# E
- *% s& ~; P) D+ l6 F, _2 z- ~
- * This file contains EDMA3 Test code.
) x' y* y- p) k1 N- A8 m8 u - *$ S, O) d4 n$ N3 p% f% K
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
, a) O5 G) e2 X4 l. u% |* O - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
+ }, J+ c5 V. I! ^5 W - * TO CHANGE.: _% d+ ~/ f+ Y5 s; B/ O4 y# I
- *: D& b* H2 b# a5 B
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( d/ N. w. |3 `3 ~
- *0 a8 G) @' l6 k. A
- * This program is free software; you can redistribute it and/or3 M/ c9 F! u C4 V
- * modify it under the terms of the GNU General Public License as+ @6 E F3 M) o+ f" ^: k
- * published by the Free Software Foundation version 2.
) \2 L- d+ k" L, j0 Q! d - *
8 U4 y' b+ Z& z1 s3 B - * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 ?2 V5 h0 z! p. P
- * kind, whether express or implied; without even the implied warranty
+ v9 m/ E7 {& y$ u7 l+ ] - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7 y! _# H$ T' R8 C' t - * GNU General Public License for more details.
& j, `* \: q8 I& ?: ^! q7 G C- Y - */
( N3 m/ P- x7 Z+ E
# @: }: u+ R8 E. F- #include <linux/module.h>5 Z D- o, |, r/ B& ^8 f
- #include <linux/init.h>- @' k4 q# w5 o+ ~" c! h8 I* m1 L T
- #include <linux/errno.h>
3 F7 p& ^6 l C - #include <linux/types.h>
- w. N( `7 t, Q1 M8 ?; Q% z& S - #include <linux/interrupt.h>+ ]7 u9 Z! E4 s5 G
- #include <asm/io.h> o+ I: r' w8 n8 r
- #include <linux/moduleparam.h>: \, v- A8 m% D5 T7 q" X/ k
- #include <linux/sysctl.h>
7 |* m( s5 `1 _' |& q- w - #include <linux/mm.h>
6 ~8 @5 o7 `; i - #include <linux/dma-mapping.h>, b, o+ H m8 }1 _/ \- b
% C; \; L9 P+ v- #include <mach/memory.h>6 w8 P0 u/ A/ ~8 b/ e
- #include <mach/hardware.h>
- V9 O T. {3 |3 q - #include <mach/irqs.h>
9 Z& {8 v+ J+ v+ R8 o! d - #include <asm/hardware/edma.h> x' e* ?8 n/ g3 u
' ]9 F& J/ ^5 O+ Y- #undef EDMA3_DEBUG/ Q1 J0 F, a) m' V
- /*#define EDMA3_DEBUG*/: p' T6 B' e* Y3 p' e5 F; w/ U
- ; f! K9 I+ r* l& O: H
- #ifdef EDMA3_DEBUG
4 y A+ I" g g2 F) ^0 K - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# S& U( B, | L. }
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__) W( i. l; X$ Y3 R' \
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
( t$ T8 x$ Z! h# |# M2 W - #else
1 m/ S0 B v8 p' L - #define DMA_PRINTK( x... )
! x: }$ D& }& D# O" m6 U! w - #define DMA_FN_IN* H7 U6 n0 H% @+ h9 ?
- #define DMA_FN_OUT7 k; Z9 h4 j f S/ _3 | i
- #endif
" I: d6 }% c: `8 E! C9 D7 k
( _; \9 _7 W5 C! `# ~2 `7 w- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
3 g, k7 i H: _7 N6 u - #define STATIC_SHIFT 3
5 _ r' t9 i& r1 u5 K - #define TCINTEN_SHIFT 204 {& u% x. d" l$ Y, `
- #define ITCINTEN_SHIFT 21. x/ S) p2 l; y
- #define TCCHEN_SHIFT 22
2 U9 U# E6 z( L! N# [3 B - #define ITCCHEN_SHIFT 23$ w9 R4 O; Y) U* c. h+ B6 H' E
. q* V6 Z/ n0 b/ z: l- static volatile int irqraised1 = 0;8 M; b1 X' v3 c" ^$ l( S+ b
- static volatile int irqraised2 = 0;; h! T, h) o7 O
- 5 L' ~6 P$ ?* \* v4 n8 j
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 Z t1 [2 |# x) m3 T
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 D n* T% j/ Q& I. p! j! q
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! ]# j1 D* Z- ~# ?) B; C+ ?
; w+ U+ N5 \: |( T- v- dma_addr_t dmaphyssrc1 = 0;8 O: M I8 z7 b- a8 z# B( o. {
- dma_addr_t dmaphyssrc2 = 0;/ _3 `9 C1 D; S. q( c1 G) Q4 q
- dma_addr_t dmaphysdest1 = 0; W6 t1 I) j( p ~4 m* c. F* u
- dma_addr_t dmaphysdest2 = 0;
" w( S8 H8 q4 B8 Q/ G5 @
, _0 x6 R# ], v Q# e+ F- char *dmabufsrc1 = NULL;( P; O& G5 K) r% g; `0 t: P W) k
- char *dmabufsrc2 = NULL;
" z* N: o, H8 J/ }5 N4 t8 b" v - char *dmabufdest1 = NULL;2 d& l$ s0 L7 `- \1 z
- char *dmabufdest2 = NULL;1 C" ^$ f0 D* I4 l# `7 l2 K
- & F. r* m7 C+ m$ v) n( P8 k2 h
- static int acnt = 512;! |3 J5 o* D* y5 F: z
- static int bcnt = 8;' d. [# I/ H* T$ P
- static int ccnt = 8;
) B0 @+ G+ Y. g. A! H+ \ - 8 d9 w1 j3 a7 I- T5 c1 `
- module_param(acnt, int, S_IRUGO);/ m g( L2 q! q# c/ {
- module_param(bcnt, int, S_IRUGO);
( o' B# ^, B& ?& W k - module_param(ccnt, int, S_IRUGO);
复制代码
) k8 ]* F0 W0 e+ g# |+ ?0 t! x) ~- J; Q8 u' k: R
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! g' g* a; L( s. a3 g- E5 sarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 U4 w, @, V. m* g
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' V/ ^, H( l6 y0 \5 j: W/ {: |6 R
2 t, O1 U. ~5 ~7 i+ X! ^
. E* `$ j0 q' Z b! S6 ]2 c; ? |
|