|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 `6 C$ ]- l" Y* }% Y: T- [code]EDMA sample test application. r6 ^, `9 O. `0 H
- /*+ E2 M! M5 M5 r' U
- * edma_test.c" L G% H4 N# e, b5 J
- *
1 Q1 u _, U: `/ f; m# l - * brief EDMA3 Test Application, V6 N0 z, b4 u; a- ^" S) N
- *
3 D( j) }3 N4 O" C3 f - * This file contains EDMA3 Test code.
/ q+ y. ~; O& @% } - *" i# F: a/ `; \4 _
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, V1 l* i4 Y0 }; n0 `( [ L
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
0 U5 R+ Q# C7 p+ a& b P - * TO CHANGE.% H( e+ c; k' c( A3 v
- *2 S# N% P. n8 e- \) |8 I0 j/ @1 C) f
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 X2 l6 i- m9 v3 Q/ l
- *
" V2 v% p) I7 N5 ?0 P- b - * This program is free software; you can redistribute it and/or! w, o- T4 D) B W: k
- * modify it under the terms of the GNU General Public License as# g* g0 c) x5 S& t
- * published by the Free Software Foundation version 2.0 ~; T7 H1 ] ?" p1 \# i
- *
& N% T( ^* ]" @7 y5 Z - * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 v( o8 H7 }+ j2 F4 \" I
- * kind, whether express or implied; without even the implied warranty6 i# Y, k. g4 ?, D9 p
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
' V1 U* z1 I! f - * GNU General Public License for more details.
% l ?. ^1 t1 A! N2 H3 Z+ p - */
8 Z+ d- h( n+ g& O, v - & t, M4 p) K! b. A! y7 l0 U
- #include <linux/module.h>
4 b! I4 T4 y$ \& h- P5 z! C - #include <linux/init.h>! E) [+ H# K2 ?) c
- #include <linux/errno.h>2 T. a: c0 q7 Y& [) m3 l2 ?
- #include <linux/types.h>& x, _; w1 ~1 Z, w: U3 c! s+ F
- #include <linux/interrupt.h>
7 v7 t% |- L/ e2 s) u& v/ ^ - #include <asm/io.h>
" q4 q# B' I5 @4 z/ v- P; J$ [ - #include <linux/moduleparam.h>
" V+ u$ b2 O& e T/ ^1 t e) U - #include <linux/sysctl.h>
9 J% l$ D( \* \' H+ X - #include <linux/mm.h>+ i# w7 I k* w: w: o- I3 t$ n
- #include <linux/dma-mapping.h>
: G6 e* y6 y; M
1 Y8 k1 O8 m0 ~$ E8 d& q- #include <mach/memory.h>
' G* F8 n T- o1 _" F$ Z6 y c, |! O/ V4 p - #include <mach/hardware.h>: u S- r# i& B" m2 j# G8 F3 Y
- #include <mach/irqs.h>
- S7 Q- @! v% s! T: f9 r$ T1 A& k4 I - #include <asm/hardware/edma.h>; n; ]% n* t" C n; ?9 |/ D
; X% }) v2 z: Y- #undef EDMA3_DEBUG) W" f% P- E1 k+ W
- /*#define EDMA3_DEBUG*/
' R# s" G* c/ u/ j - + c& N# T! H) a# B, K* s+ \6 |
- #ifdef EDMA3_DEBUG
* Z% ?; g7 W- x' C, A1 L - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
2 F8 {- y" `2 }( V3 g j. j - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
2 g4 T9 D4 ]8 |8 u - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# o! ]% t5 |" B3 c
- #else7 e9 h* ~) y, |8 F
- #define DMA_PRINTK( x... )
3 ?% v6 M1 j$ z ? - #define DMA_FN_IN
" P8 Y S: k _; N! h - #define DMA_FN_OUT
& l. s' R* Y& X: ]4 _ - #endif7 B5 X l9 L" L
8 j! s: _& v9 G- #define MAX_DMA_TRANSFER_IN_BYTES (32768)- r8 C/ e, N0 s4 J% s) V
- #define STATIC_SHIFT 3
9 q1 b3 [" [/ T1 b4 `% b- } - #define TCINTEN_SHIFT 200 s& i1 B2 G X' n( u$ u* ?8 |
- #define ITCINTEN_SHIFT 21 U: Y* l+ M7 v1 t) n
- #define TCCHEN_SHIFT 22
( v& I3 N. @7 @ - #define ITCCHEN_SHIFT 236 e6 q# v5 h( a/ Z% g$ T8 K
- 9 a; b% V# I) Y/ }5 r
- static volatile int irqraised1 = 0;/ _% X n" [ c( ~. E( w7 ]
- static volatile int irqraised2 = 0;; b( L# D1 v! T
- 3 x' {0 e2 U9 \
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( c7 H- A& Q% |$ n/ `$ ~ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' q7 r( a% Y0 D6 I, O
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& f" |: v4 G7 J# s
3 o- U2 l- `6 C& S4 x) ^- dma_addr_t dmaphyssrc1 = 0;
) e2 m- D9 E0 F( W9 w# T - dma_addr_t dmaphyssrc2 = 0;7 j4 O$ H3 P% c( @& }5 r0 M
- dma_addr_t dmaphysdest1 = 0;
/ Q# J6 i7 r6 q3 q( N/ z6 z: f - dma_addr_t dmaphysdest2 = 0;; X! q8 Z' v6 ]. u1 X$ f( t
- * S* p# ~0 X3 f7 }+ c! A, _5 J
- char *dmabufsrc1 = NULL;$ X5 x) V J8 k, U. A2 S+ ?
- char *dmabufsrc2 = NULL;
7 m/ Y' u4 ]+ z6 K - char *dmabufdest1 = NULL;( A7 y7 z' x0 V" h
- char *dmabufdest2 = NULL;9 p9 `9 t( v q' C+ V0 J2 H
: N# _( y6 v/ p1 Q6 s/ t* i- static int acnt = 512;
2 g; D# A2 b+ Q, o+ z - static int bcnt = 8;) r% p4 p. G, o' c
- static int ccnt = 8;+ a8 M: z8 N, a- o6 p( T0 Y! a
( s7 d+ Y: P6 }* |2 W- module_param(acnt, int, S_IRUGO);# x* S3 k0 e) x6 ^+ R. P ~" F$ ?
- module_param(bcnt, int, S_IRUGO);6 f; v$ `/ [3 c5 z# }& J0 J
- module_param(ccnt, int, S_IRUGO);
复制代码
$ ~4 T" E4 F1 L/ {$ s5 b2 L3 g8 y2 o+ G: ~
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 ]6 S# L0 N) @
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# F; E3 J# x- ~
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 U5 c" L: i% X8 }* [! b
/ O; e7 l3 O9 M! r4 {7 h% {
) B. F8 A5 p! n% k) G |
|