|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / `9 r3 ?; Q! t' S" ?9 |
- [code]EDMA sample test application- h! W: |& Q2 h# G7 p& c( O d
- /*
) L5 l1 ^% ]; z8 {! i9 G( Q, l - * edma_test.c
# p( g( h) Z2 m4 F& m/ R) ~ - *
# f( T1 r" \" ^' e" g - * brief EDMA3 Test Application
! ^0 `6 ?0 }1 o D* O& _6 L - *; |' w5 P7 ^* C; M
- * This file contains EDMA3 Test code.
4 b g0 @1 r3 j# |! w - *
$ M+ y4 y' f! j" `/ M* _) ` - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' b9 }: N) c2 E4 m0 [( f
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 \; P# p1 n/ `3 i, ]% H
- * TO CHANGE.
" \, v% K' D/ J7 ~/ k; D$ i* f( a - *. E7 M* f v- D7 i5 O$ p
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
K) e; D8 t2 e: S# c5 u0 d9 K - *) Z, i) a3 R. _2 h" P3 p
- * This program is free software; you can redistribute it and/or
@2 i; E% f: `+ k! a/ M - * modify it under the terms of the GNU General Public License as
: D' w% S% J! }0 O - * published by the Free Software Foundation version 2.0 O% K9 |( p( m; r) a4 L
- *, t% U% b/ z8 s
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
! y. @/ r! L- N) I* n* o - * kind, whether express or implied; without even the implied warranty g V1 @" d$ N, ~9 i
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7 M- _9 l$ O! l5 Q3 Q! ^5 I) w - * GNU General Public License for more details.
$ C+ X9 z6 F. y- a! s+ W# K - */* Z! w0 G; T6 ~2 p6 l
9 l5 j! i! ]+ j9 |- #include <linux/module.h>
4 W$ R/ N `: }( c - #include <linux/init.h>
/ n1 R& q. Q( E( t5 T) I- b - #include <linux/errno.h>' R9 \5 I! I3 F% Q
- #include <linux/types.h>; a. a' h5 k4 _1 ?4 q) I1 }
- #include <linux/interrupt.h>
g# Z( _+ T- e8 i! w - #include <asm/io.h>
* ~. B u1 Q0 @0 P# H" W - #include <linux/moduleparam.h>4 \9 Y, {+ y/ i- G
- #include <linux/sysctl.h>
4 s+ k/ S9 ?5 T% A8 h - #include <linux/mm.h>
6 L! F! w! \' I - #include <linux/dma-mapping.h>$ i7 b. ~6 g- R$ l
/ x- ^9 h' ^7 S- #include <mach/memory.h>& \( y' m' ^* Q
- #include <mach/hardware.h>
4 }1 ]9 N* V$ [/ V8 p - #include <mach/irqs.h>
3 I! y# c# a; s! |* G - #include <asm/hardware/edma.h>5 B- B3 q; m( J" l0 n5 y8 H# i' l1 Q
" Y) g' O' a% d3 Y! |; y8 m' L6 y4 Z- #undef EDMA3_DEBUG. _, q! X" F! P
- /*#define EDMA3_DEBUG*/$ f5 O/ t3 J" F/ C, e
; P f; w7 J0 X" V' r3 S" c9 R e, ~- #ifdef EDMA3_DEBUG
& s& g% ^' Y) _$ }: x6 m - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- P# S) t. }: F/ c/ _. k
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- k* D1 ~) O: H* v
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
/ b, Y9 ?. z r3 \ - #else
2 y& A# T' i- \& [2 r+ M& V3 y3 M - #define DMA_PRINTK( x... )5 H* Q0 y# c) ~( F3 [) O2 a+ U3 w' D
- #define DMA_FN_IN$ ~: h d& q% G+ H
- #define DMA_FN_OUT
, ~3 M- }7 T; N8 }$ R+ I5 i, e! o" j - #endif- n/ `7 W6 d1 q" [' ^/ g
- & D1 M8 M8 Y0 M$ \+ f' l8 |
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)8 e6 a/ v. c1 M
- #define STATIC_SHIFT 3
{/ v9 L" |0 H4 v$ Z" U - #define TCINTEN_SHIFT 20
6 ?2 d9 D& ]2 W/ t- W0 k - #define ITCINTEN_SHIFT 21
, ~& v0 ?. K3 G8 |, A - #define TCCHEN_SHIFT 22 ^# i0 L+ M! z
- #define ITCCHEN_SHIFT 234 ]) L' R3 S4 Z1 s* b) w6 e
- # h9 n3 L2 a) i$ H% J0 \7 n
- static volatile int irqraised1 = 0;1 {5 V, I3 ]2 J% f7 V1 q
- static volatile int irqraised2 = 0;" H: T- N# H9 h8 k
$ H; A5 s) f) i3 C: R6 Q0 ^2 u$ y- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 ?9 n$ c* r8 E/ k9 Q - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 a% F5 M8 x- ^0 J; K
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: K! L) I; I: [- |2 F
& {6 R7 d: v$ t" ]' n( z% W- dma_addr_t dmaphyssrc1 = 0;6 ?' o/ y' D& V
- dma_addr_t dmaphyssrc2 = 0;
3 }4 q8 v7 W) s5 h& m$ A - dma_addr_t dmaphysdest1 = 0;
6 O% Z; c9 [5 I# }; |6 \2 y1 y. J0 n - dma_addr_t dmaphysdest2 = 0;
% C8 M! i( j8 j* K4 Q - # I; R! n& n: W5 S. M$ P' O
- char *dmabufsrc1 = NULL;
6 r0 [+ U# p: S# @2 ~" j& z s, \% L - char *dmabufsrc2 = NULL;
, U6 L! J* Q4 z" _ - char *dmabufdest1 = NULL;& m$ I/ i' i5 k
- char *dmabufdest2 = NULL;. k5 i" a) Y2 k; |1 Q" f/ U
- 9 D- w2 ?4 ?: @
- static int acnt = 512;
B: x' B! f: o+ g) a - static int bcnt = 8;# P" Q6 U; L+ N* P
- static int ccnt = 8;5 D6 {2 N6 a) Z$ o* X& t W) B
- " S% M) |: j' G0 i6 b. U
- module_param(acnt, int, S_IRUGO);2 [# z% v+ N8 _8 G4 A: b
- module_param(bcnt, int, S_IRUGO);4 H6 b. G x; r q, Y9 X: `
- module_param(ccnt, int, S_IRUGO);
复制代码
( T8 Q1 `8 W1 u+ G" d* ]$ @% r4 Z0 y+ e* d+ F$ L7 S5 j& M- Z
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: `- N% b% {3 g. i1 j+ s: 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% \2 f6 e+ G- ]) C) C# g* f1 `3 F 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 O; c4 }' e4 @& o* | j
- N& Z6 _" n2 [4 s5 M9 a$ U5 c
9 L3 {8 d. D# h |
|