|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. e5 g3 } s% U1 @1 ~9 Q. |- [code]EDMA sample test application
: u/ {4 R+ i" c O - /*& `% a6 A4 k k1 l: L* _
- * edma_test.c N4 |3 T9 A" Q$ Z7 e: L
- *
" j+ i+ h0 ~ Y# a# S3 ~- ] - * brief EDMA3 Test Application
4 r) R: E" I8 H6 y* S* t" Z2 ? - *, z. ]7 r0 m0 K$ K0 ~. K( O
- * This file contains EDMA3 Test code.6 l( a' H0 P1 R% P6 ~
- *
8 ]2 Y0 a4 l, U( ` O" ] - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
( K# d/ _+ |/ @( Y - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
& }4 [9 T1 P$ o" V, X - * TO CHANGE. D9 ~8 y" V2 x1 i
- *
$ N# J; C( `+ m0 g2 I9 D - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" E- G5 g* D9 S# V
- *
( z" J7 W9 _) f" J4 ~, f - * This program is free software; you can redistribute it and/or
% H) x/ F0 D5 E% ?$ F - * modify it under the terms of the GNU General Public License as
: g( I9 e7 K$ Q' p1 N2 P% n& J - * published by the Free Software Foundation version 2.
- N& N" r: X% @, ?9 o" r - *
* ~: F& I) r/ k) e3 _- F - * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ A$ ^5 O5 m' b
- * kind, whether express or implied; without even the implied warranty& g: J7 n1 {" Y6 `
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the, ], r: D9 C8 z
- * GNU General Public License for more details.3 d% v* \8 T* h' f8 z9 u/ ?7 \8 o
- */- _! k3 z% z: J' {3 h3 O
- ( n V& @) T5 [ S* U" h5 H
- #include <linux/module.h>7 Y/ C& @7 @3 i
- #include <linux/init.h>4 S8 q- [) X! v5 b& x4 S
- #include <linux/errno.h>5 d! D6 x5 U+ O: z8 S
- #include <linux/types.h>1 ~9 n) S+ R8 P, m- m1 x
- #include <linux/interrupt.h>* \) |# L# M. \9 q+ U8 N1 O8 N9 j
- #include <asm/io.h>
~0 w6 Z% k; ?( a - #include <linux/moduleparam.h>( r. C9 M6 \+ Y! T- o B* r
- #include <linux/sysctl.h>
/ f* q) T4 `- Y% _8 O, z6 f5 _ - #include <linux/mm.h>! P5 `3 C( T) T
- #include <linux/dma-mapping.h> t# g+ X5 z8 l. i0 M) A" L
- ! g/ D% J2 o, H# H6 r; Q) u0 V
- #include <mach/memory.h>
@! p9 s% _8 @* [; l - #include <mach/hardware.h>
4 i1 q5 C1 w9 S6 c+ U k - #include <mach/irqs.h>
9 h+ V9 z+ Y! x - #include <asm/hardware/edma.h>
! q/ ^* ~0 J& j - / v, _2 j8 K' a9 e7 Y7 ^
- #undef EDMA3_DEBUG
/ _. R! C3 v, l! W; w% l - /*#define EDMA3_DEBUG*/
+ ~, L" d# H$ d" D! U - ' d. a6 ?/ u0 ~1 g5 w! Y( Q8 E
- #ifdef EDMA3_DEBUG
) K6 p9 M$ w8 P - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
3 a- i# \1 h3 Z3 k - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) y9 {2 }# ]0 j$ L' K: Z
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
- u8 H! E* C5 { - #else
" W) B! M$ N- ^2 j - #define DMA_PRINTK( x... )
s: l. F' y9 E# s5 c. C - #define DMA_FN_IN2 K( r) x: t: q
- #define DMA_FN_OUT
4 X" o0 r9 F! ~7 z - #endif
& C8 T4 X7 ^& ]
. q4 ?0 P9 v- g. h* d- #define MAX_DMA_TRANSFER_IN_BYTES (32768)9 L% J; Q/ O: l
- #define STATIC_SHIFT 3
5 Z& {( E( H# k- T9 N - #define TCINTEN_SHIFT 20
0 q7 S1 u* @# g0 B - #define ITCINTEN_SHIFT 21
8 E' n. T5 s4 Y- U9 @/ X - #define TCCHEN_SHIFT 22
! u8 P4 N% j/ K% Q% { - #define ITCCHEN_SHIFT 23( h" {: I5 N4 e# S" j" T/ b, s5 y
# e1 v$ d5 W* L$ b) K0 D2 Q- static volatile int irqraised1 = 0;6 t: E# p% |# A0 j$ _
- static volatile int irqraised2 = 0;$ j$ L: Y. ?7 ~
- _% y: O! T+ z$ m. Z0 j- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 f0 W9 ~4 j, }2 H - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ T4 `" S( Z6 A
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 b& I" o- G+ A, x - ! `. n* l/ j) u$ ?
- dma_addr_t dmaphyssrc1 = 0;
0 Y) P: _ j* \1 M n e - dma_addr_t dmaphyssrc2 = 0;
- H2 o$ W6 A$ N5 A6 `& w; y; j - dma_addr_t dmaphysdest1 = 0;& B' Q9 H* ]: Q8 I& J$ M
- dma_addr_t dmaphysdest2 = 0;! c. c/ r. z' c! U, b0 O" G
, \$ T& q/ x+ o" {- char *dmabufsrc1 = NULL;- K& j- m+ o+ n! r
- char *dmabufsrc2 = NULL;1 a, m* _& P0 D; M% |
- char *dmabufdest1 = NULL;
( F) z& u- v! o3 F1 S! ] - char *dmabufdest2 = NULL;
( {" W2 D' ?8 s+ }7 u. |
2 D- b3 Z" t+ z' a- static int acnt = 512;8 x! C- P. d' _
- static int bcnt = 8;- V, ~6 c# Y' ^% F( u5 F3 Z1 U
- static int ccnt = 8;% l3 M2 L3 y2 o, W) L$ C( }' {
4 B5 j8 l. a9 {& W( m- module_param(acnt, int, S_IRUGO);
& N. B7 q( G6 k0 X+ g - module_param(bcnt, int, S_IRUGO);, t8 S+ n. ~7 l0 C
- module_param(ccnt, int, S_IRUGO);
复制代码
$ X# O8 }8 l$ T3 h' J U f+ j- N+ O& b
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ U5 K" r6 J+ O7 f# K; d4 y. b$ uarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 d- Y# Z6 }1 P8 T
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
Q \' o r/ D m! z' K2 B* ~0 V9 G' w: q9 q# V j! ^
5 n0 f2 B3 e' o5 ^2 u! b. f& j |
|