|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' E7 m/ x3 t& z1 ?/ t5 P- [code]EDMA sample test application
% Y. `" Q4 r# ^8 X$ Z$ b - /*
2 m6 [" W$ v* x) r0 R: R0 t- p- ~ - * edma_test.c+ r$ ~* F* S; D
- *
5 |2 N1 W k* x6 n4 g: N - * brief EDMA3 Test Application
b3 U, j1 } d* x& A! m, B - *
" l7 O8 S" {, w$ H# B - * This file contains EDMA3 Test code.* p$ ^+ _1 @, m, D0 q
- *, V" g7 G/ u, \* p8 B
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
8 |# |5 e) |8 |2 U: s' [) l - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
4 ?: B& S. Z& K* i! Q1 F9 R; X - * TO CHANGE.
9 H4 e+ a$ [* \. ~4 ~) t - *
) J: R1 y4 n4 { B, b% N - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
- T+ F9 ~+ g/ g9 Z - *
9 v7 o! A$ y! J* ^5 D3 l) c - * This program is free software; you can redistribute it and/or
$ y/ a' y% R! w- r, l( U - * modify it under the terms of the GNU General Public License as0 z! P; u$ n1 [1 T% |
- * published by the Free Software Foundation version 2.+ b- n e4 ]2 [
- *5 J: A0 Q' t" b% |3 |% ?* m4 c
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
' c! t9 \5 i9 ^; S% Z - * kind, whether express or implied; without even the implied warranty$ o* ?" |; K3 A4 ~8 k1 v
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the* ~. i! ]* @# z6 B) b* X! m
- * GNU General Public License for more details.
- ?% H5 g3 c: c - */, Z7 R. V# b; n* }7 e$ C
- r- X4 |" i0 g+ j6 o3 ~- #include <linux/module.h>+ u$ p: ?! J6 b: L/ R- o! Q
- #include <linux/init.h>' H! {3 \5 D# ?. }& h
- #include <linux/errno.h>
& A) [+ ]+ M, N0 @1 { - #include <linux/types.h>
6 Y9 @3 p3 _2 C - #include <linux/interrupt.h>
7 ~ _8 y0 ^ Y w b - #include <asm/io.h>" R$ ]; n& M$ ]% Q4 i$ Q" W! a
- #include <linux/moduleparam.h>0 a1 y( f% x! A) t! w
- #include <linux/sysctl.h>
# }$ w: j8 h, k: ^* G" q; ?$ W - #include <linux/mm.h>
8 e$ V; K2 j/ o" h6 G: o; l5 _ - #include <linux/dma-mapping.h>7 N3 s. A: x5 j5 E
- , {8 q7 z2 n2 n6 w# D# ^
- #include <mach/memory.h>& M0 {9 Z1 W+ i, M0 W1 I( c& t
- #include <mach/hardware.h>
! k9 N z& A) A" D - #include <mach/irqs.h># S8 p7 F" q& g* l9 I) D4 s0 W
- #include <asm/hardware/edma.h>
8 Q: ~! O+ s, y S! X$ Z - " C4 ]+ g1 p8 K: [( O) C q, ]
- #undef EDMA3_DEBUG
5 D3 v$ j6 _& N& | - /*#define EDMA3_DEBUG*/5 d- D& j2 G1 V7 P
- 1 o5 {, i6 |6 w# l1 i
- #ifdef EDMA3_DEBUG
/ c( a* c G9 k# D; g: V - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
; \& |! o* \2 C. |. Y - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); L( O. a$ r3 R8 T+ E
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
2 \* q5 i: @! r- f& b - #else
2 J! F7 F- d3 N1 e# @ - #define DMA_PRINTK( x... )
8 {$ {' {! s: {; o! K: A' W$ a1 \ - #define DMA_FN_IN& F; s( Y( d* ?' |
- #define DMA_FN_OUT
% j; W3 m% l8 u( z4 e - #endif" H/ W% b; @0 _" {
- ?6 ?7 d/ I9 B1 r9 P- #define MAX_DMA_TRANSFER_IN_BYTES (32768): s7 h$ q g4 i% n2 i, T
- #define STATIC_SHIFT 32 k. c7 B# n" F# h. ^* q9 V
- #define TCINTEN_SHIFT 20# F9 _2 H4 Q+ u$ }! D- K+ ~7 q
- #define ITCINTEN_SHIFT 21
1 k$ Q5 s3 B" U - #define TCCHEN_SHIFT 220 T, L8 W, }: R
- #define ITCCHEN_SHIFT 235 H7 {# U- w: {) U1 r4 ?( h
- ) k A3 r! p, h6 M- z) g
- static volatile int irqraised1 = 0;
/ O1 M7 R5 `$ Q, C% }# {1 Y - static volatile int irqraised2 = 0;% T) p% e: y3 Y0 o8 Z) B2 z
! z' Q* ?( q( `$ B- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 D. O; Y2 Z* I7 b' D7 A) k - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
q- i2 X/ Y+ i1 q1 _* L - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 O4 J' H# l8 L; Y
" X& _0 l. b; @- dma_addr_t dmaphyssrc1 = 0;
- U/ L* X W H2 P& n - dma_addr_t dmaphyssrc2 = 0;
, V' n! Q, y1 c - dma_addr_t dmaphysdest1 = 0;, A8 a- b& u2 e: g, w$ x
- dma_addr_t dmaphysdest2 = 0;: U+ x' Q. q" ?( j$ O4 [1 F
! Z- ~ _8 d, ] W3 r. f6 c- char *dmabufsrc1 = NULL;) N" g% y# Q3 k, u- c# y: V h
- char *dmabufsrc2 = NULL;% Y; F9 z6 s- B m
- char *dmabufdest1 = NULL;
3 M( u- C; T; I% l5 w - char *dmabufdest2 = NULL;: }- H. T0 b9 L H. ]; @* |
; A! B, W$ c( v1 g- static int acnt = 512;2 g3 {4 x3 j2 Z5 Q; P1 h( M
- static int bcnt = 8;
8 r7 G" T# T8 ]6 ?4 u( t - static int ccnt = 8;
8 N* |. v# E6 t3 @ - : A9 P y7 D9 m% E; I. W
- module_param(acnt, int, S_IRUGO);% y9 Q- g8 ^4 C5 a6 i
- module_param(bcnt, int, S_IRUGO);# {; s5 {5 Q; n+ M: ?) L' z
- module_param(ccnt, int, S_IRUGO);
复制代码 J' g8 E2 C. R8 P9 p( W
0 I: u; ]0 k5 _ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: M! a6 j% f garm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, y; |6 I7 F/ t3 ^- L
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 a8 F# n/ j$ b! h8 X& w1 k
$ R- j5 Q: l5 C/ C: p
# Y& A+ F; X) n& k3 `% ^0 u |
|