|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 j! j3 q6 D4 o$ Y* e% r% B- [code]EDMA sample test application/ G6 v R5 }+ h% o2 z2 M* t+ M
- /*4 ]& y, O6 @ S3 X) A: C
- * edma_test.c
Q7 [" q* E- g+ ` - *
* H9 x) _2 m i0 X - * brief EDMA3 Test Application
' t2 Y2 p# o6 z* W! l - *
* ~ ^( |$ R- r' a0 M - * This file contains EDMA3 Test code.
$ l+ k! _% ?# _7 Y: L - *" w. a3 `0 j. j }6 c3 Z$ o
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( k e& L3 A+ D; v1 U! S
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- D9 ?0 y; O8 z( I% J, y6 |
- * TO CHANGE.
J6 Y N1 m {9 p# _6 [1 p! b- I o - *
4 R2 C0 e9 O* m: Z2 V' K - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
" O% s0 V& D4 Z: x# y# w2 q4 g% R n( Z - *' J+ c! o# u4 }8 |
- * This program is free software; you can redistribute it and/or
; T7 t6 k) f: `# D# _4 Q - * modify it under the terms of the GNU General Public License as
$ {) o# N: s6 I( q2 G1 E2 J - * published by the Free Software Foundation version 2. L1 U1 q+ v7 T6 U" ^; J. p! @
- *' ?- n6 z |0 P h
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 B0 X9 T) ?. y1 U
- * kind, whether express or implied; without even the implied warranty3 |5 F: ?, x# c( O
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
& Y! H l7 s: E4 `7 x3 K" ] - * GNU General Public License for more details.
( N1 F' h2 D* D - */1 H3 L- H6 L. D
- $ H( o9 m& A4 X# ]3 L2 J
- #include <linux/module.h>
+ K( m$ L# V/ q3 `/ R# s9 ? - #include <linux/init.h>. O' C6 D/ D7 p) y0 H% w1 }9 ]
- #include <linux/errno.h>
/ `( X1 L9 C- z) o' F - #include <linux/types.h> ^" r" l ^/ Y
- #include <linux/interrupt.h>) ^4 Q9 j$ ? \& e
- #include <asm/io.h>6 `% r# @5 x- U B
- #include <linux/moduleparam.h>
3 A; {" K6 P$ _' m O9 S - #include <linux/sysctl.h>
$ b: Q$ c% `8 ~ - #include <linux/mm.h>( a c3 B$ L0 P( H q- S$ A F
- #include <linux/dma-mapping.h>
4 m3 M! ]3 Y6 E( A4 Q" P; `' j - 3 G3 X; Z* r1 {1 B5 Y
- #include <mach/memory.h>% L6 J/ z& ~& N# b
- #include <mach/hardware.h>: k4 i- F% A2 u! y/ i4 c6 V9 @
- #include <mach/irqs.h>$ K! ]7 J7 \% d" {1 O( b" [
- #include <asm/hardware/edma.h>% j! U& W {. @9 V4 \7 }/ V
. y ~+ D3 z. K2 u( h- d) k. C& r3 S- #undef EDMA3_DEBUG
, }. ^) O9 I( g4 O - /*#define EDMA3_DEBUG*/7 ~ ?( M h5 w2 b! P
- " ~. i, b1 O" ] M z$ [) L- d
- #ifdef EDMA3_DEBUG: p% ]' Y% ?2 O8 D3 R/ B
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
) U2 z/ {# ~5 A+ ~' V - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
, q: @( g4 i8 N3 U$ L4 |" u - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ ?' n; e) o* F1 N+ t' @
- #else
( V! S5 t7 S" L& A6 o( R, n8 | - #define DMA_PRINTK( x... )' g0 X! g' \9 G3 x* L3 k8 s$ O3 s
- #define DMA_FN_IN: X! B9 ?1 w2 m- G
- #define DMA_FN_OUT
G. b! Z- X8 q - #endif
) l' C5 \$ a9 V% Z: B: [% c3 h
4 U( d8 P( D+ S- U9 ^( y6 Z: Q- #define MAX_DMA_TRANSFER_IN_BYTES (32768); W" r; G4 E+ d; |1 |+ K+ n$ w
- #define STATIC_SHIFT 3
; y# J1 `3 c W- M - #define TCINTEN_SHIFT 20) G0 v1 ~8 A8 v$ G
- #define ITCINTEN_SHIFT 21
4 ~4 }) g" Z, v; @! X - #define TCCHEN_SHIFT 22
- \! f) X. |4 l% q" h4 y+ N5 Y4 I - #define ITCCHEN_SHIFT 23" R) s+ R5 K, p% _# g
- 8 C+ m+ w$ b9 a
- static volatile int irqraised1 = 0;
7 v# N" b: a# b# C - static volatile int irqraised2 = 0;
" A+ H' N' ?5 @( { o
4 g4 h& _" L! \( h+ Z7 d% g* X- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); x C7 G6 a7 J5 [; M) R, N
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* }5 `' Q3 W" `( R- M
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: Q# p' D( S+ I9 v - ( x: b' k) ~2 d8 T( C& l
- dma_addr_t dmaphyssrc1 = 0;2 H4 t, D6 @, t/ X2 V) r
- dma_addr_t dmaphyssrc2 = 0;& }* [! H2 w h6 H
- dma_addr_t dmaphysdest1 = 0;
) R7 r5 r+ l4 N' n, u$ J - dma_addr_t dmaphysdest2 = 0;
0 E1 e3 s& Z$ s9 j - w5 a# f+ V, Z$ w/ A5 u3 W
- char *dmabufsrc1 = NULL;
" s+ k7 i2 j* F: Q - char *dmabufsrc2 = NULL;# H5 }) j( n" A+ Q8 X
- char *dmabufdest1 = NULL;' @8 O s1 ] Y0 s
- char *dmabufdest2 = NULL;
9 p/ F: m( d. K1 d
w5 \, x3 J$ {( Z9 L; V8 W& F- static int acnt = 512;0 S0 t, |7 |/ w; X' o% X
- static int bcnt = 8;& @5 B Z( }/ K
- static int ccnt = 8;* ]6 x5 v: m; u
+ l; R+ ]- X& Z& e( \ ]- module_param(acnt, int, S_IRUGO);
$ b! ~1 d0 J' Q* P - module_param(bcnt, int, S_IRUGO);6 S0 s7 `% U, U. t' ]; x- g( c
- module_param(ccnt, int, S_IRUGO);
复制代码 c8 M! H5 n5 C+ ]; o# H' o1 T
! Y# ~$ c/ u3 Z9 |# [ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% @8 s( d+ w& y* s3 e3 @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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" m" T! a4 s1 m) X/ i* F% m9 d 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 R. s$ ]1 m- `
! \$ v$ u6 L. F0 [; O
( T; I4 U! h6 S3 r: \1 O |
|