|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 r* I: Z2 l1 W: `$ f
- [code]EDMA sample test application
% W8 @ P! U4 q7 T: w# k - /*
3 E) p) c. i0 D" r* Y( P0 ^ - * edma_test.c
( H+ b0 }2 o% z6 t4 P - *( R3 A1 H4 ^1 j6 ^! j: B+ q
- * brief EDMA3 Test Application
% [- R/ e* c! d8 [' w - ** w7 O) c& q9 D/ c; x
- * This file contains EDMA3 Test code.4 K( J ]0 ~* \5 V8 y
- *
2 v) [, w% ~1 U# [ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
; [# U# `; ?7 { g+ q, x S8 o - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
9 P& G" t- o2 v/ R& F2 _- n - * TO CHANGE.
3 Q: j% `; O0 N - *
. y; M# S7 e9 x' U! i: t6 L - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
7 Y- Y/ K! ^& ]" } - *
\ h1 Z5 k0 g; ` - * This program is free software; you can redistribute it and/or
' F: W' l- U+ {( c+ Z; Y - * modify it under the terms of the GNU General Public License as; ]( S/ |" g5 w0 w, [
- * published by the Free Software Foundation version 2.
( I$ X) P0 v6 G" F - *
+ U2 d/ f) i- H1 n2 h( f: s - * This program is distributed "as is" WITHOUT ANY WARRANTY of any( W( y# q1 E N
- * kind, whether express or implied; without even the implied warranty
" G7 \/ j6 j! A - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* Y+ }: u: T) C [' |1 z - * GNU General Public License for more details.* T6 U# }( B' P1 q4 w% S2 T' T
- */" n# [# Y' t8 ~3 M# q. C: H, Y
0 V' w, S5 h& }: s# Z2 C- #include <linux/module.h>/ q: l& B* A, j2 Y
- #include <linux/init.h>" L* r4 j+ [3 @/ C' E* x, R
- #include <linux/errno.h>3 h% x9 B. G/ ]4 o
- #include <linux/types.h>
5 t+ A# Q0 N2 L) X; O - #include <linux/interrupt.h>: ~5 `- e+ I, N" c
- #include <asm/io.h>
' d+ I9 G) ?, n O: T - #include <linux/moduleparam.h>
& J) {+ f4 Z9 k: j% | - #include <linux/sysctl.h>
1 U* ?2 O; h; F - #include <linux/mm.h>$ p2 S3 e$ F- F; X# p& s
- #include <linux/dma-mapping.h>
' x! F2 K9 x4 d) d& k. i - ' r+ h, `1 R6 Y: C
- #include <mach/memory.h>. V. P, S% p* p) n
- #include <mach/hardware.h>* F6 V) F) Y( E" z6 c2 e* W; y
- #include <mach/irqs.h>
9 k, h$ Q3 f8 p& I/ z$ x- T. j - #include <asm/hardware/edma.h>
" m3 `" n) n% ?* c- E; b
& p- y3 a( U" m) b1 F% m; O |- #undef EDMA3_DEBUG
1 P5 |* [$ v/ l5 v5 j1 N+ S - /*#define EDMA3_DEBUG*/
0 j& @8 N' U D
8 `* ]6 A; W: w. P- #ifdef EDMA3_DEBUG
2 g' A8 h& O) Q - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
& y. O( R6 c$ T4 p" G1 i - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ z9 K* a6 p' Z; Z' R& j$ h
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
( X; e3 O7 V3 G1 R$ s* {7 w - #else- R. L' B, f6 r" E, [% ~
- #define DMA_PRINTK( x... )
; B: ~/ ^6 @/ M5 F% E - #define DMA_FN_IN
6 N: ?6 f5 M; M, [$ E+ A - #define DMA_FN_OUT0 Y W# u7 I5 b: [) Z. e/ O# ]
- #endif. [/ {% j+ H4 j& J1 N: S) J/ ?3 q8 ]
- 0 H* E. V+ Z% U) a. q( K6 d% S; _5 J
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
" U: l, j& R- T2 J6 [* e - #define STATIC_SHIFT 3
9 c5 U/ w3 o2 B - #define TCINTEN_SHIFT 20
& F. P- r+ z8 n5 C4 [0 b - #define ITCINTEN_SHIFT 21
. |3 n+ G1 r; ^% k$ d2 o. _4 \ - #define TCCHEN_SHIFT 22
7 [# t) h' h: h7 L" x8 j @% c - #define ITCCHEN_SHIFT 234 ^- a$ @2 R! o+ l
2 t7 O% z/ s4 h- static volatile int irqraised1 = 0;4 L! C ]4 b; v( H# I
- static volatile int irqraised2 = 0;
0 z' y1 W/ b& e+ u - * U- j3 a* T; S4 d
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. i! l6 V# Q2 _% q# r% y& q
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! s3 D3 E6 j% ]6 S% N! ]- U
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' E% u9 O, M$ @2 ?: n& \" n
8 L. j- T S! {! Z6 E% v- dma_addr_t dmaphyssrc1 = 0;
1 t4 M! S0 i8 D* Y' O - dma_addr_t dmaphyssrc2 = 0;
/ a3 } U/ T. F c$ c - dma_addr_t dmaphysdest1 = 0;' g9 e8 D' J" s6 N9 J
- dma_addr_t dmaphysdest2 = 0;
+ l7 F; ]9 T5 A - ! M1 z n1 C6 R. Q
- char *dmabufsrc1 = NULL;* n9 q1 _7 e7 [: x) l7 G
- char *dmabufsrc2 = NULL;
" v( z& ~6 U' D; @0 z9 i( c# P - char *dmabufdest1 = NULL;7 c* g$ G. s# K( H0 r
- char *dmabufdest2 = NULL;! C0 j7 _9 C" W5 }; }5 T& x
- # \( L9 y, V1 V' W T4 b
- static int acnt = 512;) B; D1 w4 F, u% c6 E6 X
- static int bcnt = 8;
$ L) q( v5 h; ~2 n - static int ccnt = 8;0 f. b/ v ~2 p
- : E3 u, c# }8 n
- module_param(acnt, int, S_IRUGO);' z& D/ g5 Y0 \& k8 O1 Q
- module_param(bcnt, int, S_IRUGO);0 b3 t3 o6 Z3 J
- module_param(ccnt, int, S_IRUGO);
复制代码 ' `: _' F' X4 J0 {6 |, f
( }( l* p: E% Q& f" L v 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ Q2 B& D( B+ m# N( V
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* | y1 C8 X6 X2 Y I" O2 W 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: l3 X+ v3 p3 G* |
3 M4 }3 E% e9 P' ?# y4 F; t: K' X' v! H* h' H% Q7 u" D
|
|