Miscellaneous

This module includes platform abstractions for miscellaneous behaviors.

Summary

Enumerations

otPlatMcuPowerState{
  OT_PLAT_MCU_POWER_STATE_ON = 0,
  OT_PLAT_MCU_POWER_STATE_LOW_POWER = 1,
  OT_PLAT_MCU_POWER_STATE_OFF = 2
}
enum
Enumeration of micro-controller's power states.
otPlatResetReason enum
Enumeration of possible reset reason codes.

Functions

otPlatAssertFail(const char *aFilename, int aLineNumber)
void
Provides a platform specific implementation for assert.
otPlatGetMcuPowerState(otInstance *aInstance)
Gets the current desired MCU power state.
otPlatGetResetReason(otInstance *aInstance)
Returns the reason for the last platform reset.
otPlatLogCrashDump(void)
Logs a crash dump using OpenThread logging APIs.
otPlatReset(otInstance *aInstance)
void
Performs a software reset on the platform, if supported.
otPlatResetToBootloader(otInstance *aInstance)
Performs a hardware reset on the platform to launch bootloader mode, if supported.
otPlatSetMcuPowerState(otInstance *aInstance, otPlatMcuPowerState aState)
Sets the desired MCU power state.
otPlatWakeHost(void)
void
Performs a platform specific operation to wake the host MCU.

Enumerations

otPlatMcuPowerState

 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.

Properties
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).

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.

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.

otPlatResetReason

 otPlatResetReason

Enumeration of possible reset reason codes.

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

Functions

otPlatAssertFail

void otPlatAssertFail(
  const char *aFilename,
  int aLineNumber
)

Provides a platform specific implementation for assert.

Details
Parameters
[in] aFilename
The name of the file where the assert occurred.
[in] aLineNumber
The line number in the file where the assert occurred.

otPlatGetMcuPowerState

otPlatMcuPowerState otPlatGetMcuPowerState(
  otInstance *aInstance
)

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().

Details
Parameters
[in] aInstance
A pointer to OpenThread instance.
Returns
The current power state.

otPlatGetResetReason

otPlatResetReason otPlatGetResetReason(
  otInstance *aInstance
)

Returns the reason for the last platform reset.

Details
Parameters
[in] aInstance
The OpenThread instance structure.

otPlatLogCrashDump

otError otPlatLogCrashDump(
  void
)

Logs a crash dump using OpenThread logging APIs.

Details
Return Values
OT_ERROR_NONE
Crash dump was logged successfully
OT_ERROR_NOT_CAPABLE
Platform is not capable of logging a crash dump

otPlatReset

void otPlatReset(
  otInstance *aInstance
)

Performs a software reset on the platform, if supported.

Details
Parameters
[in] aInstance
The OpenThread instance structure.

otPlatResetToBootloader

otError otPlatResetToBootloader(
  otInstance *aInstance
)

Performs a hardware reset on the platform to launch bootloader mode, if supported.

Used when OPENTHREAD_CONFIG_PLATFORM_BOOTLOADER_MODE_ENABLE is enabled.

Details
Parameters
[in] aInstance
The OpenThread instance structure.
Return Values
OT_ERROR_NONE
Reset to bootloader successfully.
OT_ERROR_BUSY
Failed due to another operation is ongoing.
OT_ERROR_NOT_CAPABLE
Not capable of resetting to bootloader.

otPlatSetMcuPowerState

otError otPlatSetMcuPowerState(
  otInstance *aInstance,
  otPlatMcuPowerState aState
)

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.

Details
Parameters
[in] aInstance
A pointer to OpenThread instance.
[in] aState
The new MCU power state.
Return Values
OT_ERROR_NONE
The power state updated successfully.
OT_ERROR_FAILED
The given MCU power state is not supported by the platform.

otPlatWakeHost

void otPlatWakeHost(
  void
)

Performs a platform specific operation to wake the host MCU.

This is used only for NCP configurations.

Resources

OpenThread API Reference topics originate from the source code, available on GitHub. For more information, or to contribute to our documentation, refer to Resources.