|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 T) i- C6 X+ }& {7 `. ^
- [code]EDMA sample test application
# m+ C# f2 M: S3 m! G: v2 X: t4 w - /* H- H8 y Q: Y; N. i- l; f
- * edma_test.c
7 s8 l( @- l9 l+ d7 P! s - *
8 z% H$ H6 Y, \' w/ }' k0 X0 J - * brief EDMA3 Test Application
/ Q6 \ U- f5 v. r+ s& P - *, g$ B0 Z; E ~1 S: b9 p- r2 J- c
- * This file contains EDMA3 Test code.
4 x, m2 o5 y- W) o; b6 R- t - *
8 [3 x; g4 W: m( L0 r2 M - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ @& ~0 H. u- @- X! I
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& ~% E3 @% G9 h
- * TO CHANGE.
, F1 @) \2 e- [8 d2 c - *6 ~6 d& ~ ?# ~# X$ ]2 U
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* v: g! R: a/ ^; M- G2 j& Q
- *% U# |% z' l% D9 m! w# k; _
- * This program is free software; you can redistribute it and/or& F4 Q- k/ f, v6 w" @( k1 ~- \" X
- * modify it under the terms of the GNU General Public License as
r. _( R0 m$ |6 `* l6 ~! } - * published by the Free Software Foundation version 2.
# b8 C. X9 u& {5 a x - *3 c, _ H' K" ?$ h# _ {; i
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
3 p G1 }. O$ A9 W1 O z" t - * kind, whether express or implied; without even the implied warranty. S3 ]5 g0 T& K; C& U- ]' a
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the2 @# |6 W1 V; c
- * GNU General Public License for more details.
& {- J& E6 S9 G1 V2 U - */9 R& L# H: r1 q
/ t9 c! |0 }/ i5 P0 I- #include <linux/module.h>
, H _0 ]; I) Z' s- r - #include <linux/init.h># g* I5 z- R# v! w+ w- ]3 ?
- #include <linux/errno.h>
& Y9 U9 ]! T' a p/ n8 o7 {$ G - #include <linux/types.h>- ~6 l# q* z0 f
- #include <linux/interrupt.h>6 f% N2 p7 T( s; Z5 |6 J; { r2 k! W8 H
- #include <asm/io.h>
5 l- a% V2 ]% \* l' Q0 B5 }/ X - #include <linux/moduleparam.h>& f0 l- u* ]2 `8 n, ^% w
- #include <linux/sysctl.h>! m* Q2 b/ i0 j) Q
- #include <linux/mm.h>
' ?& G' P8 h- G, l# _7 q - #include <linux/dma-mapping.h>
- @" d& e% m( J5 Y7 ^ - 3 p9 k1 u+ `7 \" @
- #include <mach/memory.h>
3 D4 \0 N7 S5 X/ v" z' b3 a! E - #include <mach/hardware.h>
- r( R4 S8 ~& _# V - #include <mach/irqs.h>
% ` _% \$ `/ n1 f2 b$ [ - #include <asm/hardware/edma.h>; i! ]% e! r( G+ A
- 6 u' e4 K9 h- P6 ^. N7 S
- #undef EDMA3_DEBUG$ w0 ?- I4 }" W/ m) }
- /*#define EDMA3_DEBUG*/. X; A! g. [9 Q1 \- @, b
- 4 L+ h1 x- N5 S0 B3 k7 Y
- #ifdef EDMA3_DEBUG# X: E- ?# l& ?0 V9 p1 }
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
9 d( A6 q+ W* B; X { - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
! E$ R# U5 m. f2 p2 D; }" Y - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
& k3 _- s( u! L: W+ ^0 k - #else( ^. s/ b1 ^9 l* t8 V! H% M
- #define DMA_PRINTK( x... )
! X# p0 e+ m( o. T4 N - #define DMA_FN_IN
' X+ T7 q, }/ Q# S( f - #define DMA_FN_OUT! L8 p& `. {8 ?. g8 y1 L% E6 \( I6 `
- #endif3 l8 K; D& c+ z! r: g |6 R
/ ~4 Z% V& W; U1 p. [- s- #define MAX_DMA_TRANSFER_IN_BYTES (32768)6 e% n% ^$ }" I+ j* l
- #define STATIC_SHIFT 3
4 `: D" h0 n: g$ X - #define TCINTEN_SHIFT 20 C! }! U5 v- J# t- {
- #define ITCINTEN_SHIFT 21
' Y0 I: T5 w8 Q: X4 p - #define TCCHEN_SHIFT 22( h+ U/ L( U( G# d+ j
- #define ITCCHEN_SHIFT 23
4 w0 d/ Z- Z) ~( s& F. ]( }" V
, Z1 b: @9 Z6 X# O, D) W- static volatile int irqraised1 = 0;# l! d5 q+ @# {- V/ i
- static volatile int irqraised2 = 0;' I' J( Z" N# ^9 f( Y4 c8 Z0 E
' S% z& H; ~: I1 T" b; T& E" n+ e+ w- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. x# U; I( s/ l - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 q* E8 E8 U* o- a- |3 @6 v; T" H
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; m6 D* W) s6 M$ R4 [ - : ~: d% f! i. U( ^' w: b* n5 W
- dma_addr_t dmaphyssrc1 = 0;- u! [9 z9 V2 b! f8 v
- dma_addr_t dmaphyssrc2 = 0;# d) s T, s" \# g" N# `& R
- dma_addr_t dmaphysdest1 = 0;. S. f4 q' ~! z1 ]# j3 }# @- p1 I
- dma_addr_t dmaphysdest2 = 0;1 T9 [' v; `7 m$ h( ~+ q+ z) a
, d; h1 {. F1 M- char *dmabufsrc1 = NULL;
# M3 m7 n5 Z4 ~5 H - char *dmabufsrc2 = NULL;
' M, D. y; q8 j: y" i- y: S - char *dmabufdest1 = NULL;* `# l6 D/ B7 x0 f& E
- char *dmabufdest2 = NULL;- ?$ X7 ~6 f9 C" _ p
9 @5 [4 [9 _; N7 p `5 M- static int acnt = 512;
) U6 T" z! v- R" e - static int bcnt = 8;1 k8 {& j0 O# s$ [3 O$ B" g
- static int ccnt = 8;
/ w) ]' X& b8 s5 I7 P0 T. o
; Y$ H; E4 u0 h) |) Q2 m( g- module_param(acnt, int, S_IRUGO);
6 ^8 d4 z! f3 [2 q6 s - module_param(bcnt, int, S_IRUGO);
# F( D# S" F, t+ L( Q6 B2 v - module_param(ccnt, int, S_IRUGO);
复制代码 3 u! N9 L# \, b7 X9 a( E6 @
- }4 p: p3 C; W4 p" z+ i7 q2 ^! O
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 J1 U$ N$ y6 D2 S2 X8 F% [; H y2 Z- warm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& x3 V8 {7 g2 i1 v2 J" d3 K
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! L, C: r# }1 B) t! ?' `7 X% M. V0 T1 K/ C0 e4 S1 g
+ c; c6 d* X, k+ A9 ~. N4 X+ {: Q! F
|
|