|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % R/ q% D3 ^ g7 P( q
- [code]EDMA sample test application
5 x0 S2 z! k. B. e" k - /*
5 l+ a$ P5 e7 T - * edma_test.c1 `! j: V, q: h1 P/ |
- *
1 \& f% M. S. r8 f8 G: C - * brief EDMA3 Test Application( [2 A5 P8 p; N2 k4 h
- *
" G' y& E0 Q' ?- S# I - * This file contains EDMA3 Test code.
# `! s1 l1 R& ~ - *4 k) D8 F) n3 V" t7 ~+ g/ R" V) F$ K7 }
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
5 E2 z7 V0 T j0 H - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( P) y8 Z {5 s/ O
- * TO CHANGE.0 }3 F1 A7 ^. D
- *
0 Y/ O: J' g! C* k7 _ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 f! |9 Y1 X' `1 \, W- i2 \- a
- ** f8 R$ y5 L# X% \- z, S* y* j
- * This program is free software; you can redistribute it and/or7 }, N% u- {6 a' M7 F
- * modify it under the terms of the GNU General Public License as6 O" e7 Z, Z0 U4 G! t6 \
- * published by the Free Software Foundation version 2.# d# S k; n# b. H C' B8 d* g
- *4 L. f, A% A8 k o5 K& [# @
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 X6 g/ b- q. C
- * kind, whether express or implied; without even the implied warranty
+ N4 R1 w+ P% E" O0 a! p% k1 J$ S - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the* [) _* n @6 K/ f) ^
- * GNU General Public License for more details.
3 g$ H7 {) {( S [6 S - */2 n0 Z8 P& O f0 Z0 j
, ]" { x' f. b) v; r; U3 a; U, K- #include <linux/module.h>/ s: t% \7 r W; `0 n# j9 S# @
- #include <linux/init.h>3 N6 o3 e$ x; R- w8 D8 @) u
- #include <linux/errno.h>
8 F8 i; I0 g) U. ^ - #include <linux/types.h>
7 B, s! ~; X: j/ J5 s - #include <linux/interrupt.h>
# `: @" e. J, x2 r1 o/ q( [ - #include <asm/io.h>
# V a& Y* K2 X. J0 ~4 R! |7 V. X - #include <linux/moduleparam.h>
1 F* R. E U' m5 F7 s" R* O% }8 B - #include <linux/sysctl.h>( V3 }3 J, Y- [1 M( a; h
- #include <linux/mm.h>( @% U; h0 p: g# G5 e$ o# z$ [% T
- #include <linux/dma-mapping.h>- Q( K) ~- I; g4 { S. `6 Z0 l
- 0 p9 D& J- s t4 I, c
- #include <mach/memory.h>% ]' R' v( A2 c& @. A" t
- #include <mach/hardware.h># K& T ?" x" } X* y) R. `! ?
- #include <mach/irqs.h>$ c$ i, u: J0 t
- #include <asm/hardware/edma.h>" U w" m4 ~8 b7 ?
1 l1 p( [5 A' \: V3 t- #undef EDMA3_DEBUG
$ B9 y7 p- _; U* Y0 ? - /*#define EDMA3_DEBUG*/
, n1 h$ ~( U) T& S& _
( f& F4 ]* x( N. K7 B. z' b- #ifdef EDMA3_DEBUG9 L2 {9 }( [" h0 n+ g3 M
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS) K/ w7 F" S |" M
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 d2 j# }+ q/ R7 u& u% M: q
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
0 d- ~& H# ~5 Q5 ^% t - #else
! q. N' C2 [2 w/ ?& w* f1 E( H" d - #define DMA_PRINTK( x... )1 V0 ^& V' x! B" i R1 R$ J
- #define DMA_FN_IN% }( U% f( D, c) T9 j; x; ^
- #define DMA_FN_OUT- q x n* O) [; l+ B
- #endif
0 ~ C' ~6 e: R9 s
' k- R# L9 ^8 N! ~7 S. k- #define MAX_DMA_TRANSFER_IN_BYTES (32768)8 Q; @) p U6 _4 g- j
- #define STATIC_SHIFT 3
: N( G# Y+ j0 V% }+ W7 k Z - #define TCINTEN_SHIFT 20! |* J2 O- b4 y0 Z1 G( V: m) w. ?6 _" j
- #define ITCINTEN_SHIFT 21
4 u! g; a/ a5 S" G/ x - #define TCCHEN_SHIFT 22
2 d- p- j7 V; I; h9 e2 T - #define ITCCHEN_SHIFT 237 U7 I% o5 ~ \- t: h8 M3 |
) |8 o$ z+ X# e3 t$ h7 e; x7 g7 j' C- static volatile int irqraised1 = 0;# N1 I2 @: y$ H! @$ B: m
- static volatile int irqraised2 = 0;9 G& p' ~/ d9 I ^
- " j+ @! c' U$ E
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* N7 {; c5 M; n; k) J- x. ]
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( m ]; @3 R1 g: d6 w) e5 j7 g# N - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 O9 D- S- g+ t" }5 ~
" B9 C- M6 x! o0 h! T- dma_addr_t dmaphyssrc1 = 0;. y, m5 J6 N% X$ F' d6 ~1 H7 _
- dma_addr_t dmaphyssrc2 = 0;
2 R5 @5 t1 d$ P: [8 s7 B - dma_addr_t dmaphysdest1 = 0;; V% @! D$ A3 I6 ^; }! z) n! R) R
- dma_addr_t dmaphysdest2 = 0;/ E1 m5 X9 d/ j; \2 W
# [$ f9 R2 Q) Z' ^ Q4 e6 y- char *dmabufsrc1 = NULL;% H" A1 x3 ^0 j" J
- char *dmabufsrc2 = NULL;7 B5 @! b% ]" Z( I: z
- char *dmabufdest1 = NULL;1 e, S6 E# P7 a) E. d4 C
- char *dmabufdest2 = NULL;9 V+ Y( v+ k6 G7 v1 H+ K' ^& ]! f
- 0 j) |0 C. U' w4 g
- static int acnt = 512;
3 V( b0 o2 C, M" D! r - static int bcnt = 8;
D/ {0 _1 r* _; h- M! D - static int ccnt = 8;
7 E" S# O# }' B - 1 \. n# q$ [7 L3 Y- s
- module_param(acnt, int, S_IRUGO);9 N' H7 N9 \( j" Z% O. u
- module_param(bcnt, int, S_IRUGO);
. ^0 {; d4 j* r% O% x8 Z - module_param(ccnt, int, S_IRUGO);
复制代码
; T* u& }- V& l& j: ?) f g# O) \# d- O: C2 ^
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! E- V$ g; e1 |8 g5 H% E: A
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, @! P, v& ~# G 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 Q6 h2 B* M& ?+ a6 n; l% \, \5 w5 @7 f& O( P
% V+ h1 t- i/ b |
|