|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 P ~ `4 f, H1 }
- [code]EDMA sample test application
; \0 b0 j6 u! z - /*$ ^& |* I0 u* C0 S" B
- * edma_test.c& q. x. [" |) o+ |% o
- *% _2 {8 K+ Y" L" x. V& j5 V8 B% Q3 M
- * brief EDMA3 Test Application
5 V: j$ |: R) P7 F' Q l - *
% D4 r7 X7 n- W2 ~ - * This file contains EDMA3 Test code.
; f; j O8 w \$ E1 \) p, G4 L% @ d - *
4 p, c: d+ I x% z6 d9 u - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
4 T' V3 B I$ L: [4 D3 C& B - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
- t/ V0 Q& r6 M$ p- h @/ z - * TO CHANGE.8 O* W5 M! \0 i' t7 V$ P/ X6 @: F
- *
: x! j# L$ o. V - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
$ T0 L' a2 f8 Y0 F2 N7 R - *2 j8 S* Y, G0 W# K. o: I3 I% I
- * This program is free software; you can redistribute it and/or/ g$ v; i* L: X0 z. j
- * modify it under the terms of the GNU General Public License as
% C' C$ `1 [* H1 M- t: I - * published by the Free Software Foundation version 2.
) [2 j, G( u5 s - *
0 n7 G9 i3 a" O- l - * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 I8 X5 M6 w$ x1 h& r% u2 W5 E
- * kind, whether express or implied; without even the implied warranty( H' A# ^, l' r2 W
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
. w, d8 c! @6 \; [% V; S8 l: r - * GNU General Public License for more details.3 [9 ^0 D7 K8 Q5 m0 w
- */
) u! {% {5 [! G; I9 @- L" T
7 u/ _$ Q( Q3 f8 w% P7 {- #include <linux/module.h>8 g$ V& w! e1 j& X6 e$ i
- #include <linux/init.h>
3 Y! e$ z/ V, F+ w1 o - #include <linux/errno.h>, H. K) o+ W4 G" {+ ~
- #include <linux/types.h>
" X+ j: U! B' w# x# _: \! \ - #include <linux/interrupt.h>
$ N& O% {/ H* d. K' Y+ K/ b3 a - #include <asm/io.h># S+ O+ V. ^6 O+ U% Q; g5 U3 v
- #include <linux/moduleparam.h>: ]' u: s7 G' F5 ~) W
- #include <linux/sysctl.h>- L, R( C# r2 T6 Y6 h
- #include <linux/mm.h>
c9 q8 w; c. T T - #include <linux/dma-mapping.h>8 ~2 b# L; @& p* P! D) H# t0 i
; a! f0 N7 F! D- #include <mach/memory.h>4 g# b1 v4 k* w$ B
- #include <mach/hardware.h>
/ t/ {' f8 z% Y/ Q - #include <mach/irqs.h>4 E, K1 t5 s. {8 J, }
- #include <asm/hardware/edma.h>
0 M- B6 t3 p5 q n# g. m4 g
" G) q# E) n0 x! w- #undef EDMA3_DEBUG* }3 G% b& W2 E0 h' q& U& ]
- /*#define EDMA3_DEBUG*/
& N8 {8 X& l; ^# b/ `! ~' H/ x7 | - : ]/ L5 P8 _- ~' ]! _* \/ [3 b
- #ifdef EDMA3_DEBUG
; @1 A8 b3 T: l) a3 Z$ {& o3 N - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* k% |+ i3 g1 w7 J( s3 k
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). B+ a6 Z! p9 g* U5 k: f
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! N1 Z# o# B: b$ s9 A
- #else0 C. k5 D8 Z- {. p6 Y1 B
- #define DMA_PRINTK( x... )
! W- [8 W) y- y# Z& \7 |2 X - #define DMA_FN_IN1 p6 s/ I. `# N. h
- #define DMA_FN_OUT
7 o% {. d5 I E - #endif
6 S" S' G+ D* _6 j - ! j" R" z0 M* t9 @
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)& E4 w; O0 S1 G
- #define STATIC_SHIFT 3) M6 A: F K: f+ Q
- #define TCINTEN_SHIFT 20
" F& ]: p! V; T# ] - #define ITCINTEN_SHIFT 211 u8 i) O* M5 q+ M4 H1 {( e) F
- #define TCCHEN_SHIFT 22
: s. t+ |% o- K" E0 s2 W0 e - #define ITCCHEN_SHIFT 23
* {' a; Q! d" }0 ~/ I1 W. Y1 Y# n
+ i5 }& F2 _8 ~0 z- static volatile int irqraised1 = 0;
( c, W6 j, A, ?/ r3 X& b% [1 } - static volatile int irqraised2 = 0;; d( M, }8 ?. f9 r
- 2 |4 ^# N1 ?, f# M. W
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 K' t" c6 n" v$ t3 e( a( M - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: H4 w; B, f0 D B
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 _- p: J9 I: E" a - , ~/ k7 s! p- Y; f5 q
- dma_addr_t dmaphyssrc1 = 0;. Z4 N6 R/ I$ g& Z
- dma_addr_t dmaphyssrc2 = 0;3 o7 V0 C5 T: W
- dma_addr_t dmaphysdest1 = 0;
: n7 j* [. `& O8 B J- ?# r1 Z/ X - dma_addr_t dmaphysdest2 = 0;8 Y" Z( H* i# Y: k
- 5 }- g0 ~. z+ [# J9 Q" r" b' L. @
- char *dmabufsrc1 = NULL;
" o& O1 D' E3 P3 s6 G - char *dmabufsrc2 = NULL;. w4 h$ R1 V3 i* [5 T
- char *dmabufdest1 = NULL;
& {- ?) y1 d! ~3 A8 y2 L" U - char *dmabufdest2 = NULL;9 _: q! w8 a t. `- a( n& a" S
5 u4 b$ o B K1 E8 [" ~- static int acnt = 512;
6 c* U6 G- Z4 b8 x0 W* U: ` N - static int bcnt = 8;9 m& k5 P, u- i& |% M
- static int ccnt = 8;
! c! \9 b+ ?! t7 @# m: X
3 U l5 R* S& u- module_param(acnt, int, S_IRUGO);
8 X/ ^- |- ^- i - module_param(bcnt, int, S_IRUGO);5 O4 O3 X% j" i
- module_param(ccnt, int, S_IRUGO);
复制代码
) n9 c+ J1 N7 J
% U# U9 j: Z# n2 w% c6 V$ \ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 k1 B7 L/ p1 q b5 Xarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! N7 p9 k" S! c. R) K$ e" }3 L
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 `4 Q7 }% v5 n" H$ a
9 D# p$ l6 b1 j
i& C0 x% `% l1 z$ t5 | |
|