|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # t1 V2 X5 g9 v) t/ O) Y G' i. o
- [code]EDMA sample test application% t w4 P# `1 }/ {
- /*
# d" f: N ~; T; U) L N! d( L) | - * edma_test.c
$ n5 q1 t1 h. `5 m: K$ v - *% t c2 y, v/ \# o3 C
- * brief EDMA3 Test Application9 t9 X* d) u- F
- *
: a/ Z" S' X1 |3 f6 H; z - * This file contains EDMA3 Test code.4 `5 Z a; M7 J b1 j2 ^: D4 f: ?
- *0 ?+ x( J( W( Y1 M/ Y) k
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- S3 @( P6 Y/ a5 W
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
& p4 w- m' C6 C# r) ?3 { - * TO CHANGE.
" m6 O b4 }/ ^8 w' h1 j+ w - *
- v1 s' |, x: I0 x! N - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
8 f$ w; _+ ^0 T1 ?2 s& L0 C - *5 H q8 k* c3 A/ [
- * This program is free software; you can redistribute it and/or5 d. l" b9 o: ]' t
- * modify it under the terms of the GNU General Public License as
9 a# h6 J- h. k! M0 A - * published by the Free Software Foundation version 2.
4 P8 _, D( ~2 |$ o$ Z - *
9 [2 e, k& R; K/ J8 P( S ~$ @1 L - * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 K4 I6 b! w" v8 l+ ^- ^8 i) K5 y
- * kind, whether express or implied; without even the implied warranty
8 {; y$ B7 {2 g! f7 P - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
' b; I4 }7 H0 S: [ - * GNU General Public License for more details.' V, [$ j* u7 ^& G* }
- */
) @. v6 E; j% I8 z$ t - 2 [' v0 l' [! n. {' [8 B2 C
- #include <linux/module.h>
7 \6 h0 A0 k! c `7 G& [ - #include <linux/init.h>
1 w! u% i5 a/ i2 O; @ - #include <linux/errno.h>
+ i) w# K, c# b2 {7 Z w - #include <linux/types.h>
4 x! _& C, ^! t: [" G3 V' E - #include <linux/interrupt.h>
4 ^7 g' F/ {6 ]) O9 l' S* \ - #include <asm/io.h>. u8 h1 X0 \0 P( S9 b t
- #include <linux/moduleparam.h>3 Q3 v. J2 L; ]+ U' i) B4 c
- #include <linux/sysctl.h>
G) k4 N8 b, j" G9 i6 i, u - #include <linux/mm.h>+ F1 s+ C( d% I3 K
- #include <linux/dma-mapping.h> G3 o" T2 W1 J1 m% v l0 M) u
- O4 k& W3 W+ Q5 `! j! @
- #include <mach/memory.h>
$ q% l' l) t4 f# |+ z7 X/ O - #include <mach/hardware.h>$ p3 S" _- i+ Z2 F# [. X5 j
- #include <mach/irqs.h>0 x3 ^$ `( I0 \6 b4 m9 n
- #include <asm/hardware/edma.h>* d6 c# `% g+ ^; t. f: S: ?
- ! S4 i6 F7 \/ X% d
- #undef EDMA3_DEBUG
* I9 r& t+ o4 I' X6 G - /*#define EDMA3_DEBUG*/
! P# x5 c" W! s! p3 E! U8 ~+ U. [# }# q - ; H! s& u" E5 Z4 A7 E
- #ifdef EDMA3_DEBUG
* ^0 m6 E3 r+ w$ _ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); L$ p5 F" _% _9 h8 m- B: o
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# m3 |) I; c( f( S- q6 e
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ J/ M0 V0 p2 X$ G0 R; W
- #else
/ j0 k- e$ I/ {6 E7 o# c1 ]* C& } - #define DMA_PRINTK( x... )) c2 ?4 F G& q. \' N
- #define DMA_FN_IN
! |1 O f2 K! F3 S - #define DMA_FN_OUT
$ [- s; C3 w2 B: ~9 _! d0 I" S - #endif
: |+ w+ W3 g8 Q0 o9 s) |
' H H3 S' v, _8 W- #define MAX_DMA_TRANSFER_IN_BYTES (32768), ?0 h* G M; L7 p) n* c/ D8 @, g2 d$ Q0 f
- #define STATIC_SHIFT 39 ], `, I: r6 u
- #define TCINTEN_SHIFT 203 I- |4 l. l* U- n
- #define ITCINTEN_SHIFT 214 f$ t9 M& f! c0 [3 [; S2 n
- #define TCCHEN_SHIFT 220 t' @) J; J% x& g5 ~' c
- #define ITCCHEN_SHIFT 23! N0 T( L/ m4 X7 S4 G0 R
- 4 h1 I, ^3 O4 G4 B+ P) t
- static volatile int irqraised1 = 0;
: s, T* Z1 V+ k' O+ i7 l - static volatile int irqraised2 = 0;6 p- p( P) T3 X9 {, g E: H
- 4 L! R6 Q- c* p
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& J; H4 G3 M2 D; K6 ]0 \
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 t, f, m2 U. z0 u6 l! m+ J5 x! r. |
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. p$ {3 h) _7 x
- 0 B( v/ E7 t6 [$ k: x/ Q
- dma_addr_t dmaphyssrc1 = 0;
* X* Z% t8 W1 O3 d - dma_addr_t dmaphyssrc2 = 0;
( k J9 A7 F! L0 d+ w - dma_addr_t dmaphysdest1 = 0;
( C' ]9 K( u! u - dma_addr_t dmaphysdest2 = 0;" U6 N- n# \; V+ G& y' [; |
: J: o5 x) v W, X% n* Q- char *dmabufsrc1 = NULL;
" f; _+ N, b* J, X' I+ B/ l - char *dmabufsrc2 = NULL;1 ?! j: Y$ u* Y F% ^0 e
- char *dmabufdest1 = NULL;
3 k6 M& u- V# C/ e0 ?9 ~ - char *dmabufdest2 = NULL;
, u& ?! k5 j3 M0 H/ i3 _% Z
. c" m7 V g+ q' c- static int acnt = 512;/ n) T7 h* I7 m1 J# |) f+ Q5 {- s
- static int bcnt = 8;% z6 A8 r1 g- K6 R. U
- static int ccnt = 8;
) G, W% W5 U" v5 l - " m Q4 t/ Q; w/ r* q1 A
- module_param(acnt, int, S_IRUGO);
! I5 N& X) @6 | - module_param(bcnt, int, S_IRUGO);
; `2 ^0 b- q u/ `4 h. {2 e3 M - module_param(ccnt, int, S_IRUGO);
复制代码
# @; U, R8 {* [# B- U- {# u+ W* B! A8 v9 }5 R8 ?$ [1 D' j. g
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ [( k1 M1 u5 t1 oarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& C2 P& z% s, {3 |3 _
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ [; X" y# y% U3 I5 }6 `
6 _/ O1 d c4 [9 |8 G! Z( M0 }( } o# D, B& ]* }0 x8 [; G
|
|