|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 m/ x( |5 `- M: d3 V0 t `
- [code]EDMA sample test application+ r+ U4 g* l/ r
- /*1 M! x) s$ y% x- X% D0 n1 x6 J# P
- * edma_test.c$ {* _* S& \- G5 n# L4 R
- *
0 m: s: ~0 d( n" U- c0 p6 Y - * brief EDMA3 Test Application
% m6 v3 |3 B' l0 m- E - *
& f0 i4 J6 g2 J7 U& x8 i - * This file contains EDMA3 Test code.3 w& N9 Q9 ~9 F: C" I
- *
! X0 ^$ G0 y/ i" J R9 F) y0 R& F; [ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
0 O1 f) C4 K2 X3 X" R) W5 J: | - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 R3 g/ g6 q+ G2 k
- * TO CHANGE.
: J0 P e4 k* Z& a4 l - *
8 B) U: l4 _) w; m - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
+ M' l; c- ]2 Y2 G. r6 { N* G4 l - *
% K9 Y5 e3 p' O4 Y. F; A - * This program is free software; you can redistribute it and/or
- {' j# B+ o9 W( i - * modify it under the terms of the GNU General Public License as- H$ I1 q& n, C9 k5 K' x7 a/ l
- * published by the Free Software Foundation version 2." \( o5 O# a6 V: k: v
- *: w8 N, @- e; E8 J$ J
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ w) Q" N1 X5 M% P- `" P# U
- * kind, whether express or implied; without even the implied warranty: p6 ]8 O/ ~" ?
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the3 q/ f( l0 {3 h7 r7 Y# {
- * GNU General Public License for more details.( l' e" ^& n) l4 D, f
- */# K" @2 d* j/ U) N$ L
- . x3 {/ A/ Z; C3 O( A/ ]
- #include <linux/module.h>- T8 J; N! X' B' C5 v7 O& O9 n; J9 W4 A
- #include <linux/init.h>
: Y; U3 f0 U0 ` - #include <linux/errno.h>
- j1 R: Q- _( Y4 g- N- @4 T0 g - #include <linux/types.h>
2 G, O) I; F! u) G5 b! b - #include <linux/interrupt.h>
@0 x! t" T1 ~( U, A5 l+ X3 ?' P - #include <asm/io.h>
: G- i( J2 b; N5 K9 e6 ^ - #include <linux/moduleparam.h># f; D: Y5 ^2 @ x" R* B( r
- #include <linux/sysctl.h>! f8 D: t6 P% e' y. ^6 x+ D9 [
- #include <linux/mm.h>4 M) G8 l2 [# t
- #include <linux/dma-mapping.h>* E" @2 Z' F" c: |& \% o2 s* d
- , a7 A$ H: B: Q. [- W( J
- #include <mach/memory.h>7 }/ r6 M/ L/ O& @
- #include <mach/hardware.h>! b1 [& d- X/ G5 w1 g
- #include <mach/irqs.h>2 I4 S# g" i# c2 |
- #include <asm/hardware/edma.h>
8 c6 v O3 a: H& j- b - 2 ? M* |7 q, {9 u1 I& I2 m
- #undef EDMA3_DEBUG
4 o: j7 l, T) @* G1 R( t - /*#define EDMA3_DEBUG*/
5 @6 _3 w: \4 C/ [
$ E: b2 ], p- W: |% F- O2 l: d [- #ifdef EDMA3_DEBUG
/ W' Y* n+ M4 A; M" E% [ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
. w/ d. P$ O/ f, l( r - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
" j6 w6 m- S5 B" v+ D0 v - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
; g- w6 ^! }% P& N2 a5 x2 e - #else6 d7 A$ P5 R1 Z
- #define DMA_PRINTK( x... )
7 d9 N5 b3 u: \- s1 ]) L h+ L3 `) F - #define DMA_FN_IN1 B/ K' w3 ?6 K
- #define DMA_FN_OUT% p+ P5 M8 f5 ~; `
- #endif2 y5 a7 p9 ~) e, { ]& v" ~/ L: Y; n, z
* c- x( y* { z7 h( ^- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
5 s7 H% C4 H# M! \ - #define STATIC_SHIFT 3( u) \+ B4 E6 ~1 ^* T
- #define TCINTEN_SHIFT 201 L( F9 J, R: b" [5 c& S
- #define ITCINTEN_SHIFT 21
6 F! C( ]( ]; F: e- X - #define TCCHEN_SHIFT 22) P* Z2 L! }, q& a; j3 C
- #define ITCCHEN_SHIFT 23
& O) a* ^' c7 M2 P1 u) S# { - 1 L6 d( i5 [" r
- static volatile int irqraised1 = 0;
B3 Y% h1 }- c - static volatile int irqraised2 = 0;
3 l7 ~. n$ o: |! x7 ~: y4 y
4 \7 P6 \3 a- o% L6 c0 H- S6 a" v- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); E5 d" O2 X2 o5 l7 c3 T; c2 y- |% J
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: t2 H) c( z7 }- F' @9 @
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 T N! v8 T9 J# m
+ H* Q7 Y$ K9 p% [; o& d2 N- dma_addr_t dmaphyssrc1 = 0;) g0 X9 O% `+ i" j/ W
- dma_addr_t dmaphyssrc2 = 0;
) r" S6 t; e3 {9 ~ - dma_addr_t dmaphysdest1 = 0;
( ?5 E" w+ s. l" h5 J - dma_addr_t dmaphysdest2 = 0;( \: ^4 F% I3 F# u4 y0 n5 s
- + |" N* V/ o2 C {
- char *dmabufsrc1 = NULL;
A5 R9 F. s1 D3 V% [$ q; p - char *dmabufsrc2 = NULL;
W: b- n! Y1 N( B, P - char *dmabufdest1 = NULL;
5 B! l0 |6 {9 X+ y - char *dmabufdest2 = NULL;. T4 K6 W( v# s8 w! m8 | A& s4 F
- 9 L) V; ^4 l. f1 j2 W7 n. L4 d; v5 O
- static int acnt = 512;
$ {9 @1 t9 A+ n9 [2 o3 c% h - static int bcnt = 8;
* {! R& n( W$ q# c - static int ccnt = 8;# ~8 C% k$ _: r" H7 g
- 0 s2 Z6 V9 [+ _5 X; n
- module_param(acnt, int, S_IRUGO);
3 T# E/ i2 U6 e8 F& } I" s: \ - module_param(bcnt, int, S_IRUGO);
5 t7 y. S1 K+ j3 v" C - module_param(ccnt, int, S_IRUGO);
复制代码 : ]9 V7 Z8 {4 K9 | ^1 U* z y9 L% y
. z: {9 |# G. G$ `( Q 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& f( i8 v/ W/ d& J6 Q
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
5 Z; w; T8 r7 x& o 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 x- `% v8 D* a5 u& Q0 r' b2 ^% m2 ^. ]! ^) O( @$ x& J
- i, s& y. [- ?* @4 }8 y |
|