|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , ~: P2 m0 A5 G8 S! A1 A/ t. k
- [code]EDMA sample test application! X& ]% D) n5 G
- /*) z& W- ]( i4 X1 s% P, q/ w8 W
- * edma_test.c
9 ?2 ]1 `4 Q4 S" m/ g - *
1 w9 f% {/ Q+ K7 ] - * brief EDMA3 Test Application0 I+ O" D/ h, z" K5 k! E' y; ?
- *
: u) e8 a. F0 [8 G8 M5 ^9 C - * This file contains EDMA3 Test code.7 O7 u+ Q3 s1 }& ?: s" t
- *$ Q# b! j# M5 ~) n+ R
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, A7 v/ b ^' _2 y5 J" D, j) I
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
# r6 f' p+ P, b, {, x - * TO CHANGE.
, L' c) g* B4 k - *
/ P1 G7 X) _$ l$ U9 ^ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* d! I; D: d9 n$ B/ I
- *2 q0 n" t8 E+ u; s5 f o
- * This program is free software; you can redistribute it and/or( f9 o& z% P" A# }0 W
- * modify it under the terms of the GNU General Public License as
* s& X' R2 z0 ]! k% w& v* n - * published by the Free Software Foundation version 2.
) e" A% }6 ^3 c* B ^/ {4 j; f - *4 j! U! @( i$ a: Q! x
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 y6 L& J) k `, c
- * kind, whether express or implied; without even the implied warranty
. K( m! h4 P: B1 I - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; D! f B" V3 W& Q% |" k. T - * GNU General Public License for more details.
1 L8 Q' f# c/ I' G$ L, L - */
! B+ F+ d3 E% ~/ C& W+ p e! @7 t4 A0 [ - 2 F6 Q! b2 [: H. e4 A
- #include <linux/module.h>
6 [' f0 z" q5 Y - #include <linux/init.h>
9 g e' h" k0 Z2 I; V- } - #include <linux/errno.h>
( P! Z% W8 |# {- g - #include <linux/types.h>1 n1 z+ {4 U5 T
- #include <linux/interrupt.h>
3 F" N7 S( {% t% K+ h2 ~" ~ - #include <asm/io.h>5 a' l6 h7 `/ V
- #include <linux/moduleparam.h>- m6 I8 N1 T6 n6 b
- #include <linux/sysctl.h>+ t7 ]% h5 H- u5 D+ ~
- #include <linux/mm.h>
7 C6 h# A2 U" [ - #include <linux/dma-mapping.h>. w* P! C* p2 ?. Z
- 9 D, C5 M: f- o+ Y+ y# t- p: |# B
- #include <mach/memory.h>8 S9 T4 d; e6 Y( E) \6 c% v
- #include <mach/hardware.h>
' Y' E$ @7 N @# i0 Z0 k - #include <mach/irqs.h>5 Z4 s v2 d% R" R
- #include <asm/hardware/edma.h>) Z3 H2 C% A1 F- D& D9 Q( Q
- 7 x7 g/ ?% d6 }* G6 M: ^1 L, D0 G
- #undef EDMA3_DEBUG
" a( @) ]- q; W3 F. c4 G - /*#define EDMA3_DEBUG*/
* j5 c" z+ t2 ~, ]$ }8 @6 E
" N4 l7 o9 L# D- #ifdef EDMA3_DEBUG
) R2 d, ]+ Y- K8 O2 N! N - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
4 c% z$ F. Q4 d$ k& O' A - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# X! H8 O* K2 i; r" j
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ W, L- m& R5 t$ Y7 T; j2 b
- #else$ E" ]* `! l: L- m% [0 A
- #define DMA_PRINTK( x... )
L. ~3 S8 d* a0 e$ q. u - #define DMA_FN_IN
; A& t2 `% _) m - #define DMA_FN_OUT
6 y7 d; n4 Y6 H/ J9 v3 L - #endif1 B) T+ G( S4 d! ?' [# B
- ! m+ ?3 K; P8 _; N: H
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)2 A0 R6 A: }6 m) _/ f, m# B% Q
- #define STATIC_SHIFT 39 f9 t# m. H( p
- #define TCINTEN_SHIFT 20( D' }2 a$ D9 u
- #define ITCINTEN_SHIFT 21
, g* R9 h7 v; g - #define TCCHEN_SHIFT 229 D' A# s7 ?( V7 G4 b4 x
- #define ITCCHEN_SHIFT 23
5 ~7 i- c* w& k M1 |( Q. ^9 f" d - ; ~$ {1 C8 a7 j: a: {& z
- static volatile int irqraised1 = 0;( M; ?: x' E+ X! h% f- A
- static volatile int irqraised2 = 0;
0 U- I/ s0 h6 A; c; ] - + Y/ V$ A' @3 Q C' O4 r' |& o
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, h& s) g) v+ u# e( B$ G! N - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( u; _, `& n& t
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 o- H; m' E" g" G
0 s" I8 s6 A4 j# x5 P- dma_addr_t dmaphyssrc1 = 0;
3 e$ {! D: p: ? - dma_addr_t dmaphyssrc2 = 0;
: w/ k k# P0 z3 |( e# x - dma_addr_t dmaphysdest1 = 0;5 r8 t. h$ _; I" S* M. c# Z- z" H
- dma_addr_t dmaphysdest2 = 0;6 {" h( w/ G( b: i" L$ b( O
- ! e- `& e# \6 d
- char *dmabufsrc1 = NULL;- S. Q6 v5 ?1 a1 T/ ?
- char *dmabufsrc2 = NULL;
! T$ Y6 G* Q. [( b% P - char *dmabufdest1 = NULL;
# y) H5 _: f B - char *dmabufdest2 = NULL;
* J" w7 F9 S' l4 Y" M5 I& o
. }" p( w1 }# f% H- static int acnt = 512;
2 ]: y+ p( V7 u1 A+ ]# ^% P9 U - static int bcnt = 8; t0 S' Z. X: f' h" [+ U; _
- static int ccnt = 8;
% J6 r9 v5 s: ]. O7 U, _4 P
& b, e/ i# `: d- module_param(acnt, int, S_IRUGO);
5 R6 O {5 r; m+ c# b) G - module_param(bcnt, int, S_IRUGO);
9 H# e) f7 p2 |: [+ | - module_param(ccnt, int, S_IRUGO);
复制代码 1 ?% ?& \: e' S, f+ c8 u$ H" Z5 i
* ^8 G0 h1 K1 k- w( R
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* _. H7 d B: `2 j- d* i
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ E$ d3 i3 m+ |( ^( Z9 w+ E2 B- o
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! H9 E. M, q. L1 g, U3 A' q
2 q* L9 C2 r+ A) L3 U( S0 v' s9 A
2 N( A* F) G( |; F2 F |
|