OpenCores
URL https://opencores.org/ocsvn/mb-jpeg/mb-jpeg/trunk

Subversion Repositories mb-jpeg

[/] [mb-jpeg/] [tags/] [STEP1_1/] [microblaze_0/] [include/] [_profile_timer_hw.h] - Blame information for rev 66

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 5 quickwayne
//////////////////////////////////////////////////////////////////////
2
//
3
// Copyright (c) 2004 Xilinx, Inc.  All rights reserved. 
4
// Xilinx, Inc. 
5
//
6
// XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS" AS A 
7
// COURTESY TO YOU.  BY PROVIDING THIS DESIGN, CODE, OR INFORMATION AS 
8
// ONE POSSIBLE   IMPLEMENTATION OF THIS FEATURE, APPLICATION OR 
9
// STANDARD, XILINX IS MAKING NO REPRESENTATION THAT THIS IMPLEMENTATION 
10
// IS FREE FROM ANY CLAIMS OF INFRINGEMENT, AND YOU ARE RESPONSIBLE 
11
// FOR OBTAINING ANY RIGHTS YOU MAY REQUIRE FOR YOUR IMPLEMENTATION. 
12
// XILINX EXPRESSLY DISCLAIMS ANY WARRANTY WHATSOEVER WITH RESPECT TO 
13
// THE ADEQUACY OF THE IMPLEMENTATION, INCLUDING BUT NOT LIMITED TO 
14
// ANY WARRANTIES OR REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE 
15
// FROM CLAIMS OF INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY 
16
// AND FITNESS FOR A PARTICULAR PURPOSE. 
17
//
18
// $Header: /home/marcus/revision_ctrl_test/oc_cvs/cvs/mb-jpeg/microblaze_0/include/_profile_timer_hw.h,v 1.1 2006-06-23 18:59:00 quickwayne Exp $
19
// $Id: _profile_timer_hw.h,v 1.1 2006-06-23 18:59:00 quickwayne Exp $
20
//
21
// _program_timer_hw.h:
22
//      Timer related functions
23
//
24
//////////////////////////////////////////////////////////////////////
25
 
26
#ifndef _PROFILE_TIMER_HW_H
27
#define _PROFILE_TIMER_HW_H
28
 
29
#include "profile.h"
30
 
31
#ifdef PROC_PPC
32
#include "xexception_l.h"
33
#include "xtime_l.h"
34
#include "xpseudo_asm.h"
35
#endif
36
 
37
#ifdef TIMER_CONNECT_INTC
38
#include "xintc_l.h"
39
#include "xintc.h"
40
#endif  // TIMER_CONNECT_INTC
41
 
42
#ifndef PPC_PIT_INTERRUPT
43
#include "xtmrctr_l.h"
44
#endif
45
 
46
extern unsigned int timer_clk_ticks ;
47
 
48
//--------------------------------------------------------------------
49
// PowerPC Target - Timer related functions
50
//--------------------------------------------------------------------
51
#ifdef PROC_PPC
52
#ifdef PPC_PIT_INTERRUPT
53
unsigned long timer_lo_clk_ticks ;      // Clk ticks when Timer is disabled in CG
54
#endif
55
 
56
//--------------------------------------------------------------------
57
// Disable the Timer - During Profiling
58
//
59
// For PIT Timer - 
60
//      1. XTime_PITDisableInterrupt() ;        
61
//      2. Store the remaining timer clk tick
62
//      3. Stop the PIT Timer
63
//--------------------------------------------------------------------
64
#ifdef PPC_PIT_INTERRUPT
65
#define disable_timer()                 \
66
        {                               \
67
                unsigned long val;      \
68
                val=mfspr(XREG_SPR_TCR);        \
69
                mtspr(XREG_SPR_TCR, val & ~XREG_TCR_PIT_INTERRUPT_ENABLE);      \
70
                timer_lo_clk_ticks = mfspr(XREG_SPR_PIT);                       \
71
                mtspr(XREG_SPR_PIT, 0);  \
72
        }
73
#else
74
#define disable_timer()                 \
75
        {                               \
76
        XTmrCtr_mDisable(PROFILE_TIMER_BASEADDR, 0 ); \
77
        }
78
#endif
79
 
80
 
81
 
82
//--------------------------------------------------------------------
83
// Enable the Timer
84
//
85
// For PIT Timer - 
86
//      1. Load the remaining timer clk ticks
87
//      2. XTime_PITEnableInterrupt() ; 
88
//--------------------------------------------------------------------
89
#ifdef PPC_PIT_INTERRUPT
90
#define enable_timer()                          \
91
        {                                       \
92
                unsigned long val;              \
93
                val=mfspr(XREG_SPR_TCR);        \
94
                mtspr(XREG_SPR_PIT, timer_lo_clk_ticks);        \
95
                mtspr(XREG_SPR_TCR, val | XREG_TCR_PIT_INTERRUPT_ENABLE); \
96
        }
97
#else
98
#define enable_timer()                                          \
99
        {                                                       \
100
                XTmrCtr_mEnable(PROFILE_TIMER_BASEADDR, 0 );     \
101
        }
102
#endif
103
 
104
 
105
 
106
//--------------------------------------------------------------------
107
// Send Ack to Timer Interrupt
108
//
109
// For PIT Timer -
110
//      1. Load the timer clk ticks
111
//      2. Enable AutoReload and Interrupt
112
//      3. Clear PIT Timer Status bits
113
//--------------------------------------------------------------------
114
#ifdef PPC_PIT_INTERRUPT
115
#define timer_ack()                                                     \
116
        {                                                               \
117
                unsigned long val;                                      \
118
                mtspr(XREG_SPR_PIT, timer_clk_ticks);                   \
119
                mtspr(XREG_SPR_TSR, XREG_TSR_PIT_INTERRUPT_STATUS);     \
120
                val=mfspr(XREG_SPR_TCR);                                \
121
                mtspr(XREG_SPR_TCR, val| XREG_TCR_PIT_INTERRUPT_ENABLE| XREG_TCR_AUTORELOAD_ENABLE); \
122
        }
123
#else
124
#define timer_ack()                             \
125
        {                                               \
126
                unsigned int csr;                       \
127
                csr = XTmrCtr_mGetControlStatusReg(PROFILE_TIMER_BASEADDR, 0);   \
128
                XTmrCtr_mSetControlStatusReg(PROFILE_TIMER_BASEADDR, 0, csr);    \
129
        }
130
#endif
131
 
132
//--------------------------------------------------------------------
133
#endif  // PROC_PPC
134
//--------------------------------------------------------------------
135
 
136
 
137
//--------------------------------------------------------------------
138
// MicroBlaze Target - Timer related functions
139
//--------------------------------------------------------------------
140
#ifdef PROC_MICROBLAZE
141
 
142
//--------------------------------------------------------------------
143
// Disable the Timer during Call-Graph Data collection
144
//
145
//--------------------------------------------------------------------
146
#define disable_timer()                                 \
147
        {                                               \
148
                XTmrCtr_mDisable(PROFILE_TIMER_BASEADDR, 0 );    \
149
        }
150
 
151
 
152
//--------------------------------------------------------------------
153
// Enable the Timer after Call-Graph Data collection
154
//
155
//--------------------------------------------------------------------
156
#define enable_timer()                                  \
157
        {                                               \
158
                XTmrCtr_mEnable(PROFILE_TIMER_BASEADDR, 0 ); \
159
        }
160
 
161
 
162
//--------------------------------------------------------------------
163
// Send Ack to Timer Interrupt
164
//
165
//--------------------------------------------------------------------
166
#define timer_ack()                             \
167
        {                                               \
168
                unsigned int csr;                       \
169
                csr = XTmrCtr_mGetControlStatusReg(PROFILE_TIMER_BASEADDR, 0);   \
170
                XTmrCtr_mSetControlStatusReg(PROFILE_TIMER_BASEADDR, 0, csr);    \
171
        }
172
 
173
//--------------------------------------------------------------------
174
#endif  // PROC_MICROBLAZE
175
//--------------------------------------------------------------------
176
 
177
#endif

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.