Miscellaneous

This module includes platform abstractions for miscellaneous behaviors.

Enumerations

enum  otPlatResetReason {
  OT_PLAT_RESET_REASON_POWER_ON = 0,
  OT_PLAT_RESET_REASON_EXTERNAL = 1,
  OT_PLAT_RESET_REASON_SOFTWARE = 2,
  OT_PLAT_RESET_REASON_FAULT = 3,
  OT_PLAT_RESET_REASON_CRASH = 4,
  OT_PLAT_RESET_REASON_ASSERT = 5,
  OT_PLAT_RESET_REASON_OTHER = 6,
  OT_PLAT_RESET_REASON_UNKNOWN = 7,
  OT_PLAT_RESET_REASON_WATCHDOG = 8,
  OT_PLAT_RESET_REASON_COUNT
}
 Enumeration of possible reset reason codes.
 
enum  otPlatMcuPowerState {
  OT_PLAT_MCU_POWER_STATE_ON = 0,
  OT_PLAT_MCU_POWER_STATE_LOW_POWER = 1,
  OT_PLAT_MCU_POWER_STATE_OFF = 2
}
 Enumeration of micro-controller's power states.

Functions

void otPlatReset (otInstance *aInstance)
 This function performs a software reset on the platform, if supported.
 
otPlatResetReason otPlatGetResetReason (otInstance *aInstance)
 This function returns the reason for the last platform reset.
 
void otPlatAssertFail (const char *aFilename, int aLineNumber)
 This function provides a platform specific implementation for assert.
 
void otPlatWakeHost (void)
 This function performs a platform specific operation to wake the host MCU.
 
otError otPlatSetMcuPowerState (otInstance *aInstance, otPlatMcuPowerState aState)
 This function sets the desired MCU power state.
 
otPlatMcuPowerState otPlatGetMcuPowerState (otInstance *aInstance)
 This function gets the current desired MCU power state.

Detailed Description

This module includes platform abstractions for miscellaneous behaviors.

Enumeration Type Documentation

◆ otPlatMcuPowerState

Enumeration of micro-controller's power states.

These values are used for NCP configuration when OPENTHREAD_CONFIG_NCP_ENABLE_MCU_POWER_STATE_CONTROL is enabled.

The power state specifies the desired power state of NCP's micro-controller (MCU) when the underlying platform's operating system enters idle mode (i.e., all active tasks/events are processed and the MCU can potentially enter a energy-saving power state).

The power state primarily determines how the host should interact with the NCP and whether the host needs an external trigger (a "poke") to NCP before it can communicate with the NCP or not.

After a reset, the MCU power state MUST be OT_PLAT_POWER_STATE_ON.

Enumerator
OT_PLAT_MCU_POWER_STATE_ON 

NCP's MCU stays on and active all the time.

When the NCP's desired power state is set to ON, host can send messages to NCP without requiring any "poke" or external triggers.

Note
The ON power state only determines the MCU's power mode and is not related to radio's state.
OT_PLAT_MCU_POWER_STATE_LOW_POWER 

NCP's MCU can enter low-power (energy-saving) state.

When the NCP's desired power state is set to LOW_POWER, host is expected to "poke" the NCP (e.g., an external trigger like an interrupt) before it can communicate with the NCP (send a message to the NCP). The "poke" mechanism is determined by the platform code (based on NCP's interface to the host).

While power state is set to LOW_POWER, NCP can still (at any time) send messages to host. Note that receiving a message from the NCP does NOT indicate that the NCP's power state has changed, i.e., host is expected to continue to "poke" when it wants to talk to the NCP until the power state is explicitly changed (by a successful call to otPlatSetMcuPowerState() changing the state to ON).

Note
The LOW_POWER power state only determines the MCU's power mode and is not related to radio's state (radio is managed by OpenThread core and device role, e.g., device being sleepy or not.
OT_PLAT_MCU_POWER_STATE_OFF 

NCP is fully off.

An NCP hardware reset (via a RESET pin) is required to bring the NCP back to SPINEL_MCU_POWER_STATE_ON. RAM is not retained after reset.

◆ otPlatResetReason

Enumeration of possible reset reason codes.

These are in the same order as the Spinel reset reason codes.

Function Documentation

◆ otPlatAssertFail()

void otPlatAssertFail ( const char *  aFilename,
int  aLineNumber 
)

This function provides a platform specific implementation for assert.

Parameters
[in]aFilenameThe name of the file where the assert occurred.
[in]aLineNumberThe line number in the file where the assert occurred.

◆ otPlatGetMcuPowerState()

otPlatMcuPowerState otPlatGetMcuPowerState ( otInstance aInstance)

This function gets the current desired MCU power state.

This is only applicable and used for NCP configuration when OPENTHREAD_CONFIG_NCP_ENABLE_MCU_POWER_STATE_CONTROL is enabled.

After a reset, the power state MUST return OT_PLAT_POWER_STATE_ON. During operation, power state SHOULD only change through an explicit successful call to otPlatSetMcuPowerState().

Parameters
[in]aInstanceA pointer to OpenThread instance.
Returns
The current power state.

◆ otPlatGetResetReason()

otPlatResetReason otPlatGetResetReason ( otInstance aInstance)

This function returns the reason for the last platform reset.

Parameters
[in]aInstanceThe OpenThread instance structure.

◆ otPlatReset()

void otPlatReset ( otInstance aInstance)

This function performs a software reset on the platform, if supported.

Parameters
[in]aInstanceThe OpenThread instance structure.

◆ otPlatSetMcuPowerState()

otError otPlatSetMcuPowerState ( otInstance aInstance,
otPlatMcuPowerState  aState 
)

This function sets the desired MCU power state.

This is only applicable and used for NCP configuration when OPENTHREAD_CONFIG_NCP_ENABLE_MCU_POWER_STATE_CONTROL is enabled.

Parameters
[in]aInstanceA pointer to OpenThread instance.
[in]aStateThe new MCU power state.
Return values
OT_ERROR_NONEThe power state updated successfully.
OT_ERROR_FAILEDThe given MCU power state is not supported by the platform.

◆ otPlatWakeHost()

void otPlatWakeHost ( void  )

This function performs a platform specific operation to wake the host MCU.

This is used only for NCP configurations.