|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 O/ b B& T7 w$ Z4 c- [code]EDMA sample test application
& ~8 f5 v9 M6 M: P& J$ i - /*
! n' ?' c* F m/ c - * edma_test.c
) e$ P& i8 r& |/ u, W7 ]8 g - *. w6 o4 `( A. Z/ ]$ h
- * brief EDMA3 Test Application, ?, Z8 ~: D1 @
- *( X7 \# L, |! Q
- * This file contains EDMA3 Test code.
& `" n' u7 E% H: j7 M( u6 o - *
* k; ]/ i; C! t' D* s% ~% V - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ x$ A3 a+ `+ `& G
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
3 M9 a. A3 }3 [1 m - * TO CHANGE. r$ j# Z- n$ ^
- *3 g' h. u6 {* e
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ O$ p7 l. [7 n% y. Q& a: X2 ?
- *
- o: q3 L3 Z# z% Z- k - * This program is free software; you can redistribute it and/or8 ^2 W# x/ S; I! u6 b
- * modify it under the terms of the GNU General Public License as
. a. f7 q$ t7 o2 R - * published by the Free Software Foundation version 2.1 h# v! a) P. u0 ?$ N
- *
1 L0 V3 r( n0 C! [) \4 s - * This program is distributed "as is" WITHOUT ANY WARRANTY of any! y' |4 X, T2 X' M, q# \
- * kind, whether express or implied; without even the implied warranty
. |- s, N1 A. W9 s. U# U8 m2 I - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# S1 _- [: |- F& p - * GNU General Public License for more details.
) [5 z i; b0 d - */
$ M3 L6 s; C* t" C
9 u: D0 O, L$ Z, c- #include <linux/module.h>
) J. s9 e6 V; Y( X, b - #include <linux/init.h>1 ^% A" |5 c8 o4 y$ G
- #include <linux/errno.h>
9 T [5 r' M4 J7 T2 R G# X/ o - #include <linux/types.h>
n) d& B" v) }1 X - #include <linux/interrupt.h>. `" x3 m- V6 P \# J. |
- #include <asm/io.h>+ X" T6 i. o! N5 _2 ?+ L
- #include <linux/moduleparam.h>
. y4 D- P3 [% g1 { - #include <linux/sysctl.h>1 n# E% f% l+ ]+ m
- #include <linux/mm.h>
( I% k& V( j# y - #include <linux/dma-mapping.h>
9 P/ c. ]: q- E" I$ D
/ v3 D3 ?# ~ g1 E! o- #include <mach/memory.h>4 d' T9 a. O. t4 e2 y3 {
- #include <mach/hardware.h>
0 ~$ B; f; _* U* L V. C - #include <mach/irqs.h>) q: [( D: P, H0 `% D: J
- #include <asm/hardware/edma.h>: q+ A( g- b$ k$ ~3 P9 s2 x0 e
, \! h$ u" K m. B7 Z- #undef EDMA3_DEBUG
4 T4 a0 _( G3 B O) d5 s - /*#define EDMA3_DEBUG*/, N6 }. e% q9 a
$ V3 C) O5 j" l) J, F- #ifdef EDMA3_DEBUG7 K( V& b r- `! Y1 P' x
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
* r5 I- W* @& g; U - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
2 P. p8 d, r* {* o& v - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' h v6 ] e- @3 v+ w( _+ `3 L+ I; }
- #else
" F( ]+ u8 L3 F - #define DMA_PRINTK( x... ): O; s/ T" I. k5 ? C0 g- M
- #define DMA_FN_IN
0 W7 |, \2 H r o2 G& E; h - #define DMA_FN_OUT
% ] n; B3 @. a - #endif/ I* Z: x; g1 @. r
- # M+ `+ Z2 L* ^4 q; p; q* l
- #define MAX_DMA_TRANSFER_IN_BYTES (32768) M6 `% E, k2 T- i# `3 s' n7 U; w
- #define STATIC_SHIFT 30 Y' d7 N6 Y2 a- B* r6 [' Y
- #define TCINTEN_SHIFT 20
; [/ a' R; N1 Q% ` - #define ITCINTEN_SHIFT 21* N* X5 a" L6 Z/ u6 a
- #define TCCHEN_SHIFT 229 G7 q# R5 `. Z8 V1 \+ Y
- #define ITCCHEN_SHIFT 235 D+ X$ v/ Y/ X: u; J
- ; S) n- t' D c- H0 V) j! E5 q
- static volatile int irqraised1 = 0;/ E2 P, h; P* C0 G% x+ ?
- static volatile int irqraised2 = 0;
7 Z: p& X/ J) Z; s) \ - " U( y& S; Z( I, `
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ B2 `% s0 y5 U9 `7 ^
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ t. H l1 I# R; M1 ]
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; P) v9 }; f2 b8 l* t, Z" `- q5 A
* \" V2 h3 ^) d- dma_addr_t dmaphyssrc1 = 0;, ~2 r @4 v* h
- dma_addr_t dmaphyssrc2 = 0;- S. v8 l% z9 q X
- dma_addr_t dmaphysdest1 = 0;
. ~! ^0 h4 g9 }9 l/ N - dma_addr_t dmaphysdest2 = 0;5 n R( f8 N* t/ C w7 U0 y; ^
C9 X, i; |! }8 }4 _" j0 ]1 P- char *dmabufsrc1 = NULL;9 m+ `! \7 i5 f, H
- char *dmabufsrc2 = NULL;. W, O" w5 y8 F5 T
- char *dmabufdest1 = NULL;
2 \4 j! S+ |* a3 b3 H( ]' L; @- Z - char *dmabufdest2 = NULL;
1 m6 Z) z% c8 v W1 x
. O. O8 A8 S" h' U% D- static int acnt = 512;4 e% L* g; B7 F6 T' [! X
- static int bcnt = 8;) H0 c$ W5 n- n+ @5 l6 R6 Q
- static int ccnt = 8;
5 }& N" }% X- P+ B6 C - ) m" m2 N9 `" M; U
- module_param(acnt, int, S_IRUGO);
2 Z' ?% @. l( ^' w! @0 o - module_param(bcnt, int, S_IRUGO);1 d) x4 {" c% l" R
- module_param(ccnt, int, S_IRUGO);
复制代码 3 s; {+ b; T0 ^0 S
X) D2 x6 L& W3 y9 n 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 G: J# C' C! f. q Parm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& \) T4 w0 ?/ r7 g- T6 v 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ o; G; S1 G" o! w. [' F
: N& i3 w% m. g% ^& u7 V: h
$ f H4 a, M: C7 C8 C$ f |
|