ReactOS 0.4.15-dev-8061-g57b775e
profil.c
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS HAL
3 * LICENSE: GPL - See COPYING in the top level directory
4 * FILE: hal/halx86/generic/profil.c
5 * PURPOSE: System Profiling
6 * PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org)
7 * Eric Kohl
8 */
9
10/* INCLUDES ******************************************************************/
11
12#include <hal.h>
13#define NDEBUG
14#include <debug.h>
15
16/* GLOBALS *******************************************************************/
17
20
21/* FUNCTIONS *****************************************************************/
22
23/*
24 * @implemented
25 */
26VOID
29{
30 UCHAR StatusB;
31
32 UNREFERENCED_PARAMETER(ProfileSource);
33
34 /* Acquire the CMOS lock */
36
37 /* Read Status Register B */
39
40 /* Disable periodic interrupts */
41 StatusB = StatusB & ~RTC_REG_B_PI;
42
43 /* Write new value into Status Register B */
45
47
48 /* Release the CMOS lock */
50}
51
52/*
53 * @unimplemented
54 */
55VOID
58{
59 UCHAR StatusA, StatusB;
60
61 UNREFERENCED_PARAMETER(ProfileSource);
62
64
65 /* Acquire the CMOS lock */
67
68 /* Set the interval in Status Register A */
70 StatusA = (StatusA & 0xF0) | HalpProfileRate;
72
73 /* Enable periodic interrupts in Status Register B */
75 StatusB = StatusB | RTC_REG_B_PI;
77
78 /* Release the CMOS lock */
80}
81
82/*
83 * @unimplemented
84 */
88{
89 ULONG_PTR CurrentValue, NextValue;
90 UCHAR i;
91
92 /* Normalize interval. 122100 ns is the smallest supported */
93 Interval &= ~(1 << 31);
94 if (Interval < 1221)
95 Interval = 1221;
96
97 /* Highest rate value of 15 means 500 ms */
98 CurrentValue = 5000000;
99 for (i = 15; ; i--)
100 {
101 NextValue = (CurrentValue + 1) / 2;
102 if (Interval > CurrentValue - NextValue / 2)
103 break;
104 CurrentValue = NextValue;
105 }
106
107 /* Interval as needed by RTC */
109
110 /* Reset the */
112 {
114 }
115
116 return CurrentValue;
117}
unsigned char BOOLEAN
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
VOID NTAPI HalpReleaseCmosSpinLock(VOID)
Definition: spinlock.c:243
VOID NTAPI HalpAcquireCmosSpinLock(VOID)
Definition: spinlock.c:226
VOID NTAPI HalpWriteCmos(_In_ UCHAR Reg, _In_ UCHAR Value)
Definition: cmos.c:132
UCHAR NTAPI HalpReadCmos(_In_ UCHAR Reg)
Definition: cmos.c:123
VOID NTAPI HalStartProfileInterrupt(IN KPROFILE_SOURCE ProfileSource)
Definition: profil.c:33
VOID NTAPI HalStopProfileInterrupt(IN KPROFILE_SOURCE ProfileSource)
Definition: profil.c:22
ULONG_PTR NTAPI HalSetProfileInterval(IN ULONG_PTR Interval)
Definition: profil.c:44
#define RTC_REG_B_PI
Definition: halhw.h:16
#define RTC_REGISTER_B
Definition: halhw.h:15
UCHAR HalpProfileRate
Definition: profil.c:19
BOOLEAN HalpProfilingStopped
Definition: profil.c:18
enum _KPROFILE_SOURCE KPROFILE_SOURCE
DWORD Interval
Definition: netstat.c:30
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
#define NTAPI
Definition: typedefs.h:36
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define IN
Definition: typedefs.h:39
#define RTC_REGISTER_A
Definition: xboxrtc.c:21
unsigned char UCHAR
Definition: xmlstorage.h:181