|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) t/ I+ p* [- Z( \+ K5 y2 V
- [code]EDMA sample test application( `+ ]4 U. D& E+ t
- /*
6 {5 S' |( t$ C! G - * edma_test.c0 w+ h$ F) G' P3 a+ C+ Z% D3 N
- *$ s8 B' O0 P" p9 N
- * brief EDMA3 Test Application
+ E! u, O7 ]: F. i4 x' M# Q$ u - *
- H5 R. ]! |$ a; _ - * This file contains EDMA3 Test code.- G5 q1 S8 J7 }# W+ L/ C
- *$ w% S* u0 w3 R
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
1 H5 F7 E7 {: c - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; H) R; {' d7 P% Z4 i, d" o! \1 [
- * TO CHANGE.# z0 M1 { n& B4 B+ U; f
- *
6 i% J3 u' t& q7 N! _ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
3 A4 t" J0 G2 p: v ] - *
4 v% l: D2 Y5 I+ _# ] - * This program is free software; you can redistribute it and/or
4 ~# b o: z- m3 S+ p - * modify it under the terms of the GNU General Public License as: H; h5 Q8 F/ z6 k% ]
- * published by the Free Software Foundation version 2.
6 _" j! \2 C$ O0 X5 ^% [ - *) e, `& |# B& e" [, I) m& o
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
0 v V% U3 x4 ?$ M - * kind, whether express or implied; without even the implied warranty" K f. W+ [- j8 ~6 z" s- t
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1 t* l, o! p# z! y - * GNU General Public License for more details.- N) v7 j1 M2 u2 \8 X0 D# a/ L
- */( F, q1 Q% A1 W# L$ K
- ( [9 |7 ~7 e# I/ Y
- #include <linux/module.h>8 n3 ~# ~' p7 a W, y
- #include <linux/init.h>
9 m1 U2 P3 H: S {) Q* Q - #include <linux/errno.h>2 c7 y4 J6 X$ {/ E
- #include <linux/types.h>5 s) D' u9 ~* ~# q2 K
- #include <linux/interrupt.h>0 n* r4 @1 M# X. t( ~3 h0 k8 w
- #include <asm/io.h>
2 d" B3 N7 q1 M+ i2 V - #include <linux/moduleparam.h>
; Z) o. U3 N# s- |, l - #include <linux/sysctl.h>
, C1 P( D2 c" l* F! Y - #include <linux/mm.h>0 `4 ^, ~, v0 T7 q
- #include <linux/dma-mapping.h>
0 c3 u% J2 J+ Z0 F
) k: s% \4 @, f. C: G- #include <mach/memory.h>
2 `$ `. s2 p" F5 I - #include <mach/hardware.h>
+ T( d# F4 d# f* K% a+ k" h - #include <mach/irqs.h>
9 M+ \% X' l, `- |$ c$ S7 k - #include <asm/hardware/edma.h>
/ N; O8 a$ ?( |4 c
# w3 v$ q( D* M/ F- #undef EDMA3_DEBUG, c1 c; R/ M1 G' }1 H5 R
- /*#define EDMA3_DEBUG*/
" y! ]( o/ P' u2 F6 X7 |
8 B2 g! Z- E: I; m- #ifdef EDMA3_DEBUG6 Y" ^4 Z0 j4 m/ g
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
2 a8 g# C! @* C* Y - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
2 K$ q) v, h5 o: y. @ h1 I - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
- O5 ^+ e5 Y9 n) ~0 k - #else% _/ a" a/ P& x; b; p
- #define DMA_PRINTK( x... )& R u0 {4 H. Z* I8 \, }8 u, O
- #define DMA_FN_IN
+ m0 o- q& O; E$ _ - #define DMA_FN_OUT
% o6 B& d5 K# s0 i - #endif% j1 m2 W, ~7 k0 ]
/ [$ p3 f; y: K- k5 a7 g- #define MAX_DMA_TRANSFER_IN_BYTES (32768)9 F: q$ I& j/ T& ]6 V& }/ T
- #define STATIC_SHIFT 3
* x$ ]5 `! { ]$ {, ] - #define TCINTEN_SHIFT 20& E9 {- S# U# N) g d O6 B7 V5 t
- #define ITCINTEN_SHIFT 21% \ m; X; Y5 P h" J3 d: t: f
- #define TCCHEN_SHIFT 22
/ N4 A) G; @* f! X8 K - #define ITCCHEN_SHIFT 23$ Q! W, {. }+ b; S4 h r
5 c) y7 e: p( i J9 W6 J8 [- static volatile int irqraised1 = 0;5 x/ |. E9 ]3 ^* f$ M
- static volatile int irqraised2 = 0;
: Z( M9 w) x; _7 L! n - 1 O9 ?( \5 ]; L+ T: p
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" E) k u1 T; P1 a - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 C7 ?# M9 O) X0 \ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 n# B$ M( ~+ Y- R
9 ?% [5 }3 P, y' o- dma_addr_t dmaphyssrc1 = 0;
- v$ Z2 I# D+ F0 i R - dma_addr_t dmaphyssrc2 = 0;. T1 c3 q, U! G0 B6 t/ z
- dma_addr_t dmaphysdest1 = 0;
" s5 e1 a4 H8 X) X9 x - dma_addr_t dmaphysdest2 = 0;
0 }/ X$ G2 l7 O- ]
6 A1 M/ Y; q% j" j- char *dmabufsrc1 = NULL;1 s: x+ J8 {6 K$ d5 ^- W+ H
- char *dmabufsrc2 = NULL;
5 W; n1 @& T9 L# M - char *dmabufdest1 = NULL;
7 N: c6 i8 O2 ^' {$ ~ - char *dmabufdest2 = NULL;/ O8 u" f c6 S3 I
- ( ^9 G" G) m, j( i, e
- static int acnt = 512;$ o: b# G# E/ M& u; x7 J
- static int bcnt = 8;; c0 [8 B7 H- t7 \9 i$ p7 b
- static int ccnt = 8;
4 T+ E$ `' F. j - ; ~+ ~. q1 E7 m4 e0 F2 P2 x. A
- module_param(acnt, int, S_IRUGO);1 _$ T d, L, n; X
- module_param(bcnt, int, S_IRUGO);% X4 d8 i: `. e: }. p$ ?) U
- module_param(ccnt, int, S_IRUGO);
复制代码
/ h) M# q+ i" R, @! z+ |, C4 S0 {8 e! m) L% ^( W1 R
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" S1 K7 I8 T6 M; L; n# Aarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ Z5 I) W" Y" b) u& h: Z, q
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: b& V( y6 y" \) s0 l
2 u$ W7 f1 G* ~ O! a. Q" [
+ D/ Q0 C! T/ V |
|