|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , X @$ H% G2 O" H- {4 C6 P
- [code]EDMA sample test application
1 O9 ~, a$ D. V - /*2 o) }$ ?$ Z" R' O% H3 d& H( M
- * edma_test.c7 `7 F' l: o, u& a; m7 g+ W
- *
+ e* U4 j+ k9 f" i7 f! y3 n/ D - * brief EDMA3 Test Application
' a* }8 T5 O3 C. i7 { - *9 ^' G% S, Q2 L( r! [( e- S* I p
- * This file contains EDMA3 Test code.
# V x! k0 h+ a4 B$ z, U! T& @ - *
4 \5 f/ c) L# ?) d# A- ^7 P - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( c4 }! X9 h3 j* R9 O9 b
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 @* ]9 {" b& {" w: Z: F# v; l
- * TO CHANGE.
5 v/ c( w( Y# l# L. x1 j - ** u @# e( v% s7 B" d9 a# E( P
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
" c' N) U- G8 X( ^/ ] - *$ l0 J% _; e9 o
- * This program is free software; you can redistribute it and/or
( ^* w3 E: h7 S+ H8 k5 H# p$ _* x - * modify it under the terms of the GNU General Public License as
1 ^# s: J( D# C - * published by the Free Software Foundation version 2.
2 b; D& |0 T3 A$ B2 y* ]' v - *( g3 y$ K1 P( a% d
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ V7 [# w: j" y6 t8 s. Q; C
- * kind, whether express or implied; without even the implied warranty0 `2 X+ [7 q& \+ V* q
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the, F+ }- {8 O, X: U0 v8 q5 a
- * GNU General Public License for more details.
$ m4 G- T4 P1 [ - */
7 a2 @/ Z! L( O, f
3 N) a1 J5 _; E/ b! @/ W% P3 s8 |- #include <linux/module.h>2 c- {% X2 g1 R1 L' I' v4 E* M
- #include <linux/init.h>4 M+ X" E& B, D2 D
- #include <linux/errno.h>
8 b! `+ |: S2 o) @2 t - #include <linux/types.h>- x7 |; d) H: f) O9 k1 q
- #include <linux/interrupt.h>
; r' ~8 T, @" j& A - #include <asm/io.h>
3 Z$ r' q( q2 v$ F& E* _' S; H! U* |; W - #include <linux/moduleparam.h>, i3 z1 k1 l7 T, I& m
- #include <linux/sysctl.h>0 ~) J: @) p* o8 H: V
- #include <linux/mm.h>
. ]- g |) O% g3 j: V - #include <linux/dma-mapping.h>
9 E0 x& J2 j2 c B" q5 n - 6 v" `, s! z4 q" P; M6 o6 }
- #include <mach/memory.h>
+ _: A! @* R7 ]' P - #include <mach/hardware.h>' x3 t! f5 ~* t! _, g7 b
- #include <mach/irqs.h>
0 x# u* r) f5 r( V5 ? - #include <asm/hardware/edma.h>" @* @; L' E( j# d$ K2 G
7 P5 I! D/ i7 R- #undef EDMA3_DEBUG- s3 M) f L+ [; Z
- /*#define EDMA3_DEBUG*/* T. z* a/ S# ^8 {5 T" H! E5 B
! j9 B& s9 c7 a3 r! n$ }- s6 p! m# s- #ifdef EDMA3_DEBUG
! j* u, M0 @/ K - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
$ j! Q9 F, z0 m; v - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
@" _* B7 h# p/ @' A - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 V7 y, J j& |4 j4 c$ v3 d3 M
- #else
7 T2 x) t3 \; k" _0 n5 r' S - #define DMA_PRINTK( x... )
' h1 ^" t, \- _; n- m - #define DMA_FN_IN- x" ]2 z% c2 \$ z- a$ ]/ n) \1 J
- #define DMA_FN_OUT7 K8 y4 A) L& {( z6 n! [/ r" ]
- #endif
. r1 Q. V* n# q; K, m, K4 l/ E$ S
' @( D) B' X$ J0 G+ A- #define MAX_DMA_TRANSFER_IN_BYTES (32768)* P, @# P7 P0 t
- #define STATIC_SHIFT 3+ g8 V. _# O" k, L
- #define TCINTEN_SHIFT 20
- r% d0 B1 F7 o4 \1 }8 U5 b0 G - #define ITCINTEN_SHIFT 21
; R* x; ^& G2 S( q7 u& |8 w0 X - #define TCCHEN_SHIFT 22( M1 ~. R8 \+ y% Q1 \9 v3 C0 I; f6 g
- #define ITCCHEN_SHIFT 230 y$ K T8 I* @ u) g
- # Z8 a0 D. b$ W2 f
- static volatile int irqraised1 = 0;2 M% X9 D; n9 O" I
- static volatile int irqraised2 = 0;4 H9 U( G3 R4 Q; y; F8 ~2 S4 @
2 @9 Z& i" s( A! [* L& ~- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 J* Q. r h |6 d1 t - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( V5 C! G7 `& ~( {# e - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- b P0 Q& v- o, q6 b% H
( ?6 a8 B2 k& J2 y. R- dma_addr_t dmaphyssrc1 = 0;6 O2 k, ~+ O4 z$ {, X; f# e
- dma_addr_t dmaphyssrc2 = 0;
5 R0 P/ x; T' C' {. M" h1 f - dma_addr_t dmaphysdest1 = 0;
+ h5 K; }5 o) K8 | - dma_addr_t dmaphysdest2 = 0;$ b5 D: @( y& U3 w* e# H2 m
- - t, g1 H6 l; k
- char *dmabufsrc1 = NULL;- f4 ]$ O0 f$ P) |0 }; T1 u9 Z9 B. n
- char *dmabufsrc2 = NULL;
6 N. A1 u, r; N% v# x - char *dmabufdest1 = NULL;" B/ {3 L5 W' z4 V
- char *dmabufdest2 = NULL;
* q% x5 k( c+ K1 S
8 a! w$ V0 w7 C; [* [! [% h- static int acnt = 512;
& K& ?. g, `; | - static int bcnt = 8;
3 D( |0 T; C' O; n& C1 Z' X - static int ccnt = 8;
& _2 T7 ^7 s& \) a% j, a
2 F, s! A6 e- d4 ^0 Z- m' u0 Y- module_param(acnt, int, S_IRUGO);' t( ^' v, M' c$ v9 ~* ?
- module_param(bcnt, int, S_IRUGO);# f+ ~& r9 Y% r4 v5 L1 S
- module_param(ccnt, int, S_IRUGO);
复制代码
# E W# ?1 O9 E! {. D* R; g, `. e6 {
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) Q2 g2 p5 w0 R1 Harm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, h8 |, J( R. x3 ~- u( `- B 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( h& O3 X' Z0 T( ?0 T+ v' c4 r! u4 ]$ ?4 F8 p! h" \, y0 i
q' x* Z: q5 k: o( M
|
|