Network Co-Processor#

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

Typedefs#

typedef int(*
otNcpHdlcSendCallback)(const uint8_t *aBuf, uint16_t aBufLength)

Pointer is called to send HDLC encoded NCP data.

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

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

Functions#

void

Is called after NCP send finished.

void
otNcpHdlcReceive(const uint8_t *aBuf, uint16_t aBufLength)

Is called after HDLC encoded NCP data received.

void
otNcpHdlcInit(otInstance *aInstance, otNcpHdlcSendCallback aSendCallback)

Initialize the NCP based on HDLC framing.

void
otNcpSpiInit(otInstance *aInstance)

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.

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

Writes OpenThread Log using otNcpStreamWrite.

void
otNcpRegisterPeekPokeDelegates(otNcpDelegateAllowPeekPoke aAllowPeekDelegate, otNcpDelegateAllowPeekPoke aAllowPokeDelegate)

Registers peek/poke delegate functions with NCP module.

Typedef Documentation#

otNcpHdlcSendCallback#

typedef int(* otNcpHdlcSendCallback) (const uint8_t *aBuf, uint16_t aBufLength) )(const uint8_t *aBuf, uint16_t aBufLength)

Pointer is called to send HDLC encoded NCP data.

Parameters
[in]aBuf

A pointer to a buffer with an output.

[in]aBufLength

A length of the output data stored in the buffer.

Returns

  • Number of bytes processed by the callback.


Definition at line 66 of file include/openthread/ncp.h

otNcpDelegateAllowPeekPoke#

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

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

Parameters
[in]aAddress

Start address of memory region.

[in]aCount

Number of bytes to peek or poke.

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.

Returns

  • TRUE to allow peek/poke of the given memory region, FALSE otherwise.


Definition at line 149 of file include/openthread/ncp.h

Function Documentation#

otNcpHdlcSendDone#

void otNcpHdlcSendDone (void)

Is called after NCP send finished.

Parameters
N/A

Definition at line 72 of file include/openthread/ncp.h

otNcpHdlcReceive#

void otNcpHdlcReceive (const uint8_t *aBuf, uint16_t aBufLength)

Is called after HDLC encoded NCP data received.

Parameters
[in]aBuf

A pointer to a buffer.

[in]aBufLength

The length of the data stored in the buffer.


Definition at line 81 of file include/openthread/ncp.h

otNcpHdlcInit#

void otNcpHdlcInit (otInstance *aInstance, otNcpHdlcSendCallback aSendCallback)

Initialize the NCP based on HDLC framing.

Parameters
[in]aInstance

The OpenThread instance structure.

[in]aSendCallback

The function pointer used to send NCP data.


Definition at line 90 of file include/openthread/ncp.h

otNcpSpiInit#

void otNcpSpiInit (otInstance *aInstance)

Initialize the NCP based on SPI framing.

Parameters
[in]aInstance

The OpenThread instance structure.


Definition at line 98 of file include/openthread/ncp.h

otNcpStreamWrite#

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

Send data to the host via a specific stream.

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.

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.


Definition at line 122 of file include/openthread/ncp.h

otNcpPlatLogv#

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

Writes OpenThread Log using otNcpStreamWrite.

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.


Definition at line 132 of file include/openthread/ncp.h

otNcpRegisterPeekPokeDelegates#

void otNcpRegisterPeekPokeDelegates (otNcpDelegateAllowPeekPoke aAllowPeekDelegate, otNcpDelegateAllowPeekPoke aAllowPokeDelegate)

Registers peek/poke delegate functions with NCP module.

Parameters
[in]aAllowPeekDelegate

Delegate function pointer for peek operation.

[in]aAllowPokeDelegate

Delegate function pointer for poke operation.

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.


Definition at line 161 of file include/openthread/ncp.h