|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' v* B' z1 w9 [# l- [code]EDMA sample test application, e6 T/ u, q9 q9 _( _- } @
- /*0 i! N9 P- I2 K. f9 s
- * edma_test.c
_" y$ c) ^3 [2 x - *
4 b5 v- u+ A u' L+ e) k - * brief EDMA3 Test Application
9 s- [6 R* K3 x5 i: f - *
2 H8 } F4 {' y$ E2 [( w4 g - * This file contains EDMA3 Test code.
9 l; N8 ~4 O' o - *! X; s5 t! \" ?- B6 f+ @
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( l+ g" b7 ~; W* }9 ?
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
4 F+ F: r/ D! B# m* Y* q1 c - * TO CHANGE.
! X* }* K" M! N4 K8 o9 b) Z - *& H7 X' |) S1 I3 C* z
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 P9 ]" n3 I/ C: d5 }, n
- *. G( g; u' j# W6 J. P% U5 \
- * This program is free software; you can redistribute it and/or
+ B f( ^. e! y( w- Z - * modify it under the terms of the GNU General Public License as
- }+ @! p& N; b2 p1 U' J: R4 c - * published by the Free Software Foundation version 2.4 J) Q5 C9 O% p& {
- *
2 _( n, Q' G/ M - * This program is distributed "as is" WITHOUT ANY WARRANTY of any ?( w4 _& {7 h) Q
- * kind, whether express or implied; without even the implied warranty
1 i9 v9 t5 O0 _/ I; H% v; e - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the: e) _* J. {* S! |( S9 k
- * GNU General Public License for more details.4 o+ }+ z* A V
- */
$ ^! I' S) ^- |7 z6 t
; M D V3 b4 @8 v/ B5 V- #include <linux/module.h>
7 N9 _) P, G+ _2 M1 r6 N D - #include <linux/init.h># F/ d F. t% S- b( x% F8 i. _/ ~# a
- #include <linux/errno.h>
% D/ j& k: y0 M& `8 S( x8 ]1 e - #include <linux/types.h>
4 H T- c0 D) R8 f0 H( U - #include <linux/interrupt.h>5 i! ^) I) f$ _; I- {% t. _
- #include <asm/io.h>
0 t# y- a8 Z7 R$ P* S - #include <linux/moduleparam.h>
4 @4 ]8 R; W8 B0 |! T1 Y r - #include <linux/sysctl.h>
& _+ R& _% Q+ W* d) h - #include <linux/mm.h>
% \2 V" R1 E3 ]5 e - #include <linux/dma-mapping.h>
4 ?9 g2 @8 \+ ^, C - 9 y+ v$ Q# F6 O4 H8 L$ g W& G8 g
- #include <mach/memory.h>/ B$ y0 j0 B, a5 b1 ^7 W
- #include <mach/hardware.h>
% ~4 W( r, k' [$ d - #include <mach/irqs.h>2 q! B/ F9 x& v7 q' p1 _
- #include <asm/hardware/edma.h>
0 @1 A4 W$ U! Z- z8 n
8 t9 D" _9 ^2 Z0 b, E x- #undef EDMA3_DEBUG, [+ B0 Z7 |2 t8 ]1 E7 z
- /*#define EDMA3_DEBUG*/# Q# V4 k) F4 c2 q& s. {9 M7 d1 g
- & N- ^" {' R$ ^. r
- #ifdef EDMA3_DEBUG" l1 J9 @; W6 I1 ]- O
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
0 m9 Y% \: i, B; e' s; q - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- q+ ~: F Z3 ]6 C1 H. h
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 F F1 F1 s! C, C
- #else( Z0 ]" ?* w" U4 `
- #define DMA_PRINTK( x... )% `- D& d$ k5 D8 R. x2 W. ?$ R
- #define DMA_FN_IN
: z* Q( n2 A7 @& k6 N - #define DMA_FN_OUT# q- G0 r/ W/ [8 K
- #endif$ Q) i# }4 e" h% I
/ r& s& s' G+ G J( h+ @- #define MAX_DMA_TRANSFER_IN_BYTES (32768) H) Y% x+ l+ C( m& o' h; J
- #define STATIC_SHIFT 3# m8 v, i* [: O0 q3 m
- #define TCINTEN_SHIFT 208 f( R6 y( y4 r' l2 K
- #define ITCINTEN_SHIFT 21
6 j$ ?* v8 ]2 B+ T8 ~; D - #define TCCHEN_SHIFT 22) V7 Y2 v1 D& a6 f; _$ z
- #define ITCCHEN_SHIFT 23
( l0 h, z7 X6 t# I
4 N* y: F2 B* ]* l0 ~" Q- static volatile int irqraised1 = 0;+ |: c5 s6 p! O
- static volatile int irqraised2 = 0;
0 s1 r, i6 L: _9 X$ E - $ t v! @# ^! x
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 s' I( e s7 r0 J! i& K - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, { F5 M: O$ Q7 D& J4 z" l' i
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 C2 K+ c% [" L0 F) L* y) Q3 ~
- 0 j1 M- ^/ V" z0 q- F7 Q, Z
- dma_addr_t dmaphyssrc1 = 0;9 ~( Z9 Y6 v9 o0 {- e# H0 m
- dma_addr_t dmaphyssrc2 = 0;
( y( [3 T; @4 A. q8 d - dma_addr_t dmaphysdest1 = 0;/ F" P& n- e0 ?* u
- dma_addr_t dmaphysdest2 = 0; d( ^$ f/ u! o7 R$ n
- & Y# w7 T# Z8 c
- char *dmabufsrc1 = NULL;
/ ?: U1 m) w' S( p! ` - char *dmabufsrc2 = NULL;
' k$ U0 `& R0 P0 y* v; }! b' @ - char *dmabufdest1 = NULL;
3 B M4 o3 t3 @3 N - char *dmabufdest2 = NULL;
# D1 w: n! e; a' W
1 X2 I; Q e+ @, l; O, x- static int acnt = 512;
# e# T2 H9 R2 e - static int bcnt = 8;5 E U/ t4 M" p% v7 r
- static int ccnt = 8;
! X: D: S# D1 e3 A& b* K
' X0 f Q/ N- H. r; e- module_param(acnt, int, S_IRUGO);3 b0 V9 e: }# i; S W r/ p
- module_param(bcnt, int, S_IRUGO);
Z6 ~9 n' H' D - module_param(ccnt, int, S_IRUGO);
复制代码
6 V0 k7 ]( J' ]$ u" d% u8 D* w5 `( p: E
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 c* A; B K+ I$ m
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" f9 P& [! @6 H$ l
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 f: ?$ ~4 R6 f* K2 u: ?! @ G$ Y$ j
2 i3 i5 O+ p* T& d
|
|