mirror of
https://github.com/reactos/reactos.git
synced 2024-12-27 09:34:43 +00:00
Added some hal functions
svn path=/trunk/; revision=1513
This commit is contained in:
parent
eaeab91ab2
commit
2dd3473a90
6 changed files with 116 additions and 40 deletions
|
@ -1,4 +1,4 @@
|
|||
/* $Id: halddk.h,v 1.7 2000/12/30 01:41:04 ekohl Exp $
|
||||
/* $Id: halddk.h,v 1.8 2001/01/14 15:35:56 ekohl Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -348,9 +348,11 @@ BOOLEAN STDCALL HalBeginSystemInterrupt (ULONG Vector,
|
|||
KIRQL Irql,
|
||||
PKIRQL OldIrql);
|
||||
|
||||
/*
|
||||
HalCalibratePerformanceCounter
|
||||
*/
|
||||
VOID
|
||||
STDCALL
|
||||
HalCalibratePerformanceCounter (
|
||||
ULONG Count
|
||||
);
|
||||
|
||||
/*
|
||||
FASTCALL
|
||||
|
@ -440,9 +442,13 @@ HalGetDmaAlignmentRequirement (
|
|||
VOID
|
||||
);
|
||||
|
||||
/*
|
||||
HalGetEnvironmentVariable
|
||||
*/
|
||||
BOOLEAN
|
||||
STDCALL
|
||||
HalGetEnvironmentVariable (
|
||||
IN PCH Name,
|
||||
OUT PCH Value,
|
||||
IN USHORT ValueLength
|
||||
);
|
||||
|
||||
ULONG
|
||||
STDCALL
|
||||
|
@ -550,9 +556,12 @@ HalSetDisplayParameters (
|
|||
ULONG CursorPosY
|
||||
);
|
||||
|
||||
/*
|
||||
HalSetEnvironmentVariable
|
||||
*/
|
||||
BOOLEAN
|
||||
STDCALL
|
||||
HalSetEnvironmentVariable (
|
||||
IN PCH Name,
|
||||
IN PCH Value
|
||||
);
|
||||
|
||||
/*
|
||||
HalSetProfileInterval
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: misc.c,v 1.6 2000/08/17 17:42:53 ekohl Exp $
|
||||
/* $Id: misc.c,v 1.7 2001/01/14 15:36:55 ekohl Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -45,6 +45,12 @@ HalProcessorIdle (VOID)
|
|||
#endif
|
||||
}
|
||||
|
||||
VOID STDCALL
|
||||
HalRequestIpi(ULONG Unknown)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ULONG FASTCALL
|
||||
HalSystemVectorDispatchEntry (
|
||||
ULONG Unknown1,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: perfcnt.c,v 1.1 2000/06/09 20:05:00 ekohl Exp $
|
||||
/* $Id: perfcnt.c,v 1.2 2001/01/14 15:36:55 ekohl Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -17,16 +17,25 @@
|
|||
|
||||
/* FUNCTIONS **************************************************************/
|
||||
|
||||
/*
|
||||
HalCalibratePerformanceCounter@4
|
||||
*/
|
||||
|
||||
VOID STDCALL
|
||||
HalCalibratePerformanceCounter(ULONG Count)
|
||||
{
|
||||
ULONG i;
|
||||
|
||||
/* save flags and disable interrupts */
|
||||
__asm__("pushf\n\t" \
|
||||
"cli\n\t");
|
||||
|
||||
for (i = 0; i < Count; i++);
|
||||
|
||||
/* restore flags */
|
||||
__asm__("popf\n\t");
|
||||
}
|
||||
|
||||
|
||||
LARGE_INTEGER
|
||||
STDCALL
|
||||
KeQueryPerformanceCounter (
|
||||
PLARGE_INTEGER PerformanceFreq
|
||||
)
|
||||
LARGE_INTEGER STDCALL
|
||||
KeQueryPerformanceCounter(PLARGE_INTEGER PerformanceFreq)
|
||||
/*
|
||||
* FUNCTION: Queries the finest grained running count avaiable in the system
|
||||
* ARGUMENTS:
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
/* INCLUDES *****************************************************************/
|
||||
|
||||
#include <ddk/ntddk.h>
|
||||
#include <string.h>
|
||||
|
||||
#define NDEBUG
|
||||
#include <internal/debug.h>
|
||||
|
@ -25,6 +26,8 @@
|
|||
#define RTC_REGISTER_A 0x0A
|
||||
#define RTC_REG_A_UIP 0x80 /* Update In Progress bit */
|
||||
|
||||
#define RTC_REGISTER_B 0x0B
|
||||
|
||||
#define RTC_REGISTER_CENTURY 0x32
|
||||
|
||||
|
||||
|
@ -59,11 +62,8 @@ HalSetCMOS (BYTE Reg, BYTE Val)
|
|||
}
|
||||
|
||||
|
||||
VOID
|
||||
STDCALL
|
||||
HalQueryRealTimeClock (
|
||||
PTIME_FIELDS Time
|
||||
)
|
||||
VOID STDCALL
|
||||
HalQueryRealTimeClock(PTIME_FIELDS Time)
|
||||
{
|
||||
/* check 'Update In Progress' bit */
|
||||
while (HalQueryCMOS (RTC_REGISTER_A) & RTC_REG_A_UIP)
|
||||
|
@ -102,11 +102,8 @@ HalQueryRealTimeClock (
|
|||
}
|
||||
|
||||
|
||||
VOID
|
||||
STDCALL
|
||||
HalSetRealTimeClock (
|
||||
PTIME_FIELDS Time
|
||||
)
|
||||
VOID STDCALL
|
||||
HalSetRealTimeClock(PTIME_FIELDS Time)
|
||||
{
|
||||
/* check 'Update In Progress' bit */
|
||||
while (HalQueryCMOS (RTC_REGISTER_A) & RTC_REG_A_UIP)
|
||||
|
@ -125,3 +122,56 @@ HalSetRealTimeClock (
|
|||
HalSetCMOS (RTC_REGISTER_CENTURY, INT_BCD(Time->Year / 100));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
BOOLEAN STDCALL
|
||||
HalGetEnvironmentVariable(PCH Name,
|
||||
PCH Value,
|
||||
USHORT ValueLength)
|
||||
{
|
||||
if (_stricmp(Name, "LastKnownGood") != 0)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (HalQueryCMOS(RTC_REGISTER_B) & 0x01)
|
||||
{
|
||||
strncpy(Value, "FALSE", ValueLength);
|
||||
}
|
||||
else
|
||||
{
|
||||
strncpy(Value, "TRUE", ValueLength);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
BOOLEAN STDCALL
|
||||
HalSetEnvironmentVariable(PCH Name,
|
||||
PCH Value)
|
||||
{
|
||||
UCHAR Val;
|
||||
|
||||
if (_stricmp(Name, "LastKnownGood") != 0)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
Val = HalQueryCMOS(RTC_REGISTER_B);
|
||||
|
||||
if (_stricmp(Value, "TRUE") == 0)
|
||||
{
|
||||
HalSetCMOS(RTC_REGISTER_B, Val | 0x01);
|
||||
}
|
||||
else if (_stricmp(Value, "FALSE") == 0)
|
||||
{
|
||||
HalSetCMOS(RTC_REGISTER_B, Val & ~0x01);
|
||||
}
|
||||
else
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
; $Id: ntoskrnl.def,v 1.93 2001/01/13 18:38:08 dwelch Exp $
|
||||
; $Id: ntoskrnl.def,v 1.94 2001/01/14 15:36:32 ekohl Exp $
|
||||
;
|
||||
; reactos/ntoskrnl/ntoskrnl.def
|
||||
;
|
||||
|
@ -1018,8 +1018,9 @@ HalAllocateCommonBuffer@16
|
|||
;HalAllocateCrashDumpRegisters@8
|
||||
HalAssignSlotResources@32
|
||||
HalBeginSystemInterrupt@12
|
||||
;HalCalibratePerformanceCounter@4
|
||||
HalCalibratePerformanceCounter@4
|
||||
;@HalClearSoftwareInterrupt@4
|
||||
;HalClearSoftwareInterrupt@4
|
||||
HalDisableSystemInterrupt@8
|
||||
HalDisplayString@4
|
||||
HalEnableSystemInterrupt@12
|
||||
|
@ -1029,7 +1030,7 @@ HalFreeCommonBuffer@24
|
|||
HalGetAdapter@8
|
||||
HalGetBusData@20
|
||||
HalGetBusDataByOffset@24
|
||||
;HalGetEnvironmentVariable@12
|
||||
HalGetEnvironmentVariable@12
|
||||
HalGetInterruptVector@24
|
||||
HalHandleNMI@4
|
||||
HalInitSystem@8
|
||||
|
@ -1040,13 +1041,14 @@ HalQueryDisplayParameters@16
|
|||
HalQueryRealTimeClock@4
|
||||
HalReadDmaCounter@4
|
||||
HalReportResourceUsage@0
|
||||
;HalRequestIpi@4
|
||||
HalRequestIpi@4
|
||||
;@HalRequestSoftwareInterrupt@4
|
||||
;HalRequestSoftwareInterrupt@4
|
||||
HalReturnToFirmware@4
|
||||
HalSetBusData@20
|
||||
HalSetBusDataByOffset@24
|
||||
HalSetDisplayParameters@8
|
||||
;HalSetEnvironmentVariable@8
|
||||
HalSetEnvironmentVariable@8
|
||||
;HalSetProfileInterval@4
|
||||
HalSetRealTimeClock@4
|
||||
;HalSetTimeIncrement@4
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
; $Id: ntoskrnl.edf,v 1.80 2001/01/13 18:38:08 dwelch Exp $
|
||||
; $Id: ntoskrnl.edf,v 1.81 2001/01/14 15:36:32 ekohl Exp $
|
||||
;
|
||||
; reactos/ntoskrnl/ntoskrnl.def
|
||||
;
|
||||
|
@ -1016,7 +1016,7 @@ HalAllocateCommonBuffer=HalAllocateCommonBuffer@16
|
|||
;HalAllocateCrashDumpRegisters=HalAllocateCrashDumpRegisters@8
|
||||
HalAssignSlotResource=HalAssignSlotResources@32
|
||||
HalBeginSystemInterrupt=HalBeginSystemInterrupt@12
|
||||
;HalCalibratePerformanceCounter=HalCalibratePerformanceCounter@4
|
||||
HalCalibratePerformanceCounter=HalCalibratePerformanceCounter@4
|
||||
;HalClearSoftwareInterrupt=@HalClearSoftwareInterrupt@4
|
||||
;HalClearSoftwareInterrupt=HalClearSoftwareInterrupt@4
|
||||
HalDisableSystemInterrupt=HalDisableSystemInterrupt@8
|
||||
|
@ -1028,7 +1028,7 @@ HalFreeCommonBuffer=HalFreeCommonBuffer@24
|
|||
HalGetAdapter=HalGetAdapter@8
|
||||
HalGetBusData=HalGetBusData@20
|
||||
HalGetBusDataByOffset=HalGetBusDataByOffset@24
|
||||
;HalGetEnvironmentVariable=HalGetEnvironmentVariable@12
|
||||
HalGetEnvironmentVariable=HalGetEnvironmentVariable@12
|
||||
HalGetInterruptVector=HalGetInterruptVector@24
|
||||
HalHandleNMI=HalHandleNMI@4
|
||||
HalInitSystem=HalInitSystem@8
|
||||
|
@ -1039,14 +1039,14 @@ HalQueryDisplayParameters=HalQueryDisplayParameters@16
|
|||
HalQueryRealTimeClock=HalQueryRealTimeClock@4
|
||||
HalReadDmaCounter=HalReadDmaCounter@4
|
||||
HalReportResourceUsage=HalReportResourceUsage@0
|
||||
;HalRequestIpi=HalRequestIpi@4
|
||||
HalRequestIpi=HalRequestIpi@4
|
||||
;HalRequestSoftwareInterrupt=@HalRequestSoftwareInterrupt@4
|
||||
;HalRequestSoftwareInterrupt=HalRequestSoftwareInterrupt@4
|
||||
HalReturnToFirmware=HalReturnToFirmware@4
|
||||
HalSetBusData=HalSetBusData@20
|
||||
HalSetBusDataByOffset=HalSetBusDataByOffset@24
|
||||
HalSetDisplayParameters=HalSetDisplayParameters@8
|
||||
;HalSetEnvironmentVariable=HalSetEnvironmentVariable@8
|
||||
HalSetEnvironmentVariable=HalSetEnvironmentVariable@8
|
||||
;HalSetProfileInterval=HalSetProfileInterval@4
|
||||
HalSetRealTimeClock=HalSetRealTimeClock@4
|
||||
;HalSetTimeIncrement=HalSetTimeIncrement@4
|
||||
|
|
Loading…
Reference in a new issue