CryptoAuthLib v3.7.6
Microchip CryptoAuthentication Library
 
Loading...
Searching...
No Matches
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  devtype_names_t
 
struct  ATCAIfaceCfg
 
struct  ATCAHAL_t
 HAL Driver Structure. More...
 
struct  atca_iface
 atca_iface is the context structure for a configured interface More...
 

Macros

#define ATCA_IFACECFG_NAME(x)   (x)
 
#define ATCA_IFACECFG_I2C_ADDRESS(c)   (c)->cfg.atcai2c.address
 
#define ATCA_IFACECFG_I2C_BAUD(c)   (c)->cfg.atcai2c.baud
 
#define ATCA_IFACECFG_VALUE(c, v)   (c)->cfg.v
 

Typedefs

typedef struct atca_ifaceATCAIface
 
typedef struct atca_iface atca_iface_t
 atca_iface is the context structure for a configured interface
 

Enumerations

enum  ATCAIfaceType {
  ATCA_I2C_IFACE = 0 , ATCA_SWI_IFACE = 1 , ATCA_UART_IFACE = 2 , ATCA_SPI_IFACE = 3 ,
  ATCA_HID_IFACE = 4 , ATCA_KIT_IFACE = 5 , ATCA_CUSTOM_IFACE = 6 , ATCA_I2C_GPIO_IFACE = 7 ,
  ATCA_SWI_GPIO_IFACE = 8 , ATCA_SPI_GPIO_IFACE = 9 , ATCA_UNKNOWN_IFACE = 0xFE
}
 
enum  ATCAKitType {
  ATCA_KIT_AUTO_IFACE , ATCA_KIT_I2C_IFACE , ATCA_KIT_SWI_IFACE , ATCA_KIT_SPI_IFACE ,
  ATCA_KIT_UNKNOWN_IFACE
}
 

Functions

ATCA_STATUS initATCAIface (ATCAIfaceCfg *cfg, ATCAIface ca_iface)
 Initializer for ATCAIface objects.
 
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.
 
ATCA_STATUS atsend (ATCAIface ca_iface, uint8_t word_address, uint8_t *txdata, int txlength)
 Sends the data to the device by calling intermediate HAL wrapper function.
 
ATCA_STATUS atreceive (ATCAIface ca_iface, uint8_t word_address, uint8_t *rxdata, uint16_t *rxlength)
 Receives data from the device by calling intermediate HAL wrapper function.
 
ATCA_STATUS atcontrol (ATCAIface ca_iface, uint8_t option, void *param, size_t paramlen)
 Perform control operations with the underlying hal driver.
 
ATCA_STATUS atwake (ATCAIface ca_iface)
 Wakes up the device by calling intermediate HAL wrapper function. The atcab_wakeup() function should be used instead.
 
ATCA_STATUS atidle (ATCAIface ca_iface)
 Puts the device into idle state by calling intermediate HAL wrapper function. The atcab_idle() function should be used instead.
 
ATCA_STATUS atsleep (ATCAIface ca_iface)
 Puts the device into sleep state by calling intermediate HAL wrapper function. The atcab_sleep() function should be used instead.
 
ATCAIfaceCfgatgetifacecfg (ATCAIface ca_iface)
 Returns the logical interface configuration for the device.
 
void * atgetifacehaldat (ATCAIface ca_iface)
 Returns the HAL data pointer for the device.
 
bool ifacetype_is_kit (ATCAIfaceType iface_type)
 Check if the given interface is a "kit protocol" one.
 
bool atca_iface_is_kit (ATCAIface ca_iface)
 Check if the given interface is configured as a "kit protocol" one where transactions are atomic.
 
bool atca_iface_is_swi (ATCAIface ca_iface)
 Check if the given interface is configured as a SWI.
 
int atca_iface_get_retries (ATCAIface ca_iface)
 Retrive the number of retries for a configured interface.
 
uint16_t atca_iface_get_wake_delay (ATCAIface ca_iface)
 Retrive the wake/retry delay for a configured interface/device.
 
uint8_t ifacecfg_get_address (ATCAIfaceCfg *cfg)
 Retrieves the device address given an interface configuration.
 
ATCA_STATUS ifacecfg_set_address (ATCAIfaceCfg *cfg, uint8_t address, ATCAKitType kitiface)
 Change the address of the selected device.
 
ATCA_STATUS releaseATCAIface (ATCAIface ca_iface)
 Instruct the HAL driver to release any resources associated with this interface.
 
void deleteATCAIface (ATCAIface *ca_iface)
 Instruct the HAL driver to release any resources associated with this interface, then delete the object.
 
ATCADeviceType iface_get_device_type_by_name (const char *name)
 Get the ATCADeviceType for a string that looks like a part number.
 

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.

Enumeration Type Documentation

◆ ATCAIfaceType

Enumerator
ATCA_I2C_IFACE 

Native I2C Driver

ATCA_SWI_IFACE 

SWI or 1-Wire over UART/USART

ATCA_UART_IFACE 

Kit v1 over UART/USART

ATCA_SPI_IFACE 

Native SPI Driver

ATCA_HID_IFACE 

Kit v1 over HID

ATCA_KIT_IFACE 

Kit v2 (Binary/Bridging)

ATCA_CUSTOM_IFACE 

Custom HAL functions provided during interface init

ATCA_I2C_GPIO_IFACE 

I2C "Bitbang" Driver

ATCA_SWI_GPIO_IFACE 

SWI or 1-Wire using a GPIO

ATCA_SPI_GPIO_IFACE 

SWI or 1-Wire using a GPIO

Function Documentation

◆ atca_iface_is_kit()

bool atca_iface_is_kit ( ATCAIface  ca_iface)

Check if the given interface is configured as a "kit protocol" one where transactions are atomic.

Returns
true if the interface is considered a kit

◆ atca_iface_is_swi()

bool atca_iface_is_swi ( ATCAIface  ca_iface)

Check if the given interface is configured as a SWI.

Returns
true if the interface is considered a kit

◆ atcontrol()

ATCA_STATUS atcontrol ( ATCAIface  ca_iface,
uint8_t  option,
void *  param,
size_t  paramlen 
)

Perform control operations with the underlying hal driver.

Parameters
[in]ca_ifaceDevice to interact with.
[in]optionControl parameter identifier
[in]paramOptional pointer to parameter value
[in]paramlenLength of the parameter
Returns
ATCA_SUCCESS on success, otherwise an error code.

◆ 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. The atcab_idle() function should be used instead.

Deprecated:
This function does not have defined behavior when ATCA_HAL_LEGACY_API is undefined.
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.

◆ atreceive()

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

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

Parameters
[in]ca_ifaceDevice to interact with.
[in]word_addressdevice transaction type
[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  word_address,
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]word_addressdevice transaction type
[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. The atcab_sleep() function should be used instead.

Deprecated:
This function does not have defined behavior when ATCA_HAL_LEGACY_API is undefined.
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. The atcab_wakeup() function should be used instead.

Deprecated:
This function does not have defined behavior when ATCA_HAL_LEGACY_API is undefined.
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.

◆ ifacecfg_set_address()

ATCA_STATUS ifacecfg_set_address ( ATCAIfaceCfg cfg,
uint8_t  address,
ATCAKitType  kitiface 
)

Change the address of the selected device.

Parameters
[in]cfgInterface configuration structure to update
[in]addressDesired address
[in]kitifaceOptional parameter to set the kit iface type

◆ ifacetype_is_kit()

bool ifacetype_is_kit ( ATCAIfaceType  iface_type)

Check if the given interface is a "kit protocol" one.

Returns
true if the interface type is considered a kit

◆ 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.

◆ 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.