Cascoda SDK
Cascoda SDK for building software to run with CA-821x transceivers
|
The common part of every exchange, handling message management and calling the interface-specific implementations. More...
#include "ca821x-posix/ca821x-types.h"
Go to the source code of this file.
Macros | |
#define | MAX_BUF_SIZE 256 |
Functions | |
ca_error | init_generic (struct ca821x_dev *pDeviceRef) |
Initialise the generic part of a pDeviceRef. More... | |
ca_error | deinit_generic (struct ca821x_dev *pDeviceRef) |
Deinitialise an initialised pDeviceRef struct. More... | |
ca_error | exchange_handle_error (ca_error error, struct ca821x_dev *pDeviceRef) |
Attempt to recover from an exchange error silently. More... | |
void * | ca821x_io_worker (void *arg) |
io worker thread function. More... | |
ca_error | ca821x_exchange_commands (const uint8_t *buf, size_t len, uint8_t *response, struct ca821x_dev *pDeviceRef) |
Handle an exchange with the ca821x. More... | |
The common part of every exchange, handling message management and calling the interface-specific implementations.
#define MAX_BUF_SIZE 256 |
ca_error ca821x_exchange_commands | ( | const uint8_t * | buf, |
size_t | len, | ||
uint8_t * | response, | ||
struct ca821x_dev * | pDeviceRef | ||
) |
Handle an exchange with the ca821x.
Used as the downstream function for ca821x-api.
buf | The buffer to send |
len | The length of the buffer to send, including header bytes |
response | The buffer to use for the response message to synchronous messages |
pDeviceRef | an initialised pDeviceRef struct. |
CA_ERROR_SUCCESS | Success |
CA_ERROR_INVALID_STATE | Invalid state, such as uninitialised. |
CA_ERROR_TIMEOUT | Response was not received to synchronous command in reasonable timeframe. |
void* ca821x_io_worker | ( | void * | arg | ) |
io worker thread function.
Handles reads/writes to the exchange, buffering and debuffering messages as required.
arg | an initialised pDeviceRef struct. |
ca_error deinit_generic | ( | struct ca821x_dev * | pDeviceRef | ) |
Deinitialise an initialised pDeviceRef struct.
pDeviceRef | an initialised pDeviceRef struct. |
ca_error exchange_handle_error | ( | ca_error | error, |
struct ca821x_dev * | pDeviceRef | ||
) |
Attempt to recover from an exchange error silently.
error | The error code that caused the crash |
pDeviceRef | The initialised pDeviceRef struct related to the error. |
ca_error init_generic | ( | struct ca821x_dev * | pDeviceRef | ) |
Initialise the generic part of a pDeviceRef.
pDeviceRef | An allocated and partially initialised pDeviceRef struct |