|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 Z3 P V! p: q; K; t. t% O- [code]EDMA sample test application; z5 z$ i. V3 q+ g
- /*' i: H) l7 g3 @, r+ F6 y
- * edma_test.c6 M' c7 C! q) _! l6 {; ^& V9 M
- *
% I, \" S }+ P& w7 i/ `2 W7 g - * brief EDMA3 Test Application) S* m c2 Z* F1 a* @
- *# q: O" A( R1 @
- * This file contains EDMA3 Test code.5 g! p' H7 X: ^* ?8 V
- *3 M# d; g, J/ k4 K+ [( d
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
8 H+ F/ r: a+ X4 y - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
# @: ]2 n$ k" w) w - * TO CHANGE.
# n+ ^& ]& f( {# D/ d" x7 N - * h! g9 S0 `2 h. V3 E
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) J, d5 ]$ K8 i
- *
( Q6 G G/ B! ` - * This program is free software; you can redistribute it and/or" t9 T( p( O* d) K. @0 l" ?
- * modify it under the terms of the GNU General Public License as
( q. r9 `2 T3 C2 Q/ x2 R) @ - * published by the Free Software Foundation version 2., V( X6 g+ g; e
- *, U9 s5 w$ h4 \, w
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
- \& J3 m, Q5 q+ w, z: F8 a - * kind, whether express or implied; without even the implied warranty C1 F6 f1 c) W+ V2 L- g# A Z
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the7 \3 Y C4 p. T
- * GNU General Public License for more details.7 I/ I! i" W' K+ J5 `; {# s
- */# `: O* E4 Q! J
- K+ M" ?; z" t8 i
- #include <linux/module.h>& Q9 D! v2 t, _( O& P* d
- #include <linux/init.h>
1 `. m0 K# }9 q - #include <linux/errno.h>
1 F7 |) \! f( y, A1 Y - #include <linux/types.h>4 {4 F" Y9 v) [
- #include <linux/interrupt.h>
0 t9 A e+ A5 \# f - #include <asm/io.h>
7 u& L6 X) `) L; D! H - #include <linux/moduleparam.h>/ }5 ^* `6 Z9 L- ^6 L+ z* A
- #include <linux/sysctl.h>
) l" F' S. ^5 k1 A' j* \ - #include <linux/mm.h>
: A+ ^2 r) F' @! {4 I. b8 P - #include <linux/dma-mapping.h>7 N9 r L2 |( \
- 0 a# X1 I, S0 z/ f" C) u
- #include <mach/memory.h>$ ?8 d) l+ _( T
- #include <mach/hardware.h>
) L4 F- P! a4 @( ]7 Q# d - #include <mach/irqs.h>
5 c0 E: C5 X. ? ^6 d. h: G - #include <asm/hardware/edma.h>
. ?+ s& s( @) |) D l
8 O, i! C& [ h% U4 {% C* p( G- #undef EDMA3_DEBUG q' i$ Z, E9 J/ a( D) h
- /*#define EDMA3_DEBUG*/
3 p. e* S9 ^ ?& m# x - 6 [/ C6 {9 F, N* Y5 _
- #ifdef EDMA3_DEBUG4 I' J0 \! _% H: P, n2 E! q
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). K: h: h' k# U
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
. V; ?' Q+ d: D6 H - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
4 Q7 ?( b# m# e8 H. o0 U - #else
+ ?7 P b( d, U0 _0 s7 B/ m - #define DMA_PRINTK( x... )+ p8 j9 M* E7 W1 d' _. D
- #define DMA_FN_IN
/ Z$ `0 I& T4 Y4 h0 L% d9 [, p) I - #define DMA_FN_OUT% n5 J0 J+ l% o* a9 d/ _
- #endif
/ b' B9 y) B4 y, F, N$ Q - 4 ]5 Q+ `/ q6 r, v% f2 z
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
! M- T9 _6 @4 v$ d) C - #define STATIC_SHIFT 3$ K! p! [ m' W7 X, v
- #define TCINTEN_SHIFT 20
8 j& Z4 Q1 U; i8 ]1 D2 F - #define ITCINTEN_SHIFT 21
/ ?7 p* _ C8 e$ i' D% S' l+ y' Q - #define TCCHEN_SHIFT 22. ]+ F! P& ?5 b6 e( r6 y3 z0 f
- #define ITCCHEN_SHIFT 23
; E7 J g- a! \8 Z7 l! o2 W
& m& C( _7 I4 @* z" R% c# w; c- static volatile int irqraised1 = 0;( k+ R& |( D6 m
- static volatile int irqraised2 = 0;
! U$ F! B( a1 L3 t' }$ t
$ z" j- W" N( B/ P- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 i' \, H8 {+ f3 @: |7 I
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ o# [# W9 u% U" ]" u - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. V# ?, U/ r5 w5 N
8 u. S9 H* f7 n8 f) o- dma_addr_t dmaphyssrc1 = 0;
8 F( I A! j7 t+ i# L G - dma_addr_t dmaphyssrc2 = 0;
& l1 k# a* T0 D/ Q - dma_addr_t dmaphysdest1 = 0;+ I# t. m/ |5 {
- dma_addr_t dmaphysdest2 = 0;! k; ? l& ]- |/ c
- $ o% ~6 L9 h3 o" G. ~+ ?$ u
- char *dmabufsrc1 = NULL;* {5 _3 E5 J% o4 {* i6 s3 U2 B
- char *dmabufsrc2 = NULL;
2 R" {) ]) K/ i% V4 a' F& V J - char *dmabufdest1 = NULL;
3 I/ t) r% a" g& M- X& t - char *dmabufdest2 = NULL;
" M8 h/ d) {% g - * e7 [) ~4 Q' ?# P- O) z
- static int acnt = 512;
: ~0 j$ Q: k6 W! a - static int bcnt = 8;
0 f, A. B4 @, R x- N4 l - static int ccnt = 8;
% O9 \5 ~. g% Y+ U. V8 @" O' P - & G2 S4 x/ T9 W' o) N/ s) L0 b% p
- module_param(acnt, int, S_IRUGO);; o1 _, a* Z5 Z/ b6 G
- module_param(bcnt, int, S_IRUGO);
3 [% x0 _4 N1 R: Q - module_param(ccnt, int, S_IRUGO);
复制代码 5 a* J7 S( z% N& ?7 \: M7 f$ f9 T
* t' Q' A# o- D8 h; T8 ~0 \ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: p' V& u% @# b3 X- W+ |9 ?, Y
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- D4 B' s) K* R0 o( ] 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. @) B. O( M6 N
x0 Q# G7 }* N o& j3 d
4 N, Y/ W0 H, O: q% b+ n0 g. {* x2 L |
|