|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% g3 n' H0 p1 l8 K, `/ y' A- [code]EDMA sample test application
" B& u& P+ E E# [8 L+ U - /*$ M% o Q+ ~. a+ W% P8 e, n
- * edma_test.c
* l0 V! C1 w: }. ^ - *1 R+ ]4 o2 y. Q! Y; W
- * brief EDMA3 Test Application( v* U m8 n( B# p) K
- *
/ T% ?4 y" x$ }+ P$ a) A - * This file contains EDMA3 Test code.
& b& ~! ]; l0 H- E - *
. _6 b; a/ f5 r, |' M - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
8 n$ M6 D+ H. [. d1 {# f - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
0 W. g- S% ^( S) f- |+ A - * TO CHANGE.5 @2 z' ?$ o9 l+ X6 y9 l' Y
- *4 @& N! g. o8 S+ d0 ]* |
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
0 T9 Z3 R* f. o* Q) I" c - *
! o6 f% h! {$ p' \% S - * This program is free software; you can redistribute it and/or) G. J9 p$ t% C; u/ z# w
- * modify it under the terms of the GNU General Public License as
- \! \# C/ E+ {2 e - * published by the Free Software Foundation version 2.3 v2 ?6 |* ?& U0 v- l. b; G/ G) F
- *& r% U# _8 n, p" r- j
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 {7 A! u7 {- x3 c9 X( ^- ?: {
- * kind, whether express or implied; without even the implied warranty e2 M6 @* q. u( {
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the5 X7 ]' f, o( ]0 Q) ~. `$ e M* i) o \
- * GNU General Public License for more details., e2 Y* V# M; [/ h
- */
; v+ k" @2 h( S) ]- J
v- ~8 J' V+ B8 u2 t- #include <linux/module.h>9 x+ F* i; c) H* z+ t2 A$ @4 ]
- #include <linux/init.h>
8 _5 o: T) W! P: \ - #include <linux/errno.h>$ W. N- J* U5 L: f0 w6 a" f6 M& \; J
- #include <linux/types.h>
" g( z2 [, a6 x- F) m2 y$ X - #include <linux/interrupt.h>
5 G: z- s; s# }3 V% t# z: a - #include <asm/io.h>
9 Y% P+ q# J& v0 n - #include <linux/moduleparam.h>
' l) t$ U$ t" i: l - #include <linux/sysctl.h>
8 | m1 U x8 \4 O- N% N# e - #include <linux/mm.h>. a1 J/ K. J A: Q3 f: c
- #include <linux/dma-mapping.h>
* u* z1 ^4 U: D$ u# A" G% F* T
4 C' h& @+ b3 C6 {/ H- #include <mach/memory.h>2 L, o0 F6 F9 z' a, W
- #include <mach/hardware.h># e- O9 n& L. N! s
- #include <mach/irqs.h>
8 L, X0 N8 N6 [3 q/ X - #include <asm/hardware/edma.h>
" v# @4 o6 x$ M! C/ |3 _# ~
) b% ^/ h/ R! J6 S3 \5 M1 j8 t- #undef EDMA3_DEBUG0 }: a$ [$ K7 `+ ]3 G5 c
- /*#define EDMA3_DEBUG*/
5 v+ [3 |4 c5 K+ s0 m# E6 k
9 L. K8 M# B0 o' N, Q( h- #ifdef EDMA3_DEBUG
3 h9 m9 }1 T0 w$ x9 N ] - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) D, A3 d) ?# d4 A+ l6 _
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 V, _2 |9 x* d! W+ v$ z/ ?; k* M. V
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
' J" X {2 n" n& { - #else
2 o7 b+ o$ v$ u5 l" ] - #define DMA_PRINTK( x... )
" V. P8 B7 R' ?4 m: _9 \; O - #define DMA_FN_IN
/ @9 Y% f, v3 w% y - #define DMA_FN_OUT3 J# j7 ]# Y L0 r; T
- #endif
/ s" n: P/ d& s& ^& s - ) f) \1 D5 _2 P3 D' U0 }
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)% N2 J- t& w/ _7 \4 e, a
- #define STATIC_SHIFT 3
& e2 T' y* Z- ^' V/ L+ O% { - #define TCINTEN_SHIFT 20
8 @) p5 _3 Y3 ^& T4 \ - #define ITCINTEN_SHIFT 21* f$ N& Y4 ?. l" _4 \6 x
- #define TCCHEN_SHIFT 22" \% ^4 v0 n d5 s* G0 P4 Y0 {
- #define ITCCHEN_SHIFT 23
/ B$ Z9 O$ P7 @/ e. _ - % D, o" }# Y" z2 Z
- static volatile int irqraised1 = 0;
4 q3 K1 j" w; i7 l4 F2 a0 Y - static volatile int irqraised2 = 0;
' i c* S+ p7 f% e ~* z
' q* l9 y" t. i" j- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 W- f0 J" Y7 H0 I4 R
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& x3 Q0 a$ |9 q, C+ w ~
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 _5 B) H. }' ]* L3 p3 i
- - }8 @1 ~0 y g7 Z
- dma_addr_t dmaphyssrc1 = 0;3 j) W3 R- X4 A
- dma_addr_t dmaphyssrc2 = 0;/ x D* @ Y- g, _( w* R: q
- dma_addr_t dmaphysdest1 = 0;; h$ B5 K" `6 e" e6 H4 }
- dma_addr_t dmaphysdest2 = 0;
+ ?; Z& D, w/ I8 ], o/ A - 7 M' N6 r1 m& Z
- char *dmabufsrc1 = NULL;
7 O2 [0 D0 E. F/ v! s* y: _3 c; y - char *dmabufsrc2 = NULL;
- z8 ^3 y t9 N2 D) t/ T - char *dmabufdest1 = NULL;7 ~; q( V: S$ U* b. ^+ T
- char *dmabufdest2 = NULL;7 T7 T% g4 m) h4 q" u" X5 I. Q, g
! m! t; r0 f* t& [- static int acnt = 512;
* L( n# h- e0 n( c6 d" r0 c, s( `% C5 I - static int bcnt = 8;
+ X* e7 T3 X$ s% E- e' u* q - static int ccnt = 8;
& _. W8 R# N$ `. M - + Q1 j: {. \1 s/ I* X0 t2 k
- module_param(acnt, int, S_IRUGO);/ D- F8 @- U! f4 R( ^& B
- module_param(bcnt, int, S_IRUGO);, ^4 N2 L" S! z
- module_param(ccnt, int, S_IRUGO);
复制代码
1 j% H4 |$ F5 x( [! n8 i! M/ Y
- k& U# N) Y0 E8 M9 H 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 Q/ v/ p2 o/ H" D9 `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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% U3 b* l: _) {- V9 s2 c 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 N# j8 B( d9 i; i' r+ i* d7 P6 J1 p( i
; d ]& K" Z4 T' d0 a |
|