summaryrefslogtreecommitdiff
path: root/Nt32Pkg/MetronomeDxe
diff options
context:
space:
mode:
authorqwang12 <qwang12@6f19259b-4bc3-4df7-8a09-765794883524>2007-07-03 02:34:30 +0000
committerqwang12 <qwang12@6f19259b-4bc3-4df7-8a09-765794883524>2007-07-03 02:34:30 +0000
commit1897b70ba80e0118f09fa97c3d57e4a0acc79c4e (patch)
treea01c5162e13d72605fc87c615a3906821ffcdb2e /Nt32Pkg/MetronomeDxe
parentca34da0766fcf2e0be1250a556f4b41968b0539d (diff)
Change MonotonicCounterRuntimeDxe to MetronomeDxe. This is a typo ininitally. MonotonicCounterRuntimeDxe should be in MdeModulePkg.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2974 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'Nt32Pkg/MetronomeDxe')
-rw-r--r--Nt32Pkg/MetronomeDxe/CommonHeader.h37
-rw-r--r--Nt32Pkg/MetronomeDxe/Metronome.c134
-rw-r--r--Nt32Pkg/MetronomeDxe/Metronome.h89
-rw-r--r--Nt32Pkg/MetronomeDxe/Metronome.inf88
-rw-r--r--Nt32Pkg/MetronomeDxe/Metronome.msa62
5 files changed, 410 insertions, 0 deletions
diff --git a/Nt32Pkg/MetronomeDxe/CommonHeader.h b/Nt32Pkg/MetronomeDxe/CommonHeader.h
new file mode 100644
index 000000000..7eb12c16a
--- /dev/null
+++ b/Nt32Pkg/MetronomeDxe/CommonHeader.h
@@ -0,0 +1,37 @@
+/**@file
+ Common header file shared by all source files.
+
+ This file includes package header files, library classes and protocol, PPI & GUID definitions.
+
+ Copyright (c) 2006 - 2007, Intel Corporation
+ All rights reserved. This program and the accompanying materials
+ are licensed and made available under the terms and conditions of the BSD License
+ which accompanies this distribution. The full text of the license may be found at
+ http://opensource.org/licenses/bsd-license.php
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+**/
+
+#ifndef __COMMON_HEADER_H_
+#define __COMMON_HEADER_H_
+
+
+//
+// The package level header files this module uses
+//
+#include <PiDxe.h>
+#include <WinNtDxe.h>
+//
+// The protocols, PPI and GUID defintions for this module
+//
+#include <Protocol/Metronome.h>
+//
+// The Library classes this module consumes
+//
+#include <Library/BaseLib.h>
+#include <Library/DebugLib.h>
+#include <Library/UefiDriverEntryPoint.h>
+#include <Library/WinNtLib.h>
+#include <Library/UefiBootServicesTableLib.h>
+
+#endif
diff --git a/Nt32Pkg/MetronomeDxe/Metronome.c b/Nt32Pkg/MetronomeDxe/Metronome.c
new file mode 100644
index 000000000..b02741b45
--- /dev/null
+++ b/Nt32Pkg/MetronomeDxe/Metronome.c
@@ -0,0 +1,134 @@
+/*++
+
+Copyright (c) 2006, Intel Corporation
+All rights reserved. This program and the accompanying materials
+are licensed and made available under the terms and conditions of the BSD License
+which accompanies this distribution. The full text of the license may be found at
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+Module Name:
+
+ Metronome.c
+
+Abstract:
+
+ NT Emulation Metronome Architectural Protocol Driver as defined in DXE CIS
+
+--*/
+
+//
+// Include common header file for this module.
+//
+#include "CommonHeader.h"
+
+#include "Metronome.h"
+
+//
+// Global Variables
+//
+EFI_METRONOME_ARCH_PROTOCOL mMetronome = {
+ WinNtMetronomeDriverWaitForTick,
+ TICK_PERIOD
+};
+
+//
+// Worker Functions
+//
+
+EFI_STATUS
+EFIAPI
+WinNtMetronomeDriverWaitForTick (
+ IN EFI_METRONOME_ARCH_PROTOCOL *This,
+ IN UINT32 TickNumber
+ )
+/*++
+
+Routine Description:
+
+ The WaitForTick() function waits for the number of ticks specified by
+ TickNumber from a known time source in the platform. If TickNumber of
+ ticks are detected, then EFI_SUCCESS is returned. The actual time passed
+ between entry of this function and the first tick is between 0 and
+ TickPeriod 100 nS units. If you want to guarantee that at least TickPeriod
+ time has elapsed, wait for two ticks. This function waits for a hardware
+ event to determine when a tick occurs. It is possible for interrupt
+ processing, or exception processing to interrupt the execution of the
+ WaitForTick() function. Depending on the hardware source for the ticks, it
+ is possible for a tick to be missed. This function cannot guarantee that
+ ticks will not be missed. If a timeout occurs waiting for the specified
+ number of ticks, then EFI_TIMEOUT is returned.
+
+Arguments:
+
+ This - The EFI_METRONOME_ARCH_PROTOCOL instance.
+ TickNumber - Number of ticks to wait.
+
+Returns:
+
+ EFI_SUCCESS - The wait for the number of ticks specified by TickNumber
+ succeeded.
+
+--*/
+{
+ UINT64 SleepTime;
+
+ //
+ // Calculate the time to sleep. Win API smallest unit to sleep is 1 millisec
+ // Tick Period is in 100ns units, divide by 10000 to convert to ms
+ //
+ SleepTime = DivU64x32 (MultU64x32 ((UINT64) TickNumber, TICK_PERIOD) + 9999, 10000);
+ gWinNt->Sleep ((UINT32) SleepTime);
+
+ return EFI_SUCCESS;
+}
+
+
+EFI_STATUS
+EFIAPI
+WinNtMetronomeDriverInitialize (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+/*++
+
+Routine Description:
+
+ Initialize the Metronome Architectural Protocol driver
+
+Arguments:
+
+ ImageHandle - ImageHandle of the loaded driver
+
+
+ SystemTable - Pointer to the System Table
+
+Returns:
+
+ EFI_SUCCESS - Metronome Architectural Protocol created
+
+ EFI_OUT_OF_RESOURCES - Not enough resources available to initialize driver.
+
+ EFI_DEVICE_ERROR - A device error occured attempting to initialize the driver.
+
+--*/
+{
+ EFI_STATUS Status;
+ EFI_HANDLE Handle;
+
+
+ //
+ // Install the Metronome Architectural Protocol onto a new handle
+ //
+ Handle = NULL;
+ Status = gBS->InstallProtocolInterface (
+ &Handle,
+ &gEfiMetronomeArchProtocolGuid,
+ EFI_NATIVE_INTERFACE,
+ &mMetronome
+ );
+
+ return Status;
+}
diff --git a/Nt32Pkg/MetronomeDxe/Metronome.h b/Nt32Pkg/MetronomeDxe/Metronome.h
new file mode 100644
index 000000000..b2b40eead
--- /dev/null
+++ b/Nt32Pkg/MetronomeDxe/Metronome.h
@@ -0,0 +1,89 @@
+/*++
+
+Copyright (c) 2006, Intel Corporation
+All rights reserved. This program and the accompanying materials
+are licensed and made available under the terms and conditions of the BSD License
+which accompanies this distribution. The full text of the license may be found at
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+Module Name:
+
+ Metronome.h
+
+Abstract:
+
+ NT Emulation Metronome Architectural Protocol Driver as defined in DXE CIS
+
+--*/
+
+#ifndef _NT_THUNK_METRONOME_H_
+#define _NT_THUNK_METRONOME_H_
+
+
+
+//
+// Include common header file for this module.
+//
+#include "CommonHeader.h"
+
+//
+// Period of on tick in 100 nanosecond units
+//
+#define TICK_PERIOD 2000
+
+//
+// Function Prototypes
+//
+
+EFI_STATUS
+EFIAPI
+WinNtMetronomeDriverInitialize (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+/*++
+
+Routine Description:
+
+ TODO: Add function description
+
+Arguments:
+
+ ImageHandle - TODO: add argument description
+ SystemTable - TODO: add argument description
+
+Returns:
+
+ TODO: add return values
+
+--*/
+;
+
+EFI_STATUS
+EFIAPI
+WinNtMetronomeDriverWaitForTick (
+ IN EFI_METRONOME_ARCH_PROTOCOL *This,
+ IN UINT32 TickNumber
+ )
+/*++
+
+Routine Description:
+
+ TODO: Add function description
+
+Arguments:
+
+ This - TODO: add argument description
+ TickNumber - TODO: add argument description
+
+Returns:
+
+ TODO: add return values
+
+--*/
+;
+
+#endif
diff --git a/Nt32Pkg/MetronomeDxe/Metronome.inf b/Nt32Pkg/MetronomeDxe/Metronome.inf
new file mode 100644
index 000000000..15aec0ea1
--- /dev/null
+++ b/Nt32Pkg/MetronomeDxe/Metronome.inf
@@ -0,0 +1,88 @@
+#/** @file
+# NT Emulation Metronome Architectural Protocol Driver as defined in DXE CIS
+#
+# This metronome module simulates metronome by Sleep WinAPI.
+# Copyright (c) 2006 - 2007, Intel Corporation
+#
+# All rights reserved. This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD License
+# which accompanies this distribution. The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+#
+#**/
+
+################################################################################
+#
+# Defines Section - statements that will be processed to create a Makefile.
+#
+################################################################################
+[Defines]
+ INF_VERSION = 0x00010005
+ BASE_NAME = Metronome
+ FILE_GUID = 154CAB4A-52B5-46CD-99C3-4368ABBACFFD
+ MODULE_TYPE = DXE_DRIVER
+ VERSION_STRING = 1.0
+ EDK_RELEASE_VERSION = 0x00020000
+ EFI_SPECIFICATION_VERSION = 0x00020000
+
+ ENTRY_POINT = WinNtMetronomeDriverInitialize
+
+#
+# The following information is for reference only and not required by the build tools.
+#
+# VALID_ARCHITECTURES = IA32
+#
+
+################################################################################
+#
+# Sources Section - list of files that are required for the build to succeed.
+#
+################################################################################
+
+[Sources.common]
+ Metronome.h
+ Metronome.c
+ CommonHeader.h
+
+
+################################################################################
+#
+# Package Dependency Section - list of Package files that are required for
+# this module.
+#
+################################################################################
+
+[Packages]
+ MdePkg/MdePkg.dec
+
+
+################################################################################
+#
+# Library Class Section - list of Library Classes that are required for
+# this module.
+#
+################################################################################
+
+[LibraryClasses]
+ UefiBootServicesTableLib
+ WinNtLib
+ UefiDriverEntryPoint
+ DebugLib
+ BaseLib
+
+
+################################################################################
+#
+# Protocol C Name Section - list of Protocol and Protocol Notify C Names
+# that this module uses or produces.
+#
+################################################################################
+
+[Protocols]
+ gEfiMetronomeArchProtocolGuid # PROTOCOL ALWAYS_PRODUCED
+
+[depex]
+ TRUE \ No newline at end of file
diff --git a/Nt32Pkg/MetronomeDxe/Metronome.msa b/Nt32Pkg/MetronomeDxe/Metronome.msa
new file mode 100644
index 000000000..e4dc0b144
--- /dev/null
+++ b/Nt32Pkg/MetronomeDxe/Metronome.msa
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <MsaHeader>
+ <ModuleName>Metronome</ModuleName>
+ <ModuleType>DXE_DRIVER</ModuleType>
+ <GuidValue>154CAB4A-52B5-46CD-99C3-4368ABBACFFD</GuidValue>
+ <Version>1.0</Version>
+ <Abstract>NT Emulation Metronome Architectural Protocol Driver as defined in DXE CIS</Abstract>
+ <Description>This metronome module simulates metronome by Sleep WinAPI.</Description>
+ <Copyright>Copyright (c) 2006 - 2007, Intel Corporation</Copyright>
+ <License>All rights reserved. This program and the accompanying materials
+ are licensed and made available under the terms and conditions of the BSD License
+ which accompanies this distribution. The full text of the license may be found at
+ http://opensource.org/licenses/bsd-license.php
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
+ <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
+ </MsaHeader>
+ <ModuleDefinitions>
+ <SupportedArchitectures>IA32</SupportedArchitectures>
+ <BinaryModule>false</BinaryModule>
+ <OutputFileBasename>Metronome</OutputFileBasename>
+ </ModuleDefinitions>
+ <LibraryClassDefinitions>
+ <LibraryClass Usage="ALWAYS_CONSUMED">
+ <Keyword>BaseLib</Keyword>
+ </LibraryClass>
+ <LibraryClass Usage="ALWAYS_CONSUMED">
+ <Keyword>DebugLib</Keyword>
+ </LibraryClass>
+ <LibraryClass Usage="ALWAYS_CONSUMED">
+ <Keyword>UefiDriverEntryPoint</Keyword>
+ </LibraryClass>
+ <LibraryClass Usage="ALWAYS_CONSUMED">
+ <Keyword>WinNtLib</Keyword>
+ </LibraryClass>
+ <LibraryClass Usage="ALWAYS_CONSUMED">
+ <Keyword>UefiBootServicesTableLib</Keyword>
+ </LibraryClass>
+ </LibraryClassDefinitions>
+ <SourceFiles>
+ <Filename>Metronome.c</Filename>
+ <Filename>Metronome.h</Filename>
+ <Filename>Metronome.dxs</Filename>
+ </SourceFiles>
+ <PackageDependencies>
+ <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
+ <Package PackageGuid="0fb2aa2d-10d5-40a5-a9dc-060c12a4a3f3"/>
+ </PackageDependencies>
+ <Protocols>
+ <Protocol Usage="ALWAYS_PRODUCED">
+ <ProtocolCName>gEfiMetronomeArchProtocolGuid</ProtocolCName>
+ </Protocol>
+ </Protocols>
+ <Externs>
+ <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
+ <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
+ <Extern>
+ <ModuleEntryPoint>WinNtMetronomeDriverInitialize</ModuleEntryPoint>
+ </Extern>
+ </Externs>
+</ModuleSurfaceArea> \ No newline at end of file