|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : C$ j) E$ F( q% a
- [code]EDMA sample test application& x( Z& r0 a5 T" L3 ?
- /*' ]$ f* @, j( |# T. P7 w. i
- * edma_test.c
7 n9 x( P& O5 D' u9 f1 d# H( q0 r0 E7 m - *; Q) b& E' Q! f/ f6 b# L: d5 ^
- * brief EDMA3 Test Application
" a1 o4 W$ i6 h% {5 K - *
) Q, Y0 T/ K# \- u1 F9 q* s# k$ R' e - * This file contains EDMA3 Test code.
4 N/ G/ O) F/ F) Q9 P/ p - * M* S0 m3 t, a- ]7 g7 H
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 C9 ?4 ?3 A8 j) F' r) }, y/ _. p- j
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( b3 P+ _# g5 S" Q
- * TO CHANGE.
& t' C( f6 F4 d% D8 @4 X - *
1 k1 g7 w7 N0 `; y6 }4 n( Z( ^ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; E. Z5 J0 d4 l1 f
- *7 @9 T' I3 w" w$ k
- * This program is free software; you can redistribute it and/or5 o1 ?2 { w( X, {
- * modify it under the terms of the GNU General Public License as
/ H/ e2 e* \( E# n `( z' j, U - * published by the Free Software Foundation version 2.
( Y h5 e2 `, N9 e, j - *
, @& W: M7 v2 l - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
9 l/ T/ A5 Y7 J, y9 H - * kind, whether express or implied; without even the implied warranty
! }. C7 k5 v) k# e3 p - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- a6 L( \& N9 ~2 k - * GNU General Public License for more details.
* F h# G% m+ S3 X& J. C - */
" {0 L" j' L6 l, k0 N+ X% }3 S, }
6 [; V, T- Q4 ] u4 A. ^4 U5 I- #include <linux/module.h>
( U6 [# `# [& a9 `1 l, G - #include <linux/init.h>" t% D: ~2 b1 t" Q! x( p& F* K Z
- #include <linux/errno.h>
+ ]: v. \( F6 C - #include <linux/types.h>
! @& z1 G5 ]( }3 L, L0 t/ I+ C; h - #include <linux/interrupt.h>- M U' H4 u0 ?/ ^( s$ G
- #include <asm/io.h>
- H) o6 E! U, O; f4 _ - #include <linux/moduleparam.h>: F3 I; ]* p/ F; \0 Y% b J! K/ p( H/ R
- #include <linux/sysctl.h>* A' L2 l" E0 o8 w
- #include <linux/mm.h>
" N6 E8 e4 E C" s6 A - #include <linux/dma-mapping.h>1 [4 Y6 n7 r, N4 L2 H
- X' C: E% ?) R5 ?6 W: n- i6 Z
- #include <mach/memory.h>! L! n% a r" p. M& ]
- #include <mach/hardware.h>
0 E" I9 {$ U- O, G" k - #include <mach/irqs.h>
4 X! _2 L6 k0 p - #include <asm/hardware/edma.h>, h T6 T3 v3 R8 Z `' [: b
- * G" C. t8 w: {# R. M
- #undef EDMA3_DEBUG
) c4 s& d; N6 [8 ~ I# O - /*#define EDMA3_DEBUG*/) V! L: l1 X3 a+ j' R
- - [$ A' b: l0 t+ a" r5 ]
- #ifdef EDMA3_DEBUG
! f- g$ E1 `2 |1 C1 c1 S; n - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ R. e# R8 t, M& d
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* D0 i: k" C0 w D9 j' C
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
$ L5 C8 Z* W7 _( D8 C - #else
, f1 ^' d4 L0 h - #define DMA_PRINTK( x... )
9 D7 U* d: [/ w e) {0 V1 _ - #define DMA_FN_IN
5 t0 C9 C5 z) R9 R B- B; Q - #define DMA_FN_OUT9 _5 X% ^" W+ @8 o
- #endif
1 b8 r4 l8 V: T( d3 h* D5 }/ n- Y - 2 t; K3 i" O5 c! k2 E" A
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
6 E& w6 T0 F6 y+ p2 y - #define STATIC_SHIFT 3
' O. j9 j1 w/ l6 w k2 h3 ? - #define TCINTEN_SHIFT 20
/ ]% w* B- t, R+ z% f. _9 t+ x7 M - #define ITCINTEN_SHIFT 21$ H9 P. @/ Y5 F% h# f
- #define TCCHEN_SHIFT 22
) @# c+ G J' c& h2 x6 v: } - #define ITCCHEN_SHIFT 23
1 p' C# P% B/ q* I) ?' X - : s* l1 c9 P; q7 V# ^ H! y
- static volatile int irqraised1 = 0;: n) e9 E( S. W9 K5 M6 I& g
- static volatile int irqraised2 = 0;
' j! n8 ~7 g! [% p! b \9 S - 0 W. ?1 G* ]/ ~/ e/ e
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 L0 K) j( F; F+ C - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% E: y7 L! O( y f T - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" E Q- K7 ^' I5 U c
7 o, r! h# ]2 ]. d, ~7 ~ l- {- dma_addr_t dmaphyssrc1 = 0;
b6 c# u4 R. k: W6 F) L1 }1 N$ Y - dma_addr_t dmaphyssrc2 = 0;
4 r$ Y; e& H' {- S8 f - dma_addr_t dmaphysdest1 = 0;
/ C3 g ~0 m& J* t& ]" P/ d @& x+ q - dma_addr_t dmaphysdest2 = 0;7 B- `- d3 [8 F2 I: [& |. O3 n* r
$ t' W/ \2 Z5 T/ f' V: N, C- char *dmabufsrc1 = NULL;
3 n" h' k0 S: | - char *dmabufsrc2 = NULL;. I2 j ?6 V d7 U4 j2 q
- char *dmabufdest1 = NULL;
5 e1 m! Z8 R9 T' j - char *dmabufdest2 = NULL;
. c# k7 A- _/ t - ) X' u' Q0 j D1 H; f% n5 x
- static int acnt = 512;
; S, Z3 ~% Z) p7 z) X& s; l - static int bcnt = 8;
# Z# M( O: [+ D0 y3 G; A - static int ccnt = 8;
, f! P. ~' ~' L( \% Q. W' A - 1 P. k8 b; Q1 s& v5 W% W5 s \# a
- module_param(acnt, int, S_IRUGO);
3 {" e6 i. t' w( t/ b - module_param(bcnt, int, S_IRUGO);
5 G- R% U: A) Y3 a' a: i8 ^ - module_param(ccnt, int, S_IRUGO);
复制代码
% }- \6 U5 \9 W- [0 q$ u1 R% Z5 R
D) N* n8 d9 N! u1 M6 j2 o 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- Y: q( k# T: _7 j* Carm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, c+ ]4 r% b4 {- g/ M! W$ B0 E& `4 n
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ {, L$ o5 C% N! e
3 M+ [: m/ F+ L9 C' I, W7 p. t6 J) t, ^# L7 X
|
|