CryptoAuthLib
Microchip CryptoAuthentication Library
ATCAIface (atca_)

Abstract interface to all CryptoAuth device types. This interface connects to the HAL implementation and abstracts the physical details of the device communication from all the upper layers of CryptoAuthLib. More...

Data Structures

struct  ATCAIfaceCfg
 
struct  atca_iface
 atca_iface is the C object backing ATCAIface. See the atca_iface.h file for details on the ATCAIface methods More...
 

Macros

#define ATCA_POST_DELAY_MSEC   25
 

Typedefs

typedef struct atca_ifaceATCAIface
 

Enumerations

enum  ATCAIfaceType {
  ATCA_I2C_IFACE, ATCA_SWI_IFACE, ATCA_UART_IFACE, ATCA_SPI_IFACE,
  ATCA_HID_IFACE, ATCA_CUSTOM_IFACE, ATCA_UNKNOWN_IFACE
}
 

Functions

ATCA_STATUS _atinit (ATCAIface ca_iface, ATCAHAL_t *hal)
 
ATCA_STATUS initATCAIface (ATCAIfaceCfg *cfg, ATCAIface ca_iface)
 Initializer for ATCAIface objects. More...
 
ATCAIface newATCAIface (ATCAIfaceCfg *cfg)
 Constructor for ATCAIface objects. More...
 
ATCA_STATUS atinit (ATCAIface ca_iface)
 Performs the HAL initialization by calling intermediate HAL wrapper function. If using the basic API, the atcab_init() function should be called instead. More...
 
ATCA_STATUS atsend (ATCAIface ca_iface, uint8_t *txdata, int txlength)
 Sends the data to the device by calling intermediate HAL wrapper function. More...
 
ATCA_STATUS atreceive (ATCAIface ca_iface, uint8_t *rxdata, uint16_t *rxlength)
 Receives data from the device by calling intermediate HAL wrapper function. More...
 
ATCA_STATUS atwake (ATCAIface ca_iface)
 Wakes up the device by calling intermediate HAL wrapper function. If using the basic API, the atcab_wakeup() function should be used instead. More...
 
ATCA_STATUS atidle (ATCAIface ca_iface)
 Puts the device into idle state by calling intermediate HAL wrapper function. If using the basic API, the atcab_idle() function should be used instead. More...
 
ATCA_STATUS atsleep (ATCAIface ca_iface)
 Puts the device into sleep state by calling intermediate HAL wrapper function. If using the basic API, the atcab_sleep() function should be used instead. More...
 
ATCAIfaceCfgatgetifacecfg (ATCAIface ca_iface)
 Returns the logical interface configuration for the device. More...
 
void * atgetifacehaldat (ATCAIface ca_iface)
 Returns the HAL data pointer for the device. More...
 
ATCA_STATUS releaseATCAIface (ATCAIface ca_iface)
 Instruct the HAL driver to release any resources associated with this interface. More...
 
void deleteATCAIface (ATCAIface *ca_iface)
 Instruct the HAL driver to release any resources associated with this interface, then delete the object. More...
 
ATCA_STATUS atpostinit (ATCAIface ca_iface)
 

Detailed Description

Abstract interface to all CryptoAuth device types. This interface connects to the HAL implementation and abstracts the physical details of the device communication from all the upper layers of CryptoAuthLib.

Macro Definition Documentation

◆ ATCA_POST_DELAY_MSEC

#define ATCA_POST_DELAY_MSEC   25

Typedef Documentation

◆ ATCAIface

typedef struct atca_iface* ATCAIface

Enumeration Type Documentation

◆ ATCAIfaceType

Enumerator
ATCA_I2C_IFACE 
ATCA_SWI_IFACE 
ATCA_UART_IFACE 
ATCA_SPI_IFACE 
ATCA_HID_IFACE 
ATCA_CUSTOM_IFACE 
ATCA_UNKNOWN_IFACE 

Function Documentation

◆ _atinit()

ATCA_STATUS _atinit ( ATCAIface  ca_iface,
ATCAHAL_t hal 
)

◆ atgetifacecfg()

ATCAIfaceCfg * atgetifacecfg ( ATCAIface  ca_iface)

Returns the logical interface configuration for the device.

Parameters
[in]ca_ifaceDevice interface.
Returns
Logical interface configuration.

◆ atgetifacehaldat()

void * atgetifacehaldat ( ATCAIface  ca_iface)

Returns the HAL data pointer for the device.

Parameters
[in]ca_ifaceDevice interface.
Returns
HAL data pointer.

◆ atidle()

ATCA_STATUS atidle ( ATCAIface  ca_iface)

Puts the device into idle state by calling intermediate HAL wrapper function. If using the basic API, the atcab_idle() function should be used instead.

Parameters
[in]ca_ifaceDevice to interact with.
Returns
ATCA_SUCCESS on success, otherwise an error code.

◆ atinit()

ATCA_STATUS atinit ( ATCAIface  ca_iface)

Performs the HAL initialization by calling intermediate HAL wrapper function. If using the basic API, the atcab_init() function should be called instead.

Parameters
[in]ca_ifaceDevice to interact with.
Returns
ATCA_SUCCESS on success, otherwise an error code.

◆ atpostinit()

ATCA_STATUS atpostinit ( ATCAIface  ca_iface)

◆ atreceive()

ATCA_STATUS atreceive ( ATCAIface  ca_iface,
uint8_t *  rxdata,
uint16_t *  rxlength 
)

Receives data from the device by calling intermediate HAL wrapper function.

Parameters
[in]ca_ifaceDevice to interact with.
[out]rxdataData received will be returned here.
[in,out]rxlengthAs input, the size of the rxdata buffer. As output, the number of bytes received.
Returns
ATCA_SUCCESS on success, otherwise an error code.

◆ atsend()

ATCA_STATUS atsend ( ATCAIface  ca_iface,
uint8_t *  txdata,
int  txlength 
)

Sends the data to the device by calling intermediate HAL wrapper function.

Parameters
[in]ca_ifaceDevice to interact with.
[in]txdataData to be transmitted to the device.
[in]txlengthNumber of bytes to be transmitted to the device.
Returns
ATCA_SUCCESS on success, otherwise an error code.

◆ atsleep()

ATCA_STATUS atsleep ( ATCAIface  ca_iface)

Puts the device into sleep state by calling intermediate HAL wrapper function. If using the basic API, the atcab_sleep() function should be used instead.

Parameters
[in]ca_ifaceDevice to interact with.
Returns
ATCA_SUCCESS on success, otherwise an error code.

◆ atwake()

ATCA_STATUS atwake ( ATCAIface  ca_iface)

Wakes up the device by calling intermediate HAL wrapper function. If using the basic API, the atcab_wakeup() function should be used instead.

Parameters
[in]ca_ifaceDevice to interact with.
Returns
ATCA_SUCCESS on success, otherwise an error code.

◆ deleteATCAIface()

void deleteATCAIface ( ATCAIface ca_iface)

Instruct the HAL driver to release any resources associated with this interface, then delete the object.

Parameters
[in]ca_ifaceDevice interface.

◆ initATCAIface()

ATCA_STATUS initATCAIface ( ATCAIfaceCfg cfg,
ATCAIface  ca_iface 
)

Initializer for ATCAIface objects.

Parameters
[in]cfgLogical configuration for the interface
[in]ca_ifaceInterface structure to initialize.
Returns
ATCA_SUCCESS on success, otherwise an error code.

◆ newATCAIface()

ATCAIface newATCAIface ( ATCAIfaceCfg cfg)

Constructor for ATCAIface objects.

Parameters
[in]cfgLogical configuration for the interface
Returns
New interface instance on success. NULL on failure.

◆ releaseATCAIface()

ATCA_STATUS releaseATCAIface ( ATCAIface  ca_iface)

Instruct the HAL driver to release any resources associated with this interface.

Parameters
[in]ca_ifaceDevice interface.
Returns
ATCA_SUCCESS on success, otherwise an error code.