Network Co-Processor
This module includes functions that control the Thread stack's execution.
Summary
Typedefs |
|
---|---|
otNcpDelegateAllowPeekPoke)(uint32_t aAddress, uint16_t aCount)
|
typedefbool(*
Defines delegate (function pointer) type to control behavior of peek/poke operation. |
otNcpHandlerJoinLegacyNode)(const otExtAddress *aExtAddress)
|
typedefvoid(*
Defines handler (function pointer) type for initiating joining process. |
otNcpHandlerSetLegacyUlaPrefix)(const uint8_t *aUlaPrefix)
|
typedefvoid(*
Defines handler (function pointer) type for setting the legacy ULA prefix. |
otNcpHandlerStartLegacy)(void)
|
typedefvoid(*
Defines handler (function pointer) type for starting legacy network. |
otNcpHandlerStopLegacy)(void)
|
typedefvoid(*
Defines handler (function pointer) type for stopping legacy network. |
otNcpHdlcSendCallback)(const uint8_t *aBuf, uint16_t aBufLength)
|
typedefint(*
This function pointer is called to send HDLC encoded NCP data. |
otNcpLegacyHandlers
|
typedefstruct otNcpLegacyHandlers
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.
|
otNcpHdlcInit(otInstance *aInstance, otNcpHdlcSendCallback aSendCallback)
|
void
Initialize the NCP based on HDLC framing.
|
otNcpHdlcReceive(const uint8_t *aBuf, uint16_t aBufLength)
|
void
This function is called after HDLC encoded NCP data received.
|
otNcpHdlcSendDone(void)
|
void
This function is called after NCP send finished.
|
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)
|
void
This method registers peek/poke delegate functions with NCP module.
|
otNcpSpiInit(otInstance *aInstance)
|
void
Initialize the NCP based on SPI framing.
|
otNcpStreamWrite(int aStreamId, const uint8_t *aDataPtr, int aDataLen)
|
Send data to the host via a specific stream.
|
Macros |
|
---|---|
OT_NCP_LEGACY_ULA_PREFIX_LENGTH 8
|
Legacy ULA size (in bytes)
|
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 |
|
||||
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 |
|
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 |
|
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.
otNcpHdlcSendCallback
int(* otNcpHdlcSendCallback)(const uint8_t *aBuf, uint16_t aBufLength)
This function pointer is called to send HDLC encoded NCP data.
Details | |||||
---|---|---|---|---|---|
Parameters |
|
||||
Returns |
Number of bytes processed by the callback.
|
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 |
|
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 |
|
otNcpHdlcInit
void otNcpHdlcInit( otInstance *aInstance, otNcpHdlcSendCallback aSendCallback )
Initialize the NCP based on HDLC framing.
Details | |||||
---|---|---|---|---|---|
Parameters |
|
otNcpHdlcReceive
void otNcpHdlcReceive( const uint8_t *aBuf, uint16_t aBufLength )
This function is called after HDLC encoded NCP data received.
Details | |||||
---|---|---|---|---|---|
Parameters |
|
otNcpHdlcSendDone
void otNcpHdlcSendDone( void )
This function is called after NCP send finished.
otNcpPlatLogv
void otNcpPlatLogv( otLogLevel aLogLevel, otLogRegion aLogRegion, const char *aFormat, va_list aArgs )
Writes OpenThread Log using otNcpStreamWrite
.
Details | |||||||||
---|---|---|---|---|---|---|---|---|---|
Parameters |
|
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 |
|
otNcpRegisterPeekPokeDelagates
void 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 |
|
otNcpSpiInit
void otNcpSpiInit( otInstance *aInstance )
Initialize the NCP based on SPI framing.
Details | |||
---|---|---|---|
Parameters |
|
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 |
|
||||||
Return Values |
|
Macros
OT_NCP_LEGACY_ULA_PREFIX_LENGTH
OT_NCP_LEGACY_ULA_PREFIX_LENGTH 8
Legacy ULA size (in bytes)
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.