]> git.proxmox.com Git - mirror_edk2.git/blob - ArmPlatformPkg/Include/Drivers/SP805Watchdog.h
10600a155345fd7899f34996bde0652203a2b5ea
[mirror_edk2.git] / ArmPlatformPkg / Include / Drivers / SP805Watchdog.h
1 /** @file
2 *
3 * Copyright (c) 2011, ARM Limited. All rights reserved.
4 *
5 * This program and the accompanying materials
6 * are licensed and made available under the terms and conditions of the BSD License
7 * which accompanies this distribution. The full text of the license may be found at
8 * http://opensource.org/licenses/bsd-license.php
9 *
10 * THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12 *
13 **/
14
15
16 #ifndef __SP805_WATCHDOG_H__
17 #define __SP805_WATCHDOG_H__
18
19 #include <Base.h>
20 #include <ArmPlatform.h>
21
22 // SP805 Watchdog Registers
23 #define SP805_WDOG_LOAD_REG (SP805_WDOG_BASE + 0x000)
24 #define SP805_WDOG_CURRENT_REG (SP805_WDOG_BASE + 0x004)
25 #define SP805_WDOG_CONTROL_REG (SP805_WDOG_BASE + 0x008)
26 #define SP805_WDOG_INT_CLR_REG (SP805_WDOG_BASE + 0x00C)
27 #define SP805_WDOG_RAW_INT_STS_REG (SP805_WDOG_BASE + 0x010)
28 #define SP805_WDOG_MSK_INT_STS_REG (SP805_WDOG_BASE + 0x014)
29 #define SP805_WDOG_LOCK_REG (SP805_WDOG_BASE + 0xC00)
30
31 #define SP805_WDOG_PERIPH_ID0 (SP805_WDOG_BASE + 0xFE0)
32 #define SP805_WDOG_PERIPH_ID1 (SP805_WDOG_BASE + 0xFE4)
33 #define SP805_WDOG_PERIPH_ID2 (SP805_WDOG_BASE + 0xFE8)
34 #define SP805_WDOG_PERIPH_ID3 (SP805_WDOG_BASE + 0xFEC)
35
36 #define SP805_WDOG_PCELL_ID0 (SP805_WDOG_BASE + 0xFF0)
37 #define SP805_WDOG_PCELL_ID1 (SP805_WDOG_BASE + 0xFF4)
38 #define SP805_WDOG_PCELL_ID2 (SP805_WDOG_BASE + 0xFF8)
39 #define SP805_WDOG_PCELL_ID3 (SP805_WDOG_BASE + 0xFFC)
40
41 // Timer control register bit definitions
42 #define SP805_WDOG_CTRL_INTEN BIT0
43 #define SP805_WDOG_CTRL_RESEN BIT1
44 #define SP805_WDOG_RAW_INT_STS_WDOGRIS BIT0
45 #define SP805_WDOG_MSK_INT_STS_WDOGMIS BIT0
46
47 #define SP805_WDOG_LOCK_IS_UNLOCKED 0x00000000
48 #define SP805_WDOG_LOCK_IS_LOCKED 0x00000001
49 #define SP805_WDOG_SPECIAL_UNLOCK_CODE 0x1ACCE551
50
51 VOID
52 EFIAPI
53 ExitBootServicesEvent (
54 IN EFI_EVENT Event,
55 IN VOID *Context
56 );
57
58 EFI_STATUS
59 EFIAPI
60 SP805SetTimerPeriod (
61 IN CONST EFI_WATCHDOG_TIMER_ARCH_PROTOCOL *This,
62 IN UINT64 TimerPeriod // In 100ns units
63 );
64
65 EFI_STATUS
66 EFIAPI
67 SP805GetTimerPeriod (
68 IN CONST EFI_WATCHDOG_TIMER_ARCH_PROTOCOL *This,
69 OUT UINT64 *TimerPeriod
70 );
71
72 EFI_STATUS
73 EFIAPI
74 SP805RegisterHandler (
75 IN CONST EFI_WATCHDOG_TIMER_ARCH_PROTOCOL *This,
76 IN EFI_WATCHDOG_TIMER_NOTIFY NotifyFunction
77 );
78
79 EFI_STATUS
80 SP805Initialize (
81 VOID
82 );
83
84 EFI_STATUS
85 EFIAPI
86 SP805InstallProtocol (
87 IN EFI_HANDLE ImageHandle,
88 IN EFI_SYSTEM_TABLE *SystemTable
89 );
90
91
92 #endif // __SP805_WATCHDOG_H__