|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! D% ~) l+ ] ~% N) O; y8 v& _- [code]EDMA sample test application
- o, v0 Y4 _; B2 } - /*9 O: K5 `5 v6 T. b' j8 M' Y) G
- * edma_test.c& S. z; m: R: f( k. L M
- *
3 I* x: x3 B& Y& D5 j - * brief EDMA3 Test Application
. e2 Q% f t- Q( G - *; ]! A+ G2 x2 J- {
- * This file contains EDMA3 Test code.
# w3 X4 N+ \& g2 u% r - *
/ q: d6 U- Q! w; @ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
* z. l* s* M1 h) L( n5 M8 _0 L - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
* a. k) D9 c) E" Y- B - * TO CHANGE.
5 a2 Q1 e3 ^! Z' k) V - *
b( _' d3 b$ Y2 @1 n4 k - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
Y' F4 Y* S4 m( \, A' ^; [6 T - *
+ \2 [8 R! ` D - * This program is free software; you can redistribute it and/or0 ^; H0 M8 J5 ~8 U H
- * modify it under the terms of the GNU General Public License as
7 ]# }% D6 m' P/ Y B2 U - * published by the Free Software Foundation version 2.
/ _- m; v: V1 G2 G0 G- G1 D - *
, ]. R" x# d1 u+ H - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ x, M$ e K! @' I - * kind, whether express or implied; without even the implied warranty
- { ~& R8 [4 a8 J$ W: w - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
$ @. b/ y8 Q3 J8 B7 R4 P# P - * GNU General Public License for more details.
0 X, V3 O N3 h7 f, `- V5 t - */& J) \% V# w+ S7 M. ~
2 t4 p8 Y, g& J% u- #include <linux/module.h>% l8 y' R& K8 e) r
- #include <linux/init.h>* @1 U# u0 G+ \. g
- #include <linux/errno.h>
$ b- U4 M' Z+ ^0 x( o" |8 H - #include <linux/types.h>
! N/ X. r* {. b% w ~ q3 M) U - #include <linux/interrupt.h>
! b, o5 g+ S. Z9 N p0 H0 a - #include <asm/io.h>+ u8 c3 c8 H- l. Z! t0 { O% R
- #include <linux/moduleparam.h>
, ] X3 b& [# t1 k2 a d - #include <linux/sysctl.h>" }- f5 D8 V( Z6 t# C
- #include <linux/mm.h>+ j* a; l2 I6 E$ ?. d2 n& n; Y
- #include <linux/dma-mapping.h>" g' X% A4 @% v+ i- K
9 g8 o: T* g5 ]' y- #include <mach/memory.h>- f2 L; J0 P7 v0 g% y4 A1 F" A
- #include <mach/hardware.h>! n) i& d( O r
- #include <mach/irqs.h>
5 Y+ N" z6 ~: d& H) f$ v - #include <asm/hardware/edma.h>( w. Q2 D" }( B' B3 n4 |
( H, h2 S6 F L8 w- A8 |- #undef EDMA3_DEBUG e {' v& p/ d ?
- /*#define EDMA3_DEBUG*/
; h( n0 ]& G' J0 p/ R: N7 X& V
' o4 h* a1 n6 b+ d) t- L d$ T: s- #ifdef EDMA3_DEBUG
) \# C1 O- C( C: \9 a* F+ R - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# B* {2 V# o/ X: M
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
! g& [' t1 ^, Z; t$ `$ E7 B - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- C% m/ y; G# L( k
- #else
2 ~3 X' x W3 |6 v5 Z6 p - #define DMA_PRINTK( x... )$ x5 \5 B0 b" n7 w' D
- #define DMA_FN_IN6 i% x2 L7 T4 }# d- l" t
- #define DMA_FN_OUT( G* B% H+ N# n( g
- #endif R/ O! ?3 ~) G3 y" B6 {: S9 q. `' p0 T
- 6 o! u+ _* N; {% G1 `/ h
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
' @/ f' }8 q7 n8 a6 H$ @ - #define STATIC_SHIFT 35 C- |9 J7 i. c
- #define TCINTEN_SHIFT 20
' [) [, m! G0 t5 `5 S) k6 z - #define ITCINTEN_SHIFT 21
: U) O* T d7 m6 c% A - #define TCCHEN_SHIFT 221 O5 ]( |, I' W; k2 ^5 d7 _
- #define ITCCHEN_SHIFT 236 I8 E# f# B" V& t) o$ R$ ~
- ) {0 V& A. g6 \! h! \
- static volatile int irqraised1 = 0;
" F4 o0 y! d0 C/ w( B! u - static volatile int irqraised2 = 0;
4 w- O B' u; E
: l/ G" U0 P9 ]; O- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ k3 ?7 @0 i- T/ K( } [) L3 M
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 {2 r8 @8 s8 M1 d8 A9 Q - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( {$ o- F8 x- r( ?& F" Q+ _
1 T6 z+ a# K$ z9 J- dma_addr_t dmaphyssrc1 = 0;
5 v' p5 q5 M! Q8 ?8 k - dma_addr_t dmaphyssrc2 = 0;! [" ?. b f |# U5 j
- dma_addr_t dmaphysdest1 = 0;
4 D$ o. G' H: }, @* F; c. U2 o3 T - dma_addr_t dmaphysdest2 = 0;. G2 k9 p1 V3 P" l9 x9 D" p
3 Y. R+ y' n2 Q7 ?, `) _- char *dmabufsrc1 = NULL;
7 H4 L& w6 z, w' V$ ~9 ]( y - char *dmabufsrc2 = NULL;/ ^# f8 W* R6 d0 B5 l# C
- char *dmabufdest1 = NULL;
2 h; e* L9 E% D7 M5 T4 ] - char *dmabufdest2 = NULL;- s) v: z; j& z! i6 k
1 m+ d& B8 v5 O `% w- static int acnt = 512;8 }1 N% `, X5 m$ O# w
- static int bcnt = 8;
e. u* z& e' b0 c9 j+ A. S - static int ccnt = 8;. U5 O! ]4 D3 |
! ]3 s3 n. M. h( {- module_param(acnt, int, S_IRUGO);
5 i6 m+ Q4 q" B/ z9 x) l - module_param(bcnt, int, S_IRUGO); `/ `4 @- {9 K" e
- module_param(ccnt, int, S_IRUGO);
复制代码
% S T: m$ C% U' R; ~
+ f) @7 a4 N' J9 _ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. U9 g% V9 P, ]0 \7 k; |1 M3 Q
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 `2 V: R9 [% L% [/ m0 U 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, Y- v! V# T: u! @% L
$ p+ U. k2 f6 J+ \& n% x9 a7 |, F4 k5 b* E# C0 {+ q
|
|