|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & }& B: d) M: ~
- [code]EDMA sample test application
3 |% `& L8 [9 v6 A - /*( J: E h+ q3 Z2 {0 L
- * edma_test.c1 v0 t \5 V/ {; n4 G- o+ W
- *, d* k! q3 X8 D+ J
- * brief EDMA3 Test Application
1 Q4 j$ p" O/ s2 X# o - *
$ M- B" X0 c- Y8 } - * This file contains EDMA3 Test code.. ?; w }; P, Y b
- *( l9 D- R2 G& q. C3 U/ s
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
7 I0 ~& ^, C: R4 t A% o - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
) f' o3 T; K2 v" R2 b - * TO CHANGE.) P0 }4 e, O) f: `9 {
- *
3 e, y$ i3 V2 I, f5 \7 q - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# _# e0 W+ ?2 c3 x/ J# G/ Q" |8 j5 ~
- *
0 E% _+ U6 s) K4 q4 D2 G; Q% p - * This program is free software; you can redistribute it and/or
: B& [9 _6 F3 x/ |6 T/ Z" G3 g& x - * modify it under the terms of the GNU General Public License as
1 y! X4 p2 K$ l# m - * published by the Free Software Foundation version 2.
5 I$ h: q# }7 u - *1 U5 w& l, \/ P7 o7 q6 u
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
* t U2 `3 N M) t+ I - * kind, whether express or implied; without even the implied warranty) r* z- S' c' G
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% e; `. g# J8 [# W - * GNU General Public License for more details.! Y/ Z; B! V9 H0 M! @: ^; e
- */4 b: v' t+ A6 v, ?, _- y+ d" X
- 0 v" ~3 {: ^. ?( H8 B; ?$ U
- #include <linux/module.h>
- Z+ Q! O& T/ K7 H4 e/ V7 N8 J - #include <linux/init.h> E1 [+ L: G7 U7 ?
- #include <linux/errno.h>4 k; \8 N" h+ n5 O: x
- #include <linux/types.h>- L1 p6 J2 @" ^2 q7 g
- #include <linux/interrupt.h>
% O& {1 {# X! ^& U% ^7 i - #include <asm/io.h>
( e1 r R. V4 B1 O% h! f5 | - #include <linux/moduleparam.h>
a, v; H- \2 C8 f+ { - #include <linux/sysctl.h>, r* \: b' y1 H) b0 J/ X' G
- #include <linux/mm.h>
' ~" x" e2 ]8 @- O2 _/ \" R4 Q - #include <linux/dma-mapping.h>( E5 @, w3 [, q
2 p5 r/ y+ J+ }: Z" O4 x- #include <mach/memory.h>, S5 J9 e! ]7 i/ B/ w( U
- #include <mach/hardware.h>
4 H1 w7 X# I$ t9 b* ~! I - #include <mach/irqs.h>
% b& j# U8 `7 g1 ]# c - #include <asm/hardware/edma.h> l( k: D2 N/ M, {' E
- 4 K) r: U& ^+ b6 ^
- #undef EDMA3_DEBUG
- H" d9 Q, X- v- _; k/ [ - /*#define EDMA3_DEBUG*/% K* _. p! R% Y4 d% X% Q8 |" b
- $ K& H0 G6 V# E
- #ifdef EDMA3_DEBUG" n" I/ q3 g' r
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
$ u: v2 e9 v0 @2 k- x$ O - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
, P7 U* C/ n+ f0 ~ L$ K - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
6 {9 [- ^$ F, w, w* [3 |( c/ [ - #else, ~8 b' n! A! O& g0 b2 O/ ]3 J
- #define DMA_PRINTK( x... )
^$ o! D% A: I- h+ Z( ]& i - #define DMA_FN_IN
# C0 L% e( P9 m - #define DMA_FN_OUT: `7 t. l' O: r1 |' J0 B3 Q& b! f0 i9 l
- #endif
; r1 I1 I" h7 l/ D, f, d' W
h5 Y! i% B! O1 l1 B7 A/ ^% |- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
- ?' ?% O6 ^; S7 \ - #define STATIC_SHIFT 3, E: K0 C" v! L+ M
- #define TCINTEN_SHIFT 20
) Y; d5 Y( X3 U - #define ITCINTEN_SHIFT 21. c2 M- w3 d* `) D1 M9 z
- #define TCCHEN_SHIFT 22
- H2 c5 k% }# E* b; l% U - #define ITCCHEN_SHIFT 23
' a8 K& n8 r/ u+ i/ z. s r - - s/ o3 y* L7 z
- static volatile int irqraised1 = 0;
$ F" @- Y( q K; M. O0 _ - static volatile int irqraised2 = 0;
, N* o% T/ z( D; Z; l
7 ?1 @! Q0 Z1 U# a- y- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 i3 D" w, e) {+ f - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ @' [( y$ b# `, R# ]) Z' c
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: N3 U& T$ d2 S* u. s - ) g& B2 q6 \/ D
- dma_addr_t dmaphyssrc1 = 0;& w$ J: z6 `6 w% z8 S* V3 Y
- dma_addr_t dmaphyssrc2 = 0;
F7 V& a& B; j* Y - dma_addr_t dmaphysdest1 = 0;
: y% e4 c' M! R I - dma_addr_t dmaphysdest2 = 0;4 |" z# D$ {( m
! ^1 V# w8 Y; V4 i4 W6 v7 M- char *dmabufsrc1 = NULL;8 a3 `# p8 q& l# A$ ]$ H) U) |) V2 N4 @
- char *dmabufsrc2 = NULL;
& g; e, \( m9 C3 ]3 v" L6 E - char *dmabufdest1 = NULL;
9 g9 Q& I! \! s/ F, L) W - char *dmabufdest2 = NULL;
' x) v* i- n1 Q/ C7 A+ c
0 P9 s0 b4 E: z# @6 r- ?, G- static int acnt = 512;
8 l# b: j6 n7 r: S - static int bcnt = 8;
$ J# A! |$ f& n7 G2 I - static int ccnt = 8;
" d+ \' | G. p( T - % t% [& M( y3 p4 s# u$ W5 k2 A
- module_param(acnt, int, S_IRUGO);- x/ U( X1 y% @: a$ u& S( q# b
- module_param(bcnt, int, S_IRUGO);* K$ Q# M4 J# s( U9 T2 i4 q
- module_param(ccnt, int, S_IRUGO);
复制代码
) o: P c, A# |; U V; v+ l# v y% \; L4 ~" `( c
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
9 c" J. m$ h! {6 sarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) A, N6 a% [4 K# l! y0 o 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 b z5 _$ G" \) L6 @8 B# M, }& J) Y
' l3 { a! `. _0 O) D
|
|