|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 e' L/ }4 m# v. m6 [+ k: ]. G- [code]EDMA sample test application" f( J4 z; }$ t
- /*
) G/ F2 P! ~4 Q: H - * edma_test.c9 Z8 y8 F6 _1 i; `: C
- *
! s! e3 e7 B: E+ S+ K6 i - * brief EDMA3 Test Application
/ Y' K( d# I' q - *
) k3 S# D( ~( R1 U; J - * This file contains EDMA3 Test code.* ?$ s* e! G$ V
- *
) ]! i, R N; B4 N7 X% B - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
$ {$ ]8 s# `! g: q; I9 l - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' M/ J3 q: N& B# N3 Q
- * TO CHANGE.
" w* }% V( O3 T- |% r7 h - *; l/ f3 s. d0 N9 K' D( X
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
6 |- Y/ ?4 S: ^: K2 Q. n$ F x0 k - *7 x; v% u6 n( O6 R* y
- * This program is free software; you can redistribute it and/or5 [0 Y! u* ]: R& c, t
- * modify it under the terms of the GNU General Public License as" G9 [% o1 o( ]! q- i7 ~# j+ g
- * published by the Free Software Foundation version 2.; ]' R _2 @% i, c1 Z7 _
- *
- D" T% q' F3 {7 v6 k - * This program is distributed "as is" WITHOUT ANY WARRANTY of any, ?9 N) M* s) ^
- * kind, whether express or implied; without even the implied warranty
$ u. M y# i/ G( ? - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the C( \5 ]/ G; [4 x& n9 a
- * GNU General Public License for more details.5 D& V: s$ L% c# b; g& S0 e
- */$ \9 t/ n, e4 x/ I
- : s9 @/ G( w9 V) D5 c" A. Y- B
- #include <linux/module.h>7 P6 t7 G' s; O
- #include <linux/init.h>$ p) X+ B. V$ W+ E
- #include <linux/errno.h>1 d: J. X8 j4 {
- #include <linux/types.h>
! ^2 ]# b; `, R& \ - #include <linux/interrupt.h>) y( z; O- O c$ }, I
- #include <asm/io.h>
+ X+ p: S/ {5 Z- ?3 Q - #include <linux/moduleparam.h>
o# A0 o3 T# U' R; U; h. y0 R- s& ] - #include <linux/sysctl.h>
$ R; b; e" |) y h - #include <linux/mm.h>1 z2 v# m9 @1 ~5 @' v7 {
- #include <linux/dma-mapping.h>% `8 O* C( P9 M5 ~5 D+ ~
2 ? v5 {* R+ E0 o* T$ l1 e! V; m5 l- #include <mach/memory.h>2 c. v( x2 j1 r# n
- #include <mach/hardware.h>
$ n4 P$ g. m0 N9 J4 | - #include <mach/irqs.h>
7 e6 z' t% X3 _; u3 }* \ s" \0 P, J - #include <asm/hardware/edma.h>! o, p2 T* f& ?0 [, q
- 3 Z7 `' n/ Q! G) q$ A J
- #undef EDMA3_DEBUG
! c/ L( S+ e; I* P - /*#define EDMA3_DEBUG*/. `, \' g9 }4 B9 Z
- ' U, V5 U( \9 _4 L" A
- #ifdef EDMA3_DEBUG5 C( S0 n: R) h4 T% Q. U
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
/ x2 k& y8 W+ y - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 E. s/ X" o: g8 H, Q
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
- l4 |+ d+ |8 U$ @ - #else
5 | S$ H2 A" M1 M: J# U8 {, l - #define DMA_PRINTK( x... ), o* D. s6 m# O
- #define DMA_FN_IN
7 e! u- k1 ]/ j, F2 l- K - #define DMA_FN_OUT4 }& W# e+ J5 E. |" F8 h+ D/ G! t1 n
- #endif
3 ^4 J/ j, g/ n5 j v- x: A - 1 I3 n8 a; t2 _8 S# }/ H+ g
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)/ H) f4 t' h. u8 e* c4 o
- #define STATIC_SHIFT 3
) v* v3 M+ U) ]# q, N - #define TCINTEN_SHIFT 20. k0 w' k7 |6 u! \" T$ k! M; ~
- #define ITCINTEN_SHIFT 21* A' p. T: q' {4 p; Q7 u2 V" y
- #define TCCHEN_SHIFT 22' e# c$ m2 N- t. |
- #define ITCCHEN_SHIFT 23
d2 S: P" K( n8 z0 S
- d7 g9 \1 Z+ I- static volatile int irqraised1 = 0;
4 s. M& L" r% v% t+ m- h0 X, z, Q5 x - static volatile int irqraised2 = 0;
# E6 q$ q; U7 t3 L2 }
* v. i6 k- ?* v! h: F- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" _8 z9 Q3 ~0 k) N( ~& S/ H, a/ X" u
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
j `- B+ _" ^3 \# W - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: s5 V% `2 R! k
9 W. d: B: x7 c4 b4 o% q- dma_addr_t dmaphyssrc1 = 0;$ w! g: I) Y3 S! Q; I. L) Q& y
- dma_addr_t dmaphyssrc2 = 0;
+ }6 u: P5 q4 w3 p' _" F - dma_addr_t dmaphysdest1 = 0;
) {: l$ n# e; ? - dma_addr_t dmaphysdest2 = 0;
5 \5 C& g0 V/ ^3 z: O$ A0 O' ?+ H
j. a# j. _: ^4 y. `- char *dmabufsrc1 = NULL;. ]5 |& N% F0 _
- char *dmabufsrc2 = NULL;
0 o; W- E5 N* I0 ^0 b - char *dmabufdest1 = NULL;/ A* h: a- }1 N2 b/ ~; D0 \0 n
- char *dmabufdest2 = NULL;! H- }. E% c8 R" U! f
A0 a' V* ?: d% t& b1 |8 |4 E- static int acnt = 512;) C& e4 y2 h7 |4 L: X8 H K9 j
- static int bcnt = 8;
7 ]$ c' p0 B- ^/ U7 M% i - static int ccnt = 8;
6 G% S+ ~' X0 U6 _$ M/ ~% Y) a - 9 t4 v8 H8 U" {# w' g
- module_param(acnt, int, S_IRUGO);
) i: F0 C+ o7 T4 s! q% B! o. ? - module_param(bcnt, int, S_IRUGO);
% s/ t" H. H# |+ O4 @, `3 X0 N5 j - module_param(ccnt, int, S_IRUGO);
复制代码 2 U& v# E5 P+ C* f
4 o5 q6 M" b1 l4 e6 Q. M 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 b" y2 l; c2 \0 H9 u3 A) f
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 g3 v: h* @8 p$ c( T" \ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 E' n1 q$ P- M( {. p4 D! q" u( O
$ q# C! R* [) S9 F
: ?* V. C, q& ]- }
|
|