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

Cascoda posix exchange for communicating with ca821x via kernel driver. More...

Include dependency graph for kernel-exchange.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

ca_error kernel_exchange_init (ca821x_errorhandler callback, struct ca821x_dev *pDeviceRef)
 Initialise the kernel exchange, using the supplied errorhandling callback to report any errors back to the application, which can react as required (i.e. More...
 
void kernel_exchange_deinit (struct ca821x_dev *pDeviceRef)
 Deinitialise the kernel exchange, so that it can be reinitialised by another process, or reopened later. More...
 
int kernel_exchange_reset (unsigned long resettime, struct ca821x_dev *pDeviceRef)
 Send a hard reset to the ca8210. More...
 
ca_error kernel_exchange_enumerate (util_device_found aCallback, void *aContext)
 Function to enumerate all of the kernel devices configured (currently max single device per system), calling aCallback with a struct describing each one. More...
 

Detailed Description

Cascoda posix exchange for communicating with ca821x via kernel driver.

Function Documentation

◆ kernel_exchange_deinit()

void kernel_exchange_deinit ( struct ca821x_dev pDeviceRef)

Deinitialise the kernel exchange, so that it can be reinitialised by another process, or reopened later.

Parameters
pDeviceRefPointer to initialised ca821x_device_ref struct

◆ kernel_exchange_enumerate()

ca_error kernel_exchange_enumerate ( util_device_found  aCallback,
void *  aContext 
)

Function to enumerate all of the kernel devices configured (currently max single device per system), calling aCallback with a struct describing each one.

The struct passed to aCallback will only be valid for the duration that the function is called. This function will not return until every callback has been called.

Parameters
aCallbackThe callback to call with each result
aContextThe generic void pointer to provide to the callback when it is called
Return values
CA_ERROR_SUCCESSEnumeration successful
CA_ERROR_NOT_FOUNDNo devices found

◆ kernel_exchange_init()

ca_error kernel_exchange_init ( ca821x_errorhandler  callback,
struct ca821x_dev pDeviceRef 
)

Initialise the kernel exchange, using the supplied errorhandling callback to report any errors back to the application, which can react as required (i.e.

crash gracefully or attempt to reset the ca8210)

Parameters
[in]callbackFunction pointer to an error-handling callback (can be NULL)
[in]pDeviceRefPointer to initialised ca821x_device_ref struct
Return values
CA_ERROR_SUCCESSSuccessful initialisation
CA_ERROR_NOT_FOUNDDid not succeed

◆ kernel_exchange_reset()

int kernel_exchange_reset ( unsigned long  resettime,
struct ca821x_dev pDeviceRef 
)

Send a hard reset to the ca8210.

This should not be necessary, but is provided in case the ca8210 becomes unresponsive to spi.

Parameters
[in]resettimeThe length of time (in ms) to hold the reset pin active for. 1ms is usually a suitable value for this.
[in]pDeviceRefPointer to initialised ca821x_device_ref struct