|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 |8 {$ z+ \0 M! D% v
- [code]EDMA sample test application4 B4 h! D! I* c- ]7 s6 P
- /** Z2 }* e7 t9 | b e! I9 D& t
- * edma_test.c
4 A! G* D3 m1 K8 b" f - *% o, z% X) h& r" Z) b) R) t* z
- * brief EDMA3 Test Application
5 W, {9 {+ b T* N - *+ V! T$ `; M8 S3 E1 h; G9 T8 q
- * This file contains EDMA3 Test code.
; g) a6 M& C- R7 S: |6 i! x h3 X) q/ T - *5 b* b9 Y( |/ U) ]1 q* L+ g( {0 b4 A
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
' ?9 j0 ], x- m8 T - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: x$ m' a9 z% s
- * TO CHANGE.+ @* W. L8 u8 r5 W0 }, t
- *1 i C1 |0 s7 i7 D7 c
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
' \) R( v# @( d9 l, o7 I - *
" \8 r8 @) ]& k9 b - * This program is free software; you can redistribute it and/or3 I) t9 G* }8 j% C; w
- * modify it under the terms of the GNU General Public License as
/ Y5 \- x, W9 U0 h# J7 H - * published by the Free Software Foundation version 2.
5 C9 g, K' g: ?7 F n - *( V- C. z8 d. c# O( j. v ^$ _
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any" T5 m8 l$ {& Y5 Y
- * kind, whether express or implied; without even the implied warranty
5 }8 T9 x5 S+ ^' A D - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
' {* R' B8 T5 H4 p2 w - * GNU General Public License for more details.
7 P2 M5 U& w9 I3 `# J+ Q3 \ - */6 x. ?) q+ C- }# T$ \( E% @/ j
$ I9 A. ], i$ m9 H" ~* \# S- #include <linux/module.h>9 Q; o+ t5 _( H' U
- #include <linux/init.h>: f& U0 E6 X6 n5 b
- #include <linux/errno.h>
6 @4 T+ q S! ]/ F" ?8 O$ E# f Y. S - #include <linux/types.h>
/ j- Q' u2 Y; F - #include <linux/interrupt.h>2 W/ r. I' \3 p9 E
- #include <asm/io.h>! L% x, L( h( Q
- #include <linux/moduleparam.h>5 L3 F4 m7 s% K
- #include <linux/sysctl.h>& m" s2 p- E6 a% t
- #include <linux/mm.h>
1 }5 v4 n) I3 `5 X7 C - #include <linux/dma-mapping.h>
) J: _" g0 q, M0 I F2 U5 H
4 ^4 t. f2 Y! u" F; F. o- #include <mach/memory.h>+ z+ {0 k7 ?; h2 z' v2 F
- #include <mach/hardware.h>9 K. s- b3 i8 @4 [. V
- #include <mach/irqs.h>
1 m7 ?! s1 F& p( F n" N - #include <asm/hardware/edma.h>. i/ k) i; m$ s
- 1 ]3 P' @# t) b8 c e7 {) v
- #undef EDMA3_DEBUG
5 i. B! H2 V. \1 t. G/ A5 Q1 W3 u - /*#define EDMA3_DEBUG*/
) n M+ B# q* o$ }2 B' o; V2 Y$ \( D - % N0 v$ Y$ _" d2 F: V7 N. V6 w4 c9 M
- #ifdef EDMA3_DEBUG- i3 d/ a$ {# p3 N
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* J) Q v( m1 n# t
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
: N; y: p8 Y! X6 ]2 T3 G4 G - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 |4 {0 ] R/ W' ~; a8 b' K
- #else, R2 {8 J5 z$ h9 q% F& k' v; J t
- #define DMA_PRINTK( x... )
X# M, v4 }8 U- f - #define DMA_FN_IN
3 ?0 S7 ]; D8 C1 k/ @ - #define DMA_FN_OUT
. V* ?8 i+ d* B- u- l - #endif k' a9 }" }! r' h2 M) K4 n
- $ F' W6 _) W% o2 S1 A) J' s4 s9 ~* }
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)0 ~7 c/ A5 z" M
- #define STATIC_SHIFT 3
3 j" {+ n3 t; c& D - #define TCINTEN_SHIFT 20
& i O, l2 Q: \) u/ F( d0 s0 ~ - #define ITCINTEN_SHIFT 21
2 ^. D2 c5 t1 Q9 c6 ?9 h+ b, X - #define TCCHEN_SHIFT 22
. S" V% Y4 v! t7 H! T# i( o - #define ITCCHEN_SHIFT 23
' v! \# J$ u6 B w- D - : x! a" t; J( ^! G& _$ D& ]- ~
- static volatile int irqraised1 = 0;" t1 d% e. d( P! B$ [$ f# c9 Z
- static volatile int irqraised2 = 0;
* u# U2 [8 }3 ^ X
2 t6 S% z" K# x/ F* t" d- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); x6 U d \. H6 N+ j* d3 G
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) }5 r- J; Q3 i; l
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 q/ j+ [3 y& m( u1 D5 @1 c
- : Y; d" V6 I) a
- dma_addr_t dmaphyssrc1 = 0;; [* [6 l2 c' ?. B8 z9 `9 Z
- dma_addr_t dmaphyssrc2 = 0;) T- I8 `( q" L% o, |/ P1 W
- dma_addr_t dmaphysdest1 = 0;5 W- g# Z l/ G
- dma_addr_t dmaphysdest2 = 0;
! ]2 s8 o. c4 ]% E, o' N2 Y0 W - . J0 n, P) c) }% n! D* c
- char *dmabufsrc1 = NULL;, t1 G( _) J& B3 j
- char *dmabufsrc2 = NULL;9 b4 D' ?/ R$ \
- char *dmabufdest1 = NULL;/ R9 @6 o* G: m6 }* i
- char *dmabufdest2 = NULL;
2 p0 n, E- @: m: e, } @ - 8 `" M" U. v& o+ c+ j
- static int acnt = 512;1 T/ y+ l+ `0 m' h2 B9 I9 t' }" k
- static int bcnt = 8;
7 [5 a) F# j4 d - static int ccnt = 8;) V/ k0 O3 _2 o3 |2 x' w& \! c
6 [8 \* c" e* p5 _) \+ C8 k- module_param(acnt, int, S_IRUGO);
; y/ b) Q8 A, W- \6 z: o - module_param(bcnt, int, S_IRUGO);0 y3 F+ J! \4 q, c; m
- module_param(ccnt, int, S_IRUGO);
复制代码
' r3 \$ `2 |9 |! R
- q$ ~& P2 U3 Q) V2 G. f" k 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, Z* {; s2 q. D3 i+ |( j
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 p1 }9 j" q! n
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 A |5 k \( Y+ Z9 {
9 f5 F9 m6 U# q7 H1 p2 m" \6 T! Q
5 |. e7 d# u, R- B& c |
|