|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / k1 x' j: U' h2 x, O3 Q
- [code]EDMA sample test application0 k% C& l+ X# r8 L/ y+ V+ `
- /*( t' ?' g1 X: H* X) e9 G
- * edma_test.c$ C/ ~, ^& @! s1 t# E
- *
* y4 ^ n( f! L; N3 H$ P* j - * brief EDMA3 Test Application' A& J5 v7 O/ Q; h
- *2 G% L# I$ O A# U: `1 D% S/ K
- * This file contains EDMA3 Test code.4 j6 x& h* F$ H; y L$ D
- *
) {$ ]* k. Z9 Z' K - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
: G( e _2 x! [9 `0 C0 ^/ T - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# r& s& a" ~) @
- * TO CHANGE.
( r7 p5 L% d$ t - *
% @: }5 E3 o1 t6 b6 o# K - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- k4 D" W+ C* A, u* Q9 C
- *6 S; [8 e: l3 F; b* ^5 F( n) P
- * This program is free software; you can redistribute it and/or3 R/ ]2 V. i# k. g" L
- * modify it under the terms of the GNU General Public License as
0 n0 L' H1 h' r5 A* l - * published by the Free Software Foundation version 2.) C7 Q$ j1 ~% q; D
- *! s |% S! m/ k' U8 |
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any" f7 l! c& o" H9 D
- * kind, whether express or implied; without even the implied warranty
3 g6 L( h) {7 A/ i" x: c - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- k7 u' x: _( o6 \1 m* R& E+ g& X - * GNU General Public License for more details.
# u3 l5 d- E% L$ M* Y6 t; ~ - */8 z" n2 W+ p: X1 }0 t0 M
- . X8 U8 i {; m( Q
- #include <linux/module.h>
. h: \4 D/ Z4 B" }4 R: t& V - #include <linux/init.h>$ c$ ~0 F/ \, n" M3 o i6 T
- #include <linux/errno.h>9 H* f8 K+ t! W; U7 c7 L
- #include <linux/types.h>
2 m0 u& Q- v! H2 P( f A5 { - #include <linux/interrupt.h>
. @2 D# s5 a) Y - #include <asm/io.h> u( `, N9 U! D% r& F* }5 _
- #include <linux/moduleparam.h>9 V5 _4 v" i/ [& S# b
- #include <linux/sysctl.h># |9 F( r. N; z' T
- #include <linux/mm.h>; u0 G; Z5 G) M C" W( s2 d3 h
- #include <linux/dma-mapping.h>8 i5 r( g# c( o }+ t+ f2 B. y- M0 Q
; I: K4 Z7 K3 ]! Y7 n9 `2 W- #include <mach/memory.h>
\# {2 R: M. C! f5 @- A3 A - #include <mach/hardware.h>
8 S, A+ p3 F% [- y# s$ x - #include <mach/irqs.h> N3 i6 ~0 q# V8 {" k! C
- #include <asm/hardware/edma.h>, D* d5 L6 P' |0 ?
; V' l9 m; X& @# g- #undef EDMA3_DEBUG
# m1 T- p( \8 j3 r - /*#define EDMA3_DEBUG*/1 M5 o8 M; X B3 L3 J
- # [/ T. r+ f( s6 g; M5 U: ^
- #ifdef EDMA3_DEBUG
/ x1 M/ d& @: h - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- B6 O8 P, u0 p$ Y7 ?. W8 r1 z' V
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
, F1 `) J& w1 ^8 ~5 R/ w _/ i - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" m5 E7 f% g: Z+ ?3 `$ F8 ?$ z3 Q
- #else
0 D+ H7 [0 c- t2 ` S8 M - #define DMA_PRINTK( x... ); d9 z2 X- n5 a# ^! V
- #define DMA_FN_IN" Q# S* a' }) }5 A
- #define DMA_FN_OUT
5 L1 Y/ z. s* d. [1 h - #endif+ X9 q8 O0 x+ A5 R! r
- 7 E% [3 r! _; G' N. d
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
7 ?. r; [- |1 m! w4 O# C$ Y - #define STATIC_SHIFT 3: l* w+ I: T* G
- #define TCINTEN_SHIFT 20
0 Y9 o& q8 u0 P8 k8 [! B6 w o - #define ITCINTEN_SHIFT 21
9 \* A6 h% F3 L: [' Q) H$ Q - #define TCCHEN_SHIFT 221 v& S4 P R8 y
- #define ITCCHEN_SHIFT 239 x! ]9 o. H9 r% a
- / w n9 x+ ]8 V3 O1 d( D
- static volatile int irqraised1 = 0;
) l6 d! I% ~) c3 y4 h+ A) T; u - static volatile int irqraised2 = 0;
9 _% O' j8 m, U$ u
# N* Z( ^4 x" \7 z, n- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
N; F* ]; [. H4 a/ ~ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 G7 j% g7 k; W4 R4 i3 W( a - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: S# \5 f# T# l2 V$ L+ D+ Q0 U
* Y8 s% [$ ?. i+ B8 P- dma_addr_t dmaphyssrc1 = 0;
( G# G" s1 j: e/ _9 @' L0 P - dma_addr_t dmaphyssrc2 = 0;
5 e" m$ v( x2 A: X - dma_addr_t dmaphysdest1 = 0;
6 N) ]% a" K. z8 t" [) f - dma_addr_t dmaphysdest2 = 0;4 ]! H d1 I/ a" z6 F" s
# t6 K2 y0 X& f+ ?- char *dmabufsrc1 = NULL;/ r# _9 a3 s* M, \& X* a
- char *dmabufsrc2 = NULL;8 K3 {$ u- x# |5 Q# z
- char *dmabufdest1 = NULL;
% A: V$ L6 P& c! N8 N {3 ^$ A - char *dmabufdest2 = NULL;
: X: _7 _* |+ E( M6 m7 S" r - 5 T0 Z' d* U1 U1 s# k4 p! R
- static int acnt = 512;+ C9 {" B7 b. L7 b; F
- static int bcnt = 8;
) K5 F) J# a& E - static int ccnt = 8;0 Q" _: W- P3 x( z* t7 c) o
- $ r1 O% M$ P8 u2 [" m
- module_param(acnt, int, S_IRUGO);8 x& X6 ~# |( W- r
- module_param(bcnt, int, S_IRUGO);
9 e! I D, a: g- _ - module_param(ccnt, int, S_IRUGO);
复制代码 ) L* X ?9 U7 \! U% L
4 }2 p7 K) v3 r6 n& o" h" F8 A* ? 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 `' l& Y* F+ w% ^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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# q3 p5 i) S% i% F
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& S# {$ D' V. h( u i
# R" y5 T+ n) P+ X; \
k1 Q% \4 N$ Z; ?- s( i0 S( x; i1 U2 f |
|