Zephyr API Documentation 4.0.0-rc2
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
Hardware Info Interface

Hardware Information Interface . More...

Functions

ssize_t hwinfo_get_device_id (uint8_t *buffer, size_t length)
 Copy the device id to a buffer.
 
int hwinfo_get_device_eui64 (uint8_t *buffer)
 Copy the device EUI64 to a buffer.
 
int hwinfo_get_reset_cause (uint32_t *cause)
 Retrieve cause of device reset.
 
int hwinfo_clear_reset_cause (void)
 Clear cause of device reset.
 
int hwinfo_get_supported_reset_cause (uint32_t *supported)
 Get supported reset cause flags.
 

Reset cause flags

#define RESET_PIN   BIT(0)
 External pin.
 
#define RESET_SOFTWARE   BIT(1)
 Software reset.
 
#define RESET_BROWNOUT   BIT(2)
 Brownout (drop in voltage)
 
#define RESET_POR   BIT(3)
 Power-on reset (POR)
 
#define RESET_WATCHDOG   BIT(4)
 Watchdog timer expiration.
 
#define RESET_DEBUG   BIT(5)
 Debug event.
 
#define RESET_SECURITY   BIT(6)
 Security violation.
 
#define RESET_LOW_POWER_WAKE   BIT(7)
 Waking up from low power mode.
 
#define RESET_CPU_LOCKUP   BIT(8)
 CPU lock-up detected.
 
#define RESET_PARITY   BIT(9)
 Parity error.
 
#define RESET_PLL   BIT(10)
 PLL error.
 
#define RESET_CLOCK   BIT(11)
 Clock error.
 
#define RESET_HARDWARE   BIT(12)
 Hardware reset.
 
#define RESET_USER   BIT(13)
 User reset.
 
#define RESET_TEMPERATURE   BIT(14)
 Temperature reset.
 

Detailed Description

Hardware Information Interface .

Since
1.14
Version
1.0.0

Macro Definition Documentation

◆ RESET_BROWNOUT

#define RESET_BROWNOUT   BIT(2)

#include <zephyr/drivers/hwinfo.h>

Brownout (drop in voltage)

◆ RESET_CLOCK

#define RESET_CLOCK   BIT(11)

#include <zephyr/drivers/hwinfo.h>

Clock error.

◆ RESET_CPU_LOCKUP

#define RESET_CPU_LOCKUP   BIT(8)

#include <zephyr/drivers/hwinfo.h>

CPU lock-up detected.

◆ RESET_DEBUG

#define RESET_DEBUG   BIT(5)

#include <zephyr/drivers/hwinfo.h>

Debug event.

◆ RESET_HARDWARE

#define RESET_HARDWARE   BIT(12)

#include <zephyr/drivers/hwinfo.h>

Hardware reset.

◆ RESET_LOW_POWER_WAKE

#define RESET_LOW_POWER_WAKE   BIT(7)

#include <zephyr/drivers/hwinfo.h>

Waking up from low power mode.

◆ RESET_PARITY

#define RESET_PARITY   BIT(9)

#include <zephyr/drivers/hwinfo.h>

Parity error.

◆ RESET_PIN

#define RESET_PIN   BIT(0)

#include <zephyr/drivers/hwinfo.h>

External pin.

◆ RESET_PLL

#define RESET_PLL   BIT(10)

#include <zephyr/drivers/hwinfo.h>

PLL error.

◆ RESET_POR

#define RESET_POR   BIT(3)

#include <zephyr/drivers/hwinfo.h>

Power-on reset (POR)

◆ RESET_SECURITY

#define RESET_SECURITY   BIT(6)

#include <zephyr/drivers/hwinfo.h>

Security violation.

◆ RESET_SOFTWARE

#define RESET_SOFTWARE   BIT(1)

#include <zephyr/drivers/hwinfo.h>

Software reset.

◆ RESET_TEMPERATURE

#define RESET_TEMPERATURE   BIT(14)

#include <zephyr/drivers/hwinfo.h>

Temperature reset.

◆ RESET_USER

#define RESET_USER   BIT(13)

#include <zephyr/drivers/hwinfo.h>

User reset.

◆ RESET_WATCHDOG

#define RESET_WATCHDOG   BIT(4)

#include <zephyr/drivers/hwinfo.h>

Watchdog timer expiration.

Function Documentation

◆ hwinfo_clear_reset_cause()

int hwinfo_clear_reset_cause ( void )

#include <zephyr/drivers/hwinfo.h>

Clear cause of device reset.

Clears reset cause flags.

Return values
zeroif successful.
-ENOSYSif there is no implementation for the particular device.
anynegative value on driver specific errors.

◆ hwinfo_get_device_eui64()

int hwinfo_get_device_eui64 ( uint8_t * buffer)

#include <zephyr/drivers/hwinfo.h>

Copy the device EUI64 to a buffer.

This routine copies the device EUI64 (8 bytes) to the buffer. The EUI64 depends on the hardware and is guaranteed unique.

Parameters
bufferBuffer of 8 bytes to write the ID to.
Return values
zeroif successful.
-ENOSYSif there is no implementation for the particular device.
anynegative value on driver specific errors.

◆ hwinfo_get_device_id()

ssize_t hwinfo_get_device_id ( uint8_t * buffer,
size_t length )

#include <zephyr/drivers/hwinfo.h>

Copy the device id to a buffer.

This routine copies "length" number of bytes of the device ID to the buffer. If the device ID is smaller than length, the rest of the buffer is left unchanged. The ID depends on the hardware and is not guaranteed unique.

Drivers are responsible for ensuring that the ID data structure is a sequence of bytes. The returned ID value is not supposed to be interpreted based on vendor-specific assumptions of byte order. It should express the identifier as a raw byte sequence, doing any endian conversion necessary so that a hex representation of the bytes produces the intended serial number.

Parameters
bufferBuffer to write the ID to.
lengthMax length of the buffer.
Return values
sizeof the device ID copied.
-ENOSYSif there is no implementation for the particular device.
anynegative value on driver specific errors.

◆ hwinfo_get_reset_cause()

int hwinfo_get_reset_cause ( uint32_t * cause)

#include <zephyr/drivers/hwinfo.h>

Retrieve cause of device reset.

Parameters
causeOR'd reset cause flags

This routine retrieves the flags that indicate why the device was reset.

On some platforms the reset cause flags accumulate between successive resets and this routine may return multiple flags indicating all reset causes since the device was powered on. If you need to retrieve the cause only for the most recent reset call hwinfo_clear_reset_cause after calling this routine to clear the hardware flags before the next reset event.

Successive calls to this routine will return the same value, unless hwinfo_clear_reset_cause has been called.

Return values
zeroif successful.
-ENOSYSif there is no implementation for the particular device.
anynegative value on driver specific errors.

◆ hwinfo_get_supported_reset_cause()

int hwinfo_get_supported_reset_cause ( uint32_t * supported)

#include <zephyr/drivers/hwinfo.h>

Get supported reset cause flags.

Parameters
supportedOR'd reset cause flags that are supported

Retrieves all reset_cause flags that are supported by this device.

Return values
zeroif successful.
-ENOSYSif there is no implementation for the particular device.
anynegative value on driver specific errors.