|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 [* W8 Z2 @( C! P5 E/ Y- [code]EDMA sample test application- G: ^0 Z4 M: S" n# @
- /*1 u2 N; _4 s f* [: H
- * edma_test.c8 s6 [# P- D. E3 O, |& f7 j
- *6 M" N; M. g5 J2 V+ @# j7 S
- * brief EDMA3 Test Application
" \- f% P7 U! @3 u - *
" x. R/ V4 y* z$ E - * This file contains EDMA3 Test code.
7 U+ p o% ^+ K - *: j, X: ~' n. W% A) W x; e2 \
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
) F# e4 A0 n' Z3 `0 O" s( y, [% O - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 |4 W0 G! s( Z, }
- * TO CHANGE.1 P+ t7 ~# e/ B0 k
- *' \+ _+ N( ~% V) R# f- [
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ e% Z2 B3 J9 p- l* A+ Z, K
- *
6 g. \9 G9 I1 j4 x - * This program is free software; you can redistribute it and/or
; X* `( Q4 Z6 Y, m% X5 N( l* ^- H - * modify it under the terms of the GNU General Public License as
9 e# L) g( S3 H! f. m. f - * published by the Free Software Foundation version 2.( ]% ], D# H, C8 [7 h& {
- *
0 P1 l- F; P! n# C - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
; U8 y9 r/ u0 l& i: C/ A - * kind, whether express or implied; without even the implied warranty
5 s; r% q s6 u7 D# k, J" g - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! }! e. j* m3 g7 l' Y+ b - * GNU General Public License for more details.
) P- y# G8 [- v7 B/ s - */" h0 W7 L, j1 e3 U* r& W% N: \ [
- ; T2 t4 d) T% x0 @
- #include <linux/module.h>% y- C. `2 ]- K8 T! P7 T
- #include <linux/init.h>( P$ u/ l0 j8 M% S% \
- #include <linux/errno.h>
; N6 Y% F8 r/ p6 z8 v/ Z% N8 c& m6 O - #include <linux/types.h>% S9 K. W* q: N# I
- #include <linux/interrupt.h>
0 O6 h9 v6 j9 [5 x# ]+ O - #include <asm/io.h>
% Z; g8 ~' U; f% W- S - #include <linux/moduleparam.h>% X0 R# ?$ @' A- [
- #include <linux/sysctl.h>
5 K1 ]+ d J# u) Z - #include <linux/mm.h>; C4 ?: w- ~: Y1 b1 i( C; `' p! ]
- #include <linux/dma-mapping.h>8 ~* s* R7 A. `
- 7 P# d' _( b: G, ^3 t! ?, t
- #include <mach/memory.h>
, M" _9 c. _7 {0 K- y7 { - #include <mach/hardware.h>
; M7 ?4 c2 _: t1 h5 ?! } - #include <mach/irqs.h>. c( i6 E7 D9 s2 M' `( m5 k0 |
- #include <asm/hardware/edma.h>1 ]# H$ T5 }/ F
0 ?% o; g( U2 F1 M0 l- _+ \. t- #undef EDMA3_DEBUG+ D9 b6 }# }6 y( N$ |1 G! {
- /*#define EDMA3_DEBUG*/( U! S9 x Z4 w2 ?
/ _8 M0 U r6 ]6 `+ R% J- #ifdef EDMA3_DEBUG- O7 @) q4 Q* h/ T! k5 @$ k
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
' s# ?2 L1 C+ z* ?: ] - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 g! _, \# c( D1 @6 C8 f' w( d: ]
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
! Q Q q+ I# ] - #else3 o. ^! v5 g6 F$ S
- #define DMA_PRINTK( x... )
* f) W. I0 y1 O - #define DMA_FN_IN
3 w' V$ d& `! D9 ^: s, z6 L0 {8 { - #define DMA_FN_OUT
# [" }: J. U! h6 U" Y4 U' r8 B! G - #endif
# |. r5 [' @* z* Y7 W
) x4 V+ O- j* M& u: E. v6 Q* J9 D- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
) ^% p: c5 ?1 Z$ r - #define STATIC_SHIFT 3
7 x* _, \$ y2 [9 q, Y - #define TCINTEN_SHIFT 20
6 d/ }8 }/ m3 V8 _! Y6 m - #define ITCINTEN_SHIFT 216 g. S- B! P! I8 G4 ^/ J6 z+ m
- #define TCCHEN_SHIFT 22
: B# J8 y: G# m5 Q" D - #define ITCCHEN_SHIFT 230 S- B7 f6 }3 o3 d% x& y/ s' a% S
; }, z3 \: {3 R9 R- ~+ a2 F! S- static volatile int irqraised1 = 0; G7 q) c( g9 o1 C+ _
- static volatile int irqraised2 = 0;+ Z! {5 E7 o$ k
- & v* r D- h; y: N0 t4 ? \
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. T, v; [1 U4 d9 p) D0 }3 C; ^ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. o" F) k2 V5 {/ p/ h
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 ]0 z* j0 D. f# r - 5 m6 r9 T0 i/ K7 q
- dma_addr_t dmaphyssrc1 = 0;
, }8 q% v0 y9 b2 ~9 E. A% F1 ] - dma_addr_t dmaphyssrc2 = 0;
/ U# }/ `* F& j( M8 R' H2 B* R- L - dma_addr_t dmaphysdest1 = 0;$ ~) \# ?6 q" w5 |
- dma_addr_t dmaphysdest2 = 0;
! P1 v) ?- B b0 m1 f
9 o$ [ e! v7 d: P1 l- char *dmabufsrc1 = NULL;: b6 }1 u, L% ?. D2 c7 y
- char *dmabufsrc2 = NULL;8 r0 E% ?: ^+ n2 i$ P4 L
- char *dmabufdest1 = NULL;: L3 X, e* w# e0 @, P2 K2 y
- char *dmabufdest2 = NULL;
8 M" T, b# q, x( [4 y' l2 a
9 t1 q @2 w4 j9 o+ ]- static int acnt = 512;9 i4 j' S9 E+ H& W: D1 t6 ?; f
- static int bcnt = 8;6 |( r' H# ]$ M4 f' {
- static int ccnt = 8;
* C, f o' t0 U) R - ( Z' `7 T1 ~+ b1 c
- module_param(acnt, int, S_IRUGO);5 C$ {' }; V5 ]6 j+ A% Q/ E+ i& u
- module_param(bcnt, int, S_IRUGO);
, _0 ?; U, X/ g7 m3 N' t - module_param(ccnt, int, S_IRUGO);
复制代码 ( X* |/ X& F; `; J3 G0 Y+ N
3 D9 Y) r7 q$ E# Y) n9 ]6 |% F 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' `5 p$ b0 N% B- C
arm-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 e7 W3 ]( J( o. t5 i3 @, o
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 i9 n: c2 z+ s* ~. ~
0 q% O7 i$ e1 C# n- ^& L% I' |1 ?# U6 b$ a; W; m
|
|