|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - N) u2 C' Z1 g* j1 |: P, r4 S
- [code]EDMA sample test application
W9 h9 T5 e7 ^0 D* t' F - /*" m0 T* J, J% D: J( _" w
- * edma_test.c
. b8 \- t1 Y( n; X - *4 V9 N! a6 \& e4 z( e
- * brief EDMA3 Test Application/ l b1 p/ b1 ^% M: C% `' `: K& e
- *3 }7 i- T, ?; ]% _" z3 o6 Q, g6 y* S
- * This file contains EDMA3 Test code.
! O. S/ c: _: i0 ] - *
% X: Q' x# \. |9 S- ^! g - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
/ B5 \+ q& M0 H - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ ^- u/ b9 Z2 ~# d) F* {; f
- * TO CHANGE.4 K9 I4 P% c# }! ^
- *
2 V. |$ b9 `+ e% Q* A5 N9 ?; t - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
0 E* H$ y. O/ M( m! J8 B8 x/ p) y+ ? - *
" u, [1 K1 M* `9 A2 W, ~! ] - * This program is free software; you can redistribute it and/or1 j: V6 {( r1 W6 x. h4 q
- * modify it under the terms of the GNU General Public License as, z& P* a& l. {8 r
- * published by the Free Software Foundation version 2.
+ C8 e+ {# ~: M - *% e- g: M" {( ?, E% X
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ l; A" I% w- W# H
- * kind, whether express or implied; without even the implied warranty7 }8 [9 l, N ]; Q6 A9 U
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the; t7 a+ P4 y& j9 f* X
- * GNU General Public License for more details.
) Z; b# F" P: t9 h - */
% X% B% Z1 P. X8 e
6 z/ y) \' W( A! l- #include <linux/module.h>
0 e- A- D1 C s' C" V; g - #include <linux/init.h>
' Q3 K* Q4 R* Q* S - #include <linux/errno.h>7 K; s! s ?8 d
- #include <linux/types.h>
- U7 l- U" B# F) B0 ~! I- g) t& S- Q - #include <linux/interrupt.h>% I3 ?( ]' h7 Y( }! Y
- #include <asm/io.h>+ ]7 E5 w& L1 _1 K( h2 l4 l
- #include <linux/moduleparam.h>8 ]' j1 l- r' V
- #include <linux/sysctl.h>5 J# k/ Y6 W2 M8 k/ ]
- #include <linux/mm.h>8 r$ X: F* @2 A0 Z; ~0 w; O. ^5 T
- #include <linux/dma-mapping.h>7 N! m, `2 q# r4 g3 N6 H
- 7 R6 z6 P+ n0 Y5 j$ K* R& ^
- #include <mach/memory.h>) w- M4 I9 W2 s
- #include <mach/hardware.h>
1 U8 E" M% ~" e9 q, w - #include <mach/irqs.h>
; A+ ?3 T1 T- O - #include <asm/hardware/edma.h>+ m) @1 O: @" M, j6 h6 \. K
* O9 T8 j: w4 s: \- #undef EDMA3_DEBUG
3 v% w; ^% P8 B- h - /*#define EDMA3_DEBUG*/
7 h3 Z0 A u7 H
8 |: k7 x) W* ?- #ifdef EDMA3_DEBUG. R0 i7 f! N4 |6 d- J) }4 {
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% Q) l: Z1 W$ E, f0 |5 l* Q
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 K" }; w* k# D* @7 n
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
" l* h- T2 I, R) v; p t - #else2 m4 I# p5 J/ v/ m
- #define DMA_PRINTK( x... )5 \% }1 G: @2 Q8 F1 f# a" Y
- #define DMA_FN_IN
5 O( h' `8 a8 P. r4 w - #define DMA_FN_OUT
$ t! v4 j$ J3 T" R) [8 B% ? - #endif9 \8 D* p/ j0 C. h! _
$ F. F* u# d1 U* F. t5 O ]6 T- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
* ?- C. E6 A& ^" ~ - #define STATIC_SHIFT 3
! m8 r. g0 ^3 X6 ` - #define TCINTEN_SHIFT 20
3 c1 {. V% ^, z! Q O/ t - #define ITCINTEN_SHIFT 21# \1 l) N( O% I" c3 ]! Y2 S
- #define TCCHEN_SHIFT 22
- }5 T. E, X6 s: K% v# Z% |2 J - #define ITCCHEN_SHIFT 23' L; Q4 Z" }+ a# f; z& S0 h7 x
# l8 ^% ^( s, r- static volatile int irqraised1 = 0;
2 j' {2 O/ Q9 [ - static volatile int irqraised2 = 0;
6 B( K$ N4 M; C6 F& M - : j$ j! F7 s& b) k4 g0 K# [6 f
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% n5 } t" g% L: N: r6 _. m
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; @' V+ v) _' C
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 e: k, z: h9 c' v! E s - - j0 y1 a' m8 W9 k
- dma_addr_t dmaphyssrc1 = 0;
# H0 [+ L P8 z' _, [ - dma_addr_t dmaphyssrc2 = 0;
( }. S( |/ n, N% @5 w8 S - dma_addr_t dmaphysdest1 = 0;
; R% }% G: v1 L - dma_addr_t dmaphysdest2 = 0;
t) f4 y3 M' x( x* _7 a; h6 Z" |
& K0 u% h9 x" I7 v4 d, M+ `1 e R- char *dmabufsrc1 = NULL;
" {0 d! X, |1 }+ y0 a - char *dmabufsrc2 = NULL;3 X; Y% b9 b1 U6 D ?7 B" d
- char *dmabufdest1 = NULL;
% U5 i5 e/ _1 `; k5 z$ H7 W7 h - char *dmabufdest2 = NULL;
# w Y! `) s1 Z! h; D5 A - 3 c% K( |1 |4 W2 l m
- static int acnt = 512;# ~) X9 L/ Q0 g0 ]
- static int bcnt = 8;9 J- n) s- n" E5 \8 V& H4 f
- static int ccnt = 8;* B; |( e5 \# n# J! q
- * I( L- E8 g- L# {; T# V7 L0 p. N3 e
- module_param(acnt, int, S_IRUGO);
( y+ G+ r; b1 G( n3 |( ?2 r, R+ Q - module_param(bcnt, int, S_IRUGO);+ Q8 v5 @1 z% S' K6 E
- module_param(ccnt, int, S_IRUGO);
复制代码 5 y+ |7 }1 f; O S' l
; t) }0 P% B9 S! ?" g. Q 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* W) X. E. a8 f5 R6 u% o9 Y
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" _+ d% [6 G' _+ J+ h# ^/ }7 E6 N 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ b8 J. h' m1 ^
9 [4 y# U! f" \4 G- ~* u7 U
9 C: J1 m' O1 C) E, M |
|