|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 h/ l1 q* d+ n/ j0 T3 _- [code]EDMA sample test application4 H7 j2 {0 {) d) l4 G- ?$ E) y
- /*
: }* v4 F; e! r$ L- r - * edma_test.c! _$ Z, |3 O6 r9 y* U% z+ j
- *
& m# l/ [) {. ]5 N' y8 {/ K6 Z - * brief EDMA3 Test Application
, T# J" N* I0 h( _ - *
S0 y$ o$ q; Q: C - * This file contains EDMA3 Test code.; P) i3 J( D: C
- *
; J# ^9 D% `" C5 Z5 w - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
+ v# ~8 r$ r b1 t5 F# o7 l5 | - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- z+ a) M- K: B0 |) Q* P; T: ~) ~
- * TO CHANGE.2 Z2 `' O3 w. @ ?0 F
- *
* H5 b$ m& H# m2 A8 I0 e - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
) C& e, V9 I# v% c: ^ - * u3 G9 Z; {' r7 \
- * This program is free software; you can redistribute it and/or: W( a& y* u- K0 H
- * modify it under the terms of the GNU General Public License as$ n7 x3 T( x* ^+ p
- * published by the Free Software Foundation version 2.& t% h7 j6 s! Z: [, Q7 u* @
- *
2 B9 w/ l! k4 s4 N* o! s9 U - * This program is distributed "as is" WITHOUT ANY WARRANTY of any: J# n( f2 o+ [2 ?
- * kind, whether express or implied; without even the implied warranty5 v2 G9 ~' c8 i
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the. ?! O' }( O6 u4 h0 _
- * GNU General Public License for more details.; D: T. \- ^$ U& R4 W
- */* ~% E* E9 l5 E" u* C y
- 5 w5 R3 Y5 ~ S& E+ t
- #include <linux/module.h>8 i0 E7 T8 a# J' I0 n Z
- #include <linux/init.h>
9 o I: m. k0 E: P0 H - #include <linux/errno.h>% q. A, t* G' G3 ?
- #include <linux/types.h>2 Y5 {- h6 E# v9 h4 u' x$ q0 Y
- #include <linux/interrupt.h>! ?/ T5 X, F0 ] X
- #include <asm/io.h>
0 y% C1 y9 ?4 c/ F0 i) { - #include <linux/moduleparam.h>
- e5 r7 ^5 {2 l - #include <linux/sysctl.h>, M* J' V, ]8 B2 ^$ c1 `
- #include <linux/mm.h>
: z' U [5 N1 N& U6 n/ C; A! C+ q - #include <linux/dma-mapping.h>
, `5 K9 [$ F# H C7 H P
5 F* C/ f& k/ D1 |; H0 ^- #include <mach/memory.h>6 ?) K% c% ^5 l; q5 V# W3 M
- #include <mach/hardware.h>
, Z) }- z, R$ }& O2 L' j - #include <mach/irqs.h>
3 ~! H7 |" F) }& B* M - #include <asm/hardware/edma.h># _, k5 B) a( p" B% W3 ?8 T! J" J: n
- b' z \: |! C; N+ Q# M7 F' T
- #undef EDMA3_DEBUG. b, M7 j" C& }
- /*#define EDMA3_DEBUG*/# F ]( Q8 S9 H" m; ?
- 8 j# V% o8 |; L! i1 Z$ O
- #ifdef EDMA3_DEBUG2 V' ]' c2 x# ?, @; m
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
% V/ i0 F9 q0 W, D2 c - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ F$ A% r2 L$ [! g$ |+ {
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
7 n; o2 _# H, |$ I2 f% F* n - #else. I- C& E1 w- I& q; |+ u8 A% `; |7 i
- #define DMA_PRINTK( x... ), M+ R b( |" u
- #define DMA_FN_IN
o# y. O( K( j8 J& \% b! S - #define DMA_FN_OUT4 `, Q2 c7 Z: [. m& _
- #endif
- _& n. C' A8 r8 z( p3 o - % U. V, i2 B* s9 d, ?1 q
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)4 W2 \" V5 a3 ^
- #define STATIC_SHIFT 31 K* w, `& D# Y% a1 b, T' f
- #define TCINTEN_SHIFT 20
2 W, M O: M; ?8 ^ - #define ITCINTEN_SHIFT 21+ K# u+ K G/ w, B. {" F
- #define TCCHEN_SHIFT 22
$ w' X+ ~4 ]9 ]- ` - #define ITCCHEN_SHIFT 23
* W+ k$ q' o, r" S2 `
; @6 w: s6 u. f" `8 o- static volatile int irqraised1 = 0;
; t7 n7 m* d- O - static volatile int irqraised2 = 0;4 m# I( P' z& K* c x
3 L: [& W( C2 Q: S- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, u. f: V! w- A, M
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 u) J$ `! J% v
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 J: a7 W' @) A# s2 p F4 f: T - , N9 E) |! Y4 R( w% V U2 R. c
- dma_addr_t dmaphyssrc1 = 0;
8 o1 v5 @+ ?# [& q, S5 | w - dma_addr_t dmaphyssrc2 = 0;! F% C& j7 F$ [! x: ^) ~9 ?/ @1 K* D
- dma_addr_t dmaphysdest1 = 0;$ f a/ }2 d/ Q$ L! D
- dma_addr_t dmaphysdest2 = 0;7 a/ L. `& y7 d$ C# X
- 2 t) I2 u7 d% R$ B( Y6 i3 Z
- char *dmabufsrc1 = NULL;" m0 e: l# S. q
- char *dmabufsrc2 = NULL;1 ^7 u. u1 q/ D) U7 f
- char *dmabufdest1 = NULL;$ y& i" k3 y% A' K
- char *dmabufdest2 = NULL;+ U/ h/ o; `, Y- e, P
1 c1 D: y/ b6 s; b- static int acnt = 512;
; G4 }8 ^* y: Q/ D( P [ - static int bcnt = 8;; C. Y- d0 t& S* U* D; d) w! U% o3 c
- static int ccnt = 8;* _* o& l, y" ~# z) e
- 4 W2 j) z) V4 i+ b8 V
- module_param(acnt, int, S_IRUGO);! e# u" Q6 }. U9 M: V% O
- module_param(bcnt, int, S_IRUGO);
7 Y( l: U O/ @9 z1 x9 ` - module_param(ccnt, int, S_IRUGO);
复制代码 3 \- j! v: q! @' a$ \
) }* E& j; a; D- U2 ^5 ~- b2 S/ I 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 [. r7 V& m8 Garm-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 m2 P: a. M% u 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' Y: m+ D8 o6 l3 V: _/ `( e
$ V( n+ c# }, [! b7 q. @) q6 J; C7 W7 q) t! v) d
|
|