|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 {0 e! S3 L. j. \# R
- [code]EDMA sample test application: s' [, E$ X5 a2 E: V7 j- U" W
- /*$ y5 M3 F2 ]1 w8 _1 {
- * edma_test.c
. H3 S7 H' F% C" F: w. o - *7 L0 x* ~- z1 c# Q+ D3 m* L; ?& I- c
- * brief EDMA3 Test Application
( e8 E0 u: m0 |. X& P - *
! Y# M: L5 g- M3 e3 g% R/ L# m1 D - * This file contains EDMA3 Test code.
/ H, r, n9 b# ~! R& E" ~' { - *
9 q: P- [$ p' }! S8 W - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" f$ o) {: ^5 H/ U5 b
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* i7 ^- d( @9 Z% n1 X1 r
- * TO CHANGE.5 ]6 b3 N: z7 {, E' M
- *3 ?7 i& ?' X9 N) y
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; M9 i3 E' [! V* ?
- *
7 M, A' q8 g4 f - * This program is free software; you can redistribute it and/or6 j1 m% l& Z* J1 V, |
- * modify it under the terms of the GNU General Public License as
, J: ~6 B& }( X0 J$ \) N# p* ?* K - * published by the Free Software Foundation version 2.- [8 o) ]) l! R/ C- i$ p8 \
- ** s9 k. p7 \3 m/ v9 }9 q% S3 ~9 f
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
# P" N" q$ E+ D! l7 s$ ~8 _# j - * kind, whether express or implied; without even the implied warranty3 f0 M( J: [; J# J# }; x4 J
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the$ m" X7 t, A0 A( B1 k6 K
- * GNU General Public License for more details.
3 c+ n7 C, w. \% m, P! C/ n, s - */# H& U+ W+ e' R: N
9 U' \- w: E2 g I( X/ K3 D% \- #include <linux/module.h>0 o( u8 R/ g! m* E( {( L
- #include <linux/init.h>
' o8 m) J, | j. k0 \. [! E# z0 P - #include <linux/errno.h>
; y$ f0 r: b9 q0 s& w - #include <linux/types.h>
, e8 v1 M7 E x5 l" [ - #include <linux/interrupt.h>
$ j0 l0 ^+ Y) E$ J( ~; [ - #include <asm/io.h>3 h. Z0 P& _8 l" U. [. z8 F/ t3 V
- #include <linux/moduleparam.h>
: S% Y& }" a! e( O, t - #include <linux/sysctl.h>
: o4 h, Z3 K3 C$ U - #include <linux/mm.h>% k5 K; T, Z9 \8 k+ \1 s
- #include <linux/dma-mapping.h>2 S. S9 Z& V0 o. v9 j
0 y4 P7 {# N' S/ ~" P2 q; H! n7 H- #include <mach/memory.h>$ {3 { S. r6 I6 k8 p$ l
- #include <mach/hardware.h>
* z# Q7 F! `' k# t0 S+ ?5 [4 w* ?6 G - #include <mach/irqs.h># M- Y7 ], Q! O( m
- #include <asm/hardware/edma.h>7 N8 S t8 x/ F- A
- + j8 a- |; |7 s/ G
- #undef EDMA3_DEBUG7 t8 w4 _* h4 g: b3 U3 P9 L
- /*#define EDMA3_DEBUG*/
. g) H* M! L+ w# g - , L) @4 |- W: y( c
- #ifdef EDMA3_DEBUG- Y S# v9 U) j4 ], a5 `
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
) h) C1 u+ T- m. d9 T - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
0 }- ]& D/ _5 `# e/ [& [6 b- q - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
" U4 D9 {& N6 u; Y1 M! ^3 q- J7 Y - #else
# x. v" q8 u" h! z: t! n! r- s" B - #define DMA_PRINTK( x... )
- _2 d, C* y! g6 H6 }& q - #define DMA_FN_IN
% U+ i/ z6 f# U1 C - #define DMA_FN_OUT
$ j4 D7 j. \2 R# Q; m# p5 A - #endif L: @! H8 R( k; B! f6 g& u7 ]6 A
- 1 {* ^2 p0 @9 U: d& R. N8 N; S6 l
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)* H% \# N0 R: |# @4 w, V& y
- #define STATIC_SHIFT 3
, g- F. X( u+ e9 D9 }3 Z7 P# O- O6 c - #define TCINTEN_SHIFT 20$ i( ~) r+ f/ ^' f7 l
- #define ITCINTEN_SHIFT 21
9 X, ^2 D4 C3 m u5 w8 Q+ I - #define TCCHEN_SHIFT 22
q4 |/ L: `& V - #define ITCCHEN_SHIFT 23
$ V3 M% b: J X
! G. k0 A% t/ h0 h- static volatile int irqraised1 = 0;
0 U- {8 b' `" U4 X/ b0 X! s - static volatile int irqraised2 = 0;8 ~$ m1 V$ r+ ~
- $ q: L: ?: M2 _, W- c# {( |
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: H9 ^4 D% j- f$ i* x* Q( d - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ _& g2 d* Y& f) r% X/ A
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 b# H9 ]1 w0 _% `( `! p' o - 6 N8 j3 M1 C3 v3 g# l3 e9 t: u
- dma_addr_t dmaphyssrc1 = 0;1 L3 A4 A# n; Z% i% H
- dma_addr_t dmaphyssrc2 = 0;
) \4 [/ {& I' A+ T* J - dma_addr_t dmaphysdest1 = 0;
0 O7 I4 x5 @ @8 E/ t7 E - dma_addr_t dmaphysdest2 = 0;8 ^6 N( w7 O- }# n, I$ H. k
: y0 ?5 n4 V h- ~2 |- char *dmabufsrc1 = NULL; P) |. K3 s9 k6 ~* z. U, _3 l
- char *dmabufsrc2 = NULL;& V# P9 t9 d+ x$ ?* h) g! M
- char *dmabufdest1 = NULL;
# U) i4 f a4 D# D5 v - char *dmabufdest2 = NULL;4 c; ~* s" }7 O0 o
% M+ A8 b/ Q" S/ ^' L$ U- static int acnt = 512;6 l. q1 W6 n4 @4 J6 D$ ^
- static int bcnt = 8;3 `9 T1 M3 c4 i4 B; f; p
- static int ccnt = 8;! J& M9 W6 z" p4 A" k, x
7 H5 G" Q7 S0 v- C( B( p' i- module_param(acnt, int, S_IRUGO);; l. g% ~. B0 R, V s" k. N
- module_param(bcnt, int, S_IRUGO);
t0 U$ W; q$ n( v; i- ^ - module_param(ccnt, int, S_IRUGO);
复制代码 2 i3 s: {1 Q5 Y% D' i
2 M7 x S4 c1 u O$ F$ X8 ^6 m
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. O6 Q0 G Q( }9 W+ {" _. h
arm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 B/ o: ~, h6 L; D- T
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 y4 z, R' f2 b
7 O! ~- i+ d% n) L% p) y
+ b" N7 o% s1 b. O" U. t
|
|