|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 Q% a' N8 D. n0 U3 S ]$ @$ }# d
- [code]EDMA sample test application
. _% {6 k i8 Q8 x" M9 q, q - /*" m/ A! S4 M; U( O
- * edma_test.c/ h4 d- K4 m" S* O
- * n8 [8 I1 k( A! Y' f3 \( }: u
- * brief EDMA3 Test Application! f. F9 Z. f! O0 u3 @, U
- *
; Z* g% C: J9 R: J$ X% f0 f - * This file contains EDMA3 Test code.
4 r9 n$ ~7 q* l- l; x - *
# h8 H, v0 C- s2 ^. Q7 I; s - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: j; x2 J5 r, ~/ _' r
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
' Q7 U3 q5 u+ a( Q# X- t6 S" L* E - * TO CHANGE.
8 h8 s/ ?; M, u& ~ - *% ^: E0 o/ V+ q) m" d
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
" v' D; `; K% v- t! ` - *) A( C. R( J5 \
- * This program is free software; you can redistribute it and/or3 k T6 S# q! a
- * modify it under the terms of the GNU General Public License as% x5 K' p% Z7 J& [; W: @+ b
- * published by the Free Software Foundation version 2.8 w3 ^' i1 Q3 K9 u" {
- *
- d3 O$ T5 e8 g( V% H - * This program is distributed "as is" WITHOUT ANY WARRANTY of any% l; E5 O' r8 u
- * kind, whether express or implied; without even the implied warranty6 f0 k1 r, N0 O+ x1 Z) n
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; T; _! u. l0 i/ \3 V& ? - * GNU General Public License for more details.
9 g3 u" y. |7 I+ {+ c, ]6 m/ Y' H0 G - */
# \$ x2 }, {6 ?4 } H2 h* K - ' C2 R4 b0 h( }) O, r9 o4 O; `
- #include <linux/module.h>
3 c1 |3 C2 c8 I3 j: C, O6 k - #include <linux/init.h>
/ M, L# F' j% Y* _4 h3 {# [ - #include <linux/errno.h>
& b& C7 d# U, O1 J; Q8 h# x3 u - #include <linux/types.h>+ m$ `5 q) P7 y( w
- #include <linux/interrupt.h>
{/ f' q1 q% X! r3 R9 @ - #include <asm/io.h>
8 h0 m2 X2 p! t4 K8 ? - #include <linux/moduleparam.h>
" Z2 r5 k( ?+ j - #include <linux/sysctl.h>! N- B, I4 `* v- i
- #include <linux/mm.h>
$ ?9 ~; e) P' B; g - #include <linux/dma-mapping.h>" b1 h& c1 o1 R+ u& Q
- 8 U( X6 [; R3 b* [0 B8 T2 w5 ^
- #include <mach/memory.h>$ @% {- ~" G& p4 C4 {% x3 f
- #include <mach/hardware.h>
4 |) f+ o6 d l* }# U0 a - #include <mach/irqs.h>
4 Q- j+ g9 @3 t1 F/ p - #include <asm/hardware/edma.h>: ]2 ]$ g, n6 z" P. a8 Q
- 8 S- m, X: R1 E# s& c& f
- #undef EDMA3_DEBUG
* e, f, u8 P* Y5 S U - /*#define EDMA3_DEBUG*/9 P! p- n4 b! |) C8 s, I0 w
5 ~: \. @! H* ~- #ifdef EDMA3_DEBUG. l$ |/ T$ d0 m: P, p2 C0 Z) o- X
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
! S. X, H) ~; @3 r0 m - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), L% F$ v8 g- [* @( c
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 w* L4 i9 _$ m6 ~7 r8 G( w5 I
- #else
4 I# c1 c! @4 b - #define DMA_PRINTK( x... )
% h, N/ x, I8 q8 _" ` t - #define DMA_FN_IN: P4 T# ~ h& h8 X! l
- #define DMA_FN_OUT
/ z. S# O2 V- | - #endif
- B; J/ X0 c+ e+ s N1 Q9 K# ?
2 h/ K6 C# U: Y/ C! V- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
/ Z# l5 e; R0 O! P - #define STATIC_SHIFT 3
% P; h9 ]0 x! t% M0 A( E - #define TCINTEN_SHIFT 20
9 k2 [3 H) @ k4 C - #define ITCINTEN_SHIFT 21
7 N% U, K. `( n$ R - #define TCCHEN_SHIFT 22
8 R9 e# [ ]3 @$ z. J2 p - #define ITCCHEN_SHIFT 23
( H7 O* D3 R- z% |
) V) ?1 y- y. Z- static volatile int irqraised1 = 0;
( h/ R ~/ Q# q% `2 U - static volatile int irqraised2 = 0;
+ S; A0 d" Q$ ^( |) g* G - / C- a V. {& X) a
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) p: A+ o: l* j$ a y: I" k - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' e9 o9 i9 {9 R4 ]) z5 @) c4 `. K
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 @- l3 J: ]$ r, h% f$ z7 ?$ X, l4 Z
% Z/ ^# E2 b2 v2 P/ k- dma_addr_t dmaphyssrc1 = 0;3 A- `, N8 P% T7 c1 t0 e- M
- dma_addr_t dmaphyssrc2 = 0;
4 ~. ~% n0 |8 p3 @! m - dma_addr_t dmaphysdest1 = 0;( Y. |/ n: S; ^8 V
- dma_addr_t dmaphysdest2 = 0;3 o) p7 j5 s" T+ h( \
, x/ {0 M0 W5 d6 |- char *dmabufsrc1 = NULL;
' e; d: Z. p9 S9 |4 D/ ~" Y - char *dmabufsrc2 = NULL;
* o7 @6 s1 D2 R9 }3 F2 w - char *dmabufdest1 = NULL;/ R8 L- ]% N7 i3 y! p1 m
- char *dmabufdest2 = NULL;) o2 ^/ H P$ \; v
+ v# x4 M: n9 L, b& R) f5 i- static int acnt = 512;
; N! S8 i: C; A. z+ v6 I, t - static int bcnt = 8;
/ h) v/ U8 h. V) ~ - static int ccnt = 8;3 e4 S% x! F$ Y6 g" W
- % x; n2 v+ l! w# R9 C/ Y7 Z" l7 e# ]
- module_param(acnt, int, S_IRUGO);
) x5 @7 o2 H" O. ~" B, B" A - module_param(bcnt, int, S_IRUGO);
$ L' j( _! [# L% Y, O; C+ i B - module_param(ccnt, int, S_IRUGO);
复制代码 ) c9 k& k9 ], v6 H8 [% `; d% N
) c+ P( x: l+ n. [9 V$ h" n% c 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用; u* |$ }1 y0 L& k2 x
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( _0 e8 U9 C' \4 T 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( } [. ?" T( t6 O7 ?
n4 u& b( E W$ j" [/ z
8 y. S; m: H$ ^3 X5 ^2 q |
|