]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.h
MdeModulePkg: Apply uncrustify changes
[mirror_edk2.git] / MdeModulePkg / Universal / WatchdogTimerDxe / WatchdogTimer.h
1 /** @file
2 The internal include file for WatchDogTimer module.
3
4 Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
6
7 **/
8
9 #ifndef _WATCHDOG_TIMER_H_
10 #define _WATCHDOG_TIMER_H_
11
12 #include <Uefi.h>
13 #include <Library/DebugLib.h>
14 #include <Library/UefiDriverEntryPoint.h>
15 #include <Library/ReportStatusCodeLib.h>
16 #include <Library/UefiBootServicesTableLib.h>
17 #include <Library/UefiRuntimeServicesTableLib.h>
18 #include <Protocol/WatchdogTimer.h>
19
20 /**
21 Registers a handler that is to be invoked when the watchdog timer fires.
22
23 This function registers a handler that is to be invoked when the watchdog
24 timer fires. By default, the EFI_WATCHDOG_TIMER protocol will call the
25 Runtime Service ResetSystem() when the watchdog timer fires. If a
26 NotifyFunction is registered, then the NotifyFunction will be called before
27 the Runtime Service ResetSystem() is called. If NotifyFunction is NULL, then
28 the watchdog handler is unregistered. If a watchdog handler is registered,
29 then EFI_SUCCESS is returned. If an attempt is made to register a handler
30 when a handler is already registered, then EFI_ALREADY_STARTED is returned.
31 If an attempt is made to uninstall a handler when a handler is not installed,
32 then return EFI_INVALID_PARAMETER.
33
34 @param This The EFI_WATCHDOG_TIMER_ARCH_PROTOCOL instance.
35 @param NotifyFunction The function to call when the watchdog timer fires. If this
36 is NULL, then the handler will be unregistered.
37
38 @retval EFI_SUCCESS The watchdog timer handler was registered or unregistered.
39 @retval EFI_ALREADY_STARTED NotifyFunction is not NULL, and a handler is already registered.
40 @retval EFI_INVALID_PARAMETER NotifyFunction is NULL, and a handler was not previously registered.
41
42 **/
43 EFI_STATUS
44 EFIAPI
45 WatchdogTimerDriverRegisterHandler (
46 IN EFI_WATCHDOG_TIMER_ARCH_PROTOCOL *This,
47 IN EFI_WATCHDOG_TIMER_NOTIFY NotifyFunction
48 );
49
50 /**
51 Sets the amount of time in the future to fire the watchdog timer.
52
53 This function sets the amount of time to wait before firing the watchdog
54 timer to TimerPeriod 100 ns units. If TimerPeriod is 0, then the watchdog
55 timer is disabled.
56
57 @param This The EFI_WATCHDOG_TIMER_ARCH_PROTOCOL instance.
58 @param TimerPeriod The amount of time in 100 ns units to wait before the watchdog
59 timer is fired. If TimerPeriod is zero, then the watchdog
60 timer is disabled.
61
62 @retval EFI_SUCCESS The watchdog timer has been programmed to fire in Time
63 100 ns units.
64 @retval EFI_DEVICE_ERROR A watchdog timer could not be programmed due to a device
65 error.
66
67 **/
68 EFI_STATUS
69 EFIAPI
70 WatchdogTimerDriverSetTimerPeriod (
71 IN EFI_WATCHDOG_TIMER_ARCH_PROTOCOL *This,
72 IN UINT64 TimerPeriod
73 );
74
75 /**
76 Retrieves the amount of time in 100 ns units that the system will wait before firing the watchdog timer.
77
78 This function retrieves the amount of time the system will wait before firing
79 the watchdog timer. This period is returned in TimerPeriod, and EFI_SUCCESS
80 is returned. If TimerPeriod is NULL, then EFI_INVALID_PARAMETER is returned.
81
82 @param This The EFI_WATCHDOG_TIMER_ARCH_PROTOCOL instance.
83 @param TimerPeriod A pointer to the amount of time in 100 ns units that the system
84 will wait before the watchdog timer is fired. If TimerPeriod of
85 zero is returned, then the watchdog timer is disabled.
86
87 @retval EFI_SUCCESS The amount of time that the system will wait before
88 firing the watchdog timer was returned in TimerPeriod.
89 @retval EFI_INVALID_PARAMETER TimerPeriod is NULL.
90
91 **/
92 EFI_STATUS
93 EFIAPI
94 WatchdogTimerDriverGetTimerPeriod (
95 IN EFI_WATCHDOG_TIMER_ARCH_PROTOCOL *This,
96 IN UINT64 *TimerPeriod
97 );
98
99 #endif