|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 ~9 \) M" _0 e- [code]EDMA sample test application
2 } r0 m9 h. f6 ~1 I3 X: F - /*
F( o$ D' r& ]! @" a6 E - * edma_test.c# U0 E% {" H4 [7 M
- ** x5 x& v5 M: F- _/ }+ K
- * brief EDMA3 Test Application
: o5 H9 M+ M/ [1 }7 N8 f4 R( t - *
& A* l7 m; Z# `, P7 i$ e - * This file contains EDMA3 Test code.
* T( y4 P" I( U, z: K - *- _- h0 K$ ~# c% J1 m0 ~
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# k6 g+ _. O; _! V" p9 c" W0 e
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 [2 g% m+ F$ W+ L$ z6 [- `2 g+ l9 N
- * TO CHANGE.
/ `& G" h6 t% L& r: L$ ~4 _. U6 w - *$ p( z# [' \! r9 X
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
/ [ u4 {$ T7 ]7 v* E% c - *
2 i# L4 t$ }8 |6 {' ~6 p2 S2 Y - * This program is free software; you can redistribute it and/or
; B( D' Z6 ?- e# a+ z - * modify it under the terms of the GNU General Public License as1 r* c! @$ _+ K) H( n6 p; f; T# S% q, B
- * published by the Free Software Foundation version 2.
, P; s7 X: ~/ M8 _ - *
o2 f0 X4 F1 g+ m5 {& _7 I - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
' Y! b* v7 F% g1 W& a! ? - * kind, whether express or implied; without even the implied warranty4 V4 n$ ~1 s- X9 f9 J' x' ^, }: a/ Y5 h9 S
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1 U, @4 q9 [1 C* [$ B - * GNU General Public License for more details.
& @7 d+ ^- C5 [! R- e" k* ^+ d - */
; k/ l8 D# c- F/ }
; i2 O. }% `' g" O- #include <linux/module.h>" r7 Q6 |0 v/ M# i
- #include <linux/init.h>, W" e K' ^7 u/ N. A8 E7 {6 m
- #include <linux/errno.h>/ W3 F' }) k3 l5 j
- #include <linux/types.h>2 l3 z( r. U/ @1 R$ N; c& L
- #include <linux/interrupt.h>
" G* D6 v' d! e+ Z3 Y - #include <asm/io.h>
+ e- T. u0 q, N7 w/ q - #include <linux/moduleparam.h>
' K! Q* b' v6 Y: H. I9 `0 _ - #include <linux/sysctl.h>: I$ g4 b5 g3 C* H+ f
- #include <linux/mm.h>
1 I8 a* ? m" ~2 I' W" E8 [3 k - #include <linux/dma-mapping.h>
$ L( \0 ^& X1 L0 g! u6 i
) [- T+ x2 [, f& Q0 w- #include <mach/memory.h>! M* U6 T6 M* @+ O4 x8 d
- #include <mach/hardware.h>' R" t. P$ {7 }3 w9 D- i8 N
- #include <mach/irqs.h>* U( b; K, j2 y0 V& J
- #include <asm/hardware/edma.h>) o( o3 v" I: \! r
, g* U A; K) t" E- #undef EDMA3_DEBUG
0 R. `( m$ W% d4 u8 B - /*#define EDMA3_DEBUG*/! k8 _% i% J3 w3 h8 U
6 f) d0 j- @2 g3 }3 ^- #ifdef EDMA3_DEBUG
1 R6 s! r7 V( \! D$ }. Y - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), k3 w* q1 Z; d# A. L! j6 n1 U, J
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 s, Q! a; i, O+ S
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 b9 b% c5 A/ v* ]0 x: K
- #else
6 J+ f' |9 y, V/ C0 C - #define DMA_PRINTK( x... )
, j/ V$ s9 A- Y - #define DMA_FN_IN, C( g# a# x Y2 z
- #define DMA_FN_OUT% q: B' j; ^# a9 s
- #endif* j6 A9 u g d% A5 f
- ( c( U# ?* z4 `
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
" _; O. g% Y: j& V9 G - #define STATIC_SHIFT 3 Y; G* q, a* [
- #define TCINTEN_SHIFT 20
( |# u" K8 K0 h1 n4 C - #define ITCINTEN_SHIFT 21) e8 J( M$ q4 c* j
- #define TCCHEN_SHIFT 22
% u5 h9 |$ W2 c - #define ITCCHEN_SHIFT 230 M- l% Q' ^# Z" _; R/ V
/ j4 ]2 v% E, ~# E& @- static volatile int irqraised1 = 0;
8 N) }- Q4 ~! K- I" ?5 q1 @6 e - static volatile int irqraised2 = 0;
) Q v5 c! h+ W: D2 n- D. v/ Q' A+ b
5 i. F$ L; C& L$ q' a& ?( B; [/ B+ v- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 o6 y) L- a% f. d# d! D; l - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( n0 _6 ?% W+ y5 a2 T
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 F5 T5 [0 x) Y* n# D: K& S
- ) p1 l# Y9 {" {9 X
- dma_addr_t dmaphyssrc1 = 0;
! _4 l+ W+ Z8 z - dma_addr_t dmaphyssrc2 = 0;# H) L8 g/ f4 _& O) c7 n; h Y
- dma_addr_t dmaphysdest1 = 0;' S; `9 _: L U2 |: x& x, {
- dma_addr_t dmaphysdest2 = 0;
% _ h- q- [4 X4 Z/ C! \* m2 g6 ?" J - 3 ~& P6 p8 ]' v3 a: t( L! `9 G9 V
- char *dmabufsrc1 = NULL;; \$ Z& t1 M2 A$ e0 r0 m+ ?
- char *dmabufsrc2 = NULL;
( ?2 q2 L' b4 L6 n - char *dmabufdest1 = NULL;1 i& e: H6 C( O+ y
- char *dmabufdest2 = NULL;
) A R0 U# b9 Z. Z- ~ - ! F( Z/ K9 }( [ R7 Z/ S
- static int acnt = 512;
N: E C2 Y7 s- O# @ - static int bcnt = 8;8 L I; `) O8 }4 U+ D# U) @
- static int ccnt = 8;
- [8 @6 {1 B& p% P. a' g - 8 g) R0 U: o7 }; M6 a2 I. r
- module_param(acnt, int, S_IRUGO);
1 J1 v0 S7 o& u - module_param(bcnt, int, S_IRUGO);$ m- v% L9 ^" G( P
- module_param(ccnt, int, S_IRUGO);
复制代码 2 D8 r" S6 s5 a. A- e
# _0 S( |! {+ a5 M$ O- V, M
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& b" _/ R8 T5 _) h( L! o$ t
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ X3 p* ~$ t$ X, v$ b5 e
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 F8 K. d. m( Z/ L0 S& \ R3 C2 H$ g6 o
7 U4 X: w- {1 X
|
|