|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . g8 H6 y; h4 a! `- N5 a
- [code]EDMA sample test application
2 H+ C% N# i& {2 _" n7 l- s- } - /*5 @$ V9 k9 R7 U6 @; O4 ?* ^
- * edma_test.c
% @" h; v( H( T2 T# }( A \2 _ - *
6 `; q }% o- V1 \ - * brief EDMA3 Test Application
, N2 O( a, z% U) y6 x - *
+ f' M, c# |/ L1 e6 [( W - * This file contains EDMA3 Test code./ l' j9 N. W* M5 l
- *, W) b) h* m- C- A' O3 Y' W7 ~
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
. F3 F0 P6 v @ u, k1 W - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
* u. `- P' J% G: l - * TO CHANGE.
3 L6 X# S: R3 E% r7 k - *! R# P+ X' @1 o! u( B
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& n) J; f7 G9 l& X3 ]' E
- *8 n+ Q/ `" c- y- ~
- * This program is free software; you can redistribute it and/or
; o6 ?( p- x. Z3 t% k. a/ j3 F2 n - * modify it under the terms of the GNU General Public License as) F+ b9 W8 f9 U5 Q
- * published by the Free Software Foundation version 2.
: B. k8 x( u" x" m- I( k8 `2 s - *
& T; ~% s) A+ S' M - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
; Y/ g# l" q! R9 M9 a" _1 t - * kind, whether express or implied; without even the implied warranty
% U4 `8 K( |* Z. N5 J# O* p3 p - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! g" r: C' E; R) f1 B- q# J - * GNU General Public License for more details.
1 H5 |& m8 J$ V* f; Z- U) l7 e - */, p- V% Y# i+ \
v. @3 a. T/ x: ~5 _- f- #include <linux/module.h>
2 w0 g% X' z0 v- d9 _ `6 I# Y+ w! i - #include <linux/init.h>% ~8 v; j# _. l* E, f; j. g; f/ W5 X" K
- #include <linux/errno.h>
9 y- O! g$ o4 s5 w$ }% ~: M! | - #include <linux/types.h>4 L: Z5 V6 g# l- |5 N
- #include <linux/interrupt.h>
( S1 S! s& R2 `: R- c$ j - #include <asm/io.h>" j" m( n% l' ]8 b5 x8 @( R7 d7 m
- #include <linux/moduleparam.h>
" [3 I- Z- W7 u0 s# R - #include <linux/sysctl.h>1 D+ h* s L# i9 \
- #include <linux/mm.h>
! ^, B9 L, C$ y - #include <linux/dma-mapping.h>
. c5 ]( i- ]* ^9 u( ~
9 N, ~- T) q& B5 Q% k1 G+ Q4 E- #include <mach/memory.h>6 X. b4 r, ]( Y9 T; J
- #include <mach/hardware.h>8 B6 q7 y2 I' _; w5 ?
- #include <mach/irqs.h>
% ?5 @0 ?5 e$ {3 l; a; D( z - #include <asm/hardware/edma.h>
& \: Z1 h+ c4 V- k' E9 F - 4 J2 _; y% W9 g5 Y# V, O; Q9 p
- #undef EDMA3_DEBUG
- j& C; \% |6 f8 W3 i - /*#define EDMA3_DEBUG*/0 s0 ?+ R" @' P d& l
- " D& m. C0 P* v/ f* t I
- #ifdef EDMA3_DEBUG1 i, O; o" H0 T& x+ R/ |; d
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 U. \: y3 _- j4 o$ I
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
% U! F! X, \( w6 w& J0 O% _ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ K. O4 E ?+ ~" s
- #else
) a) A0 \( o9 @9 u$ |6 _1 v - #define DMA_PRINTK( x... )
! V, W8 g" C1 y( X - #define DMA_FN_IN
$ D3 ?' d. k+ T0 | - #define DMA_FN_OUT& N/ [- m7 T6 R2 [
- #endif
5 S$ E" [, {6 R. w2 r; ]. v8 l: {# Z+ E
- Z% N: N8 X% w' [5 M9 [. z- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
' E% L4 K$ h8 v( K - #define STATIC_SHIFT 3
6 ~0 p2 D& e/ j9 Y- T6 a: {+ d - #define TCINTEN_SHIFT 208 r! r. |9 `/ B3 w$ l, l$ ?# [
- #define ITCINTEN_SHIFT 21
: |) E/ {9 P8 C M& N - #define TCCHEN_SHIFT 22, d7 w* ]. G4 D( I4 V7 u
- #define ITCCHEN_SHIFT 23! ?6 M# C; l+ Y T4 e
- 0 D1 s/ L. D+ {
- static volatile int irqraised1 = 0;8 k7 a! k8 T6 n
- static volatile int irqraised2 = 0;
1 {0 E3 W/ ?6 L - ( F: h% N0 a+ N, i3 e q ~
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 K; u/ R" f, Y5 ~& I) @ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 b) g. { J3 ~ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& n9 a7 l8 Y" l+ w" q# C - / g& D. @. g, E. h5 E- V
- dma_addr_t dmaphyssrc1 = 0;
8 `: _0 K x, X- T3 } - dma_addr_t dmaphyssrc2 = 0;+ B" j' `2 X1 t3 ?/ S
- dma_addr_t dmaphysdest1 = 0;0 }9 V, S5 G( i K+ h4 v# p8 L
- dma_addr_t dmaphysdest2 = 0;# d' e4 @- m$ {+ q- g
: e" X9 b) d7 `9 J- char *dmabufsrc1 = NULL;- y/ {/ {2 J( n( M4 d( {3 c4 r H
- char *dmabufsrc2 = NULL;
# O) N% x" [/ y, b9 ^ - char *dmabufdest1 = NULL;
; x; q2 U5 K7 P+ O$ ^, l" o: K - char *dmabufdest2 = NULL;/ ]9 }3 G X' ~- {0 u e L
* z5 O5 z! G( ~; ~9 z& t. e3 T- static int acnt = 512;/ z. B: m7 T' r! _ w6 x$ N' c( ?
- static int bcnt = 8;
6 K! X* b4 ^4 r4 x7 R2 w8 H6 j - static int ccnt = 8;
# a M( J. U% {3 X
9 C- m' c% d3 Y8 g0 w' B- module_param(acnt, int, S_IRUGO);
! V. `6 v; \! S, \ - module_param(bcnt, int, S_IRUGO);: R- e( T& J) I
- module_param(ccnt, int, S_IRUGO);
复制代码
3 U' c9 |5 A: B2 R
" @, |. S1 K$ q$ Y 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& t6 X/ ?: Y6 z0 A6 _$ Aarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 }7 J5 \( l" v7 N1 l' F
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 v' `" F6 e* D# x2 [# D& O7 j9 {, q) M0 p3 I
+ e& F0 C+ r8 H- l |
|