|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
`, e9 w# `. D+ O2 X3 r# j3 U- [code]EDMA sample test application ]/ d! M \1 C3 F' I/ k6 m
- /*
9 p) j! w- N9 X+ c$ G - * edma_test.c" E( d; W9 v/ d( w
- *8 J5 L. J5 n# y- T1 a
- * brief EDMA3 Test Application, R6 ?" Z8 u+ I& @
- *
) N! h; J& X; z" | `! s - * This file contains EDMA3 Test code.
& e# {9 ] {5 M+ y% P, y( Y- X - *4 m7 S+ s* i0 q; o
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE Q! _. j! e3 R1 M5 m5 s
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
: P; B: p( s+ f3 F. m7 X# y* k - * TO CHANGE.
7 F! ~% [+ y: p2 z" k4 ?7 j/ n: h - ** n4 n" m. j* q9 x( X5 n
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 d4 V l& A$ m
- *! T; f* c% {" m$ ^0 E
- * This program is free software; you can redistribute it and/or" R; i2 e& r- q
- * modify it under the terms of the GNU General Public License as) R3 m$ B+ q, S- K) v
- * published by the Free Software Foundation version 2.# n$ e8 [ v: f: J
- *- _/ P# ^1 r: k5 Y: b! W5 u
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 I. z6 i! V L1 |/ o- M9 g
- * kind, whether express or implied; without even the implied warranty
$ h9 S- I% w- Z* |6 |: [, |0 Z$ @ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% a, ~& f' ~8 D7 Z" E+ s - * GNU General Public License for more details.' a2 @$ O' ^' @( m }
- */
" A3 o: N- s+ ?0 B3 @, O
; {2 k6 E' R* [; c2 E- #include <linux/module.h>4 d( S# u0 T( R" H, S0 q: ^; y
- #include <linux/init.h>
' i5 l7 K% b& F' e - #include <linux/errno.h>
* A9 W: o! ^* y4 \1 F8 c# U - #include <linux/types.h>! R- y7 Z) b1 {( y- h
- #include <linux/interrupt.h>$ v( i& v& J# F, L: ^
- #include <asm/io.h>
- ?3 J% v! r* H9 r - #include <linux/moduleparam.h>
5 E S4 V- Q3 H - #include <linux/sysctl.h>0 B- J" F8 N6 c8 y
- #include <linux/mm.h>% L9 d+ o0 \; o8 Q2 u8 @# d0 R
- #include <linux/dma-mapping.h>4 K$ A. u1 h4 f: e
0 q8 D0 P" b7 O* A3 }; l5 W m- #include <mach/memory.h>/ L6 U# |8 ~! t# `
- #include <mach/hardware.h>
) I1 F( e! [, C4 j3 _ - #include <mach/irqs.h>: N1 l2 \2 v+ Z( q; U
- #include <asm/hardware/edma.h>
- W+ L% c1 Z: R7 @. P% X% I7 `/ K
7 ^6 g, _' Y3 @2 {- I- #undef EDMA3_DEBUG
+ O5 i* Q8 t# r5 G" Q- v - /*#define EDMA3_DEBUG*/
M7 P( Q" A0 f2 V - 6 {2 Z( Y B" G4 q+ W4 F/ b
- #ifdef EDMA3_DEBUG
# @, }) a+ L2 z$ w( W0 f: q9 S - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
7 ~" X1 F, n' T4 \( e4 `: } - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
6 g0 m( c: c5 ?$ {7 ?- s - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 {. p$ k/ m _' Q3 U
- #else
8 h! W* p) g+ I* U$ c - #define DMA_PRINTK( x... )5 z& i7 @( j7 |. @, ?- E
- #define DMA_FN_IN
, N- C- |- A& s5 t, F# d9 j - #define DMA_FN_OUT
- v2 `0 H# `- z% `( } L% r - #endif# _: K8 l! t3 F4 Q M" t! \
8 x; c. b! ~0 i3 n- V) E- G- #define MAX_DMA_TRANSFER_IN_BYTES (32768)- q* _7 G# B, A5 c( v2 }4 l2 X6 n
- #define STATIC_SHIFT 3
1 C0 @$ T# W* b& R5 R+ H4 x# x - #define TCINTEN_SHIFT 20
' U; w/ w" V- S% ]& O) d4 F) a - #define ITCINTEN_SHIFT 21( W0 o* j% w( u) m9 j+ }0 i& R
- #define TCCHEN_SHIFT 22
- V+ ?# M i) ~3 H1 |: t* t) O - #define ITCCHEN_SHIFT 23
2 r+ v/ D4 e9 n2 U" y. V- |+ y
( V$ E& X! |6 B6 G2 J- static volatile int irqraised1 = 0;
R6 ^" Q l" O0 F - static volatile int irqraised2 = 0;" z+ e8 }1 {: a$ h
- * R+ K! h, Z, A1 f- _) u3 c: E
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% t5 S6 l' L/ r& o' O - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 `6 m* V7 H% V3 E
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: q! G$ z! _/ e; c7 F - $ P9 b$ t. O: r: h7 F
- dma_addr_t dmaphyssrc1 = 0;0 a) g3 }/ ?" W8 g8 K* Y
- dma_addr_t dmaphyssrc2 = 0;
* K6 t. {/ V+ c - dma_addr_t dmaphysdest1 = 0;
. y' W/ [- w3 q - dma_addr_t dmaphysdest2 = 0;
! @2 w. F2 b) n5 {1 b2 F - : I$ A* `) K% Y: b% y
- char *dmabufsrc1 = NULL;
3 y! x% h9 L' Q" L - char *dmabufsrc2 = NULL;, `& t1 R" U P8 x0 L
- char *dmabufdest1 = NULL;' h& `7 ]9 m5 O; @3 U
- char *dmabufdest2 = NULL;4 W3 o* C# T& {
- " T @. f+ K, G O
- static int acnt = 512;
, n! E: b8 f* _& V2 a - static int bcnt = 8;
5 Z3 G8 b5 P d/ C: @. h - static int ccnt = 8;
+ W1 T1 r, [ a* g- m/ k
, U1 ]* e" g% ]/ ]- module_param(acnt, int, S_IRUGO); y1 P D5 [/ s) z0 T
- module_param(bcnt, int, S_IRUGO);
' n! J/ ]. o7 q, _' ?+ V - module_param(ccnt, int, S_IRUGO);
复制代码
! v; D# j4 E! l) ]( `( U5 Z9 y/ N1 t% r4 m. m3 X Z
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" o: z3 k- r+ I" c. ?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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 G( F/ g! P% Q! ^7 `0 M
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 k0 G! s1 c3 D9 K2 K* M! c! m, J
. q2 Z: _; w; V# F# m% n
: r' p/ o! v, j+ Y |
|