Network Co-Processor

This module includes functions that control the Thread stack's execution.

Summary

Typedefs

otNcpDelegateAllowPeekPoke)(uint32_t aAddress, uint16_t aCount) typedef
bool(*
Defines delegate (function pointer) type to control behavior of peek/poke operation.
otNcpHandlerJoinLegacyNode)(const otExtAddress *aExtAddress) typedef
void(*
Defines handler (function pointer) type for initiating joining process.
otNcpHandlerSetLegacyUlaPrefix)(const uint8_t *aUlaPrefix) typedef
void(*
Defines handler (function pointer) type for setting the legacy ULA prefix.
otNcpHandlerStartLegacy)(void) typedef
void(*
Defines handler (function pointer) type for starting legacy network.
otNcpHandlerStopLegacy)(void) typedef
void(*
Defines handler (function pointer) type for stopping legacy network.
otNcpLegacyHandlers typedef
Defines a struct containing all the legacy handlers (function pointers).

Functions

otNcpHandleDidReceiveNewLegacyUlaPrefix(const uint8_t *aUlaPrefix)
void
This callback is invoked by the legacy stack to notify that the legacy ULA prefix has changed.
otNcpHandleLegacyNodeDidJoin(const otExtAddress *aExtAddr)
void
This callback is invoked by the legacy stack to notify that a new legacy node did join the network.
otNcpInit(otInstance *aInstance)
void
Initialize the NCP.
otNcpPlatLogv(otLogLevel aLogLevel, otLogRegion aLogRegion, const char *aFormat, va_list aArgs)
void
Writes OpenThread Log using otNcpStreamWrite.
otNcpRegisterLegacyHandlers(const otNcpLegacyHandlers *aHandlers)
void
This method registers a set of legacy handlers with NCP.
otNcpRegisterPeekPokeDelagates(otNcpDelegateAllowPeekPoke aAllowPeekDelegate, otNcpDelegateAllowPeekPoke aAllowPokeDelegate)
This method registers peek/poke delegate functions with NCP module.
otNcpStreamWrite(int aStreamId, const uint8_t *aDataPtr, int aDataLen)
Send data to the host via a specific stream.

Structs

otNcpLegacyHandlers

Defines a struct containing all the legacy handlers (function pointers).

Typedefs

otNcpDelegateAllowPeekPoke

bool(* otNcpDelegateAllowPeekPoke)(uint32_t aAddress, uint16_t aCount)

Defines delegate (function pointer) type to control behavior of peek/poke operation.

This delegate function is called to decide whether to allow peek or poke of a specific memory region. It is used if NCP support for peek/poke commands is enabled.

Details
Parameters
[in] aAddress
Start address of memory region.
[in] aCount
Number of bytes to peek or poke.
Returns
TRUE to allow peek/poke of the given memory region, FALSE otherwise.

otNcpHandlerJoinLegacyNode

void(* otNcpHandlerJoinLegacyNode)(const otExtAddress *aExtAddress)

Defines handler (function pointer) type for initiating joining process.

Invoked to initiate a legacy join procedure to any or a specific node.

Details
Parameters
[in] aExtAddress
A pointer to the extended address for the node to join or NULL if desired to join any neighboring node.

otNcpHandlerSetLegacyUlaPrefix

void(* otNcpHandlerSetLegacyUlaPrefix)(const uint8_t *aUlaPrefix)

Defines handler (function pointer) type for setting the legacy ULA prefix.

Invoked to set the legacy ULA prefix.

Details
Parameters
[in] aUlaPrefix
A pointer to buffer containing the legacy ULA prefix.

otNcpHandlerStartLegacy

void(* otNcpHandlerStartLegacy)(void)

Defines handler (function pointer) type for starting legacy network.

Invoked to start the legacy network.

otNcpHandlerStopLegacy

void(* otNcpHandlerStopLegacy)(void)

Defines handler (function pointer) type for stopping legacy network.

Invoked to stop the legacy network.

otNcpLegacyHandlers

struct otNcpLegacyHandlers otNcpLegacyHandlers

Defines a struct containing all the legacy handlers (function pointers).

Functions

otNcpHandleDidReceiveNewLegacyUlaPrefix

void otNcpHandleDidReceiveNewLegacyUlaPrefix(
  const uint8_t *aUlaPrefix
)

This callback is invoked by the legacy stack to notify that the legacy ULA prefix has changed.

Details
Parameters
[in] aUlaPrefix
A pointer to the received ULA prefix.

otNcpHandleLegacyNodeDidJoin

void otNcpHandleLegacyNodeDidJoin(
  const otExtAddress *aExtAddr
)

This callback is invoked by the legacy stack to notify that a new legacy node did join the network.

Details
Parameters
[in] aExtAddr
A pointer to the extended address of the joined node.

otNcpInit

void otNcpInit(
  otInstance *aInstance
)

Initialize the NCP.

Details
Parameters
[in] aInstance
The OpenThread instance structure.

otNcpPlatLogv

void otNcpPlatLogv(
  otLogLevel aLogLevel,
  otLogRegion aLogRegion,
  const char *aFormat,
  va_list aArgs
)

Writes OpenThread Log using otNcpStreamWrite.

Details
Parameters
[in] aLogLevel
The log level.
[in] aLogRegion
The log region.
[in] aFormat
A pointer to the format string.
[in] aArgs
va_list matching aFormat.

otNcpRegisterLegacyHandlers

void otNcpRegisterLegacyHandlers(
  const otNcpLegacyHandlers *aHandlers
)

This method registers a set of legacy handlers with NCP.

The set of handlers provided by the struct aHandlers are used by NCP code to start/stop legacy network. The aHandlers can be NULL to disable legacy support on NCP. Individual handlers in the given handlers struct can also be NULL.

Details
Parameters
[in] aHandlers
A pointer to a handler struct.

otNcpRegisterPeekPokeDelagates

otError otNcpRegisterPeekPokeDelagates(
  otNcpDelegateAllowPeekPoke aAllowPeekDelegate,
  otNcpDelegateAllowPeekPoke aAllowPokeDelegate
)

This method registers peek/poke delegate functions with NCP module.

The delegate functions are called by NCP module to decide whether to allow peek or poke of a specific memory region. If the delegate pointer is set to NULL, it allows peek/poke operation for any address.

Details
Parameters
[in] aAllowPeekDelegate
Delegate function pointer for peek operation.
[in] aAllowPokeDelegate
Delegate function pointer for poke operation.
Return Values
OT_ERROR_NONE
Successfully registered delegate functions.
OT_ERROR_DISABLED_FEATURE
Peek/Poke feature is disabled (by a build-time configuration option).

otNcpStreamWrite

otError otNcpStreamWrite(
  int aStreamId,
  const uint8_t *aDataPtr,
  int aDataLen
)

Send data to the host via a specific stream.

This function attempts to send the given data to the host using the given aStreamId. This is useful for reporting error messages, implementing debug/diagnostic consoles, and potentially other types of datastreams.

The write either is accepted in its entirety or rejected. Partial writes are not attempted.

Details
Parameters
[in] aStreamId
A numeric identifier for the stream to write to. If set to '0', will default to the debug stream.
[in] aDataPtr
A pointer to the data to send on the stream. If aDataLen is non-zero, this param MUST NOT be NULL.
[in] aDataLen
The number of bytes of data from aDataPtr to send.
Return Values
OT_ERROR_NONE
The data was queued for delivery to the host.
OT_ERROR_BUSY
There are not enough resources to complete this request. This is usually a temporary condition.
OT_ERROR_INVALID_ARGS
The given aStreamId was invalid.

Macros

OT_NCP_LEGACY_ULA_PREFIX_LENGTH

 OT_NCP_LEGACY_ULA_PREFIX_LENGTH 8

Legacy ULA size (in bytes)