|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 u$ K; G+ b% f4 k+ `' |8 I% {; G- [code]EDMA sample test application
5 B, c }+ Y- [$ e3 ~4 y - /*; }3 `+ o) u; a, F5 L; h
- * edma_test.c
/ E+ E. B% l) B f: ]6 s) l7 e - *
5 Y* A& n, b! E, u# M: H - * brief EDMA3 Test Application' {5 i8 `- e' o) K
- *5 d: U7 h) G; D% Z
- * This file contains EDMA3 Test code.+ l1 Y P- ?# o1 q+ q5 Y
- *2 H$ _# z$ E7 ]
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& W! }' `) P9 v8 c0 ]
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' F; Y7 Z' G8 m$ }2 ~ a
- * TO CHANGE.7 Z0 h9 @- S+ P
- *
2 t& o8 c: q1 s/ Y0 X( @4 U" O5 K - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
) |* V2 @5 j6 G# R2 i y0 g% B( { - *3 m n$ `% j: x. _; T h
- * This program is free software; you can redistribute it and/or
# U$ Y+ [ O- y! x3 N - * modify it under the terms of the GNU General Public License as7 C; f9 a7 m; W0 N$ J! C
- * published by the Free Software Foundation version 2., j/ q( `" U; C$ Y/ Y# \ y' S' }
- *
, R& x* |; a+ t9 m6 T - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
; ]$ Z0 d& l$ C9 @: e' w - * kind, whether express or implied; without even the implied warranty
! u6 ~' q+ k& x) n" f: N3 q$ t+ B# [, i. z - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the3 [4 }/ l8 h- C+ d
- * GNU General Public License for more details.7 B& U" M0 u$ }
- */
e: `* R- N# M - O/ X# O3 L; x' c) U
- #include <linux/module.h>
. w% g1 K5 y- B5 S - #include <linux/init.h>
% j, U* s* z* C, l/ i8 z$ | - #include <linux/errno.h>
% @1 N6 N" N) g% _ - #include <linux/types.h>7 A! m0 b0 u$ H; Q2 {) }
- #include <linux/interrupt.h>
: A6 i$ x6 n& I, I6 n - #include <asm/io.h>
; u) D: B% K1 R2 x: s - #include <linux/moduleparam.h>1 K' x2 D7 a% y( L( Q& x
- #include <linux/sysctl.h>
s$ n8 v/ B4 }: ? - #include <linux/mm.h>
& a3 U4 f9 x, P' U4 S# K - #include <linux/dma-mapping.h>% i* K; o$ |3 a" _
- U) N* P0 j- {% g$ y8 X
- #include <mach/memory.h>1 M: q. P4 P$ Q1 w u0 o
- #include <mach/hardware.h>+ ]9 D3 d: n. N+ S! Z. @$ L
- #include <mach/irqs.h>+ u$ v$ l: j& h: |2 }. l
- #include <asm/hardware/edma.h>
6 Y) q* k8 X& w; j' @
' l) N; |0 X( G, K' f% E- #undef EDMA3_DEBUG/ Z0 Y) V4 U1 T2 J4 L' `- _
- /*#define EDMA3_DEBUG*/" e8 U1 K+ H2 H
- # `# A5 f/ |/ N1 r' B1 G e& }( y
- #ifdef EDMA3_DEBUG
& h9 B% J$ o/ ?0 i- M9 W( u6 L. M' w; [ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" Y' q% W# S1 c6 B
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
- [; i1 P) f# A# h, g3 r# ~ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
0 g4 |4 P6 g- H" A% E: h - #else
) x. p. t) \3 j2 [: c, y9 _2 n! ? - #define DMA_PRINTK( x... )
1 v2 G _2 X2 f - #define DMA_FN_IN
4 G% S9 a: z+ [1 E! Q- u - #define DMA_FN_OUT
4 {/ p" }1 Z9 J - #endif
5 ~$ s! B: y3 v3 R: A+ Q
( X1 e0 P4 J8 ]/ H2 \2 k- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
! ?* V) L# C9 A. s' W5 n" [ - #define STATIC_SHIFT 34 i: W- k( _/ d# p! s
- #define TCINTEN_SHIFT 20# S% T2 r9 x" l
- #define ITCINTEN_SHIFT 21
) f. w, _7 g B( [ - #define TCCHEN_SHIFT 22
9 l7 s6 _% u. J: g1 U) g - #define ITCCHEN_SHIFT 233 t: ~. o- G0 L
- 9 T+ {/ a- u4 c. N1 d
- static volatile int irqraised1 = 0;
% p8 H- ?; o: |" N$ q# ? - static volatile int irqraised2 = 0;
( W/ q! |! I# E. ?) c0 t; h
8 d0 ~3 u. O. s2 k- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! h: w( `& D3 \) i8 e
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. C- R" ^6 e( [8 {$ j
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. \0 S0 ^. Z- n
0 d& T& h' T& e7 F1 G! u9 U- dma_addr_t dmaphyssrc1 = 0;" T; w. ]2 b6 T+ F+ x( o: o' w; A
- dma_addr_t dmaphyssrc2 = 0;" G; W! K( r' K
- dma_addr_t dmaphysdest1 = 0;
6 B0 D6 Q7 z+ o: [' ^. S - dma_addr_t dmaphysdest2 = 0;) g( |2 `5 c" U- o2 Q# b. n
/ x2 x3 T$ Y N; b9 G- char *dmabufsrc1 = NULL;" X6 ^( V$ n. E. Z5 x$ c- O5 Z
- char *dmabufsrc2 = NULL;" t4 t9 z: N9 o
- char *dmabufdest1 = NULL;
! w: O5 r' P' x" i, R8 Q - char *dmabufdest2 = NULL;/ B! r( Z7 [% E( ]: M! ]3 {
- , V, M( T$ x8 e1 C% j5 D. `
- static int acnt = 512;1 {# @! q1 U1 E9 i% B" |& ?0 M
- static int bcnt = 8;
! t' v: `$ Y2 x3 `+ {' ~$ ~ - static int ccnt = 8;
, P) D1 q! X- [* T - - Y3 P. y* {2 N; H
- module_param(acnt, int, S_IRUGO);
3 s0 r+ p3 e+ e - module_param(bcnt, int, S_IRUGO);5 M2 {4 `6 }- d0 U7 o O; w
- module_param(ccnt, int, S_IRUGO);
复制代码 : |4 ^' Z3 ?- W
$ @( z, ~/ Z0 w3 H5 s) [ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& s, C# [2 l$ Z- P) S. D6 x" Jarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 u ^4 n2 }8 I" N1 c 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; `5 b! Q. g5 E& c; ]- B% s
$ ^& X# h- g6 U$ y( E( j+ C/ e( p1 \+ a n
|
|