|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* `; ] m4 j3 F* I% ~- [code]EDMA sample test application) z. T k* \% \, V
- /*
4 L4 Y1 b& ?; q - * edma_test.c+ n- E1 x. y5 u" O- T8 [. T
- *
8 Y( ?3 ^5 [/ M- Q& X - * brief EDMA3 Test Application1 N s+ R) T6 a$ i8 b
- *
2 k" T# ?: |. [6 F: J, S - * This file contains EDMA3 Test code.
6 O) z& U8 k7 W% k - *
6 m4 i9 S8 ~( v - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
: n3 \. h$ a0 ~ U l% W - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
, S! {: P8 M8 a# ]; [0 H+ s - * TO CHANGE.( E& @" Z9 F; Q2 E# d3 j
- *
6 w1 P6 \( x0 s) \ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 \4 `7 x( X. x% B& P8 |8 F3 T( b
- *" x; H1 U* D; W0 ] |
- * This program is free software; you can redistribute it and/or. w' {* @ G T i3 ~
- * modify it under the terms of the GNU General Public License as/ j( C/ p3 w5 i" q( `1 K
- * published by the Free Software Foundation version 2.
; ]4 R& x$ s+ T9 J$ I+ y% X% @- P - *& H) C' j' [) k8 s- Z
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 l5 n! }8 @$ ~* p
- * kind, whether express or implied; without even the implied warranty
, f* q3 Z5 v. [# H7 O8 ?$ i7 [* d - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the3 l7 R& z# o$ H
- * GNU General Public License for more details.3 k+ p: i$ L1 [2 a
- *// N$ _9 |/ b4 G! Q9 E
+ Z4 i3 ?' r) B& l$ a. m$ Y- #include <linux/module.h>
- {! o' @, J+ z: n1 H& I- |* O - #include <linux/init.h>. q! S. q$ N$ N @1 E
- #include <linux/errno.h>" V$ b# J' z9 [0 Y. x
- #include <linux/types.h>; I( f+ c1 w. U$ w, {2 ~) y6 |- m
- #include <linux/interrupt.h>/ t* n! I( s% R% j
- #include <asm/io.h>- ^; n' P0 |$ v! ]
- #include <linux/moduleparam.h>
& x" h0 P$ [% z& Z% j - #include <linux/sysctl.h>, S. F3 Q9 _" q G ~, c; J
- #include <linux/mm.h>, b9 E' I; Y- h5 N7 a+ k7 O; l
- #include <linux/dma-mapping.h>8 {, O- ]/ o; p/ U+ ^
4 \) _; {1 p! E) D" x1 T6 S- #include <mach/memory.h>
; e0 C( x7 M$ _" d' H/ b/ N$ i, Y - #include <mach/hardware.h>
- S! ?5 n( s# N9 O' s8 y - #include <mach/irqs.h>
' e" A. ^" _) d( N. k: z - #include <asm/hardware/edma.h>
Z9 F$ `0 u, H- w4 Q& k% _ - 9 t* T5 \3 p9 @9 ^1 S+ n
- #undef EDMA3_DEBUG- Q9 S2 Y; R7 E: G
- /*#define EDMA3_DEBUG*/
& E) S. O$ G8 ?, R& j3 G" s s - 0 a# v; g C- T, c3 ]$ i
- #ifdef EDMA3_DEBUG
- n" w1 [' P1 F$ e - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
7 C4 t( h; k+ ?! T: J! h - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& g* a/ @' G9 b: K( i2 j
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
% q+ E7 n+ F% r$ p7 C - #else
# y) w' l/ k1 H - #define DMA_PRINTK( x... )' \; `# R3 F5 `* Q' i" C# [
- #define DMA_FN_IN
, r/ N- U% A6 @4 G( x F! t - #define DMA_FN_OUT
: D0 f: R2 g; v# n6 r - #endif
/ b0 c* ^" R0 z" G& j
" {& [2 H# A! h3 H% ~- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
: t, l0 f' u8 {& E5 M6 m - #define STATIC_SHIFT 3) f1 A# l8 {" S4 J
- #define TCINTEN_SHIFT 20
; h2 e/ g( }0 e - #define ITCINTEN_SHIFT 217 P E: k5 s5 C5 S, A( X
- #define TCCHEN_SHIFT 22
" I- N0 r* S- P" J - #define ITCCHEN_SHIFT 23+ T0 y( T# [( n8 ^8 T" g s
$ B8 d6 [$ D& d0 |& B9 c- static volatile int irqraised1 = 0;" W& u; o" Y& m5 a! K
- static volatile int irqraised2 = 0;
" P5 m/ w$ u( J/ r8 I - % a/ W; D+ Y1 ]
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, @6 \* @9 g B: F' A - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: o' h/ G: l2 h
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ |0 d" ? J- Y2 \+ r6 {: ^# ^3 A
; {$ r/ ]# D8 D* N- ^+ j( E7 F- C- dma_addr_t dmaphyssrc1 = 0;
/ `4 M, D4 B( H/ B* e; u2 J3 k, e3 R - dma_addr_t dmaphyssrc2 = 0;* G) f5 N2 n7 \; Z8 r& W( F9 \
- dma_addr_t dmaphysdest1 = 0;
. y5 z0 | z- ]" w; G; n! H - dma_addr_t dmaphysdest2 = 0; H5 h; M9 b) O
- D8 X: G( N6 d4 K; y- char *dmabufsrc1 = NULL;
7 Z. c0 {. E' ?5 D+ ?* T; o - char *dmabufsrc2 = NULL;
$ _ o7 j o- y' F# h: J4 C5 X - char *dmabufdest1 = NULL;' c! P6 A4 E5 `. x& o" P
- char *dmabufdest2 = NULL;. x3 H3 A- F7 W9 h
. O2 N" K; k% @1 i) u+ L- static int acnt = 512;
+ S) Y9 j, K! v# g7 y9 J - static int bcnt = 8;; } `: G# b5 }$ B
- static int ccnt = 8;
: i0 V* Y& ?) t/ k/ ]6 v - * k& [+ }& c9 `5 L+ _
- module_param(acnt, int, S_IRUGO);1 }% |/ m' Z- h, j& v, V( F
- module_param(bcnt, int, S_IRUGO);6 b2 v, O+ n- Z. L- ]
- module_param(ccnt, int, S_IRUGO);
复制代码
7 P [: e( ^3 U: ]! r! i- j, V* k7 t+ u) E
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' R6 X) r' d! p2 ^! @( M0 z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& D0 ^ H2 k0 Q 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ }) M+ D1 Z; V# e6 X5 d0 |! y
# R' T& I% D, k
) t* p* A( @7 k+ \ |
|