|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ G- z# L/ \0 I. a! u- [code]EDMA sample test application
4 v% w* g$ ?% `! C - /*$ G2 g) y: N3 i2 U& E) g J' Z
- * edma_test.c- m9 u7 e, o( G5 q& a L$ S# k
- *; k6 a& ~6 o% [- C4 Y1 a+ o+ w# L
- * brief EDMA3 Test Application
2 l( B4 y D1 |9 w - *2 { S( n3 _# M4 X* M
- * This file contains EDMA3 Test code.
5 `/ Z1 k: n% J" l - */ H/ i! b6 V" R+ U) l0 U* Z& D
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
4 g, Q* ~, e! T8 [9 K3 X; K/ Z& I) { - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
9 k" e# G! Q% f* a6 R5 p - * TO CHANGE.
) P$ o* c2 g2 N# f* @ - *1 I2 J5 ]# l7 w8 w" \0 {
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
# x2 I$ {5 u: t) q - *
0 s; s v. O5 t0 s, X/ K- M - * This program is free software; you can redistribute it and/or+ o- o# T7 p9 o% ?" b* u6 {
- * modify it under the terms of the GNU General Public License as
( y9 i* f& G1 F5 [) L8 m$ n7 y+ l - * published by the Free Software Foundation version 2.
: \. c% d4 ?% B9 U, i2 q- S1 }# X - *9 f1 _0 g3 _! z9 N) F
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 b% [# X' }- x( a0 w+ a! b0 e
- * kind, whether express or implied; without even the implied warranty4 ?: J9 v" n, n$ h
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the4 r" h D, x" W7 J( H M7 `3 z: E3 U
- * GNU General Public License for more details. e( _4 }1 d; W9 ~
- */
0 t. H8 l; K5 d! Z, o9 F6 s
: K2 ]' R' k7 q. r+ _- #include <linux/module.h>
J( x, O' M8 ~" F3 s( a# P; k - #include <linux/init.h>! D9 T2 P; J# q' G p! \/ x
- #include <linux/errno.h>6 l$ t% n/ `, `! E) n
- #include <linux/types.h>- u4 Q9 d7 G+ b5 k
- #include <linux/interrupt.h>9 ]$ p2 C/ M/ O) G% j4 u. \ c
- #include <asm/io.h>1 ]3 T6 x& J; U' @6 D( H% \
- #include <linux/moduleparam.h>
7 ] G' c/ w% |7 K - #include <linux/sysctl.h> O9 F2 m! Y5 Z/ D2 K( U3 h5 I
- #include <linux/mm.h>
, F7 u0 Z) ~. k! k# X2 U. h7 R - #include <linux/dma-mapping.h>
' a j7 k) |$ F# L
+ M$ I2 [0 x0 n7 Z- #include <mach/memory.h>
1 s$ U9 ~/ ~ _( K9 d& C5 @" F - #include <mach/hardware.h>. y+ s; h J+ | K5 {
- #include <mach/irqs.h>) Q$ [+ {- {' I+ D( r5 [
- #include <asm/hardware/edma.h>
! l; F9 @1 E2 k5 s |
, ?$ @+ Z3 N" l- N1 i( `- N e+ F; ?- #undef EDMA3_DEBUG7 M# l5 D6 Y: X( |! p9 i9 t5 D
- /*#define EDMA3_DEBUG*/
S. H# C6 o6 l! i/ P1 Y
, R; M, g/ c$ E& \) }- #ifdef EDMA3_DEBUG* v) }$ m' E6 I2 ]0 p/ F: F- p
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" G$ L0 c& e, |- u
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
- R4 v9 {: z p/ i; v - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
. E1 Z3 v6 k- ` - #else: Z- j9 J x9 \% Z
- #define DMA_PRINTK( x... )) U* k- F; P& f5 v0 z7 ^4 G R( v
- #define DMA_FN_IN
; d; c/ Y- u; G$ }' u' S- Y( p - #define DMA_FN_OUT- r/ O+ g( Q& u0 q
- #endif
& M( q7 V" w; E5 q: U0 r - 2 A8 N3 b) S i' j9 d4 }+ V
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
) h3 p: L, n% `; K+ g - #define STATIC_SHIFT 3
$ J; F* u3 l, {6 u - #define TCINTEN_SHIFT 20' ~! y6 |$ I' h/ |
- #define ITCINTEN_SHIFT 21! u( I) N" b, @+ J6 Y# G
- #define TCCHEN_SHIFT 22
* F$ g" O4 n. t$ N- N* h. C - #define ITCCHEN_SHIFT 23
5 B4 g$ R5 N3 A - , E( i" |$ p: @
- static volatile int irqraised1 = 0;
]5 a2 x8 _' ]) n# ]7 u - static volatile int irqraised2 = 0;
: ~9 A" @, V5 \3 i, x1 T! B. O
6 \2 N6 `. o7 [- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, ^4 j u8 {; ], s1 m
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! O1 p) }+ n# x3 U3 `3 Y5 |2 w
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% h0 ^4 ~) V6 n4 e; O$ G
9 J/ ]) Q6 v: I! [* Q+ C- dma_addr_t dmaphyssrc1 = 0;+ g% t, O0 |* U: s! r [* h$ i
- dma_addr_t dmaphyssrc2 = 0;3 w$ ]; g# r2 G R$ z
- dma_addr_t dmaphysdest1 = 0;5 _- m; Z1 G. F) @ ^6 a) P& M% G
- dma_addr_t dmaphysdest2 = 0;3 z9 P" F' A$ M9 s
) Q1 W( l" @" U. U- char *dmabufsrc1 = NULL;7 t/ `% K" R- p( } Q4 A
- char *dmabufsrc2 = NULL;
$ k7 M) y! r4 U/ n7 c% v1 r - char *dmabufdest1 = NULL;
! ~) n9 [1 V. s) m( q - char *dmabufdest2 = NULL;
! n) |- J* Q" _0 y% P, n
7 }3 k2 Z% g% ? v5 J) m- static int acnt = 512;$ ^( V# S) Q# P% J
- static int bcnt = 8;
. i/ g, L: w2 n* t$ z( V - static int ccnt = 8;2 a) s: T( h; }4 M& s
- 7 H- k6 ^$ X1 j6 u0 v
- module_param(acnt, int, S_IRUGO);
0 }: p, m4 H8 g( ~ - module_param(bcnt, int, S_IRUGO);
2 U# }6 ]4 j# }4 v- S - module_param(ccnt, int, S_IRUGO);
复制代码
6 j( L+ A" s1 v0 j
3 |* |6 n* T2 V. ?) M* r$ r2 a# g 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 y: J: \" h; D2 I! q
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; ]4 j& Q5 I+ a9 R 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 @; ^" v- E# l5 [
" N( m5 y0 ?$ v( \ m
) O, \! d. i& [& Y) e: j |
|