|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & e% ~1 Y7 Z2 [" X' k# B
- [code]EDMA sample test application- m; m: D" E0 u# G4 F: T7 j* {
- /*8 R/ P/ d J! B
- * edma_test.c+ ^# m! u/ X; \! R% A- Y
- *# A" p# o# A" m) q
- * brief EDMA3 Test Application
& O0 T/ z/ P3 V8 P' R, a - *- n; n/ f2 z& Q( o- Y$ r! M1 R
- * This file contains EDMA3 Test code.
( r l- ?! O, r - *
* E4 l, |3 l h \0 l - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
2 h7 Y. k D: p$ V - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
) U. V$ t/ n% j7 M - * TO CHANGE./ P6 G- w2 _* h9 s" P. O
- * V. x: r1 d9 S" x2 V0 S4 g d# G
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
$ _7 V. t0 U! i+ h+ _ - *
4 H a" p5 D! ]+ Q+ B - * This program is free software; you can redistribute it and/or3 ~( B- E& v5 Y* C3 \8 b( `
- * modify it under the terms of the GNU General Public License as$ k) j4 c5 `; d$ r
- * published by the Free Software Foundation version 2.7 V ?# {1 Y! \: S+ n& H( _+ X/ r! G
- *) [9 l7 U/ I0 u% P$ J: G
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
" [4 o+ b4 O( B( \# p9 n# i2 P - * kind, whether express or implied; without even the implied warranty
& h! T3 i& ^7 u9 r - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/ I O6 n/ F/ m8 G7 Q - * GNU General Public License for more details.% T3 ?, g, m& c4 }
- */5 |) |3 ?2 M' \" G
- / y" p, e& i( ^( ^/ g; T# ~
- #include <linux/module.h>
0 d4 g+ W- i% b% T - #include <linux/init.h>
) ]2 q# m8 }2 n$ J6 u8 _3 N( L4 O - #include <linux/errno.h>% Y/ ?" U$ {4 f7 p/ ]% k0 u
- #include <linux/types.h>9 t" W4 @* ~3 i) T, S
- #include <linux/interrupt.h>
! _" b1 V- U) x- [2 n - #include <asm/io.h>
, A, K) n0 s* X7 x4 I" Q' O - #include <linux/moduleparam.h>
$ P4 |9 g6 w( Y - #include <linux/sysctl.h>
, I7 h; M) G; m/ M6 n: o. S+ s8 C# S - #include <linux/mm.h>. V6 G" m. H0 m7 M' h
- #include <linux/dma-mapping.h>* b3 [1 q. g0 h
- % A! e! M- R$ j9 ^
- #include <mach/memory.h>& A+ b3 U5 g5 [1 ~8 P
- #include <mach/hardware.h>( S+ p g8 a8 x
- #include <mach/irqs.h>/ l3 h' d- [0 E. i1 }3 E( z
- #include <asm/hardware/edma.h>
r8 K* D% J: C6 R- P' _7 ` - + G+ f6 y$ Z7 N: n# W
- #undef EDMA3_DEBUG0 @! I6 T- G2 U
- /*#define EDMA3_DEBUG*/
8 {1 h; x3 b) e9 X - + D$ |6 [# o. Z: O! E1 D/ V
- #ifdef EDMA3_DEBUG
0 Z& u- X8 S) Y& R& R - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
8 @! X& `: G; s# k - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
; H1 _, }: h+ C2 f- t3 _* y2 K* p6 T - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) Q8 h% ]5 C+ V; z; i$ @3 }
- #else/ J; b1 a5 b( K# Q0 m
- #define DMA_PRINTK( x... )
7 l4 o* @: _9 S" J, g m" f - #define DMA_FN_IN
) h" k7 ~8 j( b2 A. A3 Z - #define DMA_FN_OUT
- f/ G5 o. K& v( d+ E8 C& z - #endif
3 F5 h1 Y) X/ P; _; n7 m- o6 @ N4 n
. n6 d* P9 K2 l+ b- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
# u& L9 J2 X3 l; J - #define STATIC_SHIFT 35 x) R/ s' |3 j# m, B
- #define TCINTEN_SHIFT 20! {+ G0 ]; r1 W: v1 D
- #define ITCINTEN_SHIFT 21% ~, n( Z( Z5 S8 |
- #define TCCHEN_SHIFT 22
1 v7 B. L! K) |# S+ n* [ - #define ITCCHEN_SHIFT 23
, s5 j% v" v2 `1 W/ d
5 t8 h; a H" O; Y- static volatile int irqraised1 = 0;
% K/ _6 i8 J& c+ w( E' l - static volatile int irqraised2 = 0;/ }- a5 a) S w" R" _9 c
- ! j5 H7 W7 L/ s" B8 Y( Y
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 b7 _2 r k5 A6 @0 Y! n/ `4 A) } - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 a. c, V$ K, E" d8 X0 a
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 a; ]8 V% g6 B$ E
8 Z4 W# X+ |8 o& H- dma_addr_t dmaphyssrc1 = 0;2 `3 P' G' f# R3 S
- dma_addr_t dmaphyssrc2 = 0;( O. C3 I. o O" l% a8 j; m
- dma_addr_t dmaphysdest1 = 0;
1 g8 s3 l5 V) Z" e% V - dma_addr_t dmaphysdest2 = 0;
|2 B7 o: \2 |1 o5 Z/ y7 W - # F- W9 M& e- @
- char *dmabufsrc1 = NULL;( J% }4 \$ y7 Z, L4 S1 R% t
- char *dmabufsrc2 = NULL;. q1 i C5 P& H" e" L
- char *dmabufdest1 = NULL;* ?8 p R8 D" x
- char *dmabufdest2 = NULL;8 v% Y% t; ?6 H9 k
1 l. o& Z! n* d; a0 S+ D- static int acnt = 512;( Z% [2 S! P# q1 j, V7 S8 L" C3 V
- static int bcnt = 8;
- U8 U Y7 j) b; k; U/ D3 j - static int ccnt = 8;
# ^3 E X% ]* D2 ?. G
2 z- |4 }0 @9 K X9 B3 [- module_param(acnt, int, S_IRUGO);: r- K' O5 X( [
- module_param(bcnt, int, S_IRUGO);' N# r% ?$ |" V6 @ y9 Z
- module_param(ccnt, int, S_IRUGO);
复制代码
2 S0 ~! W& Z/ u3 `; Z& l5 t( Q& C8 f7 Q5 v/ F( k& b
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: j" N, `3 v* O5 ]
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 v K8 S) R! o, Q
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# K$ b5 H7 \2 i0 B( f; c; P2 k$ B: R; Z+ l9 u
; w. H9 J( ^* E, p# h
|
|