|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 W/ _4 D6 k0 _9 a {( d
- [code]EDMA sample test application H& W! \: n/ v7 P# P" ^1 P
- /*/ m6 t& j7 G9 e! i) C* X
- * edma_test.c
0 J7 o/ o. r3 j% p, Y - *% b R( Z" i* d+ l3 }8 o+ l
- * brief EDMA3 Test Application
, R: N v+ n: w5 c3 y- R - *
5 k: ~% S! A7 I5 L% @6 w; m/ i - * This file contains EDMA3 Test code.
6 \+ B0 H% O& |" \ - ** j j/ Z. Y; M; H+ F7 }) I. g3 h- q
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
" F1 V3 e- M; g" y% m* Z - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
7 G) R0 X; D/ e/ r% n% U( G; N w - * TO CHANGE.
8 r+ n- R: y# m9 M ~, V# `9 z - *
. b* a6 G5 G4 k5 p, u1 A' Q, O - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
3 L5 M8 v. C9 Z, a+ g) @7 S - *$ E- l' u. S5 t: I# b9 t. N
- * This program is free software; you can redistribute it and/or
]) v) B$ U8 U/ g, ` - * modify it under the terms of the GNU General Public License as
) r! _5 |/ D. W: N- a. n) o$ r% }& M - * published by the Free Software Foundation version 2.
" e3 K- Y1 b* C - *. W& h: w7 ~+ R+ r) r
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any* P* y9 V+ w+ i6 m
- * kind, whether express or implied; without even the implied warranty
) N4 f" ?' F+ e; T - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6 \; ^/ s2 m! _7 c$ i; f - * GNU General Public License for more details.
/ `+ F; z# [+ v5 Q! t2 G - */
/ X; v6 Z+ X) k, ^* x
/ Y) D1 Z7 A5 c6 m9 v* F( O- #include <linux/module.h>
: d9 L1 P; `% g$ Y e8 M Z - #include <linux/init.h>/ p: n/ j2 v" M* ?
- #include <linux/errno.h>- G1 s& `1 y- N& H" N4 c$ O
- #include <linux/types.h>
; j" ]( D2 C' P( L0 V - #include <linux/interrupt.h>
$ \6 U2 a' n+ l# Q% w& }) v - #include <asm/io.h>; F0 X8 H, P+ q
- #include <linux/moduleparam.h>! {7 P7 p9 @7 o1 @# \/ J! z \
- #include <linux/sysctl.h>" S% }: J5 h: X: {' @: |: l
- #include <linux/mm.h>; U& p7 E s, z9 f
- #include <linux/dma-mapping.h>: x% G) B/ r$ {. C1 _: ^
3 m2 l7 w& U' ]- #include <mach/memory.h>
( k/ a/ y! \& L0 t0 o - #include <mach/hardware.h>
# y$ U) a. u C" T4 U* \4 b - #include <mach/irqs.h>5 ^5 n- X- e0 K) _7 Z4 O
- #include <asm/hardware/edma.h>
( K2 Z+ n0 x- C - , j% ]7 o u- c6 |% T4 C
- #undef EDMA3_DEBUG- x( `4 L$ z) q5 k% g4 ?
- /*#define EDMA3_DEBUG*/: |: j J# c' g. Y/ `
' U* B H1 f& j0 r7 l6 R; k+ M- #ifdef EDMA3_DEBUG
# v4 v9 N. y- u' E' g* Z( M% [ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
5 p: I7 y& v/ f3 k - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
& K( E3 P' @. W; P$ Z* }/ j& p - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
) t+ j2 B4 H0 ` - #else' L C+ J: i: i
- #define DMA_PRINTK( x... )4 [' X! p% L `* ?4 H& V
- #define DMA_FN_IN( d6 v: _, o# f% D( S3 n9 b' K
- #define DMA_FN_OUT
5 V$ g& X: F7 M) U% z - #endif4 o; D; W2 E8 y$ m9 e% ?- N
- $ x" b9 w! C- c! G; |7 A: |* z4 V
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
0 u' L8 t! h- Z: w - #define STATIC_SHIFT 3" f9 J8 [$ S! Z* F
- #define TCINTEN_SHIFT 20
( l6 p( O/ E1 \7 O6 u! ? - #define ITCINTEN_SHIFT 21$ F& Y: k8 F( C4 D+ g# T1 o
- #define TCCHEN_SHIFT 22
3 ~! W. k% a4 y* p' C - #define ITCCHEN_SHIFT 23' y6 ?8 w7 a) n9 P" q
- M: n& z" E( p/ I; ]
- static volatile int irqraised1 = 0;, r7 @3 H+ B0 C
- static volatile int irqraised2 = 0;
& y% @- `" X- S3 o& F- H - % Y- K0 a) Q! w# Z. o* x, }, c+ i
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 t4 E% n) ~9 s
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 ]: Z2 r: f8 y# A - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" J g, E& c5 o7 |5 x" E
- ' W, E1 |% e- y' _; \. M. j
- dma_addr_t dmaphyssrc1 = 0;
1 X' R+ Q$ n l - dma_addr_t dmaphyssrc2 = 0;1 }8 W1 O! A: T! U4 g
- dma_addr_t dmaphysdest1 = 0;
- x3 J- s+ s8 N; w: W - dma_addr_t dmaphysdest2 = 0;
" z, L, j0 U, E# ? - - A7 A1 {" ?' ]8 |7 D1 a
- char *dmabufsrc1 = NULL;
; g# ]0 _' M; B2 i+ q - char *dmabufsrc2 = NULL;
8 j5 Q& R! K& w0 \* c a) M - char *dmabufdest1 = NULL;5 J, N) X, E2 ?: b" j8 F
- char *dmabufdest2 = NULL;2 f+ K$ K; f7 d
( Z" o9 ` m, d; h" N) \1 _- static int acnt = 512;
, k7 a# O. Y" y2 ^ - static int bcnt = 8;
# C4 [* i% ?! l9 @6 v/ n# {, T - static int ccnt = 8;
5 O% m, }" r0 l' A - - y4 l! m: t1 n/ v( \8 \
- module_param(acnt, int, S_IRUGO);2 D: l" J) J- I6 |1 r
- module_param(bcnt, int, S_IRUGO);/ ` c2 }8 A7 k( i2 \* W: i
- module_param(ccnt, int, S_IRUGO);
复制代码 % d, E- i- r: g8 o7 B
" X! I' e ~3 }) y2 O. b3 m4 v 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( Z( Z1 z6 ^, Q( Garm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 C: ]! {: U* J; Y* u 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 q% K& {4 T8 U$ \, B4 [% n+ E- [& P4 @! u3 k+ e6 a1 G" I
% `( H3 A: e% R. a/ a: s s! v |
|