mirror of
https://github.com/google/pebble.git
synced 2025-04-29 23:11:41 -04:00
58 lines
1.7 KiB
C
58 lines
1.7 KiB
C
/*
|
|
* Copyright 2024 Google LLC
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <stdbool.h>
|
|
#include <stdint.h>
|
|
|
|
// NOTE: We include the reboot reason in analytics and the tools we use to analyze the analytics are
|
|
// dependent on the position and ordering of these enumerated values. To keep the analysis tools
|
|
// simpler, it is best to keep these enums in the same order and add new ones to the end.
|
|
typedef enum {
|
|
RebootReasonCode_Unknown = 0,
|
|
RebootReasonCode_Shutdown,
|
|
RebootReasonCode_Watchdog,
|
|
RebootReasonCode_Assert,
|
|
RebootReasonCode_StackOverflow,
|
|
RebootReasonCode_HardFault,
|
|
RebootReasonCode_BreakpointButNoDebuggerAttached,
|
|
RebootReasonCode_DialogPlatformReset,
|
|
RebootReasonCode_CoreDumpReentered,
|
|
RebootReasonCode_CoreDumpRequested,
|
|
RebootReasonCode_RomError,
|
|
RebootReasonCode_NMI,
|
|
} RebootReasonCode;
|
|
|
|
typedef struct {
|
|
uint32_t cookie;
|
|
RebootReasonCode code;
|
|
union {
|
|
uint16_t data16;
|
|
uint8_t data8[2];
|
|
};
|
|
uint32_t extra;
|
|
} RebootReason;
|
|
|
|
void reboot_reason_set(RebootReason *reason);
|
|
|
|
bool reboot_reason_get(RebootReason *reason);
|
|
|
|
void reboot_reason_clear(void);
|
|
|
|
uint32_t reboot_reason_get_crash_lr(void);
|
|
|
|
RebootReasonCode reboot_reason_get_last_reboot_reason(void);
|