|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 d# A1 M$ `' S; y- [code]EDMA sample test application0 r, G; L+ Z2 I
- /*
0 t8 l2 J; l' V+ t' K0 b - * edma_test.c3 Q2 a d! N: L( R! n1 c: w# N C
- *# l2 W' a G+ U; C2 l
- * brief EDMA3 Test Application
( i7 \; Y& b" ?5 X. z6 n+ ` - *
/ | m. C8 e& q- ~7 ?0 h6 F - * This file contains EDMA3 Test code.
3 b- F) [1 N6 U5 X' p - *
/ O; }. I; j! Y - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& I+ C9 T1 J% A) Q
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" |3 @4 I6 F8 G" D
- * TO CHANGE.
* z6 |' ? E1 `. M& T1 ~ - *
6 u) W' l" Y" v7 R9 R# E - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! ]0 h: M0 g5 y+ `
- *% p, j5 R8 ?4 \5 c }
- * This program is free software; you can redistribute it and/or
' V* W, ~2 P5 h - * modify it under the terms of the GNU General Public License as9 M2 s o/ b2 @" @+ f4 C
- * published by the Free Software Foundation version 2.
P" Q Q0 J5 \ U, r - *8 w* b) u( x5 j/ X
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any. `7 e4 `0 m% z/ s
- * kind, whether express or implied; without even the implied warranty
/ \5 V5 I5 R$ i! N) ~) |) Q/ e - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1 b( E' n7 T2 S, e4 ] - * GNU General Public License for more details.
4 F' K: M" g! Q& ~7 l ` - */* M. @* ^) C6 c9 \6 F/ W
( L7 g6 j9 p7 P1 }% ]/ Z2 G- #include <linux/module.h>! h! z: d& l$ g" X/ ^3 ], A- v
- #include <linux/init.h>
# N( ^6 D( h# V K5 z - #include <linux/errno.h>4 e: U9 d9 b' e& t5 h
- #include <linux/types.h>4 c& c6 [1 O& R N8 F
- #include <linux/interrupt.h>: v4 t, q' ]" w6 k
- #include <asm/io.h>
) T0 f! T! n( N) j - #include <linux/moduleparam.h>0 k; v1 @, N# V6 A/ J: L
- #include <linux/sysctl.h>
# t& G( J0 q \. @& o9 t3 A - #include <linux/mm.h>
1 J. u4 w" _1 p6 M+ i - #include <linux/dma-mapping.h>, K0 A9 S9 |- [& v1 _0 A
. \: _! ]# ?) X! P- #include <mach/memory.h>
( e4 X8 G% S! q9 X, k* M0 j; P" ] - #include <mach/hardware.h>
# R* f$ O" ?. U# D8 F7 H - #include <mach/irqs.h>
3 L6 S9 S6 |% a& Z% D - #include <asm/hardware/edma.h>
- H. [: m$ a- t4 p2 C6 J7 O0 s - $ s& I7 I' x. r. C
- #undef EDMA3_DEBUG
) w( y2 g4 j5 f! C) { - /*#define EDMA3_DEBUG*/
3 {5 P& W; X, n3 _) s% ^# T - ( U' }9 x! R: R
- #ifdef EDMA3_DEBUG
5 l3 b/ U( n, l+ z9 P. s% d - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ R5 @- h {9 ~4 K
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" K3 v2 }3 ~8 P P
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
! {4 W9 ]4 S( ` - #else
R; E3 z6 f. ]! G" A0 j8 A N - #define DMA_PRINTK( x... )
2 e2 F* I, n0 W/ T S' a! | - #define DMA_FN_IN. L0 U1 E9 f2 w! n
- #define DMA_FN_OUT. }7 x. x T8 Y/ ~
- #endif
% u5 x0 h1 u6 G8 E, C& U
* K# l7 e$ ~& B5 E- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
( T3 ~& H, m1 ~4 l1 ^1 i$ f3 J" b - #define STATIC_SHIFT 3- P" n/ L1 X k6 k
- #define TCINTEN_SHIFT 20
" |# m3 w( i4 Y% g: d5 q. q r - #define ITCINTEN_SHIFT 21
: s+ F9 {' c. E) O& _ - #define TCCHEN_SHIFT 22" g1 z$ p6 v' ~8 n
- #define ITCCHEN_SHIFT 23* V, Z- [5 l! G+ Z! Q
- % F5 m0 W6 {9 R8 j# D/ z% j
- static volatile int irqraised1 = 0;
% u! k* _( f* I4 }# H3 r; I - static volatile int irqraised2 = 0;3 Y8 F" v# H' `4 ~. d) x& @
- $ J" y& D7 p! M! j+ M8 E
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); {8 g7 G* w+ B
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 P) Q" {4 X2 @' p - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ f$ a* @ V+ {! _& z
1 e2 a$ x0 y A- dma_addr_t dmaphyssrc1 = 0;2 F4 N2 b3 Y2 [" @
- dma_addr_t dmaphyssrc2 = 0;
3 e' l: u, J$ t& @* X3 r - dma_addr_t dmaphysdest1 = 0;, I) F2 K+ S. E4 O2 S
- dma_addr_t dmaphysdest2 = 0;; ?: l0 Z7 |3 ^
- 4 l( ^ p2 c1 Y6 E P- }. i
- char *dmabufsrc1 = NULL;- t0 V% `; j( v
- char *dmabufsrc2 = NULL;+ Q' s) j3 `3 F. k! B
- char *dmabufdest1 = NULL;
7 i1 |& j8 }9 X! A - char *dmabufdest2 = NULL;
+ O9 f& p' x/ [, e# S- O - ) m& ]2 A' B4 n% x
- static int acnt = 512;9 N3 h2 @: j) m: V& \
- static int bcnt = 8;& o7 c, d/ R7 @# A" H; f
- static int ccnt = 8;1 ?" L1 [9 Q2 q( e s) n
1 Y3 h) B2 r% }8 w9 w5 H- module_param(acnt, int, S_IRUGO);# O: D5 n- r4 L p5 _1 Q
- module_param(bcnt, int, S_IRUGO);
& i, w f* q5 q - module_param(ccnt, int, S_IRUGO);
复制代码 9 M9 \; n2 ^! s
; \- U; _" H H; K# v' _" l" a 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
_/ i! Z" e( W' s9 p; Q; @. parm-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 W/ L" l ~: G4 r" c( g& v 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 h3 f5 c+ \0 ]* _% B/ [ _5 L& J, o1 g: T
8 `$ ^+ L* S7 |2 O8 t; m" q |
|