|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & t% a0 y( w- M( s4 [2 W2 E
- [code]EDMA sample test application2 x, z" m6 B) I! L0 d# g/ Q
- /*
8 `4 d* v3 W) W& F+ [ - * edma_test.c
6 ~ \ t' R6 u - *
; {* N3 P7 a) q: O, u - * brief EDMA3 Test Application
! o. X p; ?) y* G' A# O+ X2 @+ N) B2 ?* s - *5 f& L% _' _& g- L8 `3 R
- * This file contains EDMA3 Test code." O6 _4 v/ U8 W" x' k
- *) I, l6 V3 ]; E @8 ~
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 [- D4 ~" [/ b6 ? X
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
6 [ S( G$ u o4 M. F8 {1 S* {9 g - * TO CHANGE.
Y5 x6 D4 h+ t% h6 H% i - * s6 o( D$ k, I; F5 @
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
5 c/ n6 W f7 ?5 Z7 D+ p/ Z - ** ~2 q; ?3 d8 D- Z- O9 X x
- * This program is free software; you can redistribute it and/or
. e4 X, G3 r" i6 X - * modify it under the terms of the GNU General Public License as
- t5 c5 |+ ]0 E" i* x) s - * published by the Free Software Foundation version 2.3 @$ A& o5 k: j6 q: c; ?7 F* ?
- *3 Y* e( I' u$ ~- _8 S# u
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
) j- {. k2 l; a$ i9 X: Z$ u! N - * kind, whether express or implied; without even the implied warranty' R* z" A* |# C+ d
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
Q J3 W6 j2 f5 e; K: c6 f- m% Q - * GNU General Public License for more details./ B- m Z" F& d) o1 b% U
- */
1 g+ y. @7 e( q; m3 C1 m
9 c/ d( G6 [7 k5 k- g- #include <linux/module.h>/ ` h# ~- {% V6 \ \# {
- #include <linux/init.h>5 L3 a% o6 x, z5 ~9 O
- #include <linux/errno.h> p- i5 B# E3 Z; ?- ^
- #include <linux/types.h>
( u) [4 M/ o( | - #include <linux/interrupt.h>0 h+ C3 z6 T5 X& F6 y
- #include <asm/io.h>
- U. M% o& Q8 G2 O9 H+ y6 ? - #include <linux/moduleparam.h>
( m% U4 ~0 u+ ?% | - #include <linux/sysctl.h>
0 i" F4 N! A6 n) _; \ - #include <linux/mm.h>% s; b1 P0 R& Q! @: S8 O/ _
- #include <linux/dma-mapping.h>
: T- v: h) O/ t( {2 {3 n
4 P( h9 g) [- u, E# l9 b* C- #include <mach/memory.h>% B3 z, i. P c4 d2 \7 _
- #include <mach/hardware.h>
9 h- c; H$ D2 b0 j; s - #include <mach/irqs.h>
/ N5 ^8 v! ^0 G w) f: k. _0 U: ~! ~ - #include <asm/hardware/edma.h>
, r; L/ H# X' v1 p
6 H4 m; i! Z/ A5 s1 E/ p- #undef EDMA3_DEBUG$ I; W8 @* d; {5 F
- /*#define EDMA3_DEBUG*// G: f n; u6 ?0 u" Y
: X% N7 x) W1 l- #ifdef EDMA3_DEBUG
, ?$ Y; |0 |5 t- |' z N, I' V - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
- J! H% U' v! x7 L3 [; J( p B3 \: I - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 [* x6 r+ ~; C
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 R( X6 r% ?' b3 A# ]; |. _' x/ _
- #else
/ q2 M, x" x* `3 \ - #define DMA_PRINTK( x... )8 Z- Y A, y" e4 H# m! t
- #define DMA_FN_IN, y9 ~( ], ^8 q4 r! y& n% ?0 o: ?
- #define DMA_FN_OUT
$ d+ v! w" p ? - #endif m$ H3 ?. ?- s9 D9 t
- * D# i, p: o9 M2 R; l- P/ B1 m
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
' a6 ?% o1 q: o - #define STATIC_SHIFT 3
4 B$ J# B7 T6 K$ P - #define TCINTEN_SHIFT 209 E& }+ f% o% D% O7 w- D
- #define ITCINTEN_SHIFT 21( r% N5 B6 K% N$ N* n* I
- #define TCCHEN_SHIFT 22' e9 @- ?' d2 k5 |( Y
- #define ITCCHEN_SHIFT 23
# Z3 p6 A$ n- G) t O
& U2 b- S: V3 r0 A! w- static volatile int irqraised1 = 0;
# V& O! j; N1 n. H7 {( Y8 i* q6 p - static volatile int irqraised2 = 0;
! D" j1 }# n4 e" c* V6 ^
. O4 P9 L' W1 f4 @% O* Q- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% X- Y3 f$ B1 T. M/ K
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 c0 u7 J* @# K% f+ T8 E
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ q/ |9 t1 A6 c5 I, R5 O4 Y# m j+ G! ^6 l
- + S( Y& O. b$ p
- dma_addr_t dmaphyssrc1 = 0;2 p( S4 X8 o$ x( }0 Y
- dma_addr_t dmaphyssrc2 = 0;
- z$ u' X& ]: M! V) ?% [7 N5 n0 c - dma_addr_t dmaphysdest1 = 0;
& u9 f, q: J W - dma_addr_t dmaphysdest2 = 0;
P# Q! B; F( H, K
0 a9 a* E7 z& N0 A2 G* d- char *dmabufsrc1 = NULL;" f; l' A5 F$ {9 i9 y
- char *dmabufsrc2 = NULL;1 u% ~$ P/ i- j/ d2 H
- char *dmabufdest1 = NULL;
" G, M! M# X1 K: F - char *dmabufdest2 = NULL;6 N& F5 U/ s" b% X5 a# |: J
- 8 [: L' Q. h" V" d* {+ l) ]% N
- static int acnt = 512;9 b+ d' X/ n" ~1 c0 U- m; Z5 b
- static int bcnt = 8;* o; t) f v `6 S% {
- static int ccnt = 8;$ S/ {. C \! G
- N/ O9 q S+ Y5 q- V1 Z7 E3 S- module_param(acnt, int, S_IRUGO);, w0 W) n! N! @- M s
- module_param(bcnt, int, S_IRUGO);0 K6 Y4 p, f# J3 ~
- module_param(ccnt, int, S_IRUGO);
复制代码
5 ^1 z; c+ |( U# a, R+ _2 u
! {) y$ |. o1 s/ \/ H 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) r8 F- j2 K7 R& m! o. barm-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 E( \! w0 g% }* m# i* Y5 s4 W6 U 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 B2 z) X+ L- F# W
& S: ]6 _+ R( ~0 h" `
\9 a% W( }* e |
|