|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 q$ r$ m0 A3 Q4 x! G# N, l5 U0 {
- [code]EDMA sample test application
! l& J* |2 O# k" v- l( e$ [% D9 O - /*
+ ~6 @5 i' C+ q: x; r4 ? - * edma_test.c$ k' `% X$ R. a6 v/ H
- *% V2 d4 m! F8 M* C, L
- * brief EDMA3 Test Application
0 X. ?, Z" U/ `8 v1 v C- e( [" o& @ - *
* X8 {7 J1 w' j, R5 r' q+ M - * This file contains EDMA3 Test code.: R* d3 @. a* C8 P' @, w
- *
% q5 Z9 i8 ^7 g% ^ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' I0 r7 \) _ v. k& X M
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ w- `: X8 U4 b" o5 {, g
- * TO CHANGE.1 V4 K M" }! J0 h( ]) t) l
- *
m3 x; {- ?0 h- n - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) O x* y$ B5 e4 d3 f$ S
- *& B$ V% f, R; N* J
- * This program is free software; you can redistribute it and/or0 c8 y- K, l1 R4 Y9 U" B
- * modify it under the terms of the GNU General Public License as
6 [' ~4 D# d" e R# ]5 k9 _/ j$ m1 { - * published by the Free Software Foundation version 2.
3 m3 D' p3 K! `( L - *" h+ v& j& c. J# @
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 e/ K- `. P3 C9 W, ]2 V$ b
- * kind, whether express or implied; without even the implied warranty8 K+ m' F- C) V$ a+ G$ h
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the. l/ F, V2 @2 l: e" ?
- * GNU General Public License for more details.1 w* Y# Y/ g1 x2 K# x
- */" v( l; f- A& \$ l$ ^$ v3 a
# m1 H# X F* g& l- #include <linux/module.h>
$ F( B8 I( Q' a; ~+ R2 ]" y - #include <linux/init.h>3 ]( i9 d2 ]! E2 V4 f* K* V
- #include <linux/errno.h>
% F/ k7 r4 W5 Q4 @1 P$ I* ? - #include <linux/types.h>+ J# W& T% B5 {% v6 Y
- #include <linux/interrupt.h>
! U! x7 N+ F8 c - #include <asm/io.h>- }1 F, x0 {' J- b) |
- #include <linux/moduleparam.h>
' x2 V) t3 @$ _% z" X+ p. S% z - #include <linux/sysctl.h>
/ k6 C6 e" Q0 ^& F3 T5 l4 n2 x - #include <linux/mm.h>4 G* ^$ S& _: R/ ~& l u
- #include <linux/dma-mapping.h>0 G% Y- @7 S) q( G( [
- * f- q& X+ [# S+ A1 D+ S/ v; j
- #include <mach/memory.h>& Y! ~3 i+ _$ _. @) A
- #include <mach/hardware.h> y9 B2 g# W* F
- #include <mach/irqs.h>5 t) [3 }% G; t+ r
- #include <asm/hardware/edma.h>9 u( I& F/ d+ Q4 z' V) y
; O1 ?$ j; y( E- #undef EDMA3_DEBUG
7 q; f7 W" ?/ C, F. u; E - /*#define EDMA3_DEBUG*/
$ ^' y( @& S6 {# u: n ^
2 `. O, c q+ u e T1 m. I- #ifdef EDMA3_DEBUG, Q" U" Q( }; q% R8 ^7 h
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' }% P/ \0 ^7 ^
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
1 V% [! J0 q6 Q7 _) f$ }% l - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
' |# n* H2 C* O" K - #else
- `7 k1 Z6 \; C8 ?9 C. n - #define DMA_PRINTK( x... )
9 U6 U2 `) c% I0 l9 z) b( O/ `; T - #define DMA_FN_IN5 ~1 v0 A( g4 g9 K+ e6 }
- #define DMA_FN_OUT
" Q5 o. D! k: d, I5 l5 v" v - #endif
1 ]9 Z3 R8 {9 k# G# H3 k - 0 V% q% z! f7 @. A' w9 I5 Y f/ B k
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
" F5 I5 e: u1 }) U - #define STATIC_SHIFT 35 j% g! O$ t! E; ], k
- #define TCINTEN_SHIFT 20
& b" v' |% ?, D) Y - #define ITCINTEN_SHIFT 217 y8 C9 p( k9 g* f0 Q5 G9 I
- #define TCCHEN_SHIFT 225 U ^% D- Z& Y8 X
- #define ITCCHEN_SHIFT 23! P. x- J/ |1 X2 s1 S% k" j
- S# {& Y: A' `5 T
- static volatile int irqraised1 = 0;" R9 j7 e: X9 M6 X2 l! I# s7 T
- static volatile int irqraised2 = 0;; O% W* k7 N6 z& c! B3 ?8 ?
- % J. g, \' G* ?3 V
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, p4 m! e. a& c- P2 W, P/ z
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( `7 A# z; e/ D
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* b9 b% d! e& J0 E" E( I
7 f2 I9 E4 z- f" A1 U$ e- dma_addr_t dmaphyssrc1 = 0;
5 [( R. c' v X4 q) }8 u q - dma_addr_t dmaphyssrc2 = 0;
) g' @) W. I! g - dma_addr_t dmaphysdest1 = 0;
: N& i+ ^ a& h' r - dma_addr_t dmaphysdest2 = 0;( c$ v( K) ^* l" f2 W4 L
1 s; ~6 S: X; ?) ^; x9 j2 w; h- char *dmabufsrc1 = NULL;
5 V8 h: e. y9 t# V X6 n! M6 V, g' D - char *dmabufsrc2 = NULL;( h/ \) n7 _1 o0 a) W8 Y: r
- char *dmabufdest1 = NULL;+ I: z! w3 x- z- Z
- char *dmabufdest2 = NULL;) q* S! ?! ^' M4 h4 s& u2 N) o
- 4 c7 Z2 Q1 b3 n# t2 z
- static int acnt = 512;( [, ]6 z( X3 v, Q
- static int bcnt = 8;! a# _* E) @5 [" z# H2 {
- static int ccnt = 8;, {8 n3 M! L5 _" O
! [, j' ~0 K U4 r, q- K- module_param(acnt, int, S_IRUGO);
! x1 k; i% C& @! h8 G B; q - module_param(bcnt, int, S_IRUGO); \# Q0 W# U4 |0 W' K, I" w
- module_param(ccnt, int, S_IRUGO);
复制代码
; T2 A; S* E9 n8 c6 A6 \: X N# z7 ~6 e
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 l- R! C! [; c t8 Barm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( g6 |& z& F- Q5 b 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. B4 D5 r& t6 J9 i7 C7 ~( Z
1 S2 d+ S6 C i( Z7 B- H0 G
8 X0 U2 X) [+ B/ }4 c4 z' ^
|
|