|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ Z! t# s9 b9 ]8 O6 T- [code]EDMA sample test application; A) X! r' d8 ~! Y
- /*; Q0 C+ C: {, y) s
- * edma_test.c
9 {' u3 b8 x F7 Y) i- f7 K2 ~$ | - *
0 {* O8 |5 e4 K0 S, y9 l - * brief EDMA3 Test Application
. i/ @# Q" v. _; s1 S1 } - *
7 E" Y! ^$ M; |. L& R" g - * This file contains EDMA3 Test code./ A# Z* F6 t# E" n( i+ f m- J) u
- *2 }) X4 {; t9 J: H5 [+ R
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
- ]( h4 Q: [# R* T* ~ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
* ~+ }7 r# V& B- t5 T: o$ d9 j u0 c - * TO CHANGE.
5 o$ S/ W, E) ~+ Z5 `5 @ - *; I# v4 c" \: \) |9 ~ o
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
, r+ ?4 S2 g5 v6 ~ - *
) @) N; i# W/ G" X4 K: P) G - * This program is free software; you can redistribute it and/or4 a. {# _) \. D) U |
- * modify it under the terms of the GNU General Public License as; V3 i2 a: F, U
- * published by the Free Software Foundation version 2.3 _+ {% w* T; L7 Y( ^' E( y
- *; c# e( I( d, T4 i
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any y! v4 K; @; M: M/ l! n y% `
- * kind, whether express or implied; without even the implied warranty
$ Q r( A+ F# T9 v5 o4 R M - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* Q3 K% p! m/ ~$ h - * GNU General Public License for more details.# d4 s2 i+ X( J, t W+ W
- */
6 m0 d+ r# J6 X* P3 {5 G/ N! n" F/ n
! R& t! p3 T# ~: `- #include <linux/module.h>/ S. E3 x8 t' @, |) a! W: {0 n
- #include <linux/init.h>
8 f/ m4 ]) C& _ - #include <linux/errno.h>6 k* p8 X _/ d8 S C8 ^3 Q S
- #include <linux/types.h>5 i& A" q t8 |: ?
- #include <linux/interrupt.h>
) l$ p& u! j' h' }5 a - #include <asm/io.h>
9 U6 r& T8 b( p! _2 u - #include <linux/moduleparam.h>
7 F7 K7 X; ]0 r6 W; l# B; E - #include <linux/sysctl.h>
- G8 F2 e5 K( v- U0 K" {+ n# y: M - #include <linux/mm.h>
) @( ~ q1 v, c2 | - #include <linux/dma-mapping.h>. c0 T- s+ v9 ~6 _
3 ~6 E2 x |7 h; ]6 X- P0 P% d" @- z- #include <mach/memory.h>( m" Z( e$ [! R
- #include <mach/hardware.h>& |1 {0 K. f+ g4 U* n4 b8 e8 i; Z/ i
- #include <mach/irqs.h>
) I6 ]/ M4 ~; x5 P - #include <asm/hardware/edma.h>7 i* J$ [# w) m4 d
- # Q6 R( ]6 V; B5 N: N0 b% k
- #undef EDMA3_DEBUG# `7 d) A2 m7 d
- /*#define EDMA3_DEBUG*/
3 T$ O. B4 X* G" W/ y8 E
$ C% @, B9 E( z' c- #ifdef EDMA3_DEBUG
7 ^. [2 R6 ]1 F* `% B- L - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- Y+ L! j5 A1 @+ M$ q" P
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
& L! ]8 d/ H0 y* F# l/ n - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
4 r7 g6 x- w3 ]: P1 K5 z6 Y# v - #else8 v" f% u8 \/ b5 Y. q, V
- #define DMA_PRINTK( x... )/ [2 m! U1 ]4 k* c
- #define DMA_FN_IN
% h* X4 k0 s1 R - #define DMA_FN_OUT
& a l. ?+ l! R0 X - #endif9 `& s0 B5 ~$ `7 i; f
0 W7 \9 L. l5 l0 b- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
. d& F0 Q# k2 @- V9 n - #define STATIC_SHIFT 3, l: X [# j2 M( r8 T! M
- #define TCINTEN_SHIFT 200 W( ?( u+ l4 [
- #define ITCINTEN_SHIFT 21
, Z# h2 U ^* _/ b3 m6 c5 B - #define TCCHEN_SHIFT 229 }9 d: e% [2 C5 }1 j; O3 r
- #define ITCCHEN_SHIFT 23: `1 p: R! E9 ?) a* o
- 5 g; a% T1 o' L$ b
- static volatile int irqraised1 = 0;: j4 M6 U+ i! k8 X" q
- static volatile int irqraised2 = 0;2 D9 V- R/ K& M$ A2 U/ a
- " b& e5 ]0 P, x, y8 w6 J
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& p. D" l) E. U4 l - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 Z& Q& }) k! G9 e* d3 ?
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 R( ^9 [4 D' p( M- H8 t! S% g. f8 B - : [" p! ]1 |5 E
- dma_addr_t dmaphyssrc1 = 0;4 | q) p* [6 Z9 Z
- dma_addr_t dmaphyssrc2 = 0;
; X! l" U" a. P" X - dma_addr_t dmaphysdest1 = 0;
4 l- d: K( o) c4 Z6 A - dma_addr_t dmaphysdest2 = 0;# l! G2 D1 s0 y; p; ^! f% U! K3 `
- 7 V' z6 Z( h% j) d& o9 u1 q/ x
- char *dmabufsrc1 = NULL;
/ o/ l: ]7 V7 d - char *dmabufsrc2 = NULL;# O! R8 e( b. p1 {5 H
- char *dmabufdest1 = NULL;
. o. M4 F! L h% Y4 E - char *dmabufdest2 = NULL;
" W* h0 C# g# o- f% _$ f2 A
+ M& Z/ E3 V/ |3 p3 q- static int acnt = 512;
: H$ X* p/ ^% L2 k; J* Z - static int bcnt = 8; D5 K. U0 F. q- n; L/ ~( y& L
- static int ccnt = 8;& G+ B0 d; J# q9 i2 X
4 X7 u+ |+ J% G( ?4 ~9 @3 R: P- module_param(acnt, int, S_IRUGO);- U9 ]5 ]5 T0 f; Y, J5 K
- module_param(bcnt, int, S_IRUGO);
# w( S% V9 z9 H; {1 H9 N+ Z - module_param(ccnt, int, S_IRUGO);
复制代码
0 L+ f+ V7 |) ~9 A: u- [; z8 k7 l( o) o
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( D# N0 m0 W7 jarm-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 R% p" n/ e$ p# w( P" m; y% _ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ ~; d9 J0 f: m' u+ Q
! v$ H( R8 w- @/ @2 z
: b- w9 B, ]/ o3 N
|
|