|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 g; j( u# w0 w; f* V# ^
- [code]EDMA sample test application
/ G K, N* q, b - /*8 u4 X' u; W2 s+ [
- * edma_test.c
* ^3 ?: J0 D# Q! s* @: I, B1 j - *) {8 \4 X4 Y. B5 m! O" Q
- * brief EDMA3 Test Application5 F; H, h0 o2 ~" x. h& @: {
- *" d+ p1 h) h' V
- * This file contains EDMA3 Test code.6 V' [' e7 F' F# Z% x3 x3 P
- *
' A. A( w5 R7 s - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
( t7 Z+ W& y3 i c - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 o; h8 H: `3 t7 ?" Y
- * TO CHANGE.. |) x% X9 N8 ]
- *, n& s1 v: E. l' v
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
3 s; W8 E9 B; H+ R - *
; z8 [& u' ?, h2 R0 j4 a - * This program is free software; you can redistribute it and/or
. C0 f/ O% W4 R+ N; a% w - * modify it under the terms of the GNU General Public License as
+ V. F# }0 B7 [" y7 d- r/ M7 ? - * published by the Free Software Foundation version 2.
6 G3 k& B {2 { - *0 W& k: w. f1 \& a7 {' n
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
6 H/ @3 T/ W, c: X7 A" e - * kind, whether express or implied; without even the implied warranty
$ \8 { c' V. L5 P" x* g9 d- n. T - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
" [8 F" a5 E( Y7 ^8 w* K - * GNU General Public License for more details.' S/ V3 N) F8 s4 r$ Z
- */2 D) F: } E5 q1 c' a- [/ W! c
4 ]' Y2 Q6 w( Z- s- #include <linux/module.h>
J" G" Y9 j2 n0 i$ X9 [ - #include <linux/init.h>3 Z e+ y, Y% D, i- F1 f+ L
- #include <linux/errno.h>
1 o* C+ R8 |* C - #include <linux/types.h>* f* X, W5 ~3 X) x) {1 |7 k& w$ X
- #include <linux/interrupt.h>
5 N1 b8 G D! |4 `& U - #include <asm/io.h>
+ I! ]$ c. x% H* ` - #include <linux/moduleparam.h>/ h) R: l1 w6 c
- #include <linux/sysctl.h>
/ f- Z, N# ?& W+ ^" E: e2 x% ` - #include <linux/mm.h>$ p& b1 Y( ~2 C1 R+ @9 h! q
- #include <linux/dma-mapping.h>5 a9 b5 e$ E6 r7 O
- ) P6 x I4 s+ C x: A" k) x* ^
- #include <mach/memory.h>
! N# ]; c( Q- q/ S4 Y - #include <mach/hardware.h>
, ]+ T1 Y8 o1 T2 U - #include <mach/irqs.h>
1 \4 Q; U8 D, `8 I - #include <asm/hardware/edma.h>
' W2 }2 w% o3 L9 s9 E - , ^4 Y. d; `! g
- #undef EDMA3_DEBUG5 O" y- z* S! P9 F/ l' r4 d# R
- /*#define EDMA3_DEBUG*/
4 u `, b Y2 O8 L. B! r - + l& q% `" s. b1 z
- #ifdef EDMA3_DEBUG
3 Y5 u! A! |# f% ~( a, w4 l0 q - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
! t2 y! w/ i# D, t - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 q l% x) m- E. V0 X/ c, n3 H$ Z
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
) l6 h7 H! x. `: ~$ I - #else! O. X1 `1 f2 O' k: S1 C
- #define DMA_PRINTK( x... )
8 g" G# u* T+ C7 [ - #define DMA_FN_IN1 t/ p; x$ m v6 J4 K& z' F: L
- #define DMA_FN_OUT
+ I5 a9 ^2 R4 r! t7 V" G. I - #endif
5 \* f4 b/ X1 |0 X- V
1 \/ ]) P) O9 ~: c1 m/ v) N- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
7 A2 a1 t+ L/ ?. A. c L$ a0 `& ~! A - #define STATIC_SHIFT 3
; B0 v" y( r& L1 w - #define TCINTEN_SHIFT 20
) o( U. X c( v( b8 Q - #define ITCINTEN_SHIFT 21) z" G. t9 C+ \" b7 Q) a9 w* y7 ^7 U
- #define TCCHEN_SHIFT 224 f! \: U! Q s( k2 W/ \
- #define ITCCHEN_SHIFT 23
0 F1 Y1 J9 [/ T* h) `$ S2 E* p - 9 J0 H5 w( B5 d9 p; R- G, o
- static volatile int irqraised1 = 0;) w/ p0 {- {4 _# }6 A- |7 s4 ?5 u
- static volatile int irqraised2 = 0;$ t; w1 O, W6 }- g: |) z( ?& o
, V( h# T2 j, ]1 f- y7 v- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ J; v1 S7 r3 n- \: j7 Q& X2 v: D
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ X: n% A7 H* B/ F
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ F$ z* r. B, |* E7 G Z* X - 4 W! b% V+ E. v( ] o
- dma_addr_t dmaphyssrc1 = 0;: U0 d5 p3 u7 g+ p) D2 r
- dma_addr_t dmaphyssrc2 = 0;
- F, `! `3 U7 x# e8 Y - dma_addr_t dmaphysdest1 = 0;
2 |! ^5 j$ k% K( a2 Q$ s - dma_addr_t dmaphysdest2 = 0;
) ?; j, l: P; r
" Y1 r# T; z: F/ R( }- char *dmabufsrc1 = NULL;
* c# Y8 c! z7 K7 f+ j. ]; K* E - char *dmabufsrc2 = NULL;
1 @; v) ]6 X7 p$ W/ n$ a+ [5 A9 H - char *dmabufdest1 = NULL;# M) c3 z; G6 K! s3 o
- char *dmabufdest2 = NULL;
2 w- L% K7 |$ x6 h! u
0 [: p' w& g7 W4 R. U- static int acnt = 512;
! R7 J( H2 D7 Q# E% V; F+ i - static int bcnt = 8;" M# U% _9 f! ^# y& Z
- static int ccnt = 8;
' _: v* ~! x$ e - , o7 e+ ]5 R* d; ~3 [# g, }% d& L
- module_param(acnt, int, S_IRUGO);
* @) S# K! ]8 D; ]8 K - module_param(bcnt, int, S_IRUGO);8 b8 z3 P0 n* B. l) b, [* v, s6 Y
- module_param(ccnt, int, S_IRUGO);
复制代码 9 C H) q4 K, |
, f' t( Q9 O7 }0 k3 ] 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 P+ \' B% r; P4 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 t; Q- h4 v/ k5 K( ] 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 A$ V2 e" B% t% B
1 n7 a8 z5 w8 d% V1 q4 A
. A( }. c9 w1 p: g! ~ |
|