Author: ros-arm-bringup
Date: Sun Jun 15 02:54:18 2008
New Revision: 33981
URL:
http://svn.reactos.org/svn/reactos?rev=33981&view=rev
Log:
- Continue cleanup, use new peripheral headers (And fix them)
- Fix ARM HAL headers and use them
Modified:
trunk/reactos/hal/halarm/generic/hal.c
trunk/reactos/hal/halarm/include/hal.h
trunk/reactos/hal/halarm/include/halp.h
trunk/reactos/include/psdk/intrin_arm.h
trunk/reactos/include/reactos/arm/peripherals/pl190.h
trunk/reactos/include/reactos/arm/peripherals/sp804.h
Modified: trunk/reactos/hal/halarm/generic/hal.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halarm/generic/hal.c?r…
==============================================================================
--- trunk/reactos/hal/halarm/generic/hal.c [iso-8859-1] (original)
+++ trunk/reactos/hal/halarm/generic/hal.c [iso-8859-1] Sun Jun 15 02:54:18 2008
@@ -1,28 +1,14 @@
/*
- * COPYRIGHT: See COPYING in the top level directory
- * PROJECT: ReactOS kernel
- * FILE: hal/hal.c
- * PURPOSE: Hardware Abstraction Layer DLL
- * PROGRAMMER: Casper S. Hornstrup (chorns(a)users.sourceforge.net)
- * REVISION HISTORY:
- * 01-08-2001 CSH Created
- */
-
-/* INCLUDES ******************************************************************/
-
-#include <ntddk.h>
-#include <ntdddisk.h>
-#include <arc/arc.h>
-#include <intrin.h>
-#include <ndk/halfuncs.h>
-#include <ndk/iofuncs.h>
-#include <ndk/kdfuncs.h>
-#include <ndk/kefuncs.h>
-#include <ndk/rtlfuncs.h>
-#include <internal/arm/ke.h>
-#include <internal/arm/intrin_i.h>
-#include <bugcodes.h>
-
+ * PROJECT: ReactOS HAL
+ * LICENSE: GPL - See COPYING in the top level directory
+ * FILE: hal/halarm/generic/hal.c
+ * PURPOSE: Hardware Abstraction Layer
+ * PROGRAMMERS: ReactOS Portable Systems Group
+ */
+
+/* INCLUDES *******************************************************************/
+
+#include <hal.h>
#define NDEBUG
#include <debug.h>
@@ -41,380 +27,6 @@
/* DATA **********************************************************************/
ULONG _KdComPortInUse = 0;
-
-/* FUNCTIONS *****************************************************************/
-
-NTSTATUS
-NTAPI
-DriverEntry(
- PDRIVER_OBJECT DriverObject,
- PUNICODE_STRING RegistryPath)
-{
- UNIMPLEMENTED;
-
- return STATUS_SUCCESS;
-}
-
-/*
-* @unimplemented
-*/
-VOID
-NTAPI
-HalStopProfileInterrupt(IN KPROFILE_SOURCE ProfileSource)
-{
- KEBUGCHECK(0);
- return;
-}
-
-/*
-* @unimplemented
-*/
-VOID
-NTAPI
-HalStartProfileInterrupt(IN KPROFILE_SOURCE ProfileSource)
-{
- KEBUGCHECK(0);
- return;
-}
-
-/*
-* @unimplemented
-*/
-ULONG_PTR
-NTAPI
-HalSetProfileInterval(IN ULONG_PTR Interval)
-{
- KEBUGCHECK(0);
- return Interval;
-}
-
-VOID
-FASTCALL
-ExAcquireFastMutex(
- PFAST_MUTEX FastMutex)
-{
- UNIMPLEMENTED;
-}
-
-
-VOID
-FASTCALL
-ExReleaseFastMutex(
- PFAST_MUTEX FastMutex)
-{
- UNIMPLEMENTED;
-}
-
-
-BOOLEAN FASTCALL
-ExTryToAcquireFastMutex(
- PFAST_MUTEX FastMutex)
-{
- UNIMPLEMENTED;
-
- return TRUE;
-}
-
-
-VOID
-NTAPI
-HalAcquireDisplayOwnership(
- PHAL_RESET_DISPLAY_PARAMETERS ResetDisplayParameters)
-{
- UNIMPLEMENTED;
-}
-
-
-NTSTATUS
-NTAPI
-HalAdjustResourceList(
- PCM_RESOURCE_LIST Resources)
-{
- UNIMPLEMENTED;
-
- return STATUS_SUCCESS;
-}
-
-
-/*
- * @implemented
- */
-BOOLEAN
-NTAPI
-HalAllProcessorsStarted(VOID)
-{
- /* Do nothing */
- return TRUE;
-}
-
-
-NTSTATUS
-NTAPI
-HalAllocateAdapterChannel(
- PADAPTER_OBJECT AdapterObject,
- PWAIT_CONTEXT_BLOCK WaitContextBlock,
- ULONG NumberOfMapRegisters,
- PDRIVER_CONTROL ExecutionRoutine)
-{
- UNIMPLEMENTED;
-
- return STATUS_SUCCESS;
-}
-
-
-PVOID
-NTAPI
-HalAllocateCommonBuffer(
- PADAPTER_OBJECT AdapterObject,
- ULONG Length,
- PPHYSICAL_ADDRESS LogicalAddress,
- BOOLEAN CacheEnabled)
-{
- UNIMPLEMENTED;
-
- return NULL;
-}
-
-
-PVOID
-NTAPI
-HalAllocateCrashDumpRegisters(
- PADAPTER_OBJECT AdapterObject,
- PULONG NumberOfMapRegisters)
-{
- UNIMPLEMENTED;
- return NULL;
-}
-
-
-NTSTATUS
-NTAPI
-HalAssignSlotResources(
- PUNICODE_STRING RegistryPath,
- PUNICODE_STRING DriverClassName,
- PDRIVER_OBJECT DriverObject,
- PDEVICE_OBJECT DeviceObject,
- INTERFACE_TYPE BusType,
- ULONG BusNumber,
- ULONG SlotNumber,
- PCM_RESOURCE_LIST *AllocatedResources)
-{
- UNIMPLEMENTED;
-
- return TRUE;
-}
-
-
-BOOLEAN
-NTAPI
-HalBeginSystemInterrupt (KIRQL Irql,
- ULONG Vector,
- PKIRQL OldIrql)
-{
- UNIMPLEMENTED;
-
- return TRUE;
-}
-
-
-VOID
-NTAPI
-HalCalibratePerformanceCounter(
- volatile LONG *Count,
- ULONGLONG NewCount)
-{
- UNIMPLEMENTED;
-}
-
-
-BOOLEAN
-NTAPI
-HalDisableSystemInterrupt(
- ULONG Vector,
- KIRQL Irql)
-{
- UNIMPLEMENTED;
-
- return TRUE;
-}
-
-
-VOID
-NTAPI
-HalDisplayString(
- PCH String)
-{
- UNIMPLEMENTED;
-}
-
-
-BOOLEAN
-NTAPI
-HalEnableSystemInterrupt(
- ULONG Vector,
- KIRQL Irql,
- KINTERRUPT_MODE InterruptMode)
-{
- UNIMPLEMENTED;
-
- return TRUE;
-}
-
-
-VOID
-NTAPI
-HalEndSystemInterrupt(
- KIRQL Irql,
- ULONG Unknown2)
-{
- UNIMPLEMENTED;
-}
-
-
-BOOLEAN
-NTAPI
-HalFlushCommonBuffer(
- ULONG Unknown1,
- ULONG Unknown2,
- ULONG Unknown3,
- ULONG Unknown4,
- ULONG Unknown5)
-{
- UNIMPLEMENTED;
-
- return TRUE;
-}
-
-
-VOID
-NTAPI
-HalFreeCommonBuffer(
- PADAPTER_OBJECT AdapterObject,
- ULONG Length,
- PHYSICAL_ADDRESS LogicalAddress,
- PVOID VirtualAddress,
- BOOLEAN CacheEnabled)
-{
- UNIMPLEMENTED;
-}
-
-
-PADAPTER_OBJECT
-NTAPI
-HalGetAdapter(
- PDEVICE_DESCRIPTION DeviceDescription,
- PULONG NumberOfMapRegisters)
-{
- UNIMPLEMENTED;
-
- return (PADAPTER_OBJECT)NULL;
-}
-
-
-ULONG
-NTAPI
-HalGetBusData(
- BUS_DATA_TYPE BusDataType,
- ULONG BusNumber,
- ULONG SlotNumber,
- PVOID Buffer,
- ULONG Length)
-{
- UNIMPLEMENTED;
-
- return 0;
-}
-
-
-ULONG
-NTAPI
-HalGetBusDataByOffset(
- BUS_DATA_TYPE BusDataType,
- ULONG BusNumber,
- ULONG SlotNumber,
- PVOID Buffer,
- ULONG Offset,
- ULONG Length)
-{
- UNIMPLEMENTED;
-
- return 0;
-}
-
-
-ARC_STATUS
-NTAPI
-HalGetEnvironmentVariable(
- PCH Name,
- USHORT ValueLength,
- PCH Value)
-{
- UNIMPLEMENTED;
-
- return ENOENT;
-}
-
-
-ULONG
-NTAPI
-HalGetInterruptVector(
- INTERFACE_TYPE InterfaceType,
- ULONG BusNumber,
- ULONG BusInterruptLevel,
- ULONG BusInterruptVector,
- PKIRQL Irql,
- PKAFFINITY Affinity)
-{
- UNIMPLEMENTED;
-
- return 0;
-}
-
-
-VOID
-NTAPI
-HalHandleNMI(
- PVOID NmiData)
-{
- UNIMPLEMENTED;
-}
-
-VOID
-NTAPI
-HalpGetParameters(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
-{
- PCHAR CommandLine;
-
- /* Make sure we have a loader block and command line */
- if ((LoaderBlock) && (LoaderBlock->LoadOptions))
- {
- /* Read the command line */
- CommandLine = LoaderBlock->LoadOptions;
-
- /* Check for initial breakpoint */
- if (strstr(CommandLine, "BREAK")) DbgBreakPoint();
- }
-}
-
-//
-// INTs on the Versatile:
-//
-// 0 WATCHDOG -> We use it for profiling
-// 1 SOFTWARE INTERRUPT -> We use it for APC delivery
-// 2 COMM RX -> We use it for DPC delivery
-// 3 COMM TX -> We use it for IPI delivery
-// 4 TIMER0/1 -> Use for Clock Interrupt.
-// 5+ XXX -> Mapped to to actual device
-//
-// So we have the following IRQL masks:
-// PASSIVE_LEVEL - 0xFFFFFFFF (enable all interrupts)
-// APC_LEVEL - 0xFFFFFFFD (disable interrupt 1)
-// DISPATCH_LEVEL - 0xFFFFFFF9 (disable interrupts 1, 2)
-// DEVICE_LEVEL_0 - 0xFFFFFFD9 (disable interrupts 1, 2, 5)
-// DEVICE_LEVEL_N - 0x19 (everything disabled except 0, 3, 4)
-// PROFILE_LEVEL - 0x18 (everything disabled except, 3, 4)
-// CLOCK_LEVEL - 0x10 (everything disabled except 4)
-// POWER_LEVEL, IPI_LEVEL, HIGH_LEVEL - 0x00 (everything disabled)
ULONG HalpIrqlTable[HIGH_LEVEL + 1] =
{
@@ -454,11 +66,11 @@
UCHAR HalpMaskTable[HIGH_LEVEL + 1] =
{
- PROFILE_LEVEL,
- APC_LEVEL,
- DISPATCH_LEVEL,
- IPI_LEVEL,
- CLOCK2_LEVEL,
+ PROFILE_LEVEL, // INT 0 WATCHDOG
+ APC_LEVEL, // INT 1 SOFTWARE INTERRUPT
+ DISPATCH_LEVEL,// INT 2 COMM RX
+ IPI_LEVEL, // INT 3 COMM TX
+ CLOCK2_LEVEL, // INT 4 TIMER 0
3,
4,
5,
@@ -487,32 +99,359 @@
26
};
-#define VICINTSTATUS (PVOID)0xE0040000
-#define VICINTENABLE (PVOID)0xE0040010
-#define VICINTENCLEAR (PVOID)0xE0040014
-#define VICSOFTINT (PVOID)0xE0040018
-#define VICSOFTINTCLEAR (PVOID)0xE004001C
-
-#define TIMER_LOAD (PVOID)0xE00E2000
-#define TIMER_VALUE (PVOID)0xE00E2004
-#define TIMER_CONTROL (PVOID)0xE00E2008
-#define TIMER_INT_CLEAR (PVOID)0xE00E200C
-#define TIMER_INT_STATUS (PVOID)0xE00E2010
-#define TIMER_INT_MASK (PVOID)0xE00E2014
-#define TIMER_BACKGROUND_LOAD (PVOID)0xE00E2018
-
-#define TIMER2_LOAD (PVOID)0xE00E3000
-#define TIMER2_VALUE (PVOID)0xE00E3004
-#define TIMER2_CONTROL (PVOID)0xE00E3008
-#define TIMER2_INT_CLEAR (PVOID)0xE00E300C
-#define TIMER2_INT_STATUS (PVOID)0xE00E3010
-#define TIMER2_INT_MASK (PVOID)0xE00E3014
-#define TIMER2_BACKGROUND_LOAD (PVOID)0xE00E3018
-
-#define _clz(a) \
-({ ULONG __value, __arg = (a); \
- asm ("clz\t%0, %1": "=r" (__value): "r" (__arg));
\
- __value; })
+/* FUNCTIONS *****************************************************************/
+
+NTSTATUS
+NTAPI
+DriverEntry(
+ PDRIVER_OBJECT DriverObject,
+ PUNICODE_STRING RegistryPath)
+{
+ UNIMPLEMENTED;
+
+ return STATUS_SUCCESS;
+}
+
+/*
+* @unimplemented
+*/
+VOID
+NTAPI
+HalStopProfileInterrupt(IN KPROFILE_SOURCE ProfileSource)
+{
+ KEBUGCHECK(0);
+ return;
+}
+
+/*
+* @unimplemented
+*/
+VOID
+NTAPI
+HalStartProfileInterrupt(IN KPROFILE_SOURCE ProfileSource)
+{
+ KEBUGCHECK(0);
+ return;
+}
+
+/*
+* @unimplemented
+*/
+ULONG_PTR
+NTAPI
+HalSetProfileInterval(IN ULONG_PTR Interval)
+{
+ KEBUGCHECK(0);
+ return Interval;
+}
+
+VOID
+FASTCALL
+ExAcquireFastMutex(
+ PFAST_MUTEX FastMutex)
+{
+ UNIMPLEMENTED;
+}
+
+
+VOID
+FASTCALL
+ExReleaseFastMutex(
+ PFAST_MUTEX FastMutex)
+{
+ UNIMPLEMENTED;
+}
+
+
+BOOLEAN FASTCALL
+ExTryToAcquireFastMutex(
+ PFAST_MUTEX FastMutex)
+{
+ UNIMPLEMENTED;
+
+ return TRUE;
+}
+
+
+VOID
+NTAPI
+HalAcquireDisplayOwnership(
+ PHAL_RESET_DISPLAY_PARAMETERS ResetDisplayParameters)
+{
+ UNIMPLEMENTED;
+}
+
+
+NTSTATUS
+NTAPI
+HalAdjustResourceList(
+ PCM_RESOURCE_LIST Resources)
+{
+ UNIMPLEMENTED;
+
+ return STATUS_SUCCESS;
+}
+
+
+/*
+ * @implemented
+ */
+BOOLEAN
+NTAPI
+HalAllProcessorsStarted(VOID)
+{
+ /* Do nothing */
+ return TRUE;
+}
+
+
+NTSTATUS
+NTAPI
+HalAllocateAdapterChannel(
+ PADAPTER_OBJECT AdapterObject,
+ PWAIT_CONTEXT_BLOCK WaitContextBlock,
+ ULONG NumberOfMapRegisters,
+ PDRIVER_CONTROL ExecutionRoutine)
+{
+ UNIMPLEMENTED;
+
+ return STATUS_SUCCESS;
+}
+
+
+PVOID
+NTAPI
+HalAllocateCommonBuffer(
+ PADAPTER_OBJECT AdapterObject,
+ ULONG Length,
+ PPHYSICAL_ADDRESS LogicalAddress,
+ BOOLEAN CacheEnabled)
+{
+ UNIMPLEMENTED;
+
+ return NULL;
+}
+
+
+PVOID
+NTAPI
+HalAllocateCrashDumpRegisters(
+ PADAPTER_OBJECT AdapterObject,
+ PULONG NumberOfMapRegisters)
+{
+ UNIMPLEMENTED;
+ return NULL;
+}
+
+
+NTSTATUS
+NTAPI
+HalAssignSlotResources(
+ PUNICODE_STRING RegistryPath,
+ PUNICODE_STRING DriverClassName,
+ PDRIVER_OBJECT DriverObject,
+ PDEVICE_OBJECT DeviceObject,
+ INTERFACE_TYPE BusType,
+ ULONG BusNumber,
+ ULONG SlotNumber,
+ PCM_RESOURCE_LIST *AllocatedResources)
+{
+ UNIMPLEMENTED;
+
+ return TRUE;
+}
+
+
+BOOLEAN
+NTAPI
+HalBeginSystemInterrupt (KIRQL Irql,
+ ULONG Vector,
+ PKIRQL OldIrql)
+{
+ UNIMPLEMENTED;
+
+ return TRUE;
+}
+
+
+VOID
+NTAPI
+HalCalibratePerformanceCounter(
+ volatile LONG *Count,
+ ULONGLONG NewCount)
+{
+ UNIMPLEMENTED;
+}
+
+
+BOOLEAN
+NTAPI
+HalDisableSystemInterrupt(
+ ULONG Vector,
+ KIRQL Irql)
+{
+ UNIMPLEMENTED;
+
+ return TRUE;
+}
+
+
+VOID
+NTAPI
+HalDisplayString(
+ PCH String)
+{
+ UNIMPLEMENTED;
+}
+
+
+BOOLEAN
+NTAPI
+HalEnableSystemInterrupt(
+ ULONG Vector,
+ KIRQL Irql,
+ KINTERRUPT_MODE InterruptMode)
+{
+ UNIMPLEMENTED;
+
+ return TRUE;
+}
+
+
+VOID
+NTAPI
+HalEndSystemInterrupt(
+ KIRQL Irql,
+ ULONG Unknown2)
+{
+ UNIMPLEMENTED;
+}
+
+
+BOOLEAN
+NTAPI
+HalFlushCommonBuffer(
+ ULONG Unknown1,
+ ULONG Unknown2,
+ ULONG Unknown3,
+ ULONG Unknown4,
+ ULONG Unknown5)
+{
+ UNIMPLEMENTED;
+
+ return TRUE;
+}
+
+
+VOID
+NTAPI
+HalFreeCommonBuffer(
+ PADAPTER_OBJECT AdapterObject,
+ ULONG Length,
+ PHYSICAL_ADDRESS LogicalAddress,
+ PVOID VirtualAddress,
+ BOOLEAN CacheEnabled)
+{
+ UNIMPLEMENTED;
+}
+
+
+PADAPTER_OBJECT
+NTAPI
+HalGetAdapter(
+ PDEVICE_DESCRIPTION DeviceDescription,
+ PULONG NumberOfMapRegisters)
+{
+ UNIMPLEMENTED;
+
+ return (PADAPTER_OBJECT)NULL;
+}
+
+
+ULONG
+NTAPI
+HalGetBusData(
+ BUS_DATA_TYPE BusDataType,
+ ULONG BusNumber,
+ ULONG SlotNumber,
+ PVOID Buffer,
+ ULONG Length)
+{
+ UNIMPLEMENTED;
+
+ return 0;
+}
+
+
+ULONG
+NTAPI
+HalGetBusDataByOffset(
+ BUS_DATA_TYPE BusDataType,
+ ULONG BusNumber,
+ ULONG SlotNumber,
+ PVOID Buffer,
+ ULONG Offset,
+ ULONG Length)
+{
+ UNIMPLEMENTED;
+
+ return 0;
+}
+
+
+ARC_STATUS
+NTAPI
+HalGetEnvironmentVariable(
+ PCH Name,
+ USHORT ValueLength,
+ PCH Value)
+{
+ UNIMPLEMENTED;
+
+ return ENOENT;
+}
+
+
+ULONG
+NTAPI
+HalGetInterruptVector(
+ INTERFACE_TYPE InterfaceType,
+ ULONG BusNumber,
+ ULONG BusInterruptLevel,
+ ULONG BusInterruptVector,
+ PKIRQL Irql,
+ PKAFFINITY Affinity)
+{
+ UNIMPLEMENTED;
+
+ return 0;
+}
+
+
+VOID
+NTAPI
+HalHandleNMI(
+ PVOID NmiData)
+{
+ UNIMPLEMENTED;
+}
+
+VOID
+NTAPI
+HalpGetParameters(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
+{
+ PCHAR CommandLine;
+
+ /* Make sure we have a loader block and command line */
+ if ((LoaderBlock) && (LoaderBlock->LoadOptions))
+ {
+ /* Read the command line */
+ CommandLine = LoaderBlock->LoadOptions;
+
+ /* Check for initial breakpoint */
+ if (strstr(CommandLine, "BREAK")) DbgBreakPoint();
+ }
+}
ULONG
HalGetInterruptSource(VOID)
@@ -522,7 +461,7 @@
//
// Get the interrupt status, and return the highest bit set
//
- InterruptStatus = READ_REGISTER_ULONG(VICINTSTATUS);
+ InterruptStatus = READ_REGISTER_ULONG(VIC_INT_STATUS);
return 31 - _clz(InterruptStatus);
}
@@ -533,7 +472,7 @@
// Clear the interrupt
//
//DPRINT1("CLOCK INTERRUPT!!!\n");
- WRITE_REGISTER_ULONG(TIMER_INT_CLEAR, 1);
+ WRITE_REGISTER_ULONG(TIMER0_INT_CLEAR, 1);
//while (TRUE);
}
@@ -543,7 +482,7 @@
//
// Clear the interrupt
//
- WRITE_REGISTER_ULONG(TIMER_INT_CLEAR, 1);
+ WRITE_REGISTER_ULONG(TIMER0_INT_CLEAR, 1);
}
VOID
@@ -551,18 +490,18 @@
{
PKPCR Pcr = (PKPCR)KeGetPcr();
ULONG ClockInterval;
+ SP804_CONTROL_REGISTER ControlRegister;
//
// Fill out the IRQL mappings
//
RtlCopyMemory(Pcr->IrqlTable, HalpIrqlTable, sizeof(Pcr->IrqlTable));
RtlCopyMemory(Pcr->IrqlMask, HalpMaskTable, sizeof(Pcr->IrqlMask));
-
+
//
// Setup the clock and profile interrupt
//
Pcr->InterruptRoutine[CLOCK2_LEVEL] = HalpStallInterrupt;
- // Pcr->InterruptRoutine[PROFILE_LEVEL] = HalpCountInterrupt;
//
// Configure the interval to 10ms
@@ -571,18 +510,21 @@
// (TIMCLKENXdiv (1) * PRESCALEdiv (1))
//
ClockInterval = 0x2710;
-
+
+ //
+ // Configure the timer
+ //
+ ControlRegister.AsUlong = 0;
+ ControlRegister.Wide = TRUE;
+ ControlRegister.Periodic = TRUE;
+ ControlRegister.Interrupt = TRUE;
+ ControlRegister.Enabled = TRUE;
+
//
// Enable the timer
//
- WRITE_REGISTER_ULONG(TIMER_LOAD, ClockInterval);
- WRITE_REGISTER_ULONG(TIMER_CONTROL,
- 0 << 0 | // wrapping mode
- 1 << 1 | // 32-bit mode
- 0 << 2 | // 0 stages of prescale, divided by 1
- 1 << 5 | // enable interrupt
- 1 << 6 | // periodic mode
- 1 << 7); // enable it
+ WRITE_REGISTER_ULONG(TIMER0_LOAD, ClockInterval);
+ WRITE_REGISTER_ULONG(TIMER0_CONTROL, ControlRegister.AsUlong);
}
ULONG HalpCurrentTimeIncrement, HalpNextTimeIncrement, HalpNextIntervalCount;
@@ -805,7 +747,7 @@
// Force a software interrupt
//
DPRINT1("[SOFTINT]: %d\n", Request);
- WRITE_REGISTER_ULONG(VICSOFTINT, 1 << Request);
+ WRITE_REGISTER_ULONG(VIC_SOFT_INT, 1 << Request);
}
VOID
@@ -816,7 +758,7 @@
// Force a software interrupt
//
DPRINT1("[SOFTINTC] %d\n", Request);
- WRITE_REGISTER_ULONG(VICSOFTINTCLEAR, 1 << Request);
+ WRITE_REGISTER_ULONG(VIC_SOFT_INT_CLEAR, 1 << Request);
}
VOID
@@ -1081,31 +1023,27 @@
NTAPI
KeStallExecutionProcessor(IN ULONG Microseconds)
{
- //
- // Configure the interval to xxx Micrseconds
- // (INTERVAL (xxx us) * TIMCLKfreq (1MHz))
- // ---------------------------------------
- // (TIMCLKENXdiv (1) * PRESCALEdiv (1))
- //
- // This works out great, since 1MHz * 1 us = 1!
- //
+ SP804_CONTROL_REGISTER ControlRegister;
//
// Enable the timer
//
- WRITE_REGISTER_ULONG(TIMER2_LOAD, Microseconds);
- WRITE_REGISTER_ULONG(TIMER2_CONTROL,
- 1 << 0 | // one-shot mode
- 1 << 1 | // 32-bit mode
- 0 << 2 | // 0 stages of prescale, divided by 1
- 0 << 5 | // no interrupt
- 1 << 6 | // periodic mode
- 1 << 7); // enable it
+ WRITE_REGISTER_ULONG(TIMER1_LOAD, Microseconds);
+
+ //
+ // Configure the timer
+ //
+ ControlRegister.AsUlong = 0;
+ ControlRegister.OneShot = TRUE;
+ ControlRegister.Wide = TRUE;
+ ControlRegister.Periodic = TRUE;
+ ControlRegister.Enabled = TRUE;
+ WRITE_REGISTER_ULONG(TIMER1_CONTROL, ControlRegister.AsUlong);
//
// Now we will loop until the timer reached 0
//
- while (READ_REGISTER_ULONG(TIMER2_VALUE));
+ while (READ_REGISTER_ULONG(TIMER1_VALUE));
}
VOID
@@ -1137,13 +1075,13 @@
//
// Clear interrupts associated to the old IRQL
//
- WRITE_REGISTER_ULONG(VICINTENCLEAR, 0xFFFFFFFF);
+ WRITE_REGISTER_ULONG(VIC_INT_CLEAR, 0xFFFFFFFF);
//
// Set the new interrupt mask
// PL190 VIC support only for now
//
- WRITE_REGISTER_ULONG(VICINTENABLE, InterruptMask);
+ WRITE_REGISTER_ULONG(VIC_INT_ENABLE, InterruptMask);
//
// Save the new IRQL
@@ -1183,13 +1121,13 @@
//
// Clear interrupts associated to the old IRQL
//
- WRITE_REGISTER_ULONG(VICINTENCLEAR, 0xFFFFFFFF);
+ WRITE_REGISTER_ULONG(VIC_INT_CLEAR, 0xFFFFFFFF);
//
// Set the new interrupt mask
// PL190 VIC support only for now
//
- WRITE_REGISTER_ULONG(VICINTENABLE, InterruptMask);
+ WRITE_REGISTER_ULONG(VIC_INT_ENABLE, InterruptMask);
//
// Save the new IRQL
Modified: trunk/reactos/hal/halarm/include/hal.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halarm/include/hal.h?r…
==============================================================================
--- trunk/reactos/hal/halarm/include/hal.h [iso-8859-1] (original)
+++ trunk/reactos/hal/halarm/include/hal.h [iso-8859-1] Sun Jun 15 02:54:18 2008
@@ -1,9 +1,9 @@
/*
- * COPYRIGHT: See COPYING in the top level directory
- * PROJECT: ReactOS Hardware Abstraction Layer
- * FILE: hal/halx86/include/hal.h
- * PURPOSE: HAL Header
- * PROGRAMMER: Alex Ionescu (alex(a)relsoft.net)
+ * PROJECT: ReactOS HAL
+ * LICENSE: GPL - See COPYING in the top level directory
+ * FILE: hal/halarm/include/hal.h
+ * PURPOSE: Hardware Abstraction Layer Header
+ * PROGRAMMERS: ReactOS Portable Systems Group
*/
/* INCLUDES ******************************************************************/
Modified: trunk/reactos/hal/halarm/include/halp.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halarm/include/halp.h?…
==============================================================================
--- trunk/reactos/hal/halarm/include/halp.h [iso-8859-1] (original)
+++ trunk/reactos/hal/halarm/include/halp.h [iso-8859-1] Sun Jun 15 02:54:18 2008
@@ -1,114 +1,22 @@
-/*
- *
- */
-
#ifndef __INTERNAL_HAL_HAL_H
#define __INTERNAL_HAL_HAL_H
-/* WDK Hack */
+//
+// ARM Headers
+//
+#include <internal/arm/ke.h>
+#include <internal/arm/intrin_i.h>
+
+//
+// Versatile Peripherals
+//
+#include <peripherals/pl011.h>
+#include <peripherals/pl190.h>
+#include <peripherals/sp804.h>
+
+//
+// WDK Hack
+//
#define KdComPortInUse _KdComPortInUse
-#define HAL_APC_REQUEST 0
-#define HAL_DPC_REQUEST 1
-
-/* Conversion functions */
-#define BCD_INT(bcd) \
- (((bcd & 0xF0) >> 4) * 10 + (bcd & 0x0F))
-#define INT_BCD(int) \
- (UCHAR)(((int / 10) << 4) + (int % 10))
-
-/* adapter.c */
-PADAPTER_OBJECT STDCALL HalpAllocateAdapterEx(ULONG NumberOfMapRegisters,BOOLEAN
IsMaster, BOOLEAN Dma32BitAddresses);
-
-/* bus.c */
-VOID NTAPI HalpInitNonBusHandler (VOID);
-
-/* irql.c */
-VOID NTAPI HalpInitPICs(VOID);
-
-/* udelay.c */
-VOID NTAPI HalpInitializeClock(VOID);
-
-/* pci.c */
-VOID HalpInitPciBus (VOID);
-
-/* dma.c */
-VOID HalpInitDma (VOID);
-
-/* Non-generic initialization */
-VOID HalpInitPhase0 (PLOADER_PARAMETER_BLOCK LoaderBlock);
-VOID HalpInitPhase1(VOID);
-VOID NTAPI HalpClockInterrupt(VOID);
-
-//
-// KD Support
-//
-VOID
-NTAPI
-HalpCheckPowerButton(
- VOID
-);
-
-VOID
-NTAPI
-HalpRegisterKdSupportFunctions(
- VOID
-);
-
-NTSTATUS
-NTAPI
-HalpSetupPciDeviceForDebugging(
- IN PVOID LoaderBlock,
- IN OUT PDEBUG_DEVICE_DESCRIPTOR PciDevice
-);
-
-NTSTATUS
-NTAPI
-HalpReleasePciDeviceForDebugging(
- IN OUT PDEBUG_DEVICE_DESCRIPTOR PciDevice
-);
-
-//
-// Memory routines
-//
-PVOID
-NTAPI
-HalpMapPhysicalMemory64(
- IN PHYSICAL_ADDRESS PhysicalAddress,
- IN ULONG NumberPage
-);
-
-VOID
-NTAPI
-HalpUnmapVirtualAddress(
- IN PVOID VirtualAddress,
- IN ULONG NumberPages
-);
-
-/* sysinfo.c */
-NTSTATUS
-NTAPI
-HaliQuerySystemInformation(
- IN HAL_QUERY_INFORMATION_CLASS InformationClass,
- IN ULONG BufferSize,
- IN OUT PVOID Buffer,
- OUT PULONG ReturnedLength
-);
-
-NTSTATUS
-NTAPI
-HaliSetSystemInformation(
- IN HAL_SET_INFORMATION_CLASS InformationClass,
- IN ULONG BufferSize,
- IN OUT PVOID Buffer
-);
-
-typedef struct tagHALP_HOOKS
-{
- void (*InitPciBus)(ULONG BusNumber, PBUS_HANDLER BusHandler);
-} HALP_HOOKS, *PHALP_HOOKS;
-
-extern HALP_HOOKS HalpHooks;
-extern KSPIN_LOCK HalpSystemHardwareLock;
-
#endif /* __INTERNAL_HAL_HAL_H */
Modified: trunk/reactos/include/psdk/intrin_arm.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/intrin_arm.h?…
==============================================================================
--- trunk/reactos/include/psdk/intrin_arm.h [iso-8859-1] (original)
+++ trunk/reactos/include/psdk/intrin_arm.h [iso-8859-1] Sun Jun 15 02:54:18 2008
@@ -289,6 +289,10 @@
}
#endif
+#define _clz(a) \
+({ ULONG __value, __arg = (a); \
+asm ("clz\t%0, %1": "=r" (__value): "r" (__arg)); \
+__value; })
#endif
/* EOF */
Modified: trunk/reactos/include/reactos/arm/peripherals/pl190.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/arm/periph…
==============================================================================
--- trunk/reactos/include/reactos/arm/peripherals/pl190.h [iso-8859-1] (original)
+++ trunk/reactos/include/reactos/arm/peripherals/pl190.h [iso-8859-1] Sun Jun 15 02:54:18
2008
@@ -16,5 +16,5 @@
#define VIC_INT_STATUS (VIC_BASE + 0x00)
#define VIC_INT_ENABLE (VIC_BASE + 0x10)
#define VIC_INT_CLEAR (VIC_BASE + 0x14)
-#define VIC_SOFT_INT (VIC_BASE + 0x18
+#define VIC_SOFT_INT (VIC_BASE + 0x18)
#define VIC_SOFT_INT_CLEAR (VIC_BASE + 0x1C)
Modified: trunk/reactos/include/reactos/arm/peripherals/sp804.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/arm/periph…
==============================================================================
--- trunk/reactos/include/reactos/arm/peripherals/sp804.h [iso-8859-1] (original)
+++ trunk/reactos/include/reactos/arm/peripherals/sp804.h [iso-8859-1] Sun Jun 15 02:54:18
2008
@@ -12,20 +12,20 @@
// Timer Registers
//
#define TIMER_BASE(x) (PVOID)(0xE00E2000 + (x * 0x1000)) /* HACK: freeldr
mapped it here */
-#define TIMER0_LOAD TIMER_BASE(0, 0x00)
-#define TIMER0_VALUE TIMER_BASE(0, 0x04)
-#define TIMER0_CONTROL TIMER_BASE(0, 0x08)
-#define TIMER0_INT_CLEAR TIMER_BASE(0, 0x0C)
-#define TIMER0_INT_STATUS TIMER_BASE(0, 0x10)
-#define TIMER0_INT_MASK TIMER_BASE(0, 0x14)
-#define TIMER0_BACKGROUND_LOAD TIMER_BASE(0, 0x18)
-#define TIMER1_LOAD TIMER_BASE(1, 0x00)
-#define TIMER1_VALUE TIMER_BASE(1, 0x04)
-#define TIMER1_CONTROL TIMER_BASE(1, 0x08)
-#define TIMER1_INT_CLEAR TIMER_BASE(1, 0x0C)
-#define TIMER1_INT_STATUS TIMER_BASE(1, 0x10)
-#define TIMER1_INT_MASK TIMER_BASE(1, 0x14)
-#define TIMER1_BACKGROUND_LOAD TIMER_BASE(1, 0x18)
+#define TIMER0_LOAD TIMER_BASE(0) + 0x00
+#define TIMER0_VALUE TIMER_BASE(0) + 0x04
+#define TIMER0_CONTROL TIMER_BASE(0) + 0x08
+#define TIMER0_INT_CLEAR TIMER_BASE(0) + 0x0C
+#define TIMER0_INT_STATUS TIMER_BASE(0) + 0x10
+#define TIMER0_INT_MASK TIMER_BASE(0) + 0x14
+#define TIMER0_BACKGROUND_LOAD TIMER_BASE(1) + 0x18
+#define TIMER1_LOAD TIMER_BASE(1) + 0x00
+#define TIMER1_VALUE TIMER_BASE(1) + 0x04
+#define TIMER1_CONTROL TIMER_BASE(1) + 0x08
+#define TIMER1_INT_CLEAR TIMER_BASE(1) + 0x0C
+#define TIMER1_INT_STATUS TIMER_BASE(1) + 0x10
+#define TIMER1_INT_MASK TIMER_BASE(1) + 0x14
+#define TIMER1_BACKGROUND_LOAD TIMER_BASE(1) + 0x18
//
// Control Register
@@ -34,13 +34,14 @@
{
struct
{
- ULONG Wrap:1;
+ ULONG OneShot:1;
ULONG Wide:1;
ULONG Prescale:2;
ULONG Reserved:1;
ULONG Interrupt:1;
ULONG Periodic:1;
ULONG Enabled:1;
+ ULONG Unused:24;
};
ULONG AsUlong;
} SP804_CONTROL_REGISTER, *PSP804_CONTROL_REGISTER;