OpenCore  1.0.6
OpenCore Bootloader
Loading...
Searching...
No Matches
UserEvent.h File Reference
#include <Uefi.h>
#include <Library/BaseMemoryLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/UefiLib.h>
#include <Library/UefiApplicationEntryPoint.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/DebugLib.h>

Go to the source code of this file.

Macros

#define USER_EVENT_MAXNUM   (512)
 
#define USER_EVENT_MAXTPL   (32)
 

Functions

EFI_STATUS EFIAPI UserCreateEventEx (IN UINT32 Type, IN EFI_TPL NotifyTpl, IN EFI_EVENT_NOTIFY NotifyFunction OPTIONAL, IN CONST VOID *NotifyContext OPTIONAL, IN CONST EFI_GUID *EventGroup OPTIONAL, OUT EFI_EVENT *Event)
 
EFI_STATUS EFIAPI UserCreateEvent (IN UINT32 Type, IN EFI_TPL NotifyTpl, IN EFI_EVENT_NOTIFY NotifyFunction OPTIONAL, IN VOID *NotifyContext OPTIONAL, OUT EFI_EVENT *Event)
 
EFI_STATUS EFIAPI UserCloseEvent (IN EFI_EVENT Event)
 
EFI_STATUS EFIAPI UserSignalEvent (IN EFI_EVENT Event)
 
EFI_STATUS EFIAPI UserCheckEvent (IN EFI_EVENT Event)
 
EFI_STATUS EFIAPI UserWaitForEvent (IN UINTN NumberOfEvents, IN EFI_EVENT *Events, OUT UINTN *Index)
 
EFI_STATUS EFIAPI UserSetTimer (IN EFI_EVENT Event, IN EFI_TIMER_DELAY Type, IN UINT64 TriggerTime)
 
EFI_TPL EFIAPI UserRaiseTPL (IN EFI_TPL NewTpl)
 
VOID EFIAPI UserRestoreTPL (IN EFI_TPL OldTpl)
 
BOOLEAN UserEventDispatchNow (VOID)
 

Detailed Description

Copyright (c) 2025, Pavel Naberezhnev. All rights reserved. SPDX-License-Identifier: BSD-3-Clause

Definition in file UserEvent.h.

Macro Definition Documentation

◆ USER_EVENT_MAXNUM

#define USER_EVENT_MAXNUM   (512)

Definition at line 17 of file UserEvent.h.

◆ USER_EVENT_MAXTPL

#define USER_EVENT_MAXTPL   (32)

Definition at line 18 of file UserEvent.h.

Function Documentation

◆ UserCheckEvent()

EFI_STATUS EFIAPI UserCheckEvent ( IN EFI_EVENT Event)

Checks whether an event is in the signaled state.

Parameters
[in]EventThe event to check.
Return values
EFI_SUCCESSThe event is in the signaled state.
EFI_NOT_READYThe event is not in the signaled state.
EFI_INVALID_PARAMETEREvent is of type EVT_NOTIFY_SIGNAL.

Definition at line 425 of file UserEvent.c.

◆ UserCloseEvent()

EFI_STATUS EFIAPI UserCloseEvent ( IN EFI_EVENT Event)

Closes an event.

Parameters
[in]EventThe event to close.
Return values
EFI_SUCCESSThe event has been closed.

Definition at line 364 of file UserEvent.c.

◆ UserCreateEvent()

EFI_STATUS EFIAPI UserCreateEvent ( IN UINT32 Type,
IN EFI_TPL NotifyTpl,
IN EFI_EVENT_NOTIFY NotifyFunction OPTIONAL,
IN VOID *NotifyContext OPTIONAL,
OUT EFI_EVENT * Event )

Creates an event.

Parameters
[in]TypeThe type of event to create and its mode and attributes.
[in]NotifyTplThe task priority level of event notifications, if needed.
[in]NotifyFunctionPointer to the event's notification function, if any.
[in]NotifyContextPointer to the notification function's context; corresponds to parameter Context in the notification function.
[out]EventPointer to the newly created event if the call succeeds.
Return values
EFI_SUCCESSThe event structure was created.
EFI_INVALID_PARAMETEROne of the parameters has an invalid value.
EFI_INVALID_PARAMETEREvent is NULL.
EFI_INVALID_PARAMETERType has an unsupported bit set.
EFI_INVALID_PARAMETERType has both EVT_NOTIFY_SINGAL and EVT_NOTIFY_WAIT set.
EFI_INVALID_PARAMETERType has either EVT_NOTIFY_SIGNAL or EVT_NOTIFY_WAIT set and NotifyFunction is NULL.
EFI_INVALID_PARAMETERType has either EVT_NOTIFY_SIGNAL or EVT_NOTIFY_WAIT set and NotifyTpl is not a supported TPL level.
EFI_OUT_OF_RESOURCESThe event could not be allocated.

Definition at line 337 of file UserEvent.c.

◆ UserCreateEventEx()

EFI_STATUS EFIAPI UserCreateEventEx ( IN UINT32 Type,
IN EFI_TPL NotifyTpl,
IN EFI_EVENT_NOTIFY NotifyFunction OPTIONAL,
IN CONST VOID *NotifyContext OPTIONAL,
IN CONST EFI_GUID *EventGroup OPTIONAL,
OUT EFI_EVENT * Event )

Creates an event in a group.

Parameters
[in]TypeThe type of event to create and its mode and attributes.
[in]NotifyTplThe task priority level of event notifiactions, if needed.
[in]NotifyFunctionPointer to the event's notification function, if any.
[in]NotifyContextPointer to the notification function's context; corresponds to to parameter Context in the notificatuin function.
[in]EventGroupPointer to the unique identifier of the group to which this event belongs. Maybe NULL.
[out]EventPointer to the newly created event if the call succeeds.
Return values
EFI_SUCCESSThe event structure was created.
EFI_INVALID_PARAMETEROne of the parameters has an invalid value.
EFI_INVALID_PARAMETEREvent is NULL.
EFI_INVALID_PARAMETERType has an unsupported bit set.
EFI_INVALID_PARAMETERType has both EVT_NOTIFY_SIGNAL and EVT_NOTIFY_WAIT set.
EFI_INVALID_PARAMETERType has either EVT_NOTIFY_SIGNAL or EVT_NOTIFY_WAIT set and NotifyFunction is NULL.
EFI_INVALID_PARAMETERType has either EVT_NOTIFY_SIGNAL or EVT_NOTIFY_WAIT set and NotifyTpl is not a supported TPL level.
EFI_OUT_OF_RESOURCESThe event could not be allocated.

Definition at line 248 of file UserEvent.c.

◆ UserEventDispatchNow()

BOOLEAN UserEventDispatchNow ( VOID )

Immediately triggers event dispatch.

Returns
True if at least one event is detected in the signaled state, else false.

Definition at line 657 of file UserEvent.c.

◆ UserRaiseTPL()

EFI_TPL EFIAPI UserRaiseTPL ( IN EFI_TPL NewTpl)

Raises a task's priority level and returns its previous level.

Parameters
[in]NewTplThe new task priority level. It must be greather than or equal to the current TPL.
Returns
The previous TPL value.

Definition at line 611 of file UserEvent.c.

◆ UserRestoreTPL()

VOID EFIAPI UserRestoreTPL ( IN EFI_TPL OldTpl)

Restores a task's priority level to its previous value.

Parameters
[in]OldTplThe previous task priority level to restore.

Definition at line 636 of file UserEvent.c.

◆ UserSetTimer()

EFI_STATUS EFIAPI UserSetTimer ( IN EFI_EVENT Event,
IN EFI_TIMER_DELAY Type,
IN UINT64 TriggerTime )

Sets the type of timer and the trigger time for a timer event.

Parameters
[in]EventThe timer event that is to be signaled at the specified time.
[in]TypeThe type of time is specified in TriggerTime.
[in]TriggerTimeThe number if 100ns units untill the timer expires.
Return values
EFI_SUCCESSThe event has been set to be signaled at the requested time.
EFI_INVALID_PARAMETEREvent or Type is not valid.

Definition at line 556 of file UserEvent.c.

◆ UserSignalEvent()

EFI_STATUS EFIAPI UserSignalEvent ( IN EFI_EVENT Event)

Signals an event.

Parameters
[in]EventThe event to signal.
Return values
EFI_SUCCESSThe event was signaled.

Definition at line 392 of file UserEvent.c.

◆ UserWaitForEvent()

EFI_STATUS EFIAPI UserWaitForEvent ( IN UINTN NumberOfEvents,
IN EFI_EVENT * Events,
OUT UINTN * Index )

Stops execution untill an event is signaled.

Parameters
[in]NumberOfEventsThe number of events in the Events array.
[in]EventsAn array of EFI_EVENT.
[out]IndexPointer to the index of the event which satisfied the wait condition.
Return values
EFI_SUCCESSThe event indicated by Index was signaled.
EFI_INVALID_PARAMETERNumberOfEvents is 0.
EFI_INVALID_PARAMETERThe event indicated by Index is of type EVT_NOTIFY_SIGNAL.
EFI_UNSUPPORTEDThe current TPL is not TPL_APPLICATION.

Definition at line 481 of file UserEvent.c.