|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
b2 o$ b3 L$ T2 i8 e. B; t- [code]EDMA sample test application
0 z% j( [+ A! |7 j7 i" ~ - /* M% p- h* ` A1 l8 @
- * edma_test.c
: i" Y$ {& r. B \, x6 x - *1 h6 G9 C" t5 F9 J2 @
- * brief EDMA3 Test Application2 [! q3 Q9 w5 u$ C
- *, U# v* E. E- u
- * This file contains EDMA3 Test code.; T& [( u+ U' c% `2 a
- *: @) y: L/ Z* m
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
5 c, y* T9 D2 A: h - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- a% o2 ~1 }1 W5 g. w
- * TO CHANGE.$ v7 ?$ Y% D$ O- N
- *: p0 E* b: h; A) U9 X, v
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. M3 G- Q9 `- P$ l, X) q
- *
( ]! U8 M$ w2 q - * This program is free software; you can redistribute it and/or
9 D: R e/ r5 {& }+ y' }) | - * modify it under the terms of the GNU General Public License as) D1 S+ d V" {( j
- * published by the Free Software Foundation version 2.
4 n: [1 x" `9 X, a' w" m - *$ K4 f2 X! i$ N1 ]) u
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 }% C, _- o' W. D- I
- * kind, whether express or implied; without even the implied warranty
: E) O1 _+ F7 l - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# n' N- y6 R- H% a - * GNU General Public License for more details.4 Y- s7 k9 Y" D! P0 `. v$ K5 ^
- */( h1 N/ S9 o5 Q9 O
- ( \" `/ N" w+ H
- #include <linux/module.h>
3 o- g; {' [2 h$ T4 I$ s3 ~ - #include <linux/init.h>% t& F3 B! ?+ `2 n$ W6 u7 |1 b
- #include <linux/errno.h>" T) e7 \6 S1 r% ~. B4 X$ O
- #include <linux/types.h>
9 U& E- [1 n+ B' b! ?4 c - #include <linux/interrupt.h>
2 f" L) N w2 K" [ - #include <asm/io.h>
# d& N! z, i6 @% c5 t( Y - #include <linux/moduleparam.h>
+ b6 S0 H: H5 B - #include <linux/sysctl.h>
8 f# w7 p D- O+ P% y& y - #include <linux/mm.h>) ] x' i- X, l8 y% ?
- #include <linux/dma-mapping.h>
. w! U7 j; E- z) `
1 Z/ v" ?4 M$ C) @6 w+ o+ t- #include <mach/memory.h>
2 c4 Z1 U2 l! s5 m4 R - #include <mach/hardware.h>& A) c$ \( L1 N% K( Z/ I& l( R
- #include <mach/irqs.h>% G$ q( o! I z" e
- #include <asm/hardware/edma.h>
5 r- Z0 g+ ~+ p* q' c/ X
( L. s' i' O2 m( @3 l% Y- #undef EDMA3_DEBUG$ L* K A+ p! J6 F; \
- /*#define EDMA3_DEBUG*/
/ O9 y& N1 Y& M2 }( g
0 ?2 S# ]2 |- }- #ifdef EDMA3_DEBUG7 b5 V: y6 `) p m r- W* \; q n
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 {5 l* G8 `+ v
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
% `$ D, s3 x' H! n8 V - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
4 H6 |3 {" G4 Q# Y, C+ g - #else
* ~5 _* G) F: d7 T- @4 g2 I/ |4 q - #define DMA_PRINTK( x... )
# C' @7 z, _2 ~: V - #define DMA_FN_IN
9 ]2 A( d' C( @# J- {4 h" I - #define DMA_FN_OUT5 |: x+ ^" H! g5 T
- #endif7 x& C# j d. K) J( T2 Y( Y
- 1 m# N6 e; [0 b7 E, G1 b
- #define MAX_DMA_TRANSFER_IN_BYTES (32768): G; X9 ]3 V6 \$ N+ K! ^
- #define STATIC_SHIFT 3
7 s! Z2 z1 J3 S! z& S. h - #define TCINTEN_SHIFT 20
7 v8 ~& u O. @9 N7 N - #define ITCINTEN_SHIFT 21: F- C/ k/ M/ B; `1 O
- #define TCCHEN_SHIFT 22
, I( W9 _1 E4 d& e8 Z8 h' Z2 V! O - #define ITCCHEN_SHIFT 23
- s* q- H- l6 I& [" B - # m$ G0 z: C- J
- static volatile int irqraised1 = 0;
9 k% I# Y' l9 @ d! n - static volatile int irqraised2 = 0;
8 e4 a' I: ~ c4 x9 [$ Q4 } - - \0 U: k- Y% x/ n4 k
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* w/ B! S: Y/ ^4 i0 s9 m - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, p8 s- E( P, m$ W - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 D( M9 U1 ~9 {# \
( j3 N. k9 u+ t( r: u% x9 f- w- dma_addr_t dmaphyssrc1 = 0;
9 Y l: Y7 K; B8 K( J2 R6 @4 k - dma_addr_t dmaphyssrc2 = 0;
6 l! x% e4 [# M) N D - dma_addr_t dmaphysdest1 = 0;
' x! \9 P: z4 u - dma_addr_t dmaphysdest2 = 0;
, Z2 L2 }" r- j( p4 G( Z0 H$ x
3 [6 N; s1 b; A8 |9 |/ S+ y- char *dmabufsrc1 = NULL;! O. f$ W. i. J; f; [, n
- char *dmabufsrc2 = NULL;$ D" X! {9 I2 j7 G8 y
- char *dmabufdest1 = NULL;
$ d& a9 a1 x* [5 T2 U0 {6 } - char *dmabufdest2 = NULL;
; ~+ k# s( A; S - + w# {8 ?1 t9 D* C
- static int acnt = 512;
7 F4 t% G2 ^# ]) d: k0 H: i - static int bcnt = 8;4 s4 j3 Q7 j$ p6 F. `) [2 v
- static int ccnt = 8;5 D9 I# N U9 ]/ J5 E
- 3 S0 p4 R' i" E
- module_param(acnt, int, S_IRUGO);
% `: k- t- m( k+ _+ C' X1 f- f4 { - module_param(bcnt, int, S_IRUGO);* t/ s J. G$ K$ q5 C: A) P! ?
- module_param(ccnt, int, S_IRUGO);
复制代码 6 O- G9 \. N- _# F( l
) w+ x' u, ^4 X3 j* i; j: v
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 p# c8 u7 f9 O2 E; k5 g# Marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 A- I5 {6 Q& ?6 j# \7 P- V 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( c7 {/ `% z" |( V" T2 ]# P
9 F: l6 `& q3 y2 k7 O& n2 u; _* D9 J% i! K
|
|