|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' d4 W$ B* u: s
- [code]EDMA sample test application# { U/ D' |. N4 l8 v
- /*
8 I. T3 q' s7 F8 f) l) b' J0 } - * edma_test.c6 n4 V1 e. m x9 s( k t% [$ C
- ** W/ b) @4 w" N6 f) ?4 W$ Y
- * brief EDMA3 Test Application3 Z- i1 y( l# D, A8 G- V
- *
2 A/ W# M7 i' p - * This file contains EDMA3 Test code.: y! K5 V8 |0 ^4 b7 P' J9 x* J7 r
- *( ` k, ~+ Q5 O9 @' d0 B y- F! n
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
$ k6 M8 i5 j5 y- F- \ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
* |( c4 | d* I6 F. |# l# H - * TO CHANGE.4 A( c: A+ ~3 I( c) t
- *3 e7 M7 D3 F. Z+ Q
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 O( Q7 U1 }8 ]8 u
- *- h9 f4 c) U! i |1 i
- * This program is free software; you can redistribute it and/or' a' G3 u. `- e$ E# c
- * modify it under the terms of the GNU General Public License as) n/ n3 a3 L$ |6 l3 j; v' u
- * published by the Free Software Foundation version 2.
) r* K) }+ @2 _4 J1 D9 z - *9 M1 f4 `( t# u, @0 J
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
. A$ V8 H( _" ? K: ^ - * kind, whether express or implied; without even the implied warranty: k8 ]2 V; ?# X; G1 o, W& |
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
) @+ q' Z& _. A/ y - * GNU General Public License for more details.
1 ~+ Z9 \# g! T$ A' P - */
" Z t* e% \# r3 X" Z - ' _+ O5 S' n/ f% k) X* q
- #include <linux/module.h>7 A- o% P x; F: Q
- #include <linux/init.h>
- u1 m1 R X7 W - #include <linux/errno.h>9 }9 V- r ]7 U8 C: i- o
- #include <linux/types.h>3 w% p3 a8 z' G( b5 |* k
- #include <linux/interrupt.h>
1 {" [2 ?8 I8 i+ y5 Y2 e& Z: n - #include <asm/io.h>* c( c) O2 A) c4 Z/ v1 ?. u- s6 M
- #include <linux/moduleparam.h>( c3 c( M+ S0 i; x& R
- #include <linux/sysctl.h>+ j' z' C. n) s8 M8 }& a* s
- #include <linux/mm.h>
! B- T4 w E/ m m - #include <linux/dma-mapping.h>* T2 l k* t# q, b/ I
- . f, v3 B( y7 R! H2 l4 h
- #include <mach/memory.h>/ d* H7 D$ e0 v5 P6 ?( y5 z
- #include <mach/hardware.h>
# x* L2 B; e. c# A7 K - #include <mach/irqs.h>
Q/ w# k/ {# H4 Z# t - #include <asm/hardware/edma.h>
. ]- R4 p5 w' }7 w1 S% Y; W) q - 6 m5 F# X9 q( W9 {5 {2 @
- #undef EDMA3_DEBUG
* \1 Q7 [! M& k k: C# R2 I - /*#define EDMA3_DEBUG*/' ^4 ]' w7 u' @0 f
- ! f8 d* o; B$ X/ s4 q% E
- #ifdef EDMA3_DEBUG
$ i! V5 e7 J1 m4 t! C - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), X/ e. e ~4 W5 d) ~2 Z8 a) ^
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% ]9 K7 M) d! N" S
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
7 b/ ~7 p5 G0 u - #else0 R0 |; C+ A5 S+ \+ ?! W% J
- #define DMA_PRINTK( x... )
4 b7 I# O; Q4 }' ]' F6 h - #define DMA_FN_IN4 Z% S$ \% M9 T3 E1 I
- #define DMA_FN_OUT
; {% U5 T9 _& g0 j$ W+ p- w - #endif7 b3 Z- q. I5 r* z
- ) C7 N# L8 J4 m+ F
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
: {; W8 d/ ? z: U2 f. ~ - #define STATIC_SHIFT 3
O1 u; s$ p4 B; A% X' R6 ] - #define TCINTEN_SHIFT 20/ r. O2 I L7 J+ N
- #define ITCINTEN_SHIFT 21
' ?4 L6 T! l4 n4 y. \ ?# [1 Y - #define TCCHEN_SHIFT 229 ^: Y% S: }3 H3 H
- #define ITCCHEN_SHIFT 23
, i: x+ P# F1 Y. H7 x3 g5 d* Q
0 K4 r; E+ ]/ l7 L. w- ]- static volatile int irqraised1 = 0;
. T% j2 Q4 f) A - static volatile int irqraised2 = 0;
# e4 ~1 J5 m# K c3 j3 F - " f0 ^( b, Q b x5 a6 B
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! e( k1 r# f& Y. ?2 U4 D - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' O9 j V- @2 m; t b - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& n* t. u7 u0 A, {9 |6 h! ?
- $ [4 C* ?5 e- c* f
- dma_addr_t dmaphyssrc1 = 0;
* D6 p) z$ ~. u4 x& Y5 Y8 f" D. f - dma_addr_t dmaphyssrc2 = 0;
3 \; J7 h1 I( d. y/ J* F - dma_addr_t dmaphysdest1 = 0;
; a- a$ r6 R% R8 C J - dma_addr_t dmaphysdest2 = 0;( l8 }5 |! B" Q) b+ |, E# ]
7 t. c5 {' S& H j/ W7 d. P2 r- char *dmabufsrc1 = NULL;
# F4 s6 b! }- H% [" ~' c - char *dmabufsrc2 = NULL;
' y& }7 b1 T" |9 Q( d2 W - char *dmabufdest1 = NULL;
! z9 M0 S0 E0 {0 @* d - char *dmabufdest2 = NULL;& z8 L5 d2 I$ D7 k1 n- @$ D
/ i/ @( `8 G3 V, O0 Q6 i2 U- static int acnt = 512;0 U2 Y. a2 k; Q. i' h1 V$ C
- static int bcnt = 8;; H5 a: Z) O7 P2 I* F
- static int ccnt = 8;5 ] t i; R( r7 i9 y4 }/ \
- ( t% @ g; o1 \" k x6 C
- module_param(acnt, int, S_IRUGO);6 k3 W" L1 y$ F
- module_param(bcnt, int, S_IRUGO);# q0 L- H) G* z9 f6 C3 E
- module_param(ccnt, int, S_IRUGO);
复制代码
5 C5 H! w5 ?* @9 g- k4 f7 V
& B6 k5 F( E* ?9 B+ l# E 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" j$ E$ O5 O, C5 n" f2 b$ @. `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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ n/ T' |7 N7 N K) V' } 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 ~; Y7 ?" @5 J0 Z$ R
/ a" O. n" {0 ^' ~& w
% S4 _! y3 ^, i$ n+ w
|
|