|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 I# d, j. Q- r: a/ q F1 b
- [code]EDMA sample test application
Z8 P7 {0 f B( t$ }" P - /*
4 ?4 X* N1 q$ T - * edma_test.c
& @2 w, |) l% D9 i - *
' F* N# {8 S) S) V9 S9 X8 F! @3 U - * brief EDMA3 Test Application
: Q+ D+ u, @7 _4 X, _ - *
" q: k3 M8 `$ y; F - * This file contains EDMA3 Test code.
+ d' r' S9 h7 w7 X6 I& h0 a/ Q - *
]* g3 U+ ]$ `5 F - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
, T9 `/ c2 S$ _1 t* j# y6 @ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) D3 l* I( m. O
- * TO CHANGE.
8 n7 y, _- c. a* N {' U3 [ x - *
- c* z1 r- z6 X; i& K* g - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
2 Q& C3 u5 M* u - * ^0 Q/ Y5 a- V! q
- * This program is free software; you can redistribute it and/or2 A2 A) m" u6 Y) M: N! C. M4 d
- * modify it under the terms of the GNU General Public License as( C: q! f7 x `# K2 L
- * published by the Free Software Foundation version 2.
3 ~- W: u' k9 ^; Q$ Y0 s - ** U. i& q; x. F5 V* X/ ~
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 W/ [, ^+ U- o8 n
- * kind, whether express or implied; without even the implied warranty
+ K1 a d* ]. C3 p - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the! b1 [8 f t3 @ R q$ L/ y" R
- * GNU General Public License for more details.
1 ?3 y8 [ b3 i - */* E+ m' Y4 d1 ^$ c7 J& k
- 9 H- d4 y$ b K2 n7 d0 p1 W! {
- #include <linux/module.h>
5 E( D6 K' g# V0 @2 D - #include <linux/init.h>/ R" L) W5 r; T3 D0 G9 Z* M
- #include <linux/errno.h>9 W. l/ [/ A: U, I3 {" L% [" b
- #include <linux/types.h>
|+ K9 |% M2 ^) Q# | - #include <linux/interrupt.h>8 {' W8 @' M. r+ D8 x& }+ }
- #include <asm/io.h>6 p$ u" a# ?5 s
- #include <linux/moduleparam.h>
9 ]& O0 T3 N1 I" Z3 c: V- F9 F - #include <linux/sysctl.h>& P% {. W; T5 C" A7 h
- #include <linux/mm.h>5 a0 n/ U/ v: I% b
- #include <linux/dma-mapping.h>( H# R5 [5 y2 }7 U' Q+ Y
' t/ q8 O. N5 ?$ B- #include <mach/memory.h>. I8 ]2 Q- |* I% a+ w9 Y# H
- #include <mach/hardware.h>& H4 c& F; J+ K# j' T% \: o
- #include <mach/irqs.h>: x$ [# e0 q# U7 X$ d. o! z; v
- #include <asm/hardware/edma.h>& a4 f J: j4 R3 W a7 S9 }* k
! X& @4 p# o+ [( K/ `& f4 _5 V0 u. V! R- #undef EDMA3_DEBUG
+ L: N+ n8 }; S" t" a" H* p - /*#define EDMA3_DEBUG*/# M5 p$ G! ], S0 p2 a
- 5 [7 P X5 L' {' `. l
- #ifdef EDMA3_DEBUG
. S' r! j$ O- o' _9 X4 A - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 D8 H9 s+ d+ E; p- _5 P* V! C6 l
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
- N+ o& {6 q) W9 U$ A1 O - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 R( Y; Z6 |5 |2 i7 V& a& \! `
- #else
# T2 Z; V! b4 H1 B0 n) x& W - #define DMA_PRINTK( x... ); t0 P* g! c# K# A' j4 C$ X$ O
- #define DMA_FN_IN
1 f9 p1 C, x, M* B - #define DMA_FN_OUT
% v# v# Z) S$ H |. r5 j9 v - #endif2 h1 d5 r$ C- R% `, Y; D7 B' S. d
- ( |7 j( j) e$ s7 n' m% _6 C
- #define MAX_DMA_TRANSFER_IN_BYTES (32768), C5 c# ]8 ^2 {! b8 j0 L
- #define STATIC_SHIFT 3
% ]- L* T( n! ]1 s1 Q3 |/ E9 l - #define TCINTEN_SHIFT 20
. K' P; m5 Y1 ` - #define ITCINTEN_SHIFT 21$ i" Y8 \4 O7 X; B6 o ~
- #define TCCHEN_SHIFT 228 @. y* g: J9 e& v
- #define ITCCHEN_SHIFT 23
! f q. ^) m, j! f( i+ K, b
! k* |9 ~) R" f/ q1 K: Z \; o- static volatile int irqraised1 = 0;
9 E% P; W/ b" t1 U6 x7 V - static volatile int irqraised2 = 0;$ g; U$ t& j- P: T( C4 h8 z4 x( S
$ ~( A, a, ~+ M4 _- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. D1 H7 j; h" G: I - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 a! f% h/ o& l' u# x, D& O* a
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 I: @' u1 x. f6 c9 Z2 h
- ) |( ~6 Z2 s3 I5 a
- dma_addr_t dmaphyssrc1 = 0;, m! U; ~0 l: A0 L& e
- dma_addr_t dmaphyssrc2 = 0;$ w2 h8 F- X! V
- dma_addr_t dmaphysdest1 = 0;8 ~8 w6 u2 C" M7 N3 ~
- dma_addr_t dmaphysdest2 = 0;' U' U9 C/ K! g, p
- 3 u' `. n, `! U" C
- char *dmabufsrc1 = NULL;. F" j, C2 |0 q
- char *dmabufsrc2 = NULL;3 i v" H S5 b
- char *dmabufdest1 = NULL;
6 c5 `1 h2 D! H j0 y" O( e0 }' ` - char *dmabufdest2 = NULL;4 P9 ~" C) r* `2 `. q" u" |; c+ {
- : p1 B2 N8 j2 ]- g5 y: d6 _- C
- static int acnt = 512;
' Z3 p- b* p% @) `6 ? - static int bcnt = 8;
& Z1 K9 N# W: v: L( Y8 y* G+ B - static int ccnt = 8;
$ f. y& ]2 h6 y - + Y6 t8 }9 O) w" R- t& f5 r
- module_param(acnt, int, S_IRUGO);7 k% `8 G' L# p) ^- ?8 ~
- module_param(bcnt, int, S_IRUGO);
- r/ ^5 V, g) m: a q2 b! O$ V - module_param(ccnt, int, S_IRUGO);
复制代码 4 z: L3 ? ]3 U: f$ I
. N* l9 c" F. H
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: R1 s8 L! `: V2 D! w' B8 \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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 ] q9 {% ]( h5 w6 t
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 Q+ G) m( z- \4 Q1 l6 _
3 |3 A6 y3 G5 G/ O# m+ s9 ?( W
X) L+ O. P8 g! L8 d4 O N |
|