|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ ^3 w8 W4 Y# f) S" `4 p1 A$ [- [code]EDMA sample test application6 g" P/ i" {! ?% t# V) w" R
- /*: L. f: k$ I: q1 b: N
- * edma_test.c
! y8 C0 Y8 W4 y; |( V! A. D - *2 t% \' i$ H& ] o! L" ^% |
- * brief EDMA3 Test Application# [2 c0 }5 D$ h* `* J6 r
- *9 J5 ?, ~8 j1 s' z% n. j9 z
- * This file contains EDMA3 Test code.
# f% G& w" V2 h* L - *
, }+ t' c, B' v9 r5 l, H - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
7 P* N+ a# K* V3 A( G0 D2 ] - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 u5 A+ s* u" D) l
- * TO CHANGE.
, f3 _% j9 ]6 W: S4 H+ z% D1 Z x( `6 Y - *! y" I* t' ^, `
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' N$ x6 N! l7 e" T# L6 q. _
- *- G& q9 d* @: y" |9 u4 X
- * This program is free software; you can redistribute it and/or4 v# n1 @! f% \8 l9 Y
- * modify it under the terms of the GNU General Public License as
- h9 ^3 g, [$ t$ ^6 _& h4 O - * published by the Free Software Foundation version 2.' C3 Y P- a. G7 T
- *
5 c8 b+ x+ v4 f! i! K% G) u - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
. \$ V: f1 J" C4 z [7 Q& C - * kind, whether express or implied; without even the implied warranty
6 A T5 N( o/ F$ |" @ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the& p% U+ E/ U" @* R, d8 w6 q
- * GNU General Public License for more details.
0 t( p- E: X) J1 P$ l: \/ S' f0 i# V - */7 f) \8 O j; r7 Z: _. Y1 i5 a
# x0 C8 g! Y/ |; {! X/ k2 Q- #include <linux/module.h>
y: z7 O: a# d/ o - #include <linux/init.h>" t4 s* k6 V Q; @; y1 ~0 b* N& H
- #include <linux/errno.h>
% f& U& f) f& |2 j! a; ]- T - #include <linux/types.h>; U2 M6 q9 F! t# f8 T" V' g0 c
- #include <linux/interrupt.h>6 g5 y: _4 [0 U7 g* T
- #include <asm/io.h>: \2 V! h! u) d, L$ f
- #include <linux/moduleparam.h>
O7 q: z9 q j6 Y+ u, B3 } - #include <linux/sysctl.h>
, I- ]' ?& a2 K$ [$ t - #include <linux/mm.h>
" U, V+ u) Y: d0 S, u - #include <linux/dma-mapping.h>
; a2 ]# A: U# u
/ N5 m$ U- x* P, k) J- #include <mach/memory.h>
* u) q/ z) R8 J0 } g - #include <mach/hardware.h>2 G" b8 y( P: c% {
- #include <mach/irqs.h>% D0 N* T8 \! V8 M4 D3 f
- #include <asm/hardware/edma.h>5 E2 i% c' c9 \2 d5 }, v
& e. c: `$ w# u# Z+ l1 X/ T' z- #undef EDMA3_DEBUG+ F! R: l; I; B2 ?
- /*#define EDMA3_DEBUG*/) R' s( z8 i' D6 ^
- 1 C! ?% }. G# Y: Q, Q7 T. G
- #ifdef EDMA3_DEBUG3 d/ v+ ^2 o% {& ~ \. B. }( M% v$ K' |
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
$ W( V( E2 f2 C* w8 I" R) u% [ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
+ o: N( S! E. ]7 Y - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- V$ }7 L& z: {, K
- #else( a& c3 [- t) k( a4 h+ v' K. e
- #define DMA_PRINTK( x... )8 f- i% j, g' W9 p: c: J1 G- g% p- ]
- #define DMA_FN_IN5 \0 E' n. h, {' O% [# I; r
- #define DMA_FN_OUT
' W# v" _( L) E6 p - #endif
) G8 i2 x6 ?" ~# ? - 2 ]7 w% U; }3 S
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)* K8 Q" p, x" ~. z! i# G6 [
- #define STATIC_SHIFT 3
1 F: z& D$ l h- M1 V+ d - #define TCINTEN_SHIFT 20
( `8 @ \3 u t& p - #define ITCINTEN_SHIFT 21$ _. E2 J6 s1 [9 I0 N$ p
- #define TCCHEN_SHIFT 221 C$ ^9 _+ n, R
- #define ITCCHEN_SHIFT 23
) F3 n/ C) f) e, G7 K9 B" a/ ^; e2 L - . \7 }2 M! s7 \1 H# @3 \& z4 ~
- static volatile int irqraised1 = 0;
' C9 {# {* c/ d! C6 a - static volatile int irqraised2 = 0;5 o- L5 J$ ]$ w% e9 z9 n$ l
- ( {6 [, }: \, }6 J; z
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% T2 q1 E+ z4 d" z) P( C& p
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ _" I; a, C3 c) j - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( j- ]1 H' Z6 O* d6 F+ C: R
8 }& l! W5 [8 n6 z2 `# d( s- dma_addr_t dmaphyssrc1 = 0;
3 a5 ^6 G/ g5 N0 w/ w - dma_addr_t dmaphyssrc2 = 0;
3 l4 U$ h0 q6 q- E2 G/ x( z - dma_addr_t dmaphysdest1 = 0;
~. N- q" O( K# D6 l' O8 e - dma_addr_t dmaphysdest2 = 0; v4 a( f/ c0 k O7 t" V2 S. f
- 0 i- Y: h7 [+ G* Q& J0 b
- char *dmabufsrc1 = NULL;
, I) ` [; D& i9 A3 K - char *dmabufsrc2 = NULL;
/ |. }% _, S, R - char *dmabufdest1 = NULL;
1 E1 F5 ^3 X) V D. `4 ] - char *dmabufdest2 = NULL;
- @' t) p+ B, Y' ?7 |* Y- F& \
/ b+ j, K8 U$ ?2 R+ e8 o$ }* U- static int acnt = 512;( D3 d; l$ ^' J* @! }, m$ j& \3 L1 G
- static int bcnt = 8;
; h9 X9 ]9 e) c& ^- M - static int ccnt = 8;
4 T$ E# V$ Z6 u# j! _( D" i/ h
' w: @% x& `* k0 |$ t7 |/ b8 H$ x- module_param(acnt, int, S_IRUGO);
/ q$ M0 w- p1 W" P& C( A - module_param(bcnt, int, S_IRUGO);
6 _8 y9 B' R6 p* l% ]9 { L - module_param(ccnt, int, S_IRUGO);
复制代码 5 Y* \, G% H% S: J+ G& W+ `
% \' D; o9 Y: _ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
9 U( X; c$ y! \+ F/ L: ~) Earm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! o4 k9 ]7 `3 ]5 j2 L 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" ^) M; `9 z, u4 v9 ~8 l" w% [2 }3 g) ]2 [+ K
. f2 W/ U' Q" o7 t o' G2 } |
|