|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( L; K# O/ Y7 x! L4 F# e1 I
- [code]EDMA sample test application
- b/ B& ], f0 j, ~ - /*
# u% V& Z9 i; O' n3 y, i9 D+ Z+ M - * edma_test.c% z+ V6 }1 g4 Z8 E- d& G9 @4 Y0 ]
- *
7 \0 N2 N5 c3 T$ c& } J - * brief EDMA3 Test Application
5 D' q2 T, S! ?* e& e4 N) { - *: B1 o( a4 B" S3 C4 L7 s. q
- * This file contains EDMA3 Test code.
S" U, b. U J f! Q* r9 F& F- j - *
) _' p4 Z4 w8 {' ]) ^, A0 j+ t - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# g$ |0 k7 D* b) t" h9 p
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
& M% |( s2 l& i- w0 M4 d% c - * TO CHANGE.4 q! Z C+ e+ X f1 f& [4 R8 e8 F! T
- *3 M5 d. H! R" w: C& W C) [1 j
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 [* M7 d1 X8 x- e6 s1 g7 r0 g5 e3 M
- * L( R3 f# ]7 ^* V
- * This program is free software; you can redistribute it and/or
- b) B8 v" ^1 Z# M" z" {! t7 O - * modify it under the terms of the GNU General Public License as
! U, j- H$ P: ~1 [) v - * published by the Free Software Foundation version 2.
* u" m) i p s5 i6 N/ T/ p - *
5 g# M/ S0 S6 M+ _ |+ y! |( [ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
7 U O% z$ y; c, v2 \% J8 t8 s" ^ - * kind, whether express or implied; without even the implied warranty
- ^1 ~" M' r$ ]1 D - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/ _' Y' b- R9 w" g" d% G - * GNU General Public License for more details.
: r0 l5 ~9 H( S3 K9 y1 W8 r l - */) e7 p( i# P9 X0 N! `
- 7 X' _4 @& l/ B; j7 S
- #include <linux/module.h>
% i6 R5 o% H2 N - #include <linux/init.h>. |+ a$ d% Z3 O1 U" h( g; R+ w6 S
- #include <linux/errno.h>
2 A8 Y! u" X6 f1 C6 R - #include <linux/types.h>
0 z2 J7 c2 `8 W- H, \) X - #include <linux/interrupt.h>$ r! r6 W7 \+ m- ^3 b4 r
- #include <asm/io.h>
L% [( G/ p0 f - #include <linux/moduleparam.h>
3 G* c2 F5 y' O - #include <linux/sysctl.h>
- r r$ v, A y - #include <linux/mm.h>
6 O* I0 D" B5 q* G Y; X - #include <linux/dma-mapping.h>
1 Z$ `7 f3 ^ ]& k$ r - - E+ P+ D7 S. t
- #include <mach/memory.h>* q6 T, a! _3 |3 C, _) t% Z
- #include <mach/hardware.h>
. \8 v: e4 n4 i2 Z; U - #include <mach/irqs.h>
7 U4 V0 y9 i# D U3 f# j' s# G5 ?$ I - #include <asm/hardware/edma.h>% i. P2 K# ]7 z
- ; ]& [# v- I" v
- #undef EDMA3_DEBUG
/ V/ K- h8 L0 |! e% P1 J M - /*#define EDMA3_DEBUG*/
! A: Y7 ~& Y- _* I& k. Q9 t$ f - * D/ o7 b" _* b! D, @9 M Y
- #ifdef EDMA3_DEBUG
$ e: E, p5 U9 {$ A& } - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
2 U4 x5 f! X6 J - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 ?$ G9 @1 n W7 e k. m
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ \. Z+ R z2 m) J
- #else
- B. P5 X0 r# n7 x0 p - #define DMA_PRINTK( x... )6 o% s+ M2 L# {* V9 J u, h
- #define DMA_FN_IN
( U: k8 | k3 Q3 d4 Z3 v/ I4 F7 N" \ - #define DMA_FN_OUT z3 S7 L6 L# ?, }* M! {# E
- #endif
) ^( {3 z8 s9 Y - 5 D9 X8 D' j! P+ }/ @' e
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)- C6 f z" V, W2 y; q7 @
- #define STATIC_SHIFT 3
: O7 G1 |/ V# o' a7 y/ U( ~+ E* s+ Y - #define TCINTEN_SHIFT 20
8 m' j: P' N/ Z) S- Q - #define ITCINTEN_SHIFT 21
/ n: j6 s+ P9 t) T7 n' c0 F" m# Q - #define TCCHEN_SHIFT 22! z* k; ]7 S2 ^9 s+ B- K( F
- #define ITCCHEN_SHIFT 23
! x4 K }* O6 }( d: @+ {5 V3 T
3 e) R8 d5 }: o- x6 j- b( q9 G- static volatile int irqraised1 = 0;
+ O" q" j% [( P" X. t/ m- W" t- _ - static volatile int irqraised2 = 0;6 K1 }$ H! I6 T
" v. a \% a0 _6 t+ q- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 p) E$ ?6 c8 @. t1 p$ @ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 Q/ q6 D4 p: y. n3 Z( r9 t, i
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 ~! Z0 K; h9 r8 w s& E; {( e
" z! S b* q( U# _' A- dma_addr_t dmaphyssrc1 = 0;
. [% t& f2 G: `" n+ C h - dma_addr_t dmaphyssrc2 = 0;
' l% F, {4 V7 Y) n2 Y8 e - dma_addr_t dmaphysdest1 = 0;
1 \9 b# I, q1 L5 J+ H4 t8 r - dma_addr_t dmaphysdest2 = 0;
W4 @* P8 L: d- m, X1 Y: n& q
; m2 [& J+ Q/ @ @) _- x& Y- char *dmabufsrc1 = NULL;
4 e7 r, H; s3 J; e; H1 G8 H5 g" q5 h - char *dmabufsrc2 = NULL;1 x7 C8 Y8 w/ } d
- char *dmabufdest1 = NULL;
8 O6 b$ x9 s4 F' G: x$ V7 o5 H - char *dmabufdest2 = NULL;
& N* O) e; M" U
3 [6 G) H7 W: q/ l4 F8 K. H# h0 Z- static int acnt = 512;
1 F/ H% B/ t! R& |6 Q& x& }. y - static int bcnt = 8;% M( g$ j. D& J0 Q; \
- static int ccnt = 8;
, Y* y' Z! Z T# k* U% q, N8 s& P, R
/ l& w0 {6 t4 b- I q- module_param(acnt, int, S_IRUGO);* M6 j* [' j2 y3 R9 i; ^
- module_param(bcnt, int, S_IRUGO);
; E3 H1 t) q u - module_param(ccnt, int, S_IRUGO);
复制代码 ! h/ a+ d; n. ]
) K" q- N% P0 b1 _
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% W X4 E' B8 n) a/ |8 b4 rarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 L/ r' K8 @4 G6 N- ^
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ ?7 z6 F# B# S6 A+ j! M' W
5 p+ @. N0 b N& B1 b9 h
% H* l, z: u8 }7 c/ c4 @ |
|