OpenThread¶
An open source implementation of Thread stack.
Thread is a mesh oriented network stack running for IEEE802.15.4 networks.-
OPENTHREAD_XTIMER_MSG_TYPE_EVENT
¶ xtimer message receiver event
1
(0x2235)
-
OPENTHREAD_NETDEV_MSG_TYPE_EVENT
¶ message received from driver
1
(0x2236)
-
OPENTHREAD_SERIAL_MSG_TYPE_EVENT
¶ event indicating a serial (UART) message was sent to OpenThread
1
(0x2237)
-
OPENTHREAD_MSG_TYPE_RECV
¶ event for frame reception
1
(0x2238)
-
OPENTHREAD_JOB_MSG_TYPE_EVENT
¶ event indicating an OT_JOB message
1
(0x2240)
-
OPENTHREAD_NUMBER_OF_SERIAL_BUFFER
¶ number of serial reception buffer
1
(1U)
-
OPENTHREAD_SIZEOF_LENGTH_AND_FREEBUFF
¶ sizeof in bytes the two first members of she serial structure
1
(4U)
-
OPENTHREAD_SERIAL_BUFFER_SIZE
¶ sizeof the serial buffer
1
OPENTHREAD_SIZEOF_LENGTH_AND_FREEBUFF + 100
-
OPENTHREAD_SERIAL_BUFFER__PAYLOAD_SIZE
¶ sizeof the spinel payload data
1
OPENTHREAD_SERIAL_BUFFER_SIZE - OPENTHREAD_SIZEOF_LENGTH_AND_FREEBUFF
-
OPENTHREAD_ERROR_NO_EMPTY_SERIAL_BUFFER
¶ error when no more buffer available
1
-1
-
OPENTHREAD_SERIAL_BUFFER_STATUS_FREE
¶ serial buffer ready to use
1
(0x0001)
-
OPENTHREAD_SERIAL_BUFFER_STATUS_READY_TO_PROCESS
¶ serial buffer ready for processsing
1
(0x0002)
-
OPENTHREAD_SERIAL_BUFFER_STATUS_FULL
¶ serial buffer payload full
1
(0x0004)
-
IEEE802154_MAX_LENGTH
¶ Max length for IEEE802154 frame.
1
(127U)
-
OPENTHREAD_NETDEV_BUFLEN
¶ Max length for a netdev buffer.
1
(IEEE802154_MAX_LENGTH)
-
void
recv_pkt
(otInstance * aInstance,netdev.h::netdev_t
* dev)¶ Gets packet from driver and tells OpenThread about the reception.
Parameters
aInstance: pointer to an OpenThread instance dev: pointer to a netdev instance
-
void
send_pkt
(otInstance * aInstance,netdev.h::netdev_t
* dev,netdev.h::netdev_event_t
event)¶ Inform OpenThread when tx is finished.
Parameters
aInstance: pointer to an OpenThread instance dev: pointer to a netdev interface event: just occurred netdev event
-
void
openthread_bootstrap
(void)¶ Bootstrap OpenThread.
-
void
openthread_radio_init
(netdev.h::netdev_t
* dev, uint8_t * tb, uint8_t * rb)¶ Init OpenThread radio.
Parameters
dev: pointer to a netdev interface tb: pointer to the TX buffer designed for OpenThread rb: pointer to the RX buffer designed for Open_Thread
-
int
openthread_netdev_init
(char * stack, int stacksize, char priority, const char * name,netdev.h::netdev_t
* netdev)¶ Starts OpenThread thread.
Parameters
stack: pointer to the stack designed for OpenThread stacksize: size of the stack priority: priority of the OpenThread stack name: name of the OpenThread stack netdev: pointer to the netdev interface Return values
- PID of OpenThread thread
- -EINVAL if there was an error creating the thread
-
kernel_types.h::kernel_pid_t
openthread_get_pid
(void)¶ get PID of OpenThread thread.
Return values
- PID of OpenThread thread
-
void
ot_random_init
(void)¶ Init OpenThread random.
-
uint8_t
ot_exec_command
(otInstance * ot_instance, const char * command, void * arg, void * answer)¶ Execute OpenThread command.
Call this function only in OpenThread thread
Parameters
ot_instance: OpenThread instance command: OpenThread command name arg: arg for the command answer: answer for the command Return values
- 0 on success, 1 on error
-
uint8_t
ot_call_command
(char * command, void * arg, void * answer)¶ Call OpenThread command in same thread as OT core (due to concurrency).
Note
An OpenThread command allows direct calls to OpenThread API (otXXX functions) without worrying about concurrency issues. All API calls should be made in OT_JOB type functions.
Parameters
command: name of the command to call arg: arg for the command answer: answer for the command Return values
- 0 on success, 1 on error