|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" o) @/ F1 d- v0 E- [code]EDMA sample test application( [' {! z2 c+ Q( y* r" }, \
- /*
# [6 F4 `4 x% m - * edma_test.c; T# b2 ~9 V9 B9 \# Q: T8 \
- *
& J1 r8 N5 Z) B" A- c0 n2 ` - * brief EDMA3 Test Application. [. A; U+ ]% _- p" Y" {
- *
2 T J+ C0 t4 a2 O# W& ^+ D3 ] - * This file contains EDMA3 Test code.) n$ ~/ V. |* s. M1 e
- *
5 C$ H) e$ t3 l" Q - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. M# f% C; |5 P& v$ D5 ?
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
# ?1 Y3 s- j1 A, L8 T - * TO CHANGE.$ d& K, ?: U( B0 w" |0 I
- *
- ^9 ?% r4 A, q* \. n. Z9 W - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
- s$ d, R$ w4 ?* T! O0 w: N4 ? - *
r F" \7 Z( X# F9 Y% E2 r - * This program is free software; you can redistribute it and/or9 I) V' v$ t/ }! u$ y3 H' j _
- * modify it under the terms of the GNU General Public License as) `, K4 I; b p2 W4 }% x
- * published by the Free Software Foundation version 2.0 U% m" W% R, @: _6 K- E5 G7 D
- *
6 G, @ F) J& H- Z1 n2 S - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
2 }' h1 w6 j7 x6 l4 i% E1 R - * kind, whether express or implied; without even the implied warranty4 y( J. w3 S/ k" K. Z2 d
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# v, f& O* e+ x- x1 a9 K+ z - * GNU General Public License for more details.+ ?% s/ a2 _% v# O8 L
- */ T" Z1 X( [7 u! q P a
- # i+ M. B" y9 R# s5 V
- #include <linux/module.h>" Q: I6 d! `: V
- #include <linux/init.h>
% _: g% h, i& p8 @4 { - #include <linux/errno.h>
- k. I& X+ }7 k% g - #include <linux/types.h>! P! [# Y: R2 T9 V* c- `
- #include <linux/interrupt.h>+ Z, W; E0 g9 {6 D$ ]5 B
- #include <asm/io.h>8 ]! I5 r3 u) ^% q
- #include <linux/moduleparam.h> W, u" r/ d- A1 Y, k) j/ r
- #include <linux/sysctl.h>
# k' U3 r+ _8 x% u- l' ? - #include <linux/mm.h>
- {( J: Z' k) M - #include <linux/dma-mapping.h>5 h M. w8 {5 `/ z; k
. H' d, S0 M2 [) M- U3 m- #include <mach/memory.h>9 I* ~* S4 g0 _. Y2 p8 I' X
- #include <mach/hardware.h>
4 G- p( V+ g1 h$ r: h5 \) h. ~ - #include <mach/irqs.h>
9 i8 @. a% J) T* a* R1 O# O# M - #include <asm/hardware/edma.h>/ ^/ h% s( I& s6 R% P3 \5 U* b
. a" b' K2 C. Y5 z% B& G+ S- #undef EDMA3_DEBUG
7 t H; R0 V& q( p! `" l1 { - /*#define EDMA3_DEBUG*/! O3 T+ w; X" a8 U& ?4 L
- 3 x+ Y' w+ c6 O
- #ifdef EDMA3_DEBUG
/ T# I. C! v' W - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): G* h* p$ S. z% j. Z7 v* H
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
5 ]! v3 O3 l) F7 H4 q# @ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): Y1 K" L% M; p, d/ r0 F# o3 P
- #else
- q5 u) F) l) W# a$ `, B - #define DMA_PRINTK( x... )
1 R4 i* Q4 H' @5 Y" G% W - #define DMA_FN_IN
5 Q2 I; D! v3 A4 N - #define DMA_FN_OUT
: c" u3 u9 x1 l; c% [/ O+ l* c - #endif! V$ q' C7 k9 H" {
+ s# W5 x7 {; f2 z7 v- #define MAX_DMA_TRANSFER_IN_BYTES (32768)9 V: S# v* c" L; d
- #define STATIC_SHIFT 3
) N* d7 Z4 U& L( ] - #define TCINTEN_SHIFT 20" v/ r& F$ t' }/ Z
- #define ITCINTEN_SHIFT 21
" j3 L | M8 o8 ~( J' k% O - #define TCCHEN_SHIFT 22
6 ^+ a# F) D' f6 v2 S' T' T, _ - #define ITCCHEN_SHIFT 23
( P2 `# o. @" |& j - 3 n) e( l8 @4 L- F( a) { G
- static volatile int irqraised1 = 0;, Z4 Y( p. |. E) n5 s
- static volatile int irqraised2 = 0;" l: \5 @/ W' @! O
- % a% ^, r9 O# Y ^
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. S* X8 `5 H" j6 E" {1 M - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% ~! p* o) x: o( @) n3 I - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ u3 I0 h- K( U/ c
# d( l& |, S/ _ u N/ o" |- dma_addr_t dmaphyssrc1 = 0;' C4 i& Y6 V& C1 j6 Y9 X9 i
- dma_addr_t dmaphyssrc2 = 0;& m. z5 i& O- L4 K7 j2 f! h: M( L
- dma_addr_t dmaphysdest1 = 0;
" _$ R1 F7 V/ X$ Q/ H, q - dma_addr_t dmaphysdest2 = 0;
# m% z6 @0 \/ P* A
( l; o' ?; r; u* G8 F" A- char *dmabufsrc1 = NULL;
' O+ z7 T" M" h! e - char *dmabufsrc2 = NULL;
! O' d2 ~# L2 Q% G) a: \ - char *dmabufdest1 = NULL;
3 ~9 Q9 f% D$ r+ w3 j - char *dmabufdest2 = NULL;/ P {- H6 `7 u, C2 m( i, k, B! l
$ u* \# l2 h5 g d/ k4 a. c- static int acnt = 512;
+ e0 i- h' i' [5 Q! i# C - static int bcnt = 8;
; I% ~6 n0 `8 f8 c9 B% @ - static int ccnt = 8;. D8 ?2 [7 S) E/ ]/ l. _% u
; ^) a6 Z/ z$ p! d- module_param(acnt, int, S_IRUGO);
8 e0 P2 W: K; {' \ - module_param(bcnt, int, S_IRUGO);
f2 \. H( x: S! e' x - module_param(ccnt, int, S_IRUGO);
复制代码
- j& v0 S% T# d/ F0 Z4 f$ {1 ?- |# W+ d( F
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 ^; H) r& C5 U7 L; M; Varm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。% Q" w2 O% r2 L) _3 n v) v
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。" U, L* Y' K( u7 G0 e( R( P
. v* S( Q# s! Y' q. x3 s- g. }1 j4 l2 G: |* v+ C5 r0 ~5 v' s
|
|