| Cascoda SDK
    Cascoda SDK for building software to run with CA-821x transceivers | 
#include <assert.h>#include <errno.h>#include <pthread.h>#include <stdint.h>#include <string.h>#include <unistd.h>#include "ca821x-posix/ca821x-posix.h"#include "ca821x-generic-exchange.h"#include "ca821x-posix-evbme-internal.h"#include "ca821x-queue.h"#include "ca821x_api.h"
| Enumerations | |
| enum | { SYNC_TIMEOUT_S = 5 } | 
| Functions | |
| ca_error | ca821x_util_dispatch_poll () | 
| Generic function to poll the receive queue and call callbacks for received commands.  More... | |
| ca_error | ca821x_util_start_upstream_dispatch_worker () | 
| Start the upstream_dispatch worker, which asynchronously calls the message callbacks (such as MCPS_DATA_indication) as they are received.  More... | |
| ca_error | ca821x_util_stop_upstream_dispatch_worker () | 
| Stop the upstream_dispatch worker, so callbacks will no longer be triggered from a separate thread.  More... | |
| 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_register_user_callback (exchange_user_callback callback, struct ca821x_dev *pDeviceRef) | 
| Registers the callback to call for any non-ca821x commands that are sent over the interface.  More... | |
| ca_error | exchange_wait_send_complete (time_t timeout_s, struct ca821x_dev *pDeviceRef) | 
| Query whether the given exchange has any messages pending being sent in its send queue.  More... | |
| ca_error | exchange_user_command (uint8_t cmdid, uint8_t cmdlen, uint8_t *payload, struct ca821x_dev *pDeviceRef) | 
| Sends a user-defined command over the connected interface.  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... | |
| ca_error | ca821x_api_downstream (const uint8_t *buf, uint8_t *response, struct ca821x_dev *pDeviceRef) | 
| Function for downstream api interface.  More... | |
| Variables | |
| void(* | wake_hw_worker )(void) | 
| 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 | 
| void(* wake_hw_worker) (void) | ( | void | ) |