|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # Y4 [: {. c: |! q! ^! _
- [code]EDMA sample test application
2 P1 |8 E' F" T4 x! G - /*. T) s6 W5 f d: g: H( C Z; T
- * edma_test.c
- \3 V+ o0 y7 _8 k, Z8 N K- Y - *
f, s2 o+ n' Q) ] - * brief EDMA3 Test Application
% v0 l7 {: J0 F% z - *" {; Z; y* H: H. I4 Y" x
- * This file contains EDMA3 Test code., `0 V' Y2 U4 @& n" g9 l
- *
( C( D' y" C: L+ V. h6 N' b - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" P- j0 W+ c( S. n) ~
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ z' x2 N9 @9 u j$ h7 v+ D
- * TO CHANGE.
$ A) R4 W. {6 X- |! \ - *2 k8 V" y4 B/ W
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
# n; y9 W) `" T; P8 R/ [1 W. \ - *
. m5 X+ l% Z, Y - * This program is free software; you can redistribute it and/or
+ a- o0 Q+ n4 p - * modify it under the terms of the GNU General Public License as: H' G s8 c* Q0 K1 H; ^$ h
- * published by the Free Software Foundation version 2.
2 r) e/ A5 u2 G+ N - *- V' D9 ^: d0 o9 Z8 R
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any( M/ y* Z" o4 B! i5 h
- * kind, whether express or implied; without even the implied warranty
/ c* Q4 Y, S1 O, x5 z - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the8 @% B4 H1 I) a1 x' ^, M" C& w \
- * GNU General Public License for more details.
: K. f. j& e! s' R) K" ?& S" ^ - */
2 c" M' A) a* D- L" u$ Q# z
: |/ y& d8 S5 K7 k- #include <linux/module.h>
4 w% j1 [3 i2 E) V+ [( j - #include <linux/init.h>
" C2 p& t5 a' k1 H9 q- X - #include <linux/errno.h>5 y2 T G( R# D9 V2 s
- #include <linux/types.h>! \: `0 p6 T+ x' p4 t1 x6 b7 n
- #include <linux/interrupt.h>/ }0 a) r7 a' }. Q1 M( K" k. U
- #include <asm/io.h>+ H& k) q4 U8 S/ d% R: E# i# r
- #include <linux/moduleparam.h>
: l- g* H9 u. U - #include <linux/sysctl.h>
& l4 Z; |" }; d+ J1 s H P - #include <linux/mm.h>5 T4 P/ E8 b* Q w8 j
- #include <linux/dma-mapping.h>
& K* Y. r. `6 S3 \7 j+ b1 m. N5 F
# y2 e. |0 O* A- #include <mach/memory.h>7 G1 }6 U( _3 l" j( |4 x
- #include <mach/hardware.h>! Z X% c( G( E' u
- #include <mach/irqs.h>
9 u, B% S e& i6 J% z) W3 y - #include <asm/hardware/edma.h>" i. y2 U! g8 X
! m! B' L. q2 y0 I3 `/ I4 D) r8 n- #undef EDMA3_DEBUG4 [8 t4 \- S, a3 k/ a g+ T
- /*#define EDMA3_DEBUG*/
3 o# @# P3 K) k: X h; n5 G# S - 5 i; C7 @ r2 e
- #ifdef EDMA3_DEBUG: P2 n8 t y1 n9 y; E7 M
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 u! k/ E: V X* v, I7 U
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); K' L4 a6 C+ r! v. b
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 O: k' D. {1 f0 Z
- #else( j+ @& L& G; m% d! O1 D, F
- #define DMA_PRINTK( x... )
4 @8 V6 J3 i! Y" W/ x - #define DMA_FN_IN
# z! _+ _4 \! L) K/ t; B - #define DMA_FN_OUT
) d$ C! Q; W/ B" _- o8 q - #endif
7 h4 B3 H; o5 K. \. e7 M$ x3 q6 F
7 O7 V0 B4 W' N8 \& M: ]" R1 Y! o- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
3 Z; L( F9 y- i- L' w* n3 j - #define STATIC_SHIFT 31 X" o8 W$ t1 V: `8 ?8 D
- #define TCINTEN_SHIFT 20
( i# c4 G# o; U' z% c# m8 q/ t - #define ITCINTEN_SHIFT 21
L4 U; ]4 G3 U9 \% D4 R# h - #define TCCHEN_SHIFT 22
9 d- `! G/ e7 v - #define ITCCHEN_SHIFT 23
2 E0 j1 I; k) D' o" N0 V
4 a' K% F, o' g- static volatile int irqraised1 = 0;- a" K+ j% L# U! H7 z& y
- static volatile int irqraised2 = 0;
$ H$ P8 C/ z- C - # E1 |3 d/ ?. ^2 g. c( G
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, ?6 b! d* }' I
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 O ?, N2 b- L! m! c- ^8 E
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ ]$ p0 a4 n6 J" K$ S
- $ H, Y" L' G6 c
- dma_addr_t dmaphyssrc1 = 0;. O" h" F( a" u- T3 J
- dma_addr_t dmaphyssrc2 = 0;: l+ x8 \6 q( J* u3 K8 Q* ^! n6 @9 K: K
- dma_addr_t dmaphysdest1 = 0;/ X9 X @1 [# r! G/ H
- dma_addr_t dmaphysdest2 = 0;9 k3 ?6 @- }; \. p
- 2 z& U1 t( k- r* y* }) D
- char *dmabufsrc1 = NULL;2 M; h a0 A# w- c! E& z
- char *dmabufsrc2 = NULL;
$ |4 y; r( Z, |+ Q" c4 s - char *dmabufdest1 = NULL;+ x7 [! ^% L) u: o) [! X
- char *dmabufdest2 = NULL;
4 _) n ^8 y6 A5 ]' Z! e9 P
7 t1 W. O7 L1 Y3 p- static int acnt = 512;
! }' d5 w# [6 {, e# ~ - static int bcnt = 8;
; T; Y: ?- x3 m+ t - static int ccnt = 8;0 O* K9 d B* w0 X4 \
+ \! ]1 t# `0 c/ k1 T6 L- module_param(acnt, int, S_IRUGO);5 C* h+ }* h4 [; V. i
- module_param(bcnt, int, S_IRUGO);( N2 X& k" s& y) d$ E# M9 v: D
- module_param(ccnt, int, S_IRUGO);
复制代码 " b) C `% s9 |' ]2 {
! F: W1 ?; o3 A/ S1 u) ^ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: ? ]" A/ y+ c K" { p+ i
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 d! i8 r) S7 E6 q7 l) j& n
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- x6 A5 S* w# q1 {6 Y
' L. [' Q$ [$ P, a4 C
% [4 Q# G* L0 ^, g. X+ k" Z, B
|
|