|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - Q/ z; v* \. m/ L$ y) W$ U
- [code]EDMA sample test application7 w0 [5 ]: ^) y2 x, W P) Y
- /*
" C H4 r+ w$ E9 I% o. A6 s - * edma_test.c
: v9 [3 V+ V, H6 ^" D: e/ D& E - *
$ r& ]' l) M4 E: T/ S+ U( u h - * brief EDMA3 Test Application9 E- u8 \/ u" Z5 G8 U+ e# w
- *- k1 h! c2 L9 P
- * This file contains EDMA3 Test code.
% R# D' n5 k$ Y/ f' B - *
7 v- `$ N( T) t0 ]" ^) g/ C - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
6 { m9 t# b6 Q( m- G5 _ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) l6 C! L. F9 ?6 n
- * TO CHANGE.
, f1 J# v( e; c - ** J! D6 F3 r+ _ |, t
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
: F" L' k) ]' a - *
4 ~ X) N" Q* B! ^) {' R ^ q - * This program is free software; you can redistribute it and/or8 ]: P! X5 `4 c0 d% n- ~, n
- * modify it under the terms of the GNU General Public License as
( U# X( A, @4 O; H2 w. y5 [; t - * published by the Free Software Foundation version 2.0 m2 Y. L# t$ ~, |2 o1 }
- *
: P; _! q! @; @3 N" c9 ~ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any" f6 \, G6 E' ~$ t' g
- * kind, whether express or implied; without even the implied warranty
' v8 X6 |, m$ Z - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# f2 V6 ?- H. z7 ]" [& A6 O - * GNU General Public License for more details.: ?" `6 w$ a' V& S* h
- */
1 R. W! M4 B: J8 B; ` - ( P- S7 k$ @2 \3 ^8 }8 g1 Z
- #include <linux/module.h>
4 a0 N% b3 S8 v8 F( i - #include <linux/init.h>, c' y* a& }" U
- #include <linux/errno.h># p" R. b4 E, z( C' R) p9 i
- #include <linux/types.h># _- f7 F6 L4 @% K ~
- #include <linux/interrupt.h>0 @9 [7 O# m8 F3 e
- #include <asm/io.h>) j: p+ ^) p+ x% `& `& w# o; Z' m: C, I' ~
- #include <linux/moduleparam.h>
- L- |# S1 N) K! ~! ]8 k; g - #include <linux/sysctl.h>
3 h) O4 q% t8 \* o: T9 e2 Y$ e - #include <linux/mm.h>, C: o* q" ` |4 Z5 O
- #include <linux/dma-mapping.h>& X3 @- B, K, t
- 1 t+ \9 i# v1 c0 X, y. w- H" r
- #include <mach/memory.h>8 ?6 m$ m; a, r" X" u& a& e& @
- #include <mach/hardware.h>! f# H, l. F2 I* L, u, T
- #include <mach/irqs.h>, L, M2 I R& S( L4 d* m
- #include <asm/hardware/edma.h>3 D* S! `* }* B9 J0 l
0 j+ @' ]5 _/ ~8 I# f' k( O2 c5 E- #undef EDMA3_DEBUG1 X, n6 h: {/ Z# ~1 H
- /*#define EDMA3_DEBUG*/
5 z! x& A% T5 d; ^# A/ C* m - 2 p9 R- }) j2 a4 ^
- #ifdef EDMA3_DEBUG
! ]9 U7 {' c( M7 Z0 Y - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& [: s/ r1 q) s) C4 R4 z
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' F5 A% [+ q% _5 Z% i3 f/ p T
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); ^- m3 o/ I& R: R8 ]4 A& N7 u
- #else
) s) Y' K( P. n - #define DMA_PRINTK( x... )+ l2 I) N5 E) m( P2 V. l
- #define DMA_FN_IN4 o) d' _9 r. F5 N
- #define DMA_FN_OUT) s6 U& O( |. h: ~
- #endif
1 m8 D7 ~3 C$ Q. o - 9 B/ h* O* [7 J/ N) S7 `3 h% R# R
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)/ [! {( d. V) ?0 `! _9 }( Q1 t8 ^( x
- #define STATIC_SHIFT 3+ [# I5 }* s$ l
- #define TCINTEN_SHIFT 20; t8 K$ [1 I4 R3 A+ s; i+ @. ]
- #define ITCINTEN_SHIFT 21! H6 ?0 s7 B' }: U% P* M/ C
- #define TCCHEN_SHIFT 22
1 Y6 x- _# z% y. N% L - #define ITCCHEN_SHIFT 23. Q( k* Y$ V5 o4 R3 v. _' ^! X
2 i! B( g g8 U7 H/ d$ h' \- static volatile int irqraised1 = 0;$ h! N# A6 ]% s. E% C; G
- static volatile int irqraised2 = 0;
/ e) f) a$ h/ X; M/ Z+ p$ h - 7 i- c# `, i% W h! U4 Q
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 c: `: a) @" B8 O6 k- o+ R
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ R/ ^7 a4 @: N; j* i% X- ?5 H
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; |( n9 _1 k/ T6 D# x
+ \( C b; i) c- dma_addr_t dmaphyssrc1 = 0;
* {5 B) d# L: ?# S# a3 Y - dma_addr_t dmaphyssrc2 = 0;; @* q+ V. \( ^* r
- dma_addr_t dmaphysdest1 = 0;
! x* Z6 i6 d$ t% N( K j3 h - dma_addr_t dmaphysdest2 = 0;$ {) k; i, U8 J1 i; _' [8 U
- 8 f- k, {& z3 q6 |! a( @
- char *dmabufsrc1 = NULL;1 s( ?* F4 u+ H, M, b; A( e# m A. g
- char *dmabufsrc2 = NULL;
; g0 X& e$ G$ R - char *dmabufdest1 = NULL;, `. z0 J; b- R6 @5 ^4 W& ^
- char *dmabufdest2 = NULL;/ y3 P/ d9 W6 E, K
- + u9 f! J6 Z& Q, J6 K% _
- static int acnt = 512;
8 p x3 `( E g1 ]: c3 V; L - static int bcnt = 8;9 C; g' Z2 p% L; f1 G1 R# O
- static int ccnt = 8;$ g7 X( f; Y t( o4 L* v& K
- % Q4 z- ~& L( X! ?+ M
- module_param(acnt, int, S_IRUGO);2 X O0 c( G% w4 v4 u5 A3 }
- module_param(bcnt, int, S_IRUGO);2 F: P. K: q9 e' b4 t
- module_param(ccnt, int, S_IRUGO);
复制代码
$ y K% Q5 s' x+ R
' Z$ q: ?0 E3 ?) [ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& L' P6 c6 w* K' }0 W! iarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ T/ [ E5 b/ j0 v& P+ ` 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% o) T d" ^1 E" p
9 p2 C/ ^) y8 U* w4 t9 f' s- y6 X
! u( }' I: |6 b% X
|
|