|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 b/ W' D# K9 |5 Z2 i
- [code]EDMA sample test application
8 u( P+ T1 U) G0 \ - /*7 p/ W6 h Z# t' C% ]* q% U+ n
- * edma_test.c( i/ {2 \5 m$ L
- *4 m2 n1 r4 C; _$ M
- * brief EDMA3 Test Application' i; c& v) b0 B6 I0 \# @* B
- *
: r" Q, m# y `1 X R - * This file contains EDMA3 Test code.
/ b2 h- q- s0 V3 n: F - *! W F: P9 C5 R+ H
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* ~$ G+ Y. U: e$ z1 B1 [
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
/ P1 v. x; f7 ^( O - * TO CHANGE.4 `9 ^3 ]' J& V1 b
- *$ |3 n9 H% @9 a9 Y+ W; c E
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 A+ s, M, X& p u3 d
- *! H. T' c7 ^+ G; U2 a+ d
- * This program is free software; you can redistribute it and/or! V1 c2 i4 m; Q
- * modify it under the terms of the GNU General Public License as7 N7 h- f, E( N$ z0 r) I
- * published by the Free Software Foundation version 2.# e+ K7 a1 _. H: t; a8 ]/ @6 F
- *: K' h4 c' J1 t; I& O, Y- n
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
2 F3 j A. z" q4 T+ n4 S- ~6 e - * kind, whether express or implied; without even the implied warranty
3 \8 T- K _8 c- g7 K( G - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1 {1 o. ^ F# `* {, m; x8 }
- * GNU General Public License for more details.# [) ]5 J- s5 G1 b
- */
6 E* a5 K- \7 S. R7 c% g - 6 S# |' X1 Y. i d ]' O' H
- #include <linux/module.h> m( e# I, S( Y k
- #include <linux/init.h>+ Z, l |* E, n5 c* @: f7 H: s
- #include <linux/errno.h>
: ^$ A+ P2 g. ~1 y; S" N - #include <linux/types.h>+ C3 P3 ]) d; R4 l
- #include <linux/interrupt.h>
* `& ?" V" V$ X4 @% O7 J - #include <asm/io.h> O) x9 A* h& ^' ~
- #include <linux/moduleparam.h>
# q( u6 |9 t; V: ^& | - #include <linux/sysctl.h>% ?. s { E! Y' y- h# N( g, B
- #include <linux/mm.h>
1 Q# {: {6 X) D& M5 R3 U - #include <linux/dma-mapping.h>
! }! s7 n! ]* L
8 E' U5 w, f# V+ `' e- #include <mach/memory.h>* A5 ^! H1 z7 f+ t
- #include <mach/hardware.h>
4 }! }0 B, p" r" w9 C - #include <mach/irqs.h>' F& O9 g5 @4 [0 @
- #include <asm/hardware/edma.h>( C/ s Z+ r+ a/ {# Y
- % d" M& }8 k$ ~0 t* R/ i3 P
- #undef EDMA3_DEBUG
9 z# n, S' G* f8 a- p" G+ M' w - /*#define EDMA3_DEBUG*/' T9 v M( k7 p+ \8 P
- `5 D/ c# ?3 F0 O; @# w- #ifdef EDMA3_DEBUG
+ ]1 P0 z) ^$ K( o: _0 R; J9 N+ Y& E - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
7 h- A1 ^. ~( s- ~* K6 X - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
- V: x* u, ~/ L4 W; @' X - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) G$ n' f" b" x e" b) ^
- #else* i% A5 D1 s* T1 u4 o
- #define DMA_PRINTK( x... ); _% B$ O8 h! |
- #define DMA_FN_IN
5 r0 G, v( `% w) o/ u4 |% [6 o, T - #define DMA_FN_OUT
4 U* n6 S) f6 i1 U K9 L8 q - #endif- N) G9 H; @7 \7 ~$ V1 u
* t1 J4 k" i% K( R% M+ R% I6 j+ D* \$ u, O- #define MAX_DMA_TRANSFER_IN_BYTES (32768): G' p& }$ N! d- l# R% y
- #define STATIC_SHIFT 38 O! @+ F* H! R$ E _) G
- #define TCINTEN_SHIFT 20: _* k/ E# P; [2 w
- #define ITCINTEN_SHIFT 21( U: \3 h; T0 s
- #define TCCHEN_SHIFT 225 i" q: a" T. s; w' J+ c; u
- #define ITCCHEN_SHIFT 23* l. a4 p) C& s$ T
- 6 D9 X3 N) b- o% y+ }; i
- static volatile int irqraised1 = 0;9 K2 L5 `7 \4 B$ T) e
- static volatile int irqraised2 = 0;6 o1 b" |5 s! q0 \5 a! d) _. b
- y% V. ^, |; F5 ?! ~- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: v5 U7 j9 t. y
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ R f* K7 X8 i1 E6 E% Z- G; B
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); E6 W+ }8 k7 U) K
- 8 E* N# p$ \. [) z3 M: E# R8 K3 [
- dma_addr_t dmaphyssrc1 = 0;8 M1 F9 z) k- p/ H' h l
- dma_addr_t dmaphyssrc2 = 0;
8 E) b% g# ]4 V" v! N - dma_addr_t dmaphysdest1 = 0;
1 g% A0 ^' q% a2 n6 l, r) U( G( q; i7 z: A - dma_addr_t dmaphysdest2 = 0;8 N) {6 T) K+ q2 B% ]# ~$ i/ r
* s% h% |- T8 c, K- char *dmabufsrc1 = NULL;- m; Y1 q4 ]& l) M) t
- char *dmabufsrc2 = NULL;/ y$ V" d8 Q4 Y) X9 D! I! ~
- char *dmabufdest1 = NULL;8 b5 Y$ F: N/ n6 E
- char *dmabufdest2 = NULL;
4 I. |+ W( U; `. k! i$ I6 ^. E - 6 o! P# p/ Q; [ k2 R
- static int acnt = 512;
9 A! Q0 A3 _, b" i - static int bcnt = 8;
" b& v. e1 T# | R: h* X o: T: X3 o - static int ccnt = 8;
2 T- i7 {1 J3 ^* f4 i# n" E5 {
, n! X. n: |+ p' ?! h- H- module_param(acnt, int, S_IRUGO);) c E+ F) F7 F5 e: T
- module_param(bcnt, int, S_IRUGO);: [! y1 W, n& A- S
- module_param(ccnt, int, S_IRUGO);
复制代码 " H( [; V! j' w% `
5 ]) p+ E# D% V
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! b( j h! \" F( f1 p; ?9 H2 \$ ~7 W
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
: c" o' a' f/ T& }: Y0 p 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: M9 ^" e5 Z+ N! t Q/ y* V- E! v1 H) m- ?) m2 ]4 k4 N s' p
8 Y. M1 A7 Y6 ]/ i! H' V) ]' a |
|