|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 P: w8 m+ ]: f9 k6 q- [code]EDMA sample test application
, }2 g; J. m! D1 r9 H7 w. r- C - /*, F% X, \. T2 J$ {& s
- * edma_test.c' Y, c) S- F" k2 U; S+ e# F: j5 n/ c
- *) b2 R' p8 }! y: g( v; A
- * brief EDMA3 Test Application
9 Y1 X9 B0 J' Z) R) q% W1 h1 @ - *
0 Q# y+ N) W! [+ I - * This file contains EDMA3 Test code.9 O3 G J( b7 r
- *
- x" M0 ~# g* s- v+ q4 n - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
$ n# `: T" L" B( b# v; g - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
' K9 f6 F! X- ~, s* X, u - * TO CHANGE." z/ v" [: n, O( }" `: d8 V
- *
+ g( {- R. ]# O7 }, x! H; H! U& L - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ c6 E0 ~0 l1 K) m1 @6 b2 ]* G" [
- *
9 [8 S, y) R9 P" |! g6 r - * This program is free software; you can redistribute it and/or
7 ?$ y; L2 y* |( C - * modify it under the terms of the GNU General Public License as7 T% n# C- y& B4 L7 v
- * published by the Free Software Foundation version 2.
) h: h& U2 D( h3 |' {, L1 p3 W$ x - *
P2 r9 b! ? Q) y - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
. Q6 \* h8 J5 G1 l" v8 v, A! I - * kind, whether express or implied; without even the implied warranty
+ Y1 i$ T ^: V8 J# T - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2 N. {" I; {4 i' V) x* e) m4 o6 { - * GNU General Public License for more details.
- j* ^, i; j3 }6 i: B1 |- b - */" p$ y( G8 o( h& k, O2 K) t
* o6 R& S5 _* A% n m! g( ]- #include <linux/module.h>
. H. H! T$ i5 y; `, v/ A% O - #include <linux/init.h>0 A2 Q o6 }% H( a% q
- #include <linux/errno.h>
, M# b$ S, v* u - #include <linux/types.h>
5 W* n% H5 C" B @0 w* {8 U" y - #include <linux/interrupt.h>
7 n, ^5 d: p7 P' Z! G# H' b) W - #include <asm/io.h>0 v x9 F9 R& h
- #include <linux/moduleparam.h>; x4 v# |6 Y7 K: Q H) ]
- #include <linux/sysctl.h>5 ~* `5 F, h& g/ a$ @/ g
- #include <linux/mm.h>& ^, K5 Z' y6 T
- #include <linux/dma-mapping.h>! d, a% |1 O4 w# V' _
/ D6 Z- X4 B. _3 x7 p! ]- #include <mach/memory.h>
: k7 t; G" J/ i6 ^) n! M - #include <mach/hardware.h>! Q4 K5 C( q" H1 i+ F; J
- #include <mach/irqs.h>: ~& I, p% C+ w1 F
- #include <asm/hardware/edma.h>
: W: I3 A- O! \3 h: o h
# c5 T4 _3 [; _+ t" g! w; A$ f. N- #undef EDMA3_DEBUG
9 I& @* ]7 r, S( u- K7 U - /*#define EDMA3_DEBUG*/, F# z+ I# d$ p7 |+ e/ l
1 Y: F3 Q4 C0 I- #ifdef EDMA3_DEBUG- B3 f5 ]0 `1 R3 `
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
3 G6 Q- {# C5 m - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
" O- a2 q$ i& m5 J& n" ^# c2 ?( N6 I - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" Y! h- O$ \% g% L4 `- ]2 ^6 `
- #else7 e+ q! i3 |9 }+ V
- #define DMA_PRINTK( x... )5 w+ i! k% h+ }; w+ Y# m
- #define DMA_FN_IN3 I7 I% F2 {+ f# Z0 C/ N
- #define DMA_FN_OUT6 c( J3 E' e6 u* K. ?3 F
- #endif
, O+ g/ V8 I1 i( d/ H8 `( p' j q
7 F* {4 }' I% Z- #define MAX_DMA_TRANSFER_IN_BYTES (32768)5 _ j; b e) Z4 z. l: ~
- #define STATIC_SHIFT 3
; u* r8 [# U+ Y; u - #define TCINTEN_SHIFT 20
: V* w! ?- O0 s1 w" f0 Y; |% ` - #define ITCINTEN_SHIFT 211 ?- `! L* I3 n, |/ ]
- #define TCCHEN_SHIFT 22
* W y' ?* P' B - #define ITCCHEN_SHIFT 23$ ]) H$ s( ~7 n. `
. t, n. Q* ~) Z: Z; @- J- static volatile int irqraised1 = 0;+ _% j$ S: w- d; h
- static volatile int irqraised2 = 0;
% ~6 s# [& H5 u3 V1 T7 g- | - ) n* e: d# b: K# c" C
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) [" x) d6 n, }" ], V: E
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& M, q4 k$ w+ V' @6 C - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. E# H/ P( W) q, x
- ! y9 V5 _! }1 e# a
- dma_addr_t dmaphyssrc1 = 0;+ Q: H' {( G( \# A- {' p
- dma_addr_t dmaphyssrc2 = 0;& o6 Y7 L F3 p# X
- dma_addr_t dmaphysdest1 = 0;: U0 f- h7 w: S4 {) z0 k5 i% b
- dma_addr_t dmaphysdest2 = 0; n: b* @( f; k0 A4 {
+ \, p1 d) U8 @" ]( A3 S- char *dmabufsrc1 = NULL;$ X5 {. o2 ^' i; A% b
- char *dmabufsrc2 = NULL;
- c3 p: s8 d( S7 ?, G - char *dmabufdest1 = NULL;! `, H% f# ^) n
- char *dmabufdest2 = NULL;
6 T' w* \0 W7 z( C' v0 e - ; D0 r( ]; G3 [# ~4 p
- static int acnt = 512;* S' z ~1 L$ ]8 d
- static int bcnt = 8;
7 c4 g: h8 @9 F* Y5 m) W% y - static int ccnt = 8;
9 t' z+ r+ F; V/ ]7 E+ t% Y
$ N/ u6 D+ {2 Q6 J- module_param(acnt, int, S_IRUGO);
0 R2 M1 }; d5 O6 b8 P - module_param(bcnt, int, S_IRUGO);
2 c: |- Z1 A/ r3 k* D7 ~ - module_param(ccnt, int, S_IRUGO);
复制代码 " A! \, j/ i: R
, a$ o! E( ]/ f, b8 ~& z9 b
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; i, Q' p5 d1 j/ b( Harm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 v' U" w1 b; w$ c. V E 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* E- O6 n) e% |( c/ b9 j
' p1 Z' }! l C6 N0 m
/ S( J6 }( E+ f |
|