Cascoda SDK
Cascoda SDK for building software to run with CA-821x transceivers
posix-platform.h File Reference

This file includes the posix platform-specific initializers. More...

#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/select.h>
#include <sys/time.h>
#include "openthread/instance.h"
#include "ca821x_api.h"
Include dependency graph for posix-platform.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

int posixPlatformInit (void)
 This method performs all platform-specific initialization. More...
 
struct ca821x_devPlatformGetDeviceRef ()
 Get the radio device currently in use by Openthread. More...
 
void posixPlatformSetOrigArgs (int argc, char *argv[])
 This method stores the original arguments given to the program. More...
 
void posixPlatformProcessDrivers (otInstance *aInstance)
 This method performs all platform-specific processing. More...
 
void posixPlatformProcessDriversQuick (otInstance *aInstance)
 This method performs all platform-specific processing without sleeping at the end. More...
 
void posixPlatformGetTimeout (otInstance *aInstance, struct timeval *timeout)
 This method gets the timeout for the sleep function, and places it in the timeout struct. More...
 
void posixPlatformSleep (otInstance *aInstance, struct timeval *timeout)
 This method sleeps until there is further work to do (allowing the application to access the openthread API) -Must run immediately after posixPlatformGetTimeout! More...
 
void posixPlatformAlarmInit (void)
 This method initializes the alarm service used by OpenThread. More...
 
void posixPlatformAlarmUpdateTimeout (struct timeval *tv)
 This method retrieves the time remaining until the alarm fires. More...
 
void posixPlatformAlarmProcess (otInstance *aInstance)
 This method performs alarm driver processing. More...
 
int PlatformRadioInit (void)
 This method initializes the radio service used by OpenThread. More...
 
int PlatformRadioInitWithDev (struct ca821x_dev *pDeviceRef)
 This method initializes the radio service used by OpenThread using a pDeviceRef that has already been fully initialised by the caller. More...
 
int PlatformRadioProcess (void)
 This method performs radio driver processing. More...
 
void PlatformRadioStop (void)
 This method cleanly stops the radio. More...
 
void posixPlatformRestoreTerminal (void)
 This method restores the terminal to it's pre-openthread state. More...
 
void posixPlatformRandomInit (void)
 This method initializes the random number service used by OpenThread. More...
 
void platformUartUpdateFdSet (fd_set *aReadFdSet, fd_set *aWriteFdSet, int *aMaxFd)
 This method updates the file descriptor sets with file descriptors used by the serial driver. More...
 
void platformUartProcess (void)
 This method performs radio driver processing. More...
 

Variables

uint32_t NODE_ID
 Unique node ID. More...
 
uint32_t WELLKNOWN_NODE_ID
 Well-known Unique ID used by a simulated radio that supports promiscuous mode. More...
 

Detailed Description

This file includes the posix platform-specific initializers.

Function Documentation

◆ PlatformRadioProcess()

int PlatformRadioProcess ( void  )

This method performs radio driver processing.

◆ platformUartProcess()

void platformUartProcess ( void  )

This method performs radio driver processing.

◆ platformUartUpdateFdSet()

void platformUartUpdateFdSet ( fd_set *  aReadFdSet,
fd_set *  aWriteFdSet,
int *  aMaxFd 
)

This method updates the file descriptor sets with file descriptors used by the serial driver.

Parameters
[in,out]aReadFdSetA pointer to the read file descriptors.
[in,out]aWriteFdSetA pointer to the write file descriptors.
[in,out]aMaxFdA pointer to the max file descriptor.

◆ posixPlatformAlarmInit()

void posixPlatformAlarmInit ( void  )

This method initializes the alarm service used by OpenThread.

◆ posixPlatformAlarmProcess()

void posixPlatformAlarmProcess ( otInstance *  aInstance)

This method performs alarm driver processing.

◆ posixPlatformAlarmUpdateTimeout()

void posixPlatformAlarmUpdateTimeout ( struct timeval *  tv)

This method retrieves the time remaining until the alarm fires.

Parameters
[out]tvA pointer to the timeval struct.

◆ posixPlatformGetTimeout()

void posixPlatformGetTimeout ( otInstance *  aInstance,
struct timeval *  timeout 
)

This method gets the timeout for the sleep function, and places it in the timeout struct.

◆ posixPlatformInit()

int posixPlatformInit ( void  )

This method performs all platform-specific initialization.

◆ posixPlatformProcessDrivers()

void posixPlatformProcessDrivers ( otInstance *  aInstance)

This method performs all platform-specific processing.

◆ posixPlatformProcessDriversQuick()

void posixPlatformProcessDriversQuick ( otInstance *  aInstance)

This method performs all platform-specific processing without sleeping at the end.

Should be used in conjunction with posixPlatformSleep.

◆ posixPlatformRandomInit()

void posixPlatformRandomInit ( void  )

This method initializes the random number service used by OpenThread.

◆ posixPlatformRestoreTerminal()

void posixPlatformRestoreTerminal ( void  )

This method restores the terminal to it's pre-openthread state.

◆ posixPlatformSetOrigArgs()

void posixPlatformSetOrigArgs ( int  argc,
char *  argv[] 
)

This method stores the original arguments given to the program.

◆ posixPlatformSleep()

void posixPlatformSleep ( otInstance *  aInstance,
struct timeval *  timeout 
)

This method sleeps until there is further work to do (allowing the application to access the openthread API) -Must run immediately after posixPlatformGetTimeout!

Variable Documentation

◆ NODE_ID

uint32_t NODE_ID
extern

Unique node ID.

◆ WELLKNOWN_NODE_ID

uint32_t WELLKNOWN_NODE_ID
extern

Well-known Unique ID used by a simulated radio that supports promiscuous mode.