|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) v' f: v, g: y& q. o# R& _- [code]EDMA sample test application
/ C X# _7 z: g% A2 } - /*' F* V9 f" M6 @6 Y. H9 i
- * edma_test.c; Z$ |1 s' ~% n5 p5 l
- *
' P! [+ M, X8 d5 T3 D - * brief EDMA3 Test Application
7 ^' F+ d0 Y- Q# H% H1 U4 S - * [# p3 j; _ t5 [+ D0 t* F
- * This file contains EDMA3 Test code.
( }: q9 `$ C6 b: [/ @ - *
) {0 c6 S5 E& }% c* [ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
7 j3 q) [1 a) X1 K - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
y; A* r! G# H# i8 D - * TO CHANGE., G; @ b1 R$ \: L6 Z! ]
- *' V4 f/ ^% K4 v& }- D
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
; V8 m/ Y% G* J1 u+ ` - *
* r4 B3 H' P! B) R) S$ D - * This program is free software; you can redistribute it and/or
* o! J: r, c; b0 E4 ~5 q6 b - * modify it under the terms of the GNU General Public License as9 `$ c' Y9 p4 @
- * published by the Free Software Foundation version 2., A# \% e+ ~; P
- *
9 H8 m' l7 u( { - * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 w. g j. N1 |1 [% H
- * kind, whether express or implied; without even the implied warranty. a m3 a% R1 M& E1 ~
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
$ _; `+ }: G! b1 f, ?# A2 k3 n8 z - * GNU General Public License for more details.+ {! V# E& v5 r6 |1 z' l* P* B' }
- */
4 O" F# }/ T# s6 f$ @8 ~: g - " p) q6 v7 J' l
- #include <linux/module.h>
4 B3 [& z! _9 o; R1 d; I4 X - #include <linux/init.h>5 m$ k2 n! s: n/ O
- #include <linux/errno.h>
6 n7 I& E) M" V. } - #include <linux/types.h>
6 U( x8 X H; l& w - #include <linux/interrupt.h>6 I r. ^/ i/ V
- #include <asm/io.h>
5 u$ c9 C, j% Q" a. C- D - #include <linux/moduleparam.h>9 t0 ]% Z4 n( L+ K- G
- #include <linux/sysctl.h>) t" l- U) j0 `
- #include <linux/mm.h>
# ^: Y u5 Z6 k, K( k6 B+ F' U0 A4 i - #include <linux/dma-mapping.h>
{' i- ?6 i6 h& k* S5 n - 5 l' p ?% g0 a5 E' j' ?6 t
- #include <mach/memory.h>
7 d" S# ` ~$ i - #include <mach/hardware.h>
& O9 N4 j" |% R* |" e - #include <mach/irqs.h>% U+ \& C ^3 j% }& Y/ R" A2 G% F. B
- #include <asm/hardware/edma.h>4 [% b; l3 R* A. w# n+ }
% D" D3 V$ u8 I8 i! L5 _- #undef EDMA3_DEBUG
. q$ S# S2 c# F t - /*#define EDMA3_DEBUG*/8 c v0 {$ w m$ k1 ^! G
- % H3 M7 ~0 p' C
- #ifdef EDMA3_DEBUG
( Y- j" f( ]2 \% S2 z: e# F+ k - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
. Q% a* b: E1 r9 i! S* q+ P - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
; Z$ Q6 S5 F8 W+ P8 V! t ~3 S - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
& z+ T! K. u% `4 l - #else5 T( G8 H; R( E1 _- L
- #define DMA_PRINTK( x... )7 H5 }8 `; o1 J2 ?
- #define DMA_FN_IN3 ^7 B; @, v+ a p0 s3 X+ U6 @
- #define DMA_FN_OUT: \# D: Q# A- {
- #endif
, s' Y7 i. i0 W9 l1 o( v - ; M' }5 J7 I9 {- ^2 T# R! u. p
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)2 R P( E/ \0 M) `
- #define STATIC_SHIFT 3
5 G' e z5 B. A9 w* y t - #define TCINTEN_SHIFT 209 {1 V* I5 p9 A Z" G2 X
- #define ITCINTEN_SHIFT 21% i5 J* {2 N7 F+ v; ^' N
- #define TCCHEN_SHIFT 22$ d0 p$ w& L' F6 N; F8 m/ I
- #define ITCCHEN_SHIFT 23
- C( o1 ?! \6 g( I0 f - 9 i+ X- G5 C; e/ p
- static volatile int irqraised1 = 0;
% A# @ e6 a5 t6 F0 J" t1 Z5 } - static volatile int irqraised2 = 0;
" a) {. ]% }- {9 u
" n: j" R7 q3 T( \: J; d% r- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" U% E {" \2 o, R8 x% k - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! H7 I2 U4 e) M7 m0 c1 k
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, B- x4 L4 c5 l - . z5 Z8 a3 M7 E( _6 ?1 i, i
- dma_addr_t dmaphyssrc1 = 0;0 c8 E8 Q/ c: Z- p7 N& s- v
- dma_addr_t dmaphyssrc2 = 0;8 @! l3 h& ?( m8 g( }- ~6 X
- dma_addr_t dmaphysdest1 = 0;
: R/ ^0 z! A0 \/ I% d - dma_addr_t dmaphysdest2 = 0;
* L( I. O0 }0 r1 C# P" K; K8 ] - * W! z9 g" ]0 d0 c
- char *dmabufsrc1 = NULL;7 c$ ?1 F# L* m, `" k2 B
- char *dmabufsrc2 = NULL;/ g: ^( P7 I" m2 V* P
- char *dmabufdest1 = NULL;
0 |. T c; w1 p$ m" @ - char *dmabufdest2 = NULL;
8 M6 F9 P8 o6 ^3 q+ l - 1 v$ M2 p% x' Q
- static int acnt = 512;
# x! S. U8 M8 H; ^6 R0 Z - static int bcnt = 8;! |6 D& @( r$ @( [7 I
- static int ccnt = 8;; f) R4 L1 X. w5 ~4 }1 i0 u
. Y$ n6 l9 t! \: E. p3 z- }- module_param(acnt, int, S_IRUGO);
: A5 i+ \7 }$ S) n [' E: K3 [ - module_param(bcnt, int, S_IRUGO);- t$ p3 G8 R0 t2 l5 V7 d7 z
- module_param(ccnt, int, S_IRUGO);
复制代码 ; `' `4 u- M, |6 P! e4 e9 n
) U ]6 U7 h! v
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! Q9 D% E. K v& d
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ P6 b d8 A- H' A5 ?
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ i. Q$ i2 O' J' t, @
$ w! q& G2 q/ n# c8 d. C% U
8 ?0 y& v) @7 }/ Y' _' K |
|