|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) n8 ~. M9 `, L! L* t2 Q
- [code]EDMA sample test application) K, A" h; ~1 B3 k- Y
- /*
. p% \* B# m4 K6 v. T" l/ [ - * edma_test.c
& X+ F9 R$ T1 Y( x - *
% |9 E3 j# e8 i3 X9 x1 F - * brief EDMA3 Test Application
: [1 T, s; d. _, W - *& H; @% o& j6 U I# x8 `! a* p
- * This file contains EDMA3 Test code.& U' x# F w7 R1 q' P4 y
- *+ q$ s. x8 ?4 `6 C, `* `9 _
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 Z0 B3 Q! k$ c; q; `
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* E* X8 c) r/ F: i" _
- * TO CHANGE.3 b- i( m" e7 V) F1 C: ]
- *7 a) f, B: D8 P
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
8 J: N% q7 l, }( c0 N+ V - *
/ Z. _# Y" j8 k% f, _4 |7 s9 g3 p - * This program is free software; you can redistribute it and/or: h( D S( |% G$ X3 i$ [
- * modify it under the terms of the GNU General Public License as: @+ y2 P7 G7 {
- * published by the Free Software Foundation version 2.$ {# P, C7 D# h" t0 X
- *1 d, X. C5 S" d3 M! w+ A( o
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
4 H; P. g2 \1 ]& F6 ^ - * kind, whether express or implied; without even the implied warranty- I2 ?# P( M+ r) j8 x5 d
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the, @' G# a! z- A) Y# ?
- * GNU General Public License for more details.
6 w4 O6 H4 V. `" s - */ G! m; }1 ^& Z0 D1 @$ u: t8 V
- : Y4 ~, a3 d6 E
- #include <linux/module.h>0 K4 H, p9 x, \* C
- #include <linux/init.h>
) Z0 C& q* y0 m& { - #include <linux/errno.h>
: k; A0 W3 y& ~ b2 M8 K- k9 D& E - #include <linux/types.h>% O1 w1 N# w; [ Y" G
- #include <linux/interrupt.h>
' Z4 V0 J$ R* Y9 R - #include <asm/io.h>9 a* k. |. I& m- ]# E. ~( L
- #include <linux/moduleparam.h>
$ a+ E u; k$ B- d1 h- M' _) P - #include <linux/sysctl.h>
" [+ a9 j5 v5 J# Q8 c - #include <linux/mm.h>7 L$ P6 P( O7 I' O) B+ T: M8 x
- #include <linux/dma-mapping.h>! k" Q) q! J; W! ~7 {3 i
8 ]% d7 @7 G! H- y8 r5 d7 v- #include <mach/memory.h>
4 [+ F' l" @$ ] - #include <mach/hardware.h>
' s0 l! z0 |# v3 v9 o - #include <mach/irqs.h>
2 b, x) _2 J: _. S$ a; x - #include <asm/hardware/edma.h>
4 l. j. z* z$ _" [
8 ]3 o* ?0 p$ }# \/ J+ \+ r+ ]1 d- #undef EDMA3_DEBUG: w8 v8 t- o; J" t1 _: k. {1 s
- /*#define EDMA3_DEBUG*/4 o: R* T7 J1 N7 X/ f# l1 E5 P3 B
- 1 {' N6 j' h2 P* f1 B7 u: B- H
- #ifdef EDMA3_DEBUG+ E8 K1 o7 H k
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 n5 V M1 | M5 P) ]. j# y
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 [. q' r! y$ g7 t
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
& K4 z9 p: }9 d, w) G! D - #else
% ?8 k0 P6 W! P( f2 Q2 T0 z6 S - #define DMA_PRINTK( x... )
! ]1 |4 E, Q! f" \ - #define DMA_FN_IN- ^& ^8 S- A% o; b/ L
- #define DMA_FN_OUT
+ L% v, Y A! N! U" y Z - #endif
) n6 \ y# H( n }1 ]4 |- n) `# F - / h: U( X3 \) `9 b# [& Y1 P
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
& `% Q/ e: B! ] M' E2 q - #define STATIC_SHIFT 3$ m* x9 w9 O$ Y
- #define TCINTEN_SHIFT 20+ M7 q8 c. v( ~4 Q
- #define ITCINTEN_SHIFT 21 F+ M% b, C3 m; {; c1 m
- #define TCCHEN_SHIFT 22
' `/ @! f/ k7 p6 f# d% R; a! M1 X - #define ITCCHEN_SHIFT 23, ^1 {+ h3 c$ \2 p; _7 D
- 8 L9 O% d0 G, U& r
- static volatile int irqraised1 = 0;
( f+ }* D2 i8 | {0 M1 H - static volatile int irqraised2 = 0;
$ }( z. k$ O: q! `" O - 4 v1 L! z, K% K+ n) _: u: |
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. m! g* l% R* |+ z - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( a& O! s" D. P* } - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- L `* `- |1 N+ X
A! G" H* I/ v) J* V' R) n4 U- dma_addr_t dmaphyssrc1 = 0;1 Z4 `5 ~- z ^* x
- dma_addr_t dmaphyssrc2 = 0;
K4 ^5 ]3 h" ` - dma_addr_t dmaphysdest1 = 0;
. E& C3 d' r' i - dma_addr_t dmaphysdest2 = 0;
- k! z3 B" ]2 v W' K- } - * m5 ?! o. y* M R
- char *dmabufsrc1 = NULL;
# }1 Y1 i! ?" U6 E - char *dmabufsrc2 = NULL;
( d' |' j5 \! M' N6 s" w# D - char *dmabufdest1 = NULL;
+ A5 ~/ M, p$ r* @7 r - char *dmabufdest2 = NULL;
% X* r0 A: [! Z! a
0 u# q7 \0 m9 `) W3 s- static int acnt = 512;
/ g& K3 F5 S0 y: D+ W6 P% e - static int bcnt = 8;
$ | D# y" `3 p; ?2 G3 \+ d - static int ccnt = 8;
/ v3 X( G4 c% p9 T6 P4 }& U' V
, t) j/ Q- l Q& N- V! f8 y3 u8 G- _- module_param(acnt, int, S_IRUGO);( G8 I/ m$ x S
- module_param(bcnt, int, S_IRUGO);8 h( G: Y* o( \
- module_param(ccnt, int, S_IRUGO);
复制代码 1 @0 F7 k9 }+ L
- C n+ z/ j/ r5 T$ j7 Q j% o1 @- l 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) O. \! m4 Q! O
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 o" v9 S6 Y) R3 i" V
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。" t/ A) w2 }# e& n9 P6 Y, u/ Q
* t0 `! o" L( d- v5 H( U
7 O9 [3 T" b4 s/ D |
|