|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 M$ z2 _8 a0 c. A6 W6 F
- [code]EDMA sample test application2 z0 l. j* R) o7 M% M
- /*! ]3 I- H" z& r+ {% o: m& k4 b
- * edma_test.c
- r6 @: T6 W2 M. t& Y3 p - *' e# H. e( g7 k+ y& m' g6 F$ u
- * brief EDMA3 Test Application, X2 P7 y. k3 i$ i! P' i
- *
, N H) A5 B! ^ - * This file contains EDMA3 Test code.! g" d- F. S L9 g! @% W, k# `
- *( t7 \/ B! k3 U" D. I- l
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. D/ y3 F8 J- g9 \; ]
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( f, r8 R2 I# _$ |! w
- * TO CHANGE.
& p% D, k" `- s. w' S! P+ L - *. w- V6 J7 @3 P2 t
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! N' t6 y! A: }* g. S- h
- *0 G1 N. c, E1 S- [. T
- * This program is free software; you can redistribute it and/or& t+ u7 Y- ~! H; H/ \/ D
- * modify it under the terms of the GNU General Public License as
9 S1 W+ w1 I6 {7 s. ^% m6 {4 A - * published by the Free Software Foundation version 2.
* X7 U7 ?2 [/ j" g+ y - *
2 E/ Y5 ~! x. H! @; ` - * This program is distributed "as is" WITHOUT ANY WARRANTY of any- `: v' X. o$ ~' i6 E( ? f
- * kind, whether express or implied; without even the implied warranty
- t& L9 i4 _+ n3 Z - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the% Q9 [/ M+ ?: N: d' v
- * GNU General Public License for more details.. m, @5 }! Z8 y# G c l1 R
- */
Z! Z% U8 V$ n% R6 G
4 i: x1 g9 H# W2 N; m3 O4 U- #include <linux/module.h>& J2 q/ q* j, |) S) ?6 T% M
- #include <linux/init.h>* v: W. H9 p% o$ W/ S/ I% u5 a
- #include <linux/errno.h>) M) U, j G# H. e
- #include <linux/types.h>! z/ c: j5 \$ n4 y- R4 O$ U- g
- #include <linux/interrupt.h>. {3 D7 U p# B+ [
- #include <asm/io.h>
) t( C$ h' c. V8 L - #include <linux/moduleparam.h>
1 j. }5 n& j& q( l: Y - #include <linux/sysctl.h>
8 l2 I5 h. K/ Q5 A( j' b - #include <linux/mm.h>0 S$ }8 ^1 O% D6 U. U4 P( L
- #include <linux/dma-mapping.h>
" t3 H' F9 @4 O
4 P1 s% a: U; y* Q( i, | B! h- #include <mach/memory.h>+ @8 \9 W! s; c% S7 O
- #include <mach/hardware.h>
( w6 R+ K, d$ u3 Z& _7 l, } - #include <mach/irqs.h>
( J; |+ k8 q2 m+ W8 o9 ]( i - #include <asm/hardware/edma.h>7 ]- G% t) {7 n- ~& ~/ S5 F
- + w. |7 p$ P8 W. _7 u0 R6 w/ M0 ?) Z2 i
- #undef EDMA3_DEBUG' `6 i! n4 a2 W1 D$ Q1 B
- /*#define EDMA3_DEBUG*/4 E8 y3 S, q0 d' L4 s8 p5 m
- ; i1 L1 D! P6 T9 X" {' @8 {6 v) L0 r
- #ifdef EDMA3_DEBUG
9 y h# Z |& Z - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- s# c' f0 g$ a
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
: v2 K0 j! Y1 W# S3 p8 E8 R" C, F - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
8 n! C/ T) i( V1 g" o; S- t - #else
N& P8 M. c1 h9 k - #define DMA_PRINTK( x... )* p* a4 x% \: E" j
- #define DMA_FN_IN
9 n8 U& e' S, m m# R& A* V: l - #define DMA_FN_OUT
' `1 Y i P" R) w# A& f: d# i1 P - #endif+ ~4 L% x. C0 B/ n# j+ y6 ]
- / ]$ S# e" L: v, A5 c, v2 N
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
% h$ V5 J* f9 V) m' G - #define STATIC_SHIFT 3
7 r8 w$ n& }+ c" M% Z) J1 l; D - #define TCINTEN_SHIFT 20' j5 U, w1 f: l! J
- #define ITCINTEN_SHIFT 21& W r" e" q m' v0 X
- #define TCCHEN_SHIFT 229 ?: w5 {3 S* u5 P& {" O2 _
- #define ITCCHEN_SHIFT 23
( b. E$ a4 z6 F& \& t" K2 G5 `
, ~7 u8 C; u8 x0 f: b; [- static volatile int irqraised1 = 0;3 ~3 \7 L T$ ]$ s6 Q6 L- |1 C
- static volatile int irqraised2 = 0;
( U0 o' P6 g% j0 I! F y+ m* Q
' @+ L1 w+ C( c; i, f- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 A. W7 V6 f; p$ d& l% K* g3 o8 I
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 E9 n2 e( x4 w3 C$ H1 k' o2 ^
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' d5 G( M& R" Z: E
7 @* Y- L3 `1 e- t2 e0 [7 f" b- dma_addr_t dmaphyssrc1 = 0;
* D# G+ h2 Z( n - dma_addr_t dmaphyssrc2 = 0;
* c3 \" }' G/ s0 W - dma_addr_t dmaphysdest1 = 0;& q8 ~" a/ D7 V1 d) O
- dma_addr_t dmaphysdest2 = 0;0 w. j# Y% X0 s9 `9 z
4 ?! p2 x' u) g3 F+ E- char *dmabufsrc1 = NULL;6 ]0 E7 X: A$ H, m4 I
- char *dmabufsrc2 = NULL;3 o# P& m7 p. i( N. |& O! F% R
- char *dmabufdest1 = NULL;) M" s( G2 Y8 [/ }% D
- char *dmabufdest2 = NULL;
0 Y# n/ Q& S% x4 ^" \$ a; P - @: r B+ _" c8 K
- static int acnt = 512;
. I. E6 Y0 U# y3 s7 X - static int bcnt = 8;
! _5 D7 l( L6 c - static int ccnt = 8;
$ Z- ?( m$ c! L* ]1 r) T
* r4 ?5 ?, i3 y( a- module_param(acnt, int, S_IRUGO);& p O8 E& U6 k) M/ Q) `
- module_param(bcnt, int, S_IRUGO);' I9 T- V! ?3 a' R) G5 w" a' m1 |2 Z
- module_param(ccnt, int, S_IRUGO);
复制代码 " t! Y( F; y3 S4 k
4 p+ ~9 x$ g# g1 \. N
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ l1 \" Z+ `# j5 \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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# u/ G$ e: q, \0 ? d- A! v9 | 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ N3 z6 T* V7 X, w" b3 t( c
; d, ^% V+ Y) D+ t8 a+ H
) H2 d' `" P( w9 m |
|