|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 ]3 H; B3 o/ j1 Y6 q/ _- [code]EDMA sample test application9 c- g; E# n4 u, \6 D y& V$ c
- /*
0 V3 n w) t$ F$ c# y" X - * edma_test.c. a1 i2 C' C7 W+ Y
- *
, J2 H; J3 ^/ ^3 o - * brief EDMA3 Test Application
9 y; S6 M6 v* { Y- N( b7 u - *$ k$ o1 }" _9 y
- * This file contains EDMA3 Test code.
8 N& _- Z4 c @4 y3 Z - *
% g' `1 g F+ B3 U! O+ m; J- Z - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
! Y& |: }' u M! G- @ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
. N* [# L; x/ V5 i+ T- m - * TO CHANGE.% ?: s! V& D/ G% b
- *: w. E, S7 M6 p6 X7 [' i
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
% [0 l3 m( O( G E, x w2 C - *; z( G0 Q4 a# f! \, i
- * This program is free software; you can redistribute it and/or' W9 \5 Q+ R0 F; n) D5 g( y( C
- * modify it under the terms of the GNU General Public License as
% @/ M$ \; |5 A, \( \1 t1 i2 a - * published by the Free Software Foundation version 2.
. e+ M2 a! f- R F4 ~3 s - */ O& a1 _ M# Y, ], P
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any! `6 i/ t( \& ?; w0 t( B; ~ R
- * kind, whether express or implied; without even the implied warranty+ c7 a* D# {5 }5 B8 l4 J! R/ ?
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the/ G) M8 b7 P# q% l" r: O
- * GNU General Public License for more details.
6 @( I) k9 E0 T/ k4 Z - */
P& R- D" p1 `8 x/ }
6 Z4 U9 c5 a( K3 T6 `1 x- #include <linux/module.h>
# i! `3 r% ?# j! L! O9 H - #include <linux/init.h>3 z) o' c( \4 A# N7 v
- #include <linux/errno.h>
5 R# i6 [' P* Q! q - #include <linux/types.h>2 |5 T! r6 h( W/ W
- #include <linux/interrupt.h>4 |% W4 A! H u
- #include <asm/io.h>
& a; Q& T c0 ]% v( h2 t - #include <linux/moduleparam.h>0 `( `$ k5 Y. S1 A. L, I8 M; }) H
- #include <linux/sysctl.h>* L& D: B% `! L: M* r. Z6 [
- #include <linux/mm.h>
5 V1 i( A! m! a5 z# e( w# `& \ Z - #include <linux/dma-mapping.h>
% V# F1 B0 E) V, z9 |. t - 9 Z8 l3 P; B+ H5 _
- #include <mach/memory.h>
+ J, c5 r ~9 ? - #include <mach/hardware.h>
! J7 ~$ b2 Y6 r) o' N# d - #include <mach/irqs.h># \& L& u6 \; C @$ [/ c- [) ~0 v
- #include <asm/hardware/edma.h>
7 I% O9 s) ]1 H8 I! F7 {1 p' T
, C7 _ N' N, d! b- #undef EDMA3_DEBUG5 [( I+ U3 H4 d: C
- /*#define EDMA3_DEBUG*/
# Q' M9 j' D; _# |+ w* q+ ]# @
& b# x/ u- j- ]1 ^' w$ ]- #ifdef EDMA3_DEBUG
+ \) L( p z; b& y - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 N4 _; G1 M4 k" ] g/ M2 a
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% l O# u9 ~, A: f7 ]7 j& z
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 L# U1 B- w! N G# |! y
- #else
% q& n* ]9 e/ t - #define DMA_PRINTK( x... )
3 N: {- s/ s3 M) L- a, u - #define DMA_FN_IN
$ l1 T$ W/ C' W) H5 M- A( A4 y - #define DMA_FN_OUT3 x" S- |6 V) {* ?3 T0 d
- #endif% \$ O/ W! z) r% n
1 B/ ^4 S. h, C2 z- #define MAX_DMA_TRANSFER_IN_BYTES (32768)- i( z. j, K- w
- #define STATIC_SHIFT 36 @, w- b6 C7 ?+ q
- #define TCINTEN_SHIFT 20
; I: d) k; s9 \7 V& w - #define ITCINTEN_SHIFT 21
# ~) {$ H: t1 k - #define TCCHEN_SHIFT 22
N+ ^1 V1 G, a* _2 M - #define ITCCHEN_SHIFT 231 u0 j' h) u- l$ E" v: {
" {. H _" y, Q4 Y$ h- static volatile int irqraised1 = 0;
$ ?/ C- ?6 K$ Q* k- _ - static volatile int irqraised2 = 0;
! G4 ~4 k9 b+ q - & n/ x& C% [6 k2 Z8 W$ z
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' N' J, O& {7 Z* a, V9 b
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 Q" [8 m3 I& x' f; _. r1 i
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% z8 N8 O. P; J; ?8 ?" ?
% x( t' j4 g+ L# L/ h- dma_addr_t dmaphyssrc1 = 0;0 T' X: n) p2 u' B; l
- dma_addr_t dmaphyssrc2 = 0;
: C( o) a3 y- ]3 e% t - dma_addr_t dmaphysdest1 = 0;
+ U- G% e- i, S% h - dma_addr_t dmaphysdest2 = 0;
2 r7 |* }* K$ @& G
. V( Y6 R3 O$ X, Y. A# k9 O4 x, f* d; ?- char *dmabufsrc1 = NULL;
- s' _" A4 ^2 ]* g2 } P - char *dmabufsrc2 = NULL;
3 j" s* m. W6 v. W1 X$ R/ R& c4 L - char *dmabufdest1 = NULL;
( O: f K1 B- F ? - char *dmabufdest2 = NULL;% O* r+ s- q) `$ i) O
- 8 _. R# V, K0 F, d6 i9 J
- static int acnt = 512;
3 L1 x. T' ?( e - static int bcnt = 8;4 `' W/ {2 L1 s6 N7 u
- static int ccnt = 8;$ R8 k. _5 w) Q0 ^$ _9 h/ V6 a
- $ }$ B, h6 ^6 E5 n3 u5 l% m* n9 b
- module_param(acnt, int, S_IRUGO);# F- n2 X! F q1 d3 n5 H$ e
- module_param(bcnt, int, S_IRUGO);
# b! Y2 R8 e9 H - module_param(ccnt, int, S_IRUGO);
复制代码 . O& b0 O" m- n
; x' A& Z1 G5 N# z6 W
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: t0 m% k6 b; b
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! ?0 @. d; M1 s7 Z8 c 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 w) _, e) u+ i z5 F, b2 g! z% G- m
* B' f5 c8 k, I& x3 f2 j0 S
|
|