|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 h* N: r' M ^
- [code]EDMA sample test application1 \! H3 q9 I- N6 m; ^) D, A* l
- /** S' p3 I* _% t
- * edma_test.c
) K! C5 \' z+ z9 q# R$ l - *
9 Q7 H! s' p# Y* M0 H5 v2 k - * brief EDMA3 Test Application
) E8 \1 @" X( z( y% ] - *) W% Z+ v7 M* u! w; x- F
- * This file contains EDMA3 Test code.
: g' t0 I+ ^& B G8 ^" H( m - *, v$ K; E7 x- H# J
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; x5 `. M' \5 j' m$ Z5 Y0 Z
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
9 |. @( Q9 j3 |/ Y: z' w - * TO CHANGE.
$ k" j! y& k7 h, n& i - *; u% a6 }3 x: z
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# \. h0 K7 f% L. ~( i( C2 c2 i
- */ k! f4 l7 {" r5 k) D& i1 {+ `
- * This program is free software; you can redistribute it and/or9 |0 J7 s8 ]! X
- * modify it under the terms of the GNU General Public License as1 P- v8 ?! H8 F6 d& R
- * published by the Free Software Foundation version 2.
$ w0 `; q4 G! g! o" v0 O& Y6 S6 X! R - *3 M$ ^0 s( g# |& ? ~( t
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any e" `- _) {* W" I* V* N
- * kind, whether express or implied; without even the implied warranty
% U' ~6 t) [! ~2 } - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
( Y- I# J% C# j0 c - * GNU General Public License for more details.
4 ~. H1 j/ H8 n1 j7 r, ?/ j$ F - */8 y( D0 w. e) y V/ j
6 r! c2 b/ Y5 ?( m5 u( x1 Y- #include <linux/module.h>
+ o2 a! Z$ r3 \/ | - #include <linux/init.h>2 B4 N: p/ y- S6 Z% b) i
- #include <linux/errno.h> r* `- n) _: d; p: E
- #include <linux/types.h>
) |- s2 ^# F ]- G; e3 w6 n - #include <linux/interrupt.h># f I7 M8 Q8 A* A1 e: f
- #include <asm/io.h>9 J% {" F" g0 `6 m% g
- #include <linux/moduleparam.h>
: z2 B% s# O4 Y0 A: T - #include <linux/sysctl.h>
; r W# C) x% e6 y. P e - #include <linux/mm.h>
8 T) o) B8 R! _, Z$ w" [7 f - #include <linux/dma-mapping.h>7 [2 d3 M7 K7 ~
& L# _) U9 C3 a8 A7 V8 A- #include <mach/memory.h>4 [7 c; H- {( v. r4 D7 t
- #include <mach/hardware.h>( s5 M6 Q8 a! Q* h, c0 W W& z
- #include <mach/irqs.h>+ v. e! M4 s, n/ Z
- #include <asm/hardware/edma.h>
+ y) C, j- v; _4 g' Z7 L
3 m! M$ l; l+ H6 m- #undef EDMA3_DEBUG, q$ b# h) `% O7 s; U* n! d, \( n
- /*#define EDMA3_DEBUG*/$ j" J) A* T9 K! x, r& y) {
6 q# D; C9 B+ T" a# J8 y- #ifdef EDMA3_DEBUG a% a' P5 D8 p# k7 ]% D8 d
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
l- i8 g8 r. h: t- r; o4 K2 j - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), I* A% G; M4 W" i
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
$ o3 z. p7 R% G5 T* v" ^ - #else0 @6 ]( i0 ~3 ~& l
- #define DMA_PRINTK( x... )' K7 F! i2 [8 F$ H
- #define DMA_FN_IN
+ v7 A8 _8 c( q - #define DMA_FN_OUT
( v. v2 _ N4 s' ?2 a8 V - #endif+ h, K5 ~* Q6 _; N
! B- K* T) {! o" x) p- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
, b# ^2 s8 `. Q$ w# O - #define STATIC_SHIFT 3
6 S# S5 b8 Y7 @ - #define TCINTEN_SHIFT 20! I+ T8 y- `% \4 ]9 b c3 K0 C
- #define ITCINTEN_SHIFT 21
% E( x1 P8 X# s1 x+ ^ - #define TCCHEN_SHIFT 22' p7 f8 m X! p9 E, q( C- @2 t) H
- #define ITCCHEN_SHIFT 23
' m* W& t" A/ K - B& X9 e z# y0 e5 U
- static volatile int irqraised1 = 0;& k, V8 F' |5 H4 [; v0 ]
- static volatile int irqraised2 = 0;) @5 C/ h) Q! s& J5 ]% k
+ N5 K; ^$ J7 Q! D2 L ^- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; B& C0 w0 `; i: Q7 a& W3 d& } - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( |/ F4 N1 c8 A, D8 c& o( E) V0 j - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ U9 A/ ]2 E) T1 |
- 7 u' f4 ^+ `0 k8 |* H4 N
- dma_addr_t dmaphyssrc1 = 0;
: `& |! d. G6 Z9 S4 G) U5 d, I - dma_addr_t dmaphyssrc2 = 0;
/ K+ _( U4 T0 ]. G% @ c4 M8 X; v - dma_addr_t dmaphysdest1 = 0;# P! X1 R* v! u* v- y
- dma_addr_t dmaphysdest2 = 0;/ k* _4 ?- I! A5 p2 l4 n# \
, E# s6 x; w7 K/ w- char *dmabufsrc1 = NULL;
- y! _, h* W# [" z+ o - char *dmabufsrc2 = NULL;+ d! R" z' x) d$ n& m- y# r/ E
- char *dmabufdest1 = NULL;# v1 y: Z( ?" k U
- char *dmabufdest2 = NULL;( X0 s- l9 ?6 t0 D, i
- ' u* r K6 r9 K& a* k9 ^
- static int acnt = 512;1 C" j+ s0 ~5 t* Y7 c' ^
- static int bcnt = 8;
# h! |) O: t: w. l/ `' @- b - static int ccnt = 8;
f6 a7 \! T, `: G. j# D - ( W7 M; a4 c% h% M6 Q7 q
- module_param(acnt, int, S_IRUGO);
/ |' Z4 G- b2 I" f6 S* k - module_param(bcnt, int, S_IRUGO);
1 ?4 H; F# |1 S# W3 q# n' l) U- y - module_param(ccnt, int, S_IRUGO);
复制代码 6 ^9 v! y9 S7 Z8 e& b3 v
4 m7 ?- ]2 Y# u1 P 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. R# N' t% W, a; v& P# B8 n l! Oarm-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* L% }* s7 L2 k9 `, ?& y, k# X 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( F9 b; `! n6 a% n: T9 [
: [/ r% G Y3 e# o+ z( Y t4 K+ }. O" O, P3 L8 Q% m$ a
|
|