Cascoda SDK
Cascoda SDK for building software to run with CA-821x transceivers
ca821x-posix-util.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "ca821x-posix/ca821x-posix.h"
#include "cascoda-util/cascoda_rand.h"
#include "cascoda-util/cascoda_time.h"
#include "ca821x-generic-exchange.h"
#include "ca821x-posix-util-internal.h"
#include "kernel-exchange.h"
#include "uart-exchange.h"
#include "usb-exchange.h"
Include dependency graph for ca821x-posix-util.c:

Classes

struct  dev_info_context
 

Functions

uint32_t TIME_ReadAbsoluteTime (void)
 Get the number of milliseconds since program start. More...
 
ca_error ca821x_util_init (struct ca821x_dev *pDeviceRef, ca821x_errorhandler errorHandler, union ca821x_util_init_extra_arg arg)
 Generic function to initialise an available ca821x device. More...
 
ca_error ca821x_util_init_path (struct ca821x_dev *pDeviceRef, ca821x_errorhandler errorHandler, enum ca821x_exchange_type exchangeType, const char *path)
 Generic function to initialise a specific device as found via ca821x_util_enumerate or other mechanism. More...
 
void ca821x_util_deinit (struct ca821x_dev *pDeviceRef)
 Generic function to deinitialise an initialised ca821x device. More...
 
ca_error ca821x_util_enumerate (util_device_found aCallback, bool enumerate_uart, void *aContext)
 Function to enumerate all of the connected devices, calling aCallback with a struct describing each one. More...
 
ca_error ca821x_util_reset (struct ca821x_dev *pDeviceRef)
 Generic function to attempt a hard reset of the ca821x chip. More...
 
struct timespec time_sub (const struct timespec *t1, const struct timespec *t2)
 Subtract one timespec from another. More...
 
int time_cmp (const struct timespec *t1, const struct timespec *t2)
 Compare two timespec structures. More...
 

Function Documentation

◆ time_cmp()

int time_cmp ( const struct timespec *  t1,
const struct timespec *  t2 
)

Compare two timespec structures.

Parameters
t1first timespec
t2second timespec
Returns
0 if equal, 1 if t1 > t2, -1 if t1 < t2

◆ time_sub()

struct timespec time_sub ( const struct timespec *  t1,
const struct timespec *  t2 
)

Subtract one timespec from another.

Parameters
t1timespec 1
t2timespec 2
Returns
The difference between t1 and t2