|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: t2 {. T1 `! q/ K+ d8 O/ i4 E6 n- [code]EDMA sample test application
: L0 H' e! C T9 L9 B: p; o E - /*; z1 ^5 w) {% L9 K' b
- * edma_test.c5 F& m9 P6 {1 i4 H, r% X
- *6 J, N( ?" n1 r9 j: X, w
- * brief EDMA3 Test Application Z# X; R& K, z, K
- *% D- B. ^0 m t3 Y' V0 K M
- * This file contains EDMA3 Test code.. i# Y! M' e3 X
- *! F/ Z1 `( q8 R- A0 v! s$ q
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
3 Y M5 A# r3 ?- q2 D5 l - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 l( s V2 f8 x+ {3 f" O+ q
- * TO CHANGE.( v0 H t1 F) ~8 v
- *
% y2 W% z) L8 Y; \5 J - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% o6 {1 y5 P* t+ y9 C6 p$ K! Z
- *# y* j+ H8 j5 k
- * This program is free software; you can redistribute it and/or
$ B3 x) `# w# I) }# u3 c - * modify it under the terms of the GNU General Public License as
4 k* @& w# s6 L, v - * published by the Free Software Foundation version 2.) d: x1 t* r/ y1 d$ k* S
- *
+ i; G' g2 N4 w - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
! a- E, D0 n( W. G8 Y& B& l - * kind, whether express or implied; without even the implied warranty" @4 u7 U4 T8 n- y0 t( c- ^
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* K8 R0 F; l0 _) b4 E5 Y0 K" w1 B - * GNU General Public License for more details.
' I7 P8 x' M4 ~ - */
3 S+ l5 B: t. D( y
) O( `% v! r1 M9 S7 ^( H- #include <linux/module.h>
; w9 \1 v/ T4 |2 F* T- U - #include <linux/init.h>
$ B- S( |- `! @# C - #include <linux/errno.h>
9 I1 E( P1 Y: y. c! L - #include <linux/types.h>& p; Z& n1 O1 R7 K0 a1 d9 |. l
- #include <linux/interrupt.h>
: c) _2 n* a3 T4 v$ g3 `% r; ` - #include <asm/io.h>) i% ]: n8 x! c; |
- #include <linux/moduleparam.h> Z3 U$ {. F5 O% z1 }
- #include <linux/sysctl.h>
1 e! R) S) I, B# U' Q" L" R5 | - #include <linux/mm.h>
, R$ a0 v$ I1 a' V( ?! P0 r- U - #include <linux/dma-mapping.h>7 i# o5 i8 m; Q, t
- ! s5 V: D; e4 ~; N* ~
- #include <mach/memory.h>
+ Y/ E6 t# M! h5 t. m - #include <mach/hardware.h>) d2 ]- }: i: J9 P/ \/ s
- #include <mach/irqs.h>
- H0 q3 J* k, i; @7 x - #include <asm/hardware/edma.h>. `9 ^* w# k) |' M5 X. W y# Q8 N. K
2 h" W4 ~. j( e7 `- D, S3 w2 N+ |- #undef EDMA3_DEBUG
- P' P' ~: C7 {; @& P - /*#define EDMA3_DEBUG*/
! I4 s& T, g- w# c- m2 `! s6 P
+ p0 D9 ^ b' l6 G- #ifdef EDMA3_DEBUG# {' b+ z3 S! u" ~
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
$ j8 C9 O0 y; @) p - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
7 @; U5 s/ I, w3 t - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
1 J( G2 J6 k* c - #else, ~8 y9 ]* U, O, d! [6 s! L* T% x
- #define DMA_PRINTK( x... )# s0 R6 L4 x3 _. W! _
- #define DMA_FN_IN: r; R6 t6 q, I! h! h" S4 `
- #define DMA_FN_OUT
4 G9 P l; y: s - #endif' T) A; h. e# x; }
5 g! m k6 i. l1 E/ D- #define MAX_DMA_TRANSFER_IN_BYTES (32768) z$ d; H$ k+ r/ F" m
- #define STATIC_SHIFT 3
# t) R1 C1 s' [% P* S$ W - #define TCINTEN_SHIFT 202 S- r! u( s) o) }; a S
- #define ITCINTEN_SHIFT 21
4 ?1 g( |% D! \1 ^* `0 L. s( N - #define TCCHEN_SHIFT 22
' G2 C6 T- h" C. y1 H - #define ITCCHEN_SHIFT 23
3 s# E G \, e/ R7 A8 O
" ^- @8 S O! m- M- static volatile int irqraised1 = 0;6 w8 K ]: r9 e$ |
- static volatile int irqraised2 = 0;
' j9 _# x8 d* I; `3 ] - . R4 k0 @- t- r ~+ D
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% N- X" Y$ U& M6 ^ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 M2 n) b* M, q1 b" w, K
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 S6 W" p5 T; J% ~/ V5 u
- 4 m# M2 ?9 D' [
- dma_addr_t dmaphyssrc1 = 0; \+ e, w8 N# O, t; {+ c
- dma_addr_t dmaphyssrc2 = 0;
4 [& ]* @" W6 [$ P* }9 U' X - dma_addr_t dmaphysdest1 = 0;
+ o; }0 W! k, u, L9 M8 i$ u - dma_addr_t dmaphysdest2 = 0;
* e+ U9 A' i' s2 j7 j+ k6 j8 J - J0 \- X/ }0 z7 T# {
- char *dmabufsrc1 = NULL;
2 E& P& K$ k/ D) o0 g) Y# Q - char *dmabufsrc2 = NULL;9 ~3 q1 x1 Q* {1 e
- char *dmabufdest1 = NULL;" M' ?/ G3 I9 v; |' X, D5 z3 }' G
- char *dmabufdest2 = NULL;9 a+ q# f% [( O5 p& Q
2 @9 M* t) y# D5 _- static int acnt = 512;
( g: v, d. Y# y$ v- v \7 y - static int bcnt = 8;
( ?( Q* F8 }$ _* |+ { - static int ccnt = 8;
. M# {# n* g) S0 r* w - # b7 y" h" G# p [* X6 Y
- module_param(acnt, int, S_IRUGO); Q1 ^0 ^5 j; ?. H. l4 o4 J3 F5 H
- module_param(bcnt, int, S_IRUGO);& T- {7 b' ~7 A5 B/ G0 K. J! D" r' o
- module_param(ccnt, int, S_IRUGO);
复制代码
' ]+ U, }6 d- P, O0 d! x4 ?+ O% w2 b3 l, ~3 G! G
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 B* G# \6 y, [$ [" rarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' x" H# [$ p3 Z: o& ^
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 Y4 R0 o& O: N+ L# o! k
# P$ J% `4 [6 h6 Q. M
0 P* O% w' ^1 G) }9 g" r8 ~
|
|