|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% R, H% L! h3 g. }$ \- [code]EDMA sample test application
, n G8 L: c, O0 Y - /*& [' I; ~9 I: S$ Z, t! ~. |
- * edma_test.c
! Q& C C, P6 C - *
' c7 V4 y7 B( r2 ]; [! i0 b3 A - * brief EDMA3 Test Application! f1 @: s) n0 | l# a! j- w1 o1 j/ Y
- ** w/ Z5 [" F+ w% @' @: |
- * This file contains EDMA3 Test code./ A5 _+ K% o3 B. P( |
- *! p7 E( E- y- t2 f' r
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
" ]' j2 n: w8 C" g8 P4 y - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
- B, K' B# p( K) j# R0 l, K( u - * TO CHANGE.7 W |! s$ K, R" {+ z
- *
+ K- J- S' R9 e - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
1 J# o. M& T* R, J- P( r - *
2 P, y& b0 k! ^" V" p( p/ ? - * This program is free software; you can redistribute it and/or7 o; @7 ?! `. V- w: V
- * modify it under the terms of the GNU General Public License as% B, t; \8 l% h% @) E
- * published by the Free Software Foundation version 2.( b- S' @! R; z4 r
- *
R, ~% m. H/ g - * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 z. j. v" Z, U5 Y
- * kind, whether express or implied; without even the implied warranty
+ z! B- {$ O! c/ f2 `; e4 l" [6 h - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
' P/ B% w4 M' I$ J, g3 Y. G: r( [ - * GNU General Public License for more details.
* ~5 D0 w/ J9 ?! G0 f# h( p2 I8 p: z - */8 _+ h/ Z- ?5 f9 Z. s3 c( V% `
- - F! g' G) {% L' H/ Y
- #include <linux/module.h>
( j5 B: J" m$ a& f' D - #include <linux/init.h>5 m) `; T' {* ~
- #include <linux/errno.h>' s% R: r! i" z/ x' v# p
- #include <linux/types.h>
/ o$ {7 ^) Q6 Y7 X - #include <linux/interrupt.h>* Q, v4 J( O9 w5 W6 {; a* E
- #include <asm/io.h>
" j& f9 C, R, \7 l - #include <linux/moduleparam.h>
+ b% q4 N9 G o7 v2 ?6 u$ i8 N/ V - #include <linux/sysctl.h>
4 J/ C* W4 ]8 z# V" p - #include <linux/mm.h>1 V$ k" E2 Z% D
- #include <linux/dma-mapping.h>/ M2 H: i; p' q! X1 E
- ! n- ~, X' ?: g" M' \, h. A1 I
- #include <mach/memory.h>
) ]: F/ v( y5 S0 W. n6 X% o: C - #include <mach/hardware.h>' V$ D5 b* O: A$ t
- #include <mach/irqs.h>( y9 w% x2 T6 o, x' X. r2 `
- #include <asm/hardware/edma.h>+ U3 @- ` Y2 D! l6 k, m
) ?5 ]% _& O$ ~6 q- #undef EDMA3_DEBUG6 z+ |. B- _4 }5 ^% v
- /*#define EDMA3_DEBUG*/
+ t+ z6 v* l1 k( V
$ A1 O1 w. A% i* Y6 w, e$ D- #ifdef EDMA3_DEBUG% W- C7 s! A7 J- g* I
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
, |2 R W2 g# f4 N4 i- D - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 d6 ? O; u: R9 I$ e+ N: x
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( `: F0 N( M1 s
- #else, _) \. z. d ^8 L3 x4 f% u
- #define DMA_PRINTK( x... )3 ~# _4 ?9 _9 b, u2 J
- #define DMA_FN_IN# }/ v' A5 v8 Z) N" w# k5 Z( G
- #define DMA_FN_OUT
! Q( H+ H, a$ I( u# [' {. Z - #endif
9 v6 G, R9 X2 X# u6 d' \) B+ R% P; L" a4 N; ?
: z9 z2 q5 Z4 {) ?( I- #define MAX_DMA_TRANSFER_IN_BYTES (32768)0 S$ }' W Z/ ~" J" A
- #define STATIC_SHIFT 3/ F5 @+ K; F- S8 e8 _( t
- #define TCINTEN_SHIFT 20! S' I s3 @* r0 l1 g
- #define ITCINTEN_SHIFT 21
, u* T/ E d6 T5 b% B( I8 N - #define TCCHEN_SHIFT 22! ~0 q% h; z: I
- #define ITCCHEN_SHIFT 23
& F t+ }2 J3 x& P; h, n - ) }# _" c* B3 J' L& K( W5 V4 b
- static volatile int irqraised1 = 0;
) F( e$ u; R; |% b. N: e5 [) _' {# e - static volatile int irqraised2 = 0;9 `1 c$ A) o+ x* j
- 0 f8 a- A) m- ^9 U; e+ q' v
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, E" v: ~6 I7 @4 y - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ M5 |+ @" S9 v" j+ k' H( G* | - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 k9 A" n! n6 I9 L" ]3 f
# E$ q; y0 C/ ?0 L0 N& w- dma_addr_t dmaphyssrc1 = 0;
2 `7 Z7 Z4 v5 g7 D* E - dma_addr_t dmaphyssrc2 = 0;* U" m3 i, [5 @* {" _2 {3 l
- dma_addr_t dmaphysdest1 = 0;
3 j0 N N0 e1 \& u; z. H - dma_addr_t dmaphysdest2 = 0;, k- j+ p4 x- H) J5 u4 ~! T
- 7 e$ N, P. E( F7 ^+ F
- char *dmabufsrc1 = NULL;- o$ D, ~1 j3 B. y' ?' c @2 g
- char *dmabufsrc2 = NULL;
# P% N5 P6 n/ C: L1 O6 X - char *dmabufdest1 = NULL;7 m a& T8 N( i0 k8 u$ M
- char *dmabufdest2 = NULL;9 G0 _1 p* Y9 j1 e
- % o* A" n2 y+ y, _
- static int acnt = 512;3 L# ]. L' {; Y j, R
- static int bcnt = 8;
: `6 v v G2 [) `3 c+ ?9 W$ _, j - static int ccnt = 8;6 S9 }/ H( c. H' a
- : b# c' r' h& h" J2 O/ R. w
- module_param(acnt, int, S_IRUGO);
. ?, |( r! g! x7 u4 B% I' |8 |2 h - module_param(bcnt, int, S_IRUGO);
: _% e2 x1 t1 I0 m) s$ \ - module_param(ccnt, int, S_IRUGO);
复制代码 3 h0 z# K$ Z5 t$ r6 `
+ L0 _5 z' W; k. @3 c# `/ p u 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' @. K5 o) X" P/ m8 }% s
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
z- A+ N- [3 `5 j5 Q' ~ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% V! M: S F5 P. }
. V/ g r$ f* Z+ U+ s% P
8 K7 L5 K. _+ L7 l) ~* ?
|
|