|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! V. I! k2 G. J# k
- [code]EDMA sample test application7 ]' M& a9 b* ]
- /*2 s7 A8 Q% h; P) F: a: t
- * edma_test.c+ _# `* R% P$ F7 T# @& Z' n% s
- *
) X' c! X) w8 H# T* K - * brief EDMA3 Test Application- U5 D) |' f2 N3 k: s
- *# y( w" w0 L, v' e5 }
- * This file contains EDMA3 Test code.
% l \+ X) x0 B' ?& s - *
( U* {6 F. ^; b' W9 k1 Y - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
8 d( ~' u* T% W" o( D* @4 Y" Y1 h - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
* C! R7 y0 z5 D - * TO CHANGE.7 ]7 `9 h- x- o
- *$ Y" |, w% P$ [$ _, x
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
: ]+ X$ B6 k" q# F% t/ c - *! Z8 e3 {5 E$ j: x4 i- q
- * This program is free software; you can redistribute it and/or
9 r5 Q0 n; y; d - * modify it under the terms of the GNU General Public License as
# X$ ^3 T' t% q% a8 U, \. ` - * published by the Free Software Foundation version 2.5 G- U$ E8 H/ O; j- z; n
- *
: o" A9 T+ v4 }4 N: N - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
* a$ A8 u( y3 p+ Z, b' x - * kind, whether express or implied; without even the implied warranty1 b' d; I+ I* C& X
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/ k( v# E( Y$ v8 |/ W* V8 K' ^ - * GNU General Public License for more details.& q' F! `& G- ?' F
- */, U1 ?2 _& _" Y- w( l( y% i+ O( l
- : i0 t6 X. p! K8 Y+ k% a
- #include <linux/module.h>
: w; d7 d ]/ D' C+ C$ y1 g, {1 s - #include <linux/init.h>
. t8 L2 p$ R! f/ p5 f( w' I - #include <linux/errno.h>
# ^ o) K/ H3 g2 M - #include <linux/types.h>1 O, y/ f2 B+ k/ ]- U
- #include <linux/interrupt.h>
2 a9 ^. k$ ^6 _9 ?2 S+ B3 r3 E6 ^& t2 P - #include <asm/io.h>) \3 Y1 g" f% d+ Q% k8 g' ^/ y) Y
- #include <linux/moduleparam.h>1 j9 D/ b& \' \7 P/ y
- #include <linux/sysctl.h>+ s6 `9 l, j+ d" M$ ^& z
- #include <linux/mm.h>$ N4 Z8 L5 l5 A2 y
- #include <linux/dma-mapping.h>
! Z& Y! @8 R/ M. x4 o, Q* U% u( J
Y- r% {6 K5 j: |- #include <mach/memory.h>: n- Z) j8 p5 T7 _( U7 H: ]! |; I
- #include <mach/hardware.h>/ L. B; ~2 m/ ^( c
- #include <mach/irqs.h>% P3 f. H1 B% {+ O
- #include <asm/hardware/edma.h>
* l5 l9 F6 ?$ f# F( n' u - " q! S9 U" x( D
- #undef EDMA3_DEBUG
d6 T4 p& W( d - /*#define EDMA3_DEBUG*/; b- u# g" {. v* R
- 2 R0 c& g8 [$ ^$ c
- #ifdef EDMA3_DEBUG
8 M" s& o) ]7 I# i' Z0 \- Y - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ t; j. A4 a3 y; z) }9 G3 |
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), k8 s: _9 e& F f" R5 a
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& r4 Z5 x/ f$ h1 t& U: r; z0 l* b
- #else3 E4 y& Y* ~: T9 t5 O5 V
- #define DMA_PRINTK( x... )
2 j! l8 [- R+ _7 ?- p - #define DMA_FN_IN$ ^ y. C! h; h: t" Y" v' ]
- #define DMA_FN_OUT8 @% E' p1 s) v* o2 F
- #endif& a, G& x8 N/ d3 x8 `: `% x1 Q. X
- 4 o) a6 `3 O6 b
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
" K8 E- j6 X- Z7 j+ { - #define STATIC_SHIFT 3+ B' A; V5 a* P' D
- #define TCINTEN_SHIFT 20$ i- T. z! c+ ]
- #define ITCINTEN_SHIFT 214 z8 Y0 s7 \: B: B8 z& b7 r4 B
- #define TCCHEN_SHIFT 22( d; h9 y! I. i2 Q9 ]
- #define ITCCHEN_SHIFT 23. M5 Q" B9 E* u# Q9 S! {
# @+ ^& d# j) ]! j* |( D& z3 O- static volatile int irqraised1 = 0;$ y V/ ]) Q: R3 w6 |; J9 u
- static volatile int irqraised2 = 0;
$ S9 F$ o% o; Y
# Z- ^! z$ Y( \- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# E u' l- y: Z
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. B: l5 N, K# Q* Q7 ?1 a# r - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ |+ x2 r9 l1 y8 d - & `" |! f4 }3 i) V
- dma_addr_t dmaphyssrc1 = 0;# w( t- E4 @( l4 h$ o
- dma_addr_t dmaphyssrc2 = 0;
' X0 F2 D0 K7 ^; J# ~ - dma_addr_t dmaphysdest1 = 0;
+ X3 T) U4 k: u - dma_addr_t dmaphysdest2 = 0;
; X$ B. ~1 @6 ~% R D* h. o( |$ E - 0 U1 x% C5 e: e! a6 p, A' r
- char *dmabufsrc1 = NULL;, W! r" A, X8 U) W j- P' C
- char *dmabufsrc2 = NULL;
7 _- J$ k( Z) Q# @- }" { - char *dmabufdest1 = NULL;
9 u- r3 S, ~$ r: ?) B - char *dmabufdest2 = NULL;
# V1 p. c$ ^" M4 u - 1 i! H# B: G; r* L2 t# P
- static int acnt = 512;
. n- c* W6 \0 s- X! o - static int bcnt = 8;
3 k) V% I& l$ |/ M5 u( n) o - static int ccnt = 8;. x9 Q5 U2 X2 s( L' C% Y: k/ W* n
- * ^, l7 a: H% J
- module_param(acnt, int, S_IRUGO);
: ?5 } J' k( c- Y# r0 _ - module_param(bcnt, int, S_IRUGO);
/ s( r9 t z5 X: f3 v - module_param(ccnt, int, S_IRUGO);
复制代码 ; O" m5 `% ?( x
. ]# W' f8 r* @4 }& c
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% Z, c6 K/ R" a3 ~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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. E& y. `" o) R, v3 j! J0 g. {
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 [& T# b" s( X
7 ]; ~7 S7 T: p( u
- \# F% [8 P7 L. W |
|