|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- d5 R2 x) Y8 X' n. h- }. H- [code]EDMA sample test application& E% P! y# C4 \! d* c/ ]% n" R
- /*
* p* z, S5 ]: G) u1 w5 n - * edma_test.c. e" g2 } R3 x# H4 T$ T0 \0 t3 p. V
- *
4 Y5 x# U1 C3 c5 g5 K8 r4 u - * brief EDMA3 Test Application
- H" \+ E Z; H9 j- A: h' a - *
# d3 _' }) I0 R- g - * This file contains EDMA3 Test code.) G$ r. o0 Z5 X6 g) n
- *
: k( J) u3 P6 E& t4 _# e, F( ] - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
3 T( s0 g6 \5 I" }5 P+ ^1 ] - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
& n+ a$ J3 i' F, d6 _5 ? - * TO CHANGE.0 r! q: \; o' P& p. J
- *
6 A8 ]% ^( v1 Q- a8 n3 H - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
0 r9 D! Q; X) z: N$ W! k - *
$ ~& L0 h4 P6 m - * This program is free software; you can redistribute it and/or8 x! B8 C- c; `
- * modify it under the terms of the GNU General Public License as
8 n+ U( K: B$ T4 }7 ` - * published by the Free Software Foundation version 2.
5 n: o& F( b( x - *
' S4 g. a( z% U: c# ?% t" B - * This program is distributed "as is" WITHOUT ANY WARRANTY of any) C* F! Z7 j. s; C5 L% Q7 g
- * kind, whether express or implied; without even the implied warranty
3 i7 s( H: d/ s6 I - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; O4 i0 w' i+ Z0 _+ A; Y2 L - * GNU General Public License for more details.* v1 q* E* ~* z" i/ h6 F
- */1 ]8 s3 Y- |% K
. t+ `$ H) }3 D- {+ @( w7 k; M- #include <linux/module.h>
5 s! L3 `2 ^2 h$ M0 s) p6 o7 q - #include <linux/init.h>- O: |- ^- [6 A* b1 K2 N
- #include <linux/errno.h>
6 n& o1 D( T4 \1 f+ M - #include <linux/types.h>- u( Z4 F! l$ h! G( @
- #include <linux/interrupt.h>: a1 ]6 u, z, h
- #include <asm/io.h>3 P# A# W+ r& c8 m& e$ \
- #include <linux/moduleparam.h>
4 p) |% J% g0 u' ?+ p8 y. @5 T - #include <linux/sysctl.h>
; l" ^" E4 ]- e, p - #include <linux/mm.h>3 A/ S9 C9 g j& s9 h
- #include <linux/dma-mapping.h>0 f+ B; k+ _% k
- 5 Z* a4 j! a2 E' U' h! K
- #include <mach/memory.h>; M& A! }/ O4 W
- #include <mach/hardware.h>
3 ^1 ^$ L1 Q: v2 T- x2 W: \ - #include <mach/irqs.h>' Y7 b- ~& N* R2 A
- #include <asm/hardware/edma.h>
; x5 J8 A! C( V2 k. n( A" f. T
9 G& a7 ^& I i* g- #undef EDMA3_DEBUG) i) h, t- M, A4 Z: \0 a5 G
- /*#define EDMA3_DEBUG*/
5 m2 B' R3 O3 b& \ B - , @2 @7 y5 d, t- [1 c
- #ifdef EDMA3_DEBUG
9 n* \+ F, V( p8 F - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
# t. _! y8 t1 E$ o E6 u - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( J F$ [4 T, ]; |! ?
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 s; |0 j8 }3 [5 o& {1 r( n8 |
- #else
6 ^$ O0 b- S- ` M+ W2 m - #define DMA_PRINTK( x... )+ k2 w5 s9 P9 l' S t! J
- #define DMA_FN_IN4 \: x9 M- t. o0 Q+ G' a5 Z
- #define DMA_FN_OUT5 t' I2 O, ~/ X G, D
- #endif8 c# E% }6 i0 i6 }8 ]9 `% b$ b1 M
8 W8 n8 Z) ^) s6 m1 c# A6 }$ a. Y- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
3 Z% F" [# `8 f - #define STATIC_SHIFT 3
5 u2 g, S/ p t1 s- M# I$ }* T - #define TCINTEN_SHIFT 20
; V; v0 I* ?* J% Y6 E% v: r! j' I - #define ITCINTEN_SHIFT 216 p9 q, J! h- z7 z
- #define TCCHEN_SHIFT 229 b8 a0 f7 U4 M7 C# D
- #define ITCCHEN_SHIFT 231 P. I; t2 f% R& R" c Q
/ F1 Z- ?: M0 J# R) y- static volatile int irqraised1 = 0;% @5 N ~8 a3 V# `
- static volatile int irqraised2 = 0;9 \8 A) h) J4 q6 m5 p
- B( W2 q. K0 [
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" X/ j7 O" k1 s) u: T# z - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. h/ ~; s ^* x, i
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: ]! `- Z1 a r) v' U! C
; ]$ m0 V! h! O7 y6 l7 v) A- dma_addr_t dmaphyssrc1 = 0;
# [! s* O/ {) F: K6 n% D, x - dma_addr_t dmaphyssrc2 = 0;# I, `+ M# y8 a% j' `3 q/ q; g2 t) D
- dma_addr_t dmaphysdest1 = 0;. V: c) q: ]! M5 _' Z1 d9 i
- dma_addr_t dmaphysdest2 = 0;
# X0 }, Q. t" ^% V8 J - : R. v" j# B. i2 O1 g, w$ x2 u) J
- char *dmabufsrc1 = NULL;
5 I, q, A0 ?* L( n - char *dmabufsrc2 = NULL;/ Q% V3 P$ G* n( f
- char *dmabufdest1 = NULL;
# r; ? o5 E2 a1 j. ]. P( c5 D9 k - char *dmabufdest2 = NULL;8 [6 R' u. ]0 S" a$ O
! \% z0 j9 D0 ^& v# P. L- static int acnt = 512;
9 y/ D' k, g3 M2 g( e. y - static int bcnt = 8;
8 E" I. a: \2 B$ W, s1 Z! |5 H - static int ccnt = 8;
}, F& Y$ w9 Y! \8 m1 [ - 2 ?* |# F/ }! o" U3 u2 F
- module_param(acnt, int, S_IRUGO);: w, j/ X" a- `3 F- }9 a
- module_param(bcnt, int, S_IRUGO);
; X6 T! g- c' I. k - module_param(ccnt, int, S_IRUGO);
复制代码
& s# K7 f: u! e. p7 P$ t: L6 \; {, }) U; v5 R7 f- T
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 g, }7 E# x' S4 p( M8 B2 J0 U
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 V7 Y3 j8 @4 u% _# S9 V* { 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% m$ O7 ]& r3 B/ N
0 \) z, Q: ]4 {/ r7 F! _ T3 w
0 u V/ G" a* o6 E% K# x |
|