|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " }- N) I F! |" G- @! V( |0 o6 P
- [code]EDMA sample test application6 ?3 B) _: O- _ p
- /*) `5 F' V9 A* C/ {
- * edma_test.c' u/ O0 |7 q( `, R
- *- U* w9 o# I9 k; N1 N/ T( ~
- * brief EDMA3 Test Application( ^1 q: B$ O+ T
- *
, D5 R. l: L2 ]# a0 I- ^7 V& d - * This file contains EDMA3 Test code.& {/ w1 R) f5 i- O, a
- *1 O$ ]* N& u6 }4 A) [
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 \: C. t0 _6 \3 n
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
, F! h% J4 ^8 F! U# z7 E" D0 @0 ? - * TO CHANGE.6 w! [% U( l* p( V
- *
% `% |! n% Z% j, S - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
; g! C- W# x# o% r# N5 i - *3 Y4 |' ?2 I/ ], H
- * This program is free software; you can redistribute it and/or2 ]& B! h" O8 L# I. t
- * modify it under the terms of the GNU General Public License as# r9 A3 F9 b2 x- V c' s
- * published by the Free Software Foundation version 2.4 J" O3 x. e( S( \ I. A. R
- *& Z8 S8 ~! f/ R4 Z
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
# w( w! r7 ]9 ^. S! r$ a - * kind, whether express or implied; without even the implied warranty2 M: X9 \" c8 e4 X7 e' N' I
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4 s b1 S6 `9 X( t# B2 N5 b - * GNU General Public License for more details.( z6 v' F: m+ \/ I+ Y8 e* t
- */- ^' e1 X ^; r6 X7 j7 y
- v/ \2 F6 O* O( z; o8 L$ X* X. }7 g- #include <linux/module.h>0 W7 ~, ?( [/ T7 s3 T6 B2 g
- #include <linux/init.h>8 n8 E% G7 P- s- F* Z P9 c( B+ C
- #include <linux/errno.h>
2 a( E; \" P7 m) A - #include <linux/types.h>
2 a2 a: T) B: R2 C% X# I, `1 } - #include <linux/interrupt.h>& \% J' [' @6 ]. [$ q
- #include <asm/io.h>
. n" _! p( ~/ m4 D8 h7 P - #include <linux/moduleparam.h>* [! s$ E/ ]& B' L
- #include <linux/sysctl.h>
( {$ p# H5 }! y2 N N - #include <linux/mm.h>+ p5 g% `) m; o, s& U
- #include <linux/dma-mapping.h>
- E. @/ |) p" ^ - 1 r; e9 m& C$ c$ g" Y! J# z
- #include <mach/memory.h>
% \2 p, G0 s. }4 @7 z/ W - #include <mach/hardware.h>9 V, M! w$ R! j1 L5 M5 k
- #include <mach/irqs.h>1 p9 Z# d$ }/ I8 w
- #include <asm/hardware/edma.h>5 T0 R# g7 ?! @5 g( N7 A% C
$ H- O3 \% p6 ^: G; E- #undef EDMA3_DEBUG
! y, q; l, Q& I - /*#define EDMA3_DEBUG*/
7 G# h5 V/ C5 k
( J: |# }4 Y) F, Q9 I- #ifdef EDMA3_DEBUG* z1 B. w- U8 O; r8 X& r! u4 ?2 A- S
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 X+ n2 `! p" t% w/ C2 g
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
+ f' {. A; d# x - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 D) j# D/ E D( X$ V0 X8 _ w
- #else
4 ^# K! e7 H* \' Y' t0 D - #define DMA_PRINTK( x... )
! L+ N& A) A; q8 K/ Y) m, g - #define DMA_FN_IN
: u$ B, n" t3 d9 D - #define DMA_FN_OUT
) H" ~. B0 {1 N - #endif0 r. h: O8 K$ t2 A
- % U9 _! I+ ~3 \. a9 y4 p
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)& ?+ j! W" \+ ]% ?1 \
- #define STATIC_SHIFT 3# b0 ~% I3 c g& b4 D, p3 h
- #define TCINTEN_SHIFT 20
0 `: y- I5 c) w0 T5 D - #define ITCINTEN_SHIFT 21
9 p% @. f0 `* C" y, F7 V8 j8 E - #define TCCHEN_SHIFT 22
/ R- e$ j% D2 e. t7 e! P. q - #define ITCCHEN_SHIFT 23
3 z5 e: m1 ^; t! k0 R! s$ b - 5 x; O' W7 z" A
- static volatile int irqraised1 = 0;
8 j7 }) E" O& j. k( ]4 ~0 _. { - static volatile int irqraised2 = 0;
3 S. |& J" T1 o R) n6 ?1 b
) X' {4 `; s5 W- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" q/ x$ v) R. C3 I, u
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ T8 A3 z9 W( S7 Y" y# d
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. ?, D6 N0 ~, [, V" |: ] - 9 |# r2 b" A. ?$ x
- dma_addr_t dmaphyssrc1 = 0;. W! f# l. c- w7 a
- dma_addr_t dmaphyssrc2 = 0;
3 H* P z! M9 Z$ n7 s - dma_addr_t dmaphysdest1 = 0;7 b$ D2 F4 Q ~) A, T$ A0 d4 k
- dma_addr_t dmaphysdest2 = 0;
/ |: K1 m& Y0 p% _0 v
& a2 A: v* V8 S! p* g- char *dmabufsrc1 = NULL;
4 X- J) N, n) ]: r$ M5 H1 } M - char *dmabufsrc2 = NULL;" z+ m6 y+ u( H1 z3 k' ]
- char *dmabufdest1 = NULL;3 S5 R Q5 f# `' L' E( j
- char *dmabufdest2 = NULL;5 @! l% A7 L, b
- 9 p" M6 O0 N8 e8 T: O: x
- static int acnt = 512;
$ _8 }- n: E4 o% Y - static int bcnt = 8;1 U% J- |7 H d# P. q3 {$ I
- static int ccnt = 8;
9 U6 O. X1 v6 n - 9 k, T& \$ g4 u4 {
- module_param(acnt, int, S_IRUGO); e: L- A0 D. R+ u$ l. D+ |! J
- module_param(bcnt, int, S_IRUGO);
' r9 T0 P8 J& j) h8 _8 c8 ]& o - module_param(ccnt, int, S_IRUGO);
复制代码 5 [5 a7 \1 L2 A
4 U" g9 N( Z" W3 O, F2 Q
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( A% g* |* }3 l+ f" O1 harm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" O- W4 o) ~. D" i% }9 S$ F 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 R( d: b& g7 C. T+ s
. W# ~( B% |: e, }+ N+ s1 ^
& V5 e5 w# S$ G( u |
|