PebbleOS v4.47.0-1312-gf1984a001
Loading...
Searching...
No Matches
Reset cause

Reset cause class. More...

Modules

 Nordic nRF52 POWER
 Reset reason latched by the POWER block of the nRF52.
 
 QEMU
 Reset reason latched by the system controller of the QEMU Pebble machines.
 
 SiFli SF32LB PMUC
 Wake and reset sources latched by the PMUC of the SF32LB52 and SF32LB57.
 
 ST STM32H7 RCC
 Reset flags latched by the RCC of the STM32H7.
 

Data Structures

struct  pbl_reset_cause_ops
 Reset cause driver operations. More...
 
struct  pbl_reset_cause
 Reset cause. More...
 

Macros

#define PBL_RESET_CAUSE_STATE_DEFINE(sym)
 Define the class state of a reset cause.
 
#define PBL_RESET_CAUSE_INIT(sym, _name, _parent, _ops)
 Initialize a struct pbl_reset_cause.
 

Typedefs

typedef uint32_t pbl_reset_cause_t
 Reset causes, as PBL_RESET_CAUSE_* flags.
 

Functions

int pbl_reset_cause_get (const struct pbl_reset_cause *rc, pbl_reset_cause_t *causes)
 Get the causes of the last reset.
 
int pbl_reset_cause_clear (const struct pbl_reset_cause *rc)
 Clear the causes latched by the hardware, so the next reset reports its own.
 

Variables

const struct pbl_reset_cause *const RESET_CAUSE
 The board's reset cause.
 

Reset causes

#define PBL_RESET_CAUSE_POWER_ON   PBL_BIT(0)
 Power-on.
 
#define PBL_RESET_CAUSE_BROWN_OUT   PBL_BIT(1)
 Supply below the brown-out threshold.
 
#define PBL_RESET_CAUSE_PIN   PBL_BIT(2)
 Reset pin.
 
#define PBL_RESET_CAUSE_SOFTWARE   PBL_BIT(3)
 Software request.
 
#define PBL_RESET_CAUSE_WATCHDOG   PBL_BIT(4)
 Watchdog expiry.
 
#define PBL_RESET_CAUSE_LOCKUP   PBL_BIT(5)
 CPU lockup.
 
#define PBL_RESET_CAUSE_LOW_POWER   PBL_BIT(6)
 Illegal low-power mode entry.
 
#define PBL_RESET_CAUSE_WAKEUP   PBL_BIT(7)
 Wake-up from a power-off state.
 

Detailed Description

Reset cause class.

A reset cause is a struct pbl_reset_cause device: the block that latches why the system last reset, such as the power or clock controller of the SoC. The cause is read when the device comes up, so it stays available once the hardware latch is cleared.

if (pbl_reset_cause_get(RESET_CAUSE, &causes) == 0) {
}
int pbl_reset_cause_get(const struct pbl_reset_cause *rc, pbl_reset_cause_t *causes)
Get the causes of the last reset.
uint32_t pbl_reset_cause_t
Reset causes, as PBL_RESET_CAUSE_* flags.
Definition reset_cause.h:31
int pbl_reset_cause_clear(const struct pbl_reset_cause *rc)
Clear the causes latched by the hardware, so the next reset reports its own.
const struct pbl_reset_cause *const RESET_CAUSE
The board's reset cause.

Data Structure Documentation

◆ pbl_reset_cause

struct pbl_reset_cause

Reset cause.

Data Fields
pbl_reset_cause_t * causes Causes read when the device came up.
struct pbl_device dev Device.
const struct pbl_reset_cause_ops * ops Driver operations.

Macro Definition Documentation

◆ PBL_RESET_CAUSE_BROWN_OUT

#define PBL_RESET_CAUSE_BROWN_OUT   PBL_BIT(1)

Supply below the brown-out threshold.

◆ PBL_RESET_CAUSE_INIT

#define PBL_RESET_CAUSE_INIT (   sym,
  _name,
  _parent,
  _ops 
)
Value:
{ \
.dev = PBL_DEVICE_INIT_CLASS(sym, _name, pbl_reset_cause_dev_init, _parent, \
&pbl_reset_cause_class), \
.ops = (_ops), \
.causes = &sym##_reset_causes, \
}
#define PBL_DEVICE_INIT_CLASS(sym, _name, _init, _parent, _cls)
Initializer for the struct pbl_device of device instance sym, in class _cls.
Definition device.h:153

Initialize a struct pbl_reset_cause.

Parameters
symSymbol of the instance, as passed to PBL_RESET_CAUSE_STATE_DEFINE().
_nameDevice name.
_parentParent device, or NULL.
_opsDriver operations.

◆ PBL_RESET_CAUSE_LOCKUP

#define PBL_RESET_CAUSE_LOCKUP   PBL_BIT(5)

CPU lockup.

◆ PBL_RESET_CAUSE_LOW_POWER

#define PBL_RESET_CAUSE_LOW_POWER   PBL_BIT(6)

Illegal low-power mode entry.

◆ PBL_RESET_CAUSE_PIN

#define PBL_RESET_CAUSE_PIN   PBL_BIT(2)

Reset pin.

◆ PBL_RESET_CAUSE_POWER_ON

#define PBL_RESET_CAUSE_POWER_ON   PBL_BIT(0)

Power-on.

◆ PBL_RESET_CAUSE_SOFTWARE

#define PBL_RESET_CAUSE_SOFTWARE   PBL_BIT(3)

Software request.

◆ PBL_RESET_CAUSE_STATE_DEFINE

#define PBL_RESET_CAUSE_STATE_DEFINE (   sym)
Value:
static pbl_reset_cause_t sym##_reset_causes
#define PBL_DEVICE_STATE_DEFINE(sym)
Define the runtime state of device instance sym.
Definition device.h:132

Define the class state of a reset cause.

Parameters
symSymbol of the instance.

◆ PBL_RESET_CAUSE_WAKEUP

#define PBL_RESET_CAUSE_WAKEUP   PBL_BIT(7)

Wake-up from a power-off state.

◆ PBL_RESET_CAUSE_WATCHDOG

#define PBL_RESET_CAUSE_WATCHDOG   PBL_BIT(4)

Watchdog expiry.

Typedef Documentation

◆ pbl_reset_cause_t

typedef uint32_t pbl_reset_cause_t

Reset causes, as PBL_RESET_CAUSE_* flags.

Function Documentation

◆ pbl_reset_cause_clear()

int pbl_reset_cause_clear ( const struct pbl_reset_cause *  rc)

Clear the causes latched by the hardware, so the next reset reports its own.

pbl_reset_cause_get() keeps reporting the causes read when the device came up.

Parameters
rcReset cause.
Returns
0, -ENODEV if the device is not ready, or a negative errno.

◆ pbl_reset_cause_get()

int pbl_reset_cause_get ( const struct pbl_reset_cause *  rc,
pbl_reset_cause_t *  causes 
)

Get the causes of the last reset.

Parameters
rcReset cause.
[out]causesPBL_RESET_CAUSE_* flags, read when the device came up; those the hardware cannot report are clear.
Returns
0, -ENODEV if the device is not ready.

Variable Documentation

◆ RESET_CAUSE

const struct pbl_reset_cause* const RESET_CAUSE
extern

The board's reset cause.