|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, E5 \ Y' |0 o) |- [code]EDMA sample test application
2 d2 r* Z' x: h/ G+ a- I - /*0 e, u } K0 e8 y: l( j/ e
- * edma_test.c
8 _, S. S( e! ?7 d - *
4 k( |* U- F3 x - * brief EDMA3 Test Application# Q# x! F/ _( c2 D; J0 H
- *
% ^; X% p" ]6 ] - * This file contains EDMA3 Test code.* O$ d0 f& s V# @, A5 Q4 t/ e, D6 D
- *9 f9 `0 f2 I# `
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 Q7 a6 l _9 Z1 n
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* L7 z3 A( F8 I$ @
- * TO CHANGE., k' R) p: x7 `4 r0 e
- *+ a. i; l, Z; l$ o8 y5 w- |3 u
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
6 G7 @2 U, a4 A* a0 d" s - *; y5 o8 j: F' b; \
- * This program is free software; you can redistribute it and/or
( S3 z; g3 ?4 v W$ s8 c% N, F - * modify it under the terms of the GNU General Public License as
" Q3 m% ?2 ?" C- C; R+ N - * published by the Free Software Foundation version 2.
0 G# Y5 D' \ H T - */ C# u" w/ Y9 W* ~. t6 M
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
6 ]5 E1 K4 @& i2 G) ] - * kind, whether express or implied; without even the implied warranty
: n# D/ l- b9 \1 F* X; j - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the' u$ Q8 o; V' O$ ]
- * GNU General Public License for more details.2 O7 O9 A5 N* U2 |& w. f
- */1 q% s4 h! E6 X1 B: }% a- E! P
- / A0 s. E" l0 k# Z' {! t
- #include <linux/module.h>: X6 J+ z' i' Q+ `( }6 `
- #include <linux/init.h>
. b. u6 `' B/ T8 a& P - #include <linux/errno.h>
$ v* K4 b) Z+ u! e8 r; l3 r" _ - #include <linux/types.h>8 [# [! ~5 I9 a( I# T
- #include <linux/interrupt.h>
5 {: w9 _ q8 R - #include <asm/io.h>
/ `/ j8 O$ Z! Z- K" c! ~! B% S! o2 e - #include <linux/moduleparam.h>
r9 `; n. |( \7 L6 w - #include <linux/sysctl.h>- }3 O- i% m, J7 H- O: u# ?
- #include <linux/mm.h>3 C+ n3 ?: g2 P2 R5 n
- #include <linux/dma-mapping.h>4 ?: x3 y! B% [$ O6 n" F
( E2 [/ u. ]2 o" U6 j" g& {- #include <mach/memory.h>
" C' ~+ j0 ?7 F5 l Z - #include <mach/hardware.h>: C$ C2 h8 r4 L! |0 M
- #include <mach/irqs.h>
6 E! \8 {! J$ l; |5 ? - #include <asm/hardware/edma.h>$ x) `% ~; A& I1 D t8 Z: {6 P
- 8 c& V4 Q) ?8 R2 p: ]) y M A
- #undef EDMA3_DEBUG$ O' z% T' n( v, V* Y) t7 s" g: y6 o
- /*#define EDMA3_DEBUG*/; i2 Y d: w/ d. A
- $ o( K5 o# b8 g- |
- #ifdef EDMA3_DEBUG9 ]* _9 k m4 o! V- U/ b& @
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
. N) ]1 a0 j% B - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
& k/ q! R0 F6 ^; L V6 B( X - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
, C+ ]1 O) R: Y - #else
3 `* w- l& i8 c) v0 c - #define DMA_PRINTK( x... )* {/ r' C' B" F' m
- #define DMA_FN_IN
4 M8 W! {. R, b - #define DMA_FN_OUT; H( A# O, _* H
- #endif
5 o: r7 h/ g7 ?' l - - A9 C" ]1 p. _. o( E7 d( }/ S
- #define MAX_DMA_TRANSFER_IN_BYTES (32768) Z' n' O5 @, T% [5 b
- #define STATIC_SHIFT 3+ S! N8 \* Y% P8 t( l' h6 Q, r
- #define TCINTEN_SHIFT 206 W. ?1 b. V6 i( B" b8 U
- #define ITCINTEN_SHIFT 21
& ?5 L, R" y: G. k2 L; D6 ^& { - #define TCCHEN_SHIFT 22 o& f* [% C) g. a( f
- #define ITCCHEN_SHIFT 23$ \8 e; ~2 ]. C& P
' A, I# D- H' [# I0 N- F2 C- static volatile int irqraised1 = 0;
; j6 S) G, v) O: [" p' o - static volatile int irqraised2 = 0;
; z# G7 |0 Y# R' T; J" Y( G) X3 V' p
9 V! ?- E8 a: E; B, ]+ s. l4 y- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- C2 u7 C6 T( j% i - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 d) s' l0 J. a0 y$ h
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. ?. C3 ?% f/ g! d' \ - 2 o1 Z4 k, x/ m5 d# m/ o0 [
- dma_addr_t dmaphyssrc1 = 0;' n. ^# `* |- D( ~3 o4 L# A% p9 q
- dma_addr_t dmaphyssrc2 = 0;
0 D) h9 o8 M6 Q9 d5 B O; S - dma_addr_t dmaphysdest1 = 0;
# J- n" h ]4 O5 G& ~ - dma_addr_t dmaphysdest2 = 0;
: h6 m/ s9 U7 M3 Q* R
4 a3 X. k3 h: F3 k- char *dmabufsrc1 = NULL;
9 C2 a* a: X% O' t - char *dmabufsrc2 = NULL; G1 V" M5 D( \' ?" L
- char *dmabufdest1 = NULL;
2 T+ K. B% t# |) T k* C, Q$ P - char *dmabufdest2 = NULL;+ L( {, ~$ M% ]* q: y2 z4 i
- , K& e2 c4 J; R! A
- static int acnt = 512;% S: ?( S: A: R; }
- static int bcnt = 8;
9 F* k- j9 H& r - static int ccnt = 8;$ c* G R1 u7 b' C a$ \' O
- " l! [( L( S( ?3 v4 _
- module_param(acnt, int, S_IRUGO);
; ~! J5 H. o6 s" g ^ - module_param(bcnt, int, S_IRUGO);4 h4 S5 B$ {. i; V% d9 h' ^
- module_param(ccnt, int, S_IRUGO);
复制代码
0 L( b) c" R) z
/ Z) v1 ?, k) Q' l v# G8 _0 Y 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% n8 m" W4 g& @; U: g5 q) L
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* X+ p0 F+ m% `0 } 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% |( _! S% h0 d4 Z7 `( r* y
" E3 T& R" T1 [6 ?- o8 {
! \( E; C! C2 b- B+ i |
|