|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* V2 F, T- t% Z# L& E# @8 c- x7 F- [code]EDMA sample test application
; A) T* o: [1 K7 _% C! I* _5 u - /*
- ?, N7 ^# S6 H Q6 Z- w - * edma_test.c
8 P' ^7 ~; s* m- t/ m) m - */ r* i: s+ \7 P4 J! m- D
- * brief EDMA3 Test Application
8 _$ m7 y$ {, x5 t. E - *
- |+ l. ]% B) y2 F - * This file contains EDMA3 Test code.
" n$ R9 I' G1 J3 n2 {- J$ \ - *9 H: d L7 U" m+ y
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
3 R% [( j+ i2 C* j3 Q1 o - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
3 P) U9 U3 U6 R' G& e - * TO CHANGE.
9 a9 Q5 C! p, ]/ v8 W - *0 {% Q* U0 n5 h
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 {, t# K! r' z9 d& x, h$ g
- *3 I5 f0 H5 m1 r, W
- * This program is free software; you can redistribute it and/or9 n1 y0 L2 _; i& y! \( N
- * modify it under the terms of the GNU General Public License as
( L Y5 ^# s8 N* L& r7 } - * published by the Free Software Foundation version 2.& q/ M% E0 j$ o U' o
- *# g, s6 w; d7 J8 I# b: Y U
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
$ S9 i% A3 s* U; B/ i1 Y) D - * kind, whether express or implied; without even the implied warranty
# m7 s. l& ~! B0 B - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- @0 \: Y: _1 x' U4 w; E4 W5 w; Y
- * GNU General Public License for more details.
" ]: ]; z* T$ L6 v1 C" L - */
* L' {% n- N9 e4 N' n3 c; C
/ B6 k8 ?" S1 W/ N: Q c- #include <linux/module.h>2 u6 R' U; N: L0 K9 B1 z
- #include <linux/init.h>
4 w q Z6 k- D1 S. W - #include <linux/errno.h>* h; O- [& g0 L8 x- y# v0 g
- #include <linux/types.h>
/ i& \$ G) i! Z4 {2 h - #include <linux/interrupt.h>% N% \7 } G, ]/ V9 E7 |
- #include <asm/io.h>
# K/ j4 V: G/ ~! n+ {! R h7 I* A1 _0 z - #include <linux/moduleparam.h>
' X( Y1 N: ^, ~* S+ \* C - #include <linux/sysctl.h>
3 ^! b R3 V2 j- G - #include <linux/mm.h>
6 S# ^+ h+ i% p7 W o - #include <linux/dma-mapping.h>
# @, D, @1 N ^3 W$ B* u3 }
- w/ |+ \6 ]: f5 D- #include <mach/memory.h>- G, E! ~5 q! F( z
- #include <mach/hardware.h>6 j% X7 j, r# \: E
- #include <mach/irqs.h>( @" W5 j; C; M6 O" v
- #include <asm/hardware/edma.h>8 X$ e; Y; p0 N! ^
- , F$ Z. z! I5 A' ], B% l/ ~! [7 i
- #undef EDMA3_DEBUG3 ^4 W- W) \' k Q# O% P
- /*#define EDMA3_DEBUG*/
8 K9 W' w; e% t0 s5 R
2 C5 o" M, Q% x+ W7 Z. k) K9 F7 ]9 T- #ifdef EDMA3_DEBUG
% x1 }; z3 K1 c, y, Z - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
1 i. g3 A' P& \: x" i - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
' b; Q: V7 W! G8 c. |0 k# u2 P! y - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
, y* }4 V9 A8 {+ v/ R# j& A. T( B7 M - #else
% I% j8 E' Y' X2 i4 L - #define DMA_PRINTK( x... ); [/ v" h9 [ p/ V: q2 r/ f& @
- #define DMA_FN_IN! g# w5 _+ Z2 B+ q
- #define DMA_FN_OUT `3 S1 X8 U" _. E
- #endif
8 I2 D h6 g! u5 Q+ u" J
4 J1 [5 B: n0 a! J- #define MAX_DMA_TRANSFER_IN_BYTES (32768)/ g) y# q+ J6 S- j
- #define STATIC_SHIFT 37 N) K3 F+ L/ m+ [6 Q# I4 B
- #define TCINTEN_SHIFT 20
. F7 M" r2 O3 f# L4 s9 W0 F - #define ITCINTEN_SHIFT 21. |7 J/ ^& w% S n9 C
- #define TCCHEN_SHIFT 22/ Z5 @/ m5 V( _$ y1 Y4 p
- #define ITCCHEN_SHIFT 231 O* M/ h7 W2 B+ M
- % P# _$ ]& \) ]( [
- static volatile int irqraised1 = 0;! u1 c0 y- |- Y3 x3 M3 o- g* P
- static volatile int irqraised2 = 0;: N, Q! l! }% r$ ?
! a& I% P2 B0 Y" p% ^) ^- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# I5 f( V E6 M7 H, t
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. S5 N, _5 S7 G$ S - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: A M1 V+ T+ T' |! \& t* w
- 9 n- _& L% }5 r2 i) O6 [: m! W
- dma_addr_t dmaphyssrc1 = 0;! H' ^; n. p4 L( G8 o' @. e; Q
- dma_addr_t dmaphyssrc2 = 0;
9 j2 [# }" Y" {7 z0 x - dma_addr_t dmaphysdest1 = 0;! U- m1 Z: t: H9 `/ }% p
- dma_addr_t dmaphysdest2 = 0;! {& u* F0 c% Z
' |' `4 K" Z* W, H- char *dmabufsrc1 = NULL;5 Z- a" r7 ?$ u7 i8 R' T) ^
- char *dmabufsrc2 = NULL;
) I, z2 \( ~" {: H2 n - char *dmabufdest1 = NULL;
; g7 O; N( e6 K3 [4 N& H1 A' F - char *dmabufdest2 = NULL;
8 N5 k% c- ]- y2 D: e3 ^ - ; i7 g% S! ?1 a$ C" @. s0 K1 ^
- static int acnt = 512;% Z% c* h' P2 |' b8 ]8 {% m
- static int bcnt = 8;
[, ~# t) U# l) R8 P - static int ccnt = 8;
/ X2 T3 x! I7 h- J) ]1 z5 [' G - ( ` X" I9 n! L5 ^! b( u3 p
- module_param(acnt, int, S_IRUGO);" \" U- }& z6 A5 U( K5 p) l
- module_param(bcnt, int, S_IRUGO);3 ~' ?5 y( S P* v. Q2 l
- module_param(ccnt, int, S_IRUGO);
复制代码
0 M3 t9 ?+ `* t& m
2 c& |3 d0 ?' S) e& x8 M 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# W! w) v: s( O0 ^ C, U
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 {" h/ h0 y% Q- `2 v 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 o% U9 { B+ d( e3 j4 v7 Q7 p* c u
; h- i* S1 q5 E
|
|