CryptoAuthLib v3.7.6
Microchip CryptoAuthentication Library
 
Loading...
Searching...
No Matches
Hardware abstraction layer (hal_)

These methods define the hardware abstraction layer for communicating with a CryptoAuth device. More...

HAL Directory - Purpose

This directory contains all the Hardware Abstraction Layer (HAL) files used to adapt the upper levels of atca-ng and abstractions to physical hardware.HAL contains physical implementations for I2C, SWI, SPI, UART and timers for specific hardware platforms.Include just those HAL files you require based on platform type.

Cryptoauthlib HAL Architecture

Cryptoauthlib has several intermediate conceptual layers

  1. The highest layer of cryptoauthlib (outside of integration APIS) that may be used with an application is the atcab_ api functions. These are general purpose functions that present a simple and consistent crypto interface to the application regardless of the device being used.
  2. calib_, talib_ APIs are the library functions behind atcab_ ones that generate the correct command packets and process the received responses. Device specific logic is handled by the library here
  3. hal_ these functions perform the transmit/recieve of data for a given interface. These are split into sublayers
    • The HAL layer is the first hal layer that presents the interface expected by the higher level library. When using a native driver and no further interpretation is required this layer is all that is required.
    • The PHY layer if for hals that perform an interpretation or additional protocol logic. In this situation the HAL performs protocol interpretation while the phy performs the physical communication

HAL and PHY Requirements

The hal and phy layers have the same construction. A hal or phy must have the following functions and their signatures

  • ATCA_STATUS hal_<name>init(ATCAIface iface, ATCAIfaceCfg *cfg);
  • ATCA_STATUS hal<name>post_init(ATCAIface iface);
  • ATCA_STATUS hal<name>send(ATCAIface iface, uint8_t address, uint8_t *txdata, int txlength);
  • ATCA_STATUS hal<name>receive(ATCAIface iface, uint8_t address, uint8_t *rxdata, uint16_t *rxlength);
  • ATCA_STATUS hal<name>control(ATCAIface iface, uint8_t option, void* param, size_t paramlen);
  • ATCA_STATUS hal<name>_release(void *hal_data);

If the hal is a native driver no phy is required. See the tables below for which hal is required to be ported based on a configured interface

CryptoAuthLib Supported HAL Layers

Device Interface Physical Interface HAL PHY
i2c i2c hal_i2c
gpio hal_i2c_gpio hal_gpio
spi spi hal_spi
swi uart hal_swi hal_uart
gpio hal_swi_gpio hal_gpio
any uart kit hal_uart
hid kit hal_hid
any (user provided) kit_bridge

Microchip Harmony 3 for all PIC32 & ARM products - Use the Harmony 3 Configurator to generate and configure prjects

Obtain library and configure using Harmony 3

Interface Files API Notes
I2C hal_i2c_harmony.c plib.h For all Harmony 3 based projects
SPI hal_spi_harmony.c plib.h
UART hal_uart_harmony.c plib.h

Microchip 8 & 16 bit products - AVR, PIC16/18, PIC24/DSPIC

Obtain library and integration through Microchip Code Configurator

OS & RTOS integrations

Use CMake to configure the library in Linux, Windows, and MacOS environments

OS Interface Files API Notes
Linux I2C hal_linux_i2c_userspace.c/h i2c-dev
Linux SPI hal_linux_spi_userspace.c/h spidev
Linux/Mac hal_linux.c For all Linux/Mac projects
Windows hal_windows.c For all Windows projects
All kit-hid hal_all_platforms_kit_hidapi.c/h hidapi Works for Windows, Linux, and Mac
freeRTOS hal_freertos.c freeRTOS common routines

Legacy Support - <a href="https://www.microchip.com/start" >Atmel START</a> for AVR, ARM based processesors (SAM)

Interface Files API Notes
hal_timer_start.c START Timer implementation
I2C hal_i2c_start.c/h START
SWI swi_uart_start.c/h START SWI using UART

Legacy Support - ASF3 for ARM Cortex-m0 & Cortex-m based processors (SAM)

SAM Micros Interface Files API Notes
cortex-m0 I2C hal_sam0_i2c_asf.c/h ASF3 SAMD21, SAMB11, etc
cortex-m3/4/7 I2C hal_sam_i2c_asf.c/h ASF3 SAM4S, SAMG55, SAMV71, etc
all hal_sam_timer_asf.c ASF3 Common timer hal for all platforms

Data Structures

struct  atca_hal_kit_phy_t
 
struct  atca_hal_shm_t
 
struct  i2c_start_instance
 
struct  atca_i2c_host_s
 
struct  i2c_sam_instance
 
struct  atcaI2Cmaster
 this is the hal_data for ATCA HAL for ASF SERCOM More...
 
struct  atcaSWImaster
 this is the hal_data for ATCA HAL for ASF SERCOM More...
 

Macros

#define ATCA_POLLING_INIT_TIME_MSEC   1
 
#define ATCA_POLLING_FREQUENCY_TIME_MSEC   2
 
#define ATCA_POLLING_MAX_TIME_MSEC   2500
 
#define ATCA_HAL_CONTROL_WAKE   (0U)
 Execute the hardware specific wake - generally only for kits.
 
#define ATCA_HAL_CONTROL_IDLE   (1U)
 Execute the hardware specific idle - generally only for kits.
 
#define ATCA_HAL_CONTROL_SLEEP   (2U)
 Execute the hardware specific sleep - generally only for kits.
 
#define ATCA_HAL_CONTROL_RESET   (3U)
 Execute the hardware specific reset - generally only for kits.
 
#define ATCA_HAL_CONTROL_SELECT   (4U)
 Select the device - assert CS, open device, etc.
 
#define ATCA_HAL_CONTROL_DESELECT   (5U)
 Select the device - de-assert CS, release device, etc.
 
#define ATCA_HAL_CHANGE_BAUD   (6U)
 Change the datarate of the phy.
 
#define ATCA_HAL_FLUSH_BUFFER   (7U)
 If the phy has a buffer make sure all bytes are transmitted.
 
#define ATCA_HAL_CONTROL_DIRECTION   (8U)
 Set the PIN mode (in vs out)
 
#define MAX_I2C_BUSES   3
 
#define KIT_MAX_SCAN_COUNT   8
 
#define KIT_MAX_TX_BUF   32
 
#define KIT_TX_WRAP_SIZE   (10)
 
#define KIT_MSG_SIZE   (32u)
 
#define KIT_RX_WRAP_SIZE   (KIT_MSG_SIZE + 6u)
 
#define MAX_SWI_BUSES   6
 
#define RECEIVE_MODE   0
 
#define TRANSMIT_MODE   1
 
#define RX_DELAY   10
 
#define TX_DELAY   90
 
#define DEBUG_PIN_1   EXT2_PIN_5
 
#define DEBUG_PIN_2   EXT2_PIN_6
 
#define MAX_SWI_BUSES   6
 
#define RECEIVE_MODE   0
 
#define TRANSMIT_MODE   1
 
#define RX_DELAY   10
 
#define TX_DELAY   93
 

Typedefs

typedef void * hal_mutex_t
 Generic mutex type definition for most systems.
 
typedef void(* start_change_baudrate) (ATCAIface iface, uint32_t speed)
 
typedef struct i2c_start_instance i2c_start_instance_t
 
typedef struct atca_i2c_host_s atca_i2c_host_t
 
typedef void(* sam_change_baudrate) (ATCAIface iface, uint32_t speed)
 
typedef struct i2c_sam_instance i2c_sam_instance_t
 
typedef struct atcaI2Cmaster ATCAI2CMaster_t
 this is the hal_data for ATCA HAL for ASF SERCOM
 
typedef struct atcaSWImaster ATCASWIMaster_t
 this is the hal_data for ATCA HAL for ASF SERCOM
 
typedef struct atcaSWImaster ATCASWIMaster_t
 this is the hal_data for ATCA HAL for ASF SERCOM
 

Functions

ATCA_STATUS hal_iface_init (ATCAIfaceCfg *cfg, ATCAHAL_t **hal, ATCAHAL_t **phy)
 Standard HAL API for ATCA to initialize a physical interface.
 
ATCA_STATUS hal_iface_release (ATCAIfaceType iface_type, void *hal_data)
 releases a physical interface, HAL knows how to interpret hal_data
 
ATCA_STATUS hal_check_wake (const uint8_t *response, int response_size)
 Utility function for hal_wake to check the reply.
 
void atca_delay_ms (uint32_t ms)
 Timer API for legacy implementations.
 
void atca_delay_us (uint32_t delay)
 This function delays for a number of microseconds.
 
void hal_delay_ms (uint32_t delay)
 Timer API implemented at the HAL level.
 
void hal_delay_us (uint32_t delay)
 This function delays for a number of microseconds.
 
ATCA_STATUS hal_create_mutex (void **ppMutex, const char *pName)
 Optional hal interfaces.
 
ATCA_STATUS hal_init_mutex (void *pMutex, bool shared)
 
ATCA_STATUS hal_destroy_mutex (void *pMutex)
 
ATCA_STATUS hal_lock_mutex (void *pMutex)
 
ATCA_STATUS hal_unlock_mutex (void *pMutex)
 
ATCA_STATUS hal_alloc_shared (void **pShared, size_t size, const char *pName, bool *initialized)
 
ATCA_STATUS hal_free_shared (void *pShared, size_t size)
 
ATCA_STATUS hal_iface_register_hal (ATCAIfaceType iface_type, ATCAHAL_t *hal, ATCAHAL_t **old_hal, ATCAHAL_t *phy, ATCAHAL_t **old_phy)
 Register/Replace a HAL with a.
 
uint8_t hal_is_command_word (uint8_t word_address)
 Utility function for hal_wake to check the reply.
 
ATCA_STATUS hal_kit_hid_init (ATCAIface iface, ATCAIfaceCfg *cfg)
 HAL implementation of Kit USB HID init.
 
ATCA_STATUS hal_kit_hid_post_init (ATCAIface iface)
 HAL implementation of Kit HID post init.
 
ATCA_STATUS hal_kit_hid_send (ATCAIface iface, uint8_t word_address, uint8_t *txdata, int txlength)
 HAL implementation of kit protocol send over USB HID.
 
ATCA_STATUS hal_kit_hid_receive (ATCAIface iface, uint8_t word_address, uint8_t *rxdata, uint16_t *rxlength)
 HAL implementation of send over USB HID.
 
ATCA_STATUS hal_kit_hid_control (ATCAIface iface, uint8_t option, void *param, size_t paramlen)
 Perform control operations for the kit protocol.
 
ATCA_STATUS hal_kit_hid_release (void *hal_data)
 Close the physical port for HID.
 
void * hal_malloc (size_t size)
 
void hal_free (void *ptr)
 
void hal_rtos_delay_ms (uint32_t delay)
 This function delays for a number of milliseconds.
 
ATCA_STATUS hal_i2c_discover_buses (int i2c_buses[], int max_buses)
 discover i2c buses available for this hardware this maintains a list of logical to physical bus mappings freeing the application of the a-prior knowledge
 
ATCA_STATUS hal_i2c_discover_devices (int bus_num, ATCAIfaceCfg cfg[], int *found)
 discover any CryptoAuth devices on a given logical bus number
 
ATCA_STATUS hal_i2c_init (ATCAIface iface, ATCAIfaceCfg *cfg)
 hal_i2c_init manages requests to initialize a physical interface. it manages use counts so when an interface has released the physical layer, it will disable the interface for some other use. You can have multiple ATCAIFace instances using the same bus, and you can have multiple ATCAIFace instances on multiple i2c buses, so hal_i2c_init manages these things and ATCAIFace is abstracted from the physical details.
 
ATCA_STATUS hal_i2c_post_init (ATCAIface iface)
 HAL implementation of I2C post init.
 
ATCA_STATUS hal_i2c_send (ATCAIface iface, uint8_t word_address, uint8_t *txdata, int txlength)
 HAL implementation of I2C send over START.
 
ATCA_STATUS hal_i2c_receive (ATCAIface iface, uint8_t address, uint8_t *rxdata, uint16_t *rxlength)
 HAL implementation of I2C receive function for START I2C.
 
ATCA_STATUS change_i2c_speed (ATCAIface iface, uint32_t speed)
 method to change the bus speec of I2C
 
ATCA_STATUS hal_i2c_control (ATCAIface iface, uint8_t option, void *param, size_t paramlen)
 Perform control operations for the kit protocol.
 
ATCA_STATUS hal_i2c_release (void *hal_data)
 manages reference count on given bus and releases resource if no more refences exist
 
ATCA_STATUS hal_i2c_init (void *hal, ATCAIfaceCfg *cfg)
 hal_i2c_init manages requests to initialize a physical interface. it manages use counts so when an interface has released the physical layer, it will disable the interface for some other use. You can have multiple ATCAIFace instances using the same bus, and you can have multiple ATCAIFace instances on multiple i2c buses, so hal_i2c_init manages these things and ATCAIFace is abstracted from the physical details.
 
ATCA_STATUS hal_i2c_wake (ATCAIface iface)
 wake up CryptoAuth device using I2C bus
 
ATCA_STATUS hal_i2c_idle (ATCAIface iface)
 idle CryptoAuth device using I2C bus
 
ATCA_STATUS hal_i2c_sleep (ATCAIface iface)
 sleep CryptoAuth device using I2C bus
 
ATCA_STATUS hal_kit_attach_phy (ATCAIfaceCfg *cfg, atca_hal_kit_phy_t *phy)
 Helper function that connects a physical layer context structure that will be used by the kit protocol bridge.
 
ATCA_STATUS hal_kit_init (ATCAIface iface, ATCAIfaceCfg *cfg)
 HAL implementation of Kit USB HID init.
 
ATCA_STATUS hal_kit_post_init (ATCAIface iface)
 HAL implementation of Kit HID post init.
 
ATCA_STATUS hal_kit_send (ATCAIface iface, uint8_t word_address, uint8_t *txdata, int txlength)
 HAL implementation of kit protocol send over USB HID.
 
ATCA_STATUS hal_kit_receive (ATCAIface iface, uint8_t word_address, uint8_t *rxdata, uint16_t *rxsize)
 HAL implementation of send over USB HID.
 
ATCA_STATUS hal_kit_control (ATCAIface iface, uint8_t option, void *param, size_t paramlen)
 Kit Protocol Control.
 
ATCA_STATUS hal_kit_release (void *hal_data)
 Close the physical port for HID.
 
ATCA_STATUS hal_check_pid (hal_pid_t pid)
 Check if the pid exists in the system.
 
void atca_delay_10us (uint32_t delay)
 This function delays for a number of tens of microseconds.
 
ATCA_STATUS hal_spi_discover_buses (int spi_buses[], int max_buses)
 discover spi buses available for this hardware this maintains a list of logical to physical bus mappings freeing the application of the a-priori knowledge
 
ATCA_STATUS hal_spi_discover_devices (int bus_num, ATCAIfaceCfg cfg[], int *found)
 discover any TA10x devices on a given logical bus number
 
ATCA_STATUS hal_spi_init (ATCAIface iface, ATCAIfaceCfg *cfg)
 initialize an SPI interface using given config
 
ATCA_STATUS hal_spi_post_init (ATCAIface iface)
 HAL implementation of SPI post init.
 
ATCA_STATUS hal_spi_select (ATCAIface iface)
 HAL implementation to assert the device chip select.
 
ATCA_STATUS hal_spi_deselect (ATCAIface iface)
 HAL implementation to deassert the device chip select.
 
ATCA_STATUS hal_spi_send (ATCAIface iface, uint8_t word_address, uint8_t *txdata, int txlength)
 HAL implementation of SPI send over Harmony.
 
ATCA_STATUS hal_spi_receive (ATCAIface iface, uint8_t word_address, uint8_t *rxdata, uint16_t *rxlength)
 HAL implementation of SPI receive function for HARMONY SPI.
 
ATCA_STATUS hal_spi_control (ATCAIface iface, uint8_t option, void *param, size_t paramlen)
 Perform control operations for the kit protocol.
 
ATCA_STATUS hal_spi_release (void *hal_data)
 manages reference count on given bus and releases resource if no more refences exist
 
ATCA_STATUS hal_swi_init (ATCAIface iface, ATCAIfaceCfg *cfg)
 initialize an SWI interface using given config
 
ATCA_STATUS hal_swi_post_init (ATCAIface iface)
 HAL implementation of SWI post init.
 
ATCA_STATUS hal_swi_send (ATCAIface iface, uint8_t word_address, uint8_t *txdata, int txlength)
 HAL implementation of SWI send command over UART.
 
ATCA_STATUS hal_swi_receive (ATCAIface iface, uint8_t word_address, uint8_t *rxdata, uint16_t *rxlength)
 HAL implementation of SWI receive function over UART.
 
ATCA_STATUS hal_swi_wake (ATCAIface iface)
 Send Wake flag via SWI.
 
ATCA_STATUS hal_swi_sleep (ATCAIface iface)
 Send Sleep flag via SWI.
 
ATCA_STATUS hal_swi_idle (ATCAIface iface)
 Send Idle flag via SWI.
 
ATCA_STATUS hal_swi_control (ATCAIface iface, uint8_t option, void *param, size_t paramlen)
 Perform control operations for the kit protocol.
 
ATCA_STATUS hal_swi_release (void *hal_data)
 manages reference count on given bus and releases resource if no more refences exist
 
const char * kit_id_from_devtype (ATCADeviceType devtype)
 
const char * kit_interface_from_kittype (ATCAKitType kittype)
 
const char * kit_interface (ATCAKitType kittype)
 
ATCA_STATUS kit_init (ATCAIface iface, ATCAIfaceCfg *cfg)
 
ATCA_STATUS kit_post_init (ATCAIface iface)
 
ATCA_STATUS kit_send (ATCAIface iface, uint8_t word_address, uint8_t *txdata, int txlength)
 
ATCA_STATUS kit_receive (ATCAIface iface, uint8_t word_address, uint8_t *rxdata, uint16_t *rxsize)
 
ATCA_STATUS kit_control (ATCAIface iface, uint8_t option, void *param, size_t paramlen)
 
ATCA_STATUS kit_release (void *hal_data)
 
ATCA_STATUS kit_wrap_cmd (ATCAIface iface, uint8_t word_address, const uint8_t *txdata, int txlen, char *pkitcmd, int *nkitcmd)
 
ATCA_STATUS kit_parse_rsp (const char *pkitbuf, int nkitbuf, uint8_t *kitstatus, uint8_t *rxdata, int *datasize)
 
ATCA_STATUS kit_wake (ATCAIface iface)
 
ATCA_STATUS kit_idle (ATCAIface iface)
 
ATCA_STATUS kit_sleep (ATCAIface iface)
 
ATCA_STATUS kit_phy_send (ATCAIface iface, uint8_t *txdata, int txlength)
 
ATCA_STATUS kit_phy_receive (ATCAIface iface, uint8_t *rxdata, int *rxsize)
 
ATCA_STATUS swi_uart_init (ATCASWIMaster_t *instance)
 Implementation of SWI UART init.
 
ATCA_STATUS swi_uart_deinit (ATCASWIMaster_t *instance)
 Implementation of SWI UART deinit.
 
void swi_uart_setbaud (ATCASWIMaster_t *instance, uint32_t baudrate)
 implementation of SWI UART change baudrate.
 
void swi_uart_mode (ATCASWIMaster_t *instance, uint8_t mode)
 implementation of SWI UART change mode.
 
void swi_uart_discover_buses (int swi_uart_buses[], int max_buses)
 discover UART buses available for this hardware this maintains a list of logical to physical bus mappings freeing the application of the a-priori knowledge
 
ATCA_STATUS swi_uart_send_byte (ATCASWIMaster_t *instance, uint8_t data)
 HAL implementation of SWI UART send byte over ASF. This function send one byte over UART.
 
ATCA_STATUS swi_uart_receive_byte (ATCASWIMaster_t *instance, uint8_t *data)
 HAL implementation of SWI UART receive bytes over ASF. This function receive one byte over UART.
 

Variables

struct port_config pin_conf
 

Detailed Description

These methods define the hardware abstraction layer for communicating with a CryptoAuth device.

These methods define the hardware abstraction layer for communicating with a CryptoAuth device using SWI Interface.

These methods define the hardware abstraction layer for communicating with a TA10x device.

< Uncomment when debugging

These methods define the hardware abstraction layer for communicating with a CryptoAuth device using I2C driver of ASF.

Macro Definition Documentation

◆ MAX_SWI_BUSES [1/2]

#define MAX_SWI_BUSES   6
  • this HAL implementation assumes you've included the ASF SERCOM UART libraries in your project, otherwise, the HAL layer will not compile because the ASF UART drivers are a dependency *

◆ MAX_SWI_BUSES [2/2]

#define MAX_SWI_BUSES   6
  • this HAL implementation assumes you've included the ASF SERCOM UART libraries in your project, otherwise, the HAL layer will not compile because the ASF UART drivers are a dependency *

Function Documentation

◆ atca_delay_10us()

void atca_delay_10us ( uint32_t  delay)

This function delays for a number of tens of microseconds.

Parameters
[in]delaynumber of 0.01 milliseconds to delay
Parameters
[in]delaynumber of 0.01 milliseconds to delay

◆ atca_delay_ms()

void atca_delay_ms ( uint32_t  delay)

Timer API for legacy implementations.

This function delays for a number of milliseconds.

   You can override this function if you like to do
   something else in your system while delaying.
Parameters
[in]delaynumber of milliseconds to delay
   You can override this function if you like to do
   something else in your system while delaying.
Parameters
[in]delaynumber of milliseconds to delay

◆ atca_delay_us()

void atca_delay_us ( uint32_t  delay)

This function delays for a number of microseconds.

Parameters
[in]delaynumber of 0.001 milliseconds to delay
Parameters
[in]delaynumber of microseconds to delay
Parameters
[in]delaynumber of 0.001 milliseconds to delay

◆ change_i2c_speed()

ATCA_STATUS change_i2c_speed ( ATCAIface  iface,
uint32_t  speed 
)

method to change the bus speec of I2C

method to change the bus speed of I2C

Parameters
[in]ifaceinterface on which to change bus speed
[in]speedbaud rate (typically 100000 or 400000)
[in]ifaceinterface on which to change bus speed
[in]speedbaud rate (typically 100000 or 400000)
Returns
ATCA_SUCCESS on success, otherwise an error code.

◆ hal_check_wake()

ATCA_STATUS hal_check_wake ( const uint8_t *  response,
int  response_size 
)

Utility function for hal_wake to check the reply.

Parameters
[in]responseWake response to be checked.
[in]response_sizeSize of the response to check.
Returns
ATCA_SUCCESS for expected wake, ATCA_STATUS_SELFTEST_ERROR if the power on self test failed, ATCA_WAKE_FAILED for other failures.

◆ hal_create_mutex()

ATCA_STATUS hal_create_mutex ( void **  ppMutex,
const char *  pName 
)

Optional hal interfaces.

Application callback for creating a mutex object.

Parameters
[in,out]ppMutexlocation to receive ptr to mutex
[in,out]pNameString used to identify the mutex
[IN/OUT]ppMutex location to receive ptr to mutex
[IN]pName Name of the mutex for systems using named objects

◆ hal_delay_ms()

void hal_delay_ms ( uint32_t  delay)

Timer API implemented at the HAL level.

This function delays for a number of milliseconds.

Parameters
[in]delaynumber of milliseconds to delay
   You can override this function if you like to do
   something else in your system while delaying.
Parameters
[in]delaynumber of milliseconds to delay

◆ hal_delay_us()

void hal_delay_us ( uint32_t  delay)

This function delays for a number of microseconds.

Parameters
[in]delaynumber of microseconds to delay
Parameters
[in]delaynumber of microseconds to delay

◆ hal_i2c_control()

ATCA_STATUS hal_i2c_control ( ATCAIface  iface,
uint8_t  option,
void *  param,
size_t  paramlen 
)

Perform control operations for the kit protocol.

Parameters
[in]ifaceInterface 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.

◆ hal_i2c_discover_buses()

ATCA_STATUS hal_i2c_discover_buses ( int  i2c_buses[],
int  max_buses 
)

discover i2c buses available for this hardware this maintains a list of logical to physical bus mappings freeing the application of the a-prior knowledge

This HAL implementation assumes you've included the ASF TWI libraries in your project, otherwise, the HAL layer will not compile because the ASF TWI drivers are a dependency.

logical to physical bus mapping structure

discover i2c buses available for this hardware this maintains a list of logical to physical bus mappings freeing the application of the a-priori knowledge

Parameters
[in]i2c_buses- an array of logical bus numbers
[in]max_buses- maximum number of buses the app wants to attempt to discover
Returns
ATCA_SUCCESS

discover i2c buses available for this hardware this maintains a list of logical to physical bus mappings freeing the application of the a-priori knowledge

Parameters
[in]i2c_buses- an array of logical bus numbers
[in]max_buses- maximum number of buses the app wants to attempt to discover
Returns
ATCA_SUCCESS

discover i2c buses available for this hardware this maintains a list of logical to physical bus mappings freeing the application of the a-priori knowledge

Parameters
[in]i2c_buses- an array of logical bus numbers
[in]max_buses- maximum number of buses the app wants to attempt to discover return ATCA_SUCCESS

◆ hal_i2c_discover_devices()

ATCA_STATUS hal_i2c_discover_devices ( int  bus_num,
ATCAIfaceCfg  cfg[],
int *  found 
)

discover any CryptoAuth devices on a given logical bus number

Parameters
[in]bus_numlogical bus number on which to look for CryptoAuth devices
[out]cfgpointer to head of an array of interface config structures which get filled in by this method
[out]foundnumber of devices found on this bus
Returns
ATCA_SUCCESS
Parameters
[in]bus_num- logical bus number on which to look for CryptoAuth devices
[out]cfg[]- pointer to head of an array of interface config structures which get filled in by this method
[out]*found- number of devices found on this bus
Returns
ATCA_SUCCESS
Parameters
[in]bus_numLogical bus number on which to look for CryptoAuth devices
[out]cfgPointer to head of an array of interface config structures which get filled in by this method
[out]foundNumber of devices found on this bus
Returns
ATCA_SUCCESS on success, otherwise an error code.

◆ hal_i2c_idle()

ATCA_STATUS hal_i2c_idle ( ATCAIface  iface)

idle CryptoAuth device using I2C bus

Parameters
[in]ifaceinterface to logical device to idle
Returns
ATCA_SUCCESS on success, otherwise an error code.
Parameters
[in]ifaceinterface to logical device to idle
Returns
ATCA_SUCCESS on success, otherwise an error code.

◆ hal_i2c_init() [1/2]

ATCA_STATUS hal_i2c_init ( ATCAIface  iface,
ATCAIfaceCfg cfg 
)

hal_i2c_init manages requests to initialize a physical interface. it manages use counts so when an interface has released the physical layer, it will disable the interface for some other use. You can have multiple ATCAIFace instances using the same bus, and you can have multiple ATCAIFace instances on multiple i2c buses, so hal_i2c_init manages these things and ATCAIFace is abstracted from the physical details.

HAL implementation of I2C init.

  • this HAL implementation assumes you've included the START Twi libraries in your project, otherwise, the HAL layer will not compile because the START TWI drivers are a dependency *

initialize an I2C interface using given config

Parameters
[in]hal- opaque ptr to HAL data
[in]cfg- interface configuration
Returns
ATCA_SUCCESS on success, otherwise an error code.

this implementation assumes I2C peripheral has been enabled by user. It only initialize an I2C interface using given config.

Parameters
[in]halpointer to HAL specific data that is maintained by this HAL
[in]cfgpointer to HAL specific configuration data that is used to initialize this HAL
Returns
ATCA_SUCCESS on success, otherwise an error code.

◆ hal_i2c_init() [2/2]

ATCA_STATUS hal_i2c_init ( void *  hal,
ATCAIfaceCfg cfg 
)

hal_i2c_init manages requests to initialize a physical interface. it manages use counts so when an interface has released the physical layer, it will disable the interface for some other use. You can have multiple ATCAIFace instances using the same bus, and you can have multiple ATCAIFace instances on multiple i2c buses, so hal_i2c_init manages these things and ATCAIFace is abstracted from the physical details.

hal_i2c_init manages requests to initialize a physical interface. It manages use counts so when an interface has released the physical layer, it will disable the interface for some other use. You can have multiple ATCAIFace instances using the same bus, and you can have multiple ATCAIFace instances on multiple i2c buses, so hal_i2c_init manages these things and ATCAIFace is abstracted from the physical details.

initialize an I2C interface using given config

  • this HAL implementation assumes you've included the START Twi libraries in your project, otherwise, the HAL layer will not compile because the START TWI drivers are a dependency *

initialize an I2C interface using given config

Parameters
[in]hal- opaque ptr to HAL data
[in]cfg- interface configuration
Returns
ATCA_SUCCESS on success, otherwise an error code.
  • this HAL implementation assumes you've included the ASF SERCOM I2C libraries in your project, otherwise, the HAL layer will not compile because the ASF I2C drivers are a dependency *
    Parameters
    [in]hal- opaque ptr to HAL data
    [in]cfg- interface configuration
    Returns
    ATCA_SUCCESS on success, otherwise an error code.
    initialize an I2C interface using given config
Parameters
[in]hal- opaque ptr to HAL data
[in]cfg- interface configuration
Returns
ATCA_SUCCESS on success, otherwise an error code.
  • this HAL implementation assumes you've included the ASF Twi libraries in your project, otherwise, the HAL layer will not compile because the ASF TWI drivers are a dependency *

initialize an I2C interface using given config

Parameters
[in]hal- opaque ptr to HAL data
[in]cfg- interface configuration
Returns
ATCA_SUCCESS on success, otherwise an error code.

◆ hal_i2c_post_init()

ATCA_STATUS hal_i2c_post_init ( ATCAIface  iface)

HAL implementation of I2C post init.

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

◆ hal_i2c_receive()

ATCA_STATUS hal_i2c_receive ( ATCAIface  iface,
uint8_t  word_address,
uint8_t *  rxdata,
uint16_t *  rxlength 
)

HAL implementation of I2C receive function for START I2C.

HAL implementation of I2C receive function for ASF I2C.

HAL implementation of I2C receive function.

Parameters
[in]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.
Parameters
[in]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.
Parameters
[in]ifaceDevice to interact with.
[in]addressdevice address
[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.
Parameters
[in]ifaceDevice to interact with.
[in]word_addressdevice word address
[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.

◆ hal_i2c_release()

ATCA_STATUS hal_i2c_release ( void *  hal_data)

manages reference count on given bus and releases resource if no more refences exist

manages reference count on given bus and releases resource if no more refernces exist

Parameters
[in]hal_data- opaque pointer to hal data structure - known only to the HAL implementation
Returns
ATCA_SUCCESS on success, otherwise an error code.
Parameters
[in]hal_data- opaque pointer to hal data structure - known only to the HAL implementation return ATCA_SUCCESS
Parameters
[in]hal_data- opaque pointer to hal data structure - known only to the HAL implementation
Returns
ATCA_SUCCESS on success, otherwise an error code.
Parameters
[in]hal_data- opaque pointer to hal data structure - known only to the HAL implementation
Returns
ATCA_SUCCESS

◆ hal_i2c_send()

ATCA_STATUS hal_i2c_send ( ATCAIface  iface,
uint8_t  word_address,
uint8_t *  txdata,
int  txlength 
)

HAL implementation of I2C send over START.

HAL implementation of I2C send over ASF.

HAL implementation of I2C send.

Parameters
[in]ifaceinstance
[in]word_addressdevice transaction type
[in]txdatapointer to space to bytes to send
[in]txlengthnumber of bytes to send
Returns
ATCA_SUCCESS on success, otherwise an error code.
Parameters
[in]ifaceinstance
[in]txdatapointer to space to bytes to send
[in]txlengthnumber of bytes to send
Returns
ATCA_SUCCESS on success, otherwise an error code.
Parameters
[in]ifaceinstance
[in]word_addressdevice word address
[in]txdatapointer to space to bytes to send
[in]txlengthnumber of bytes to send
Returns
ATCA_SUCCESS on success, otherwise an error code.
Parameters
[in]ifaceinstance
[in]word_addressdevice word address
[in]txdatapointer to space to bytes to send
[in]txlengthnumber of bytes to send
Returns
ATCA_SUCCESS on success, otherwise an error code.

Add 1 byte for word address

Add 1 byte for word address

◆ hal_i2c_sleep()

ATCA_STATUS hal_i2c_sleep ( ATCAIface  iface)

sleep CryptoAuth device using I2C bus

Parameters
[in]ifaceinterface to logical device to sleep
Returns
ATCA_SUCCESS on success, otherwise an error code.
Parameters
[in]ifaceinterface to logical device to sleep
Returns
ATCA_SUCCESS on success, otherwise an error code.

◆ hal_i2c_wake()

ATCA_STATUS hal_i2c_wake ( ATCAIface  iface)

wake up CryptoAuth device using I2C bus

Parameters
[in]ifaceinterface to logical device to wakeup
Returns
ATCA_SUCCESS on success, otherwise an error code.
Parameters
[in]ifaceinterface to logical device to wakeup
Returns
ATCA_SUCCESS on success, otherwise an error code.

◆ hal_iface_init()

ATCA_STATUS hal_iface_init ( ATCAIfaceCfg cfg,
ATCAHAL_t **  hal,
ATCAHAL_t **  phy 
)

Standard HAL API for ATCA to initialize a physical interface.

Parameters
[in]cfgpointer to ATCAIfaceCfg object
[in]halpointer to ATCAHAL_t intermediate data structure
Returns
ATCA_SUCCESS on success, otherwise an error code.

◆ hal_iface_register_hal()

ATCA_STATUS hal_iface_register_hal ( ATCAIfaceType  iface_type,
ATCAHAL_t hal,
ATCAHAL_t **  old_hal,
ATCAHAL_t phy,
ATCAHAL_t **  old_phy 
)

Register/Replace a HAL with a.

Parameters
[in]iface_type- the type of physical interface to register
[in]halpointer to the new ATCAHAL_t structure to register
[out]oldpointer to the existing ATCAHAL_t structure
Returns
ATCA_SUCCESS on success, otherwise an error code.

◆ hal_iface_release()

ATCA_STATUS hal_iface_release ( ATCAIfaceType  iface_type,
void *  hal_data 
)

releases a physical interface, HAL knows how to interpret hal_data

Parameters
[in]iface_type- the type of physical interface to release
[in]hal_data- pointer to opaque hal data maintained by HAL implementation for this interface type
Returns
ATCA_SUCCESS on success, otherwise an error code.

◆ hal_is_command_word()

uint8_t hal_is_command_word ( uint8_t  word_address)

Utility function for hal_wake to check the reply.

Parameters
[in]word_addressCommand to check
Returns
true if the word_address is considered a command

◆ hal_kit_attach_phy()

ATCA_STATUS hal_kit_attach_phy ( ATCAIfaceCfg cfg,
atca_hal_kit_phy_t phy 
)

Helper function that connects a physical layer context structure that will be used by the kit protocol bridge.

Returns
ATCA_STATUS
Parameters
cfg[IN] Interface configuration structure
phy[IN] Structure with physical layer interface functions and context

◆ hal_kit_control()

ATCA_STATUS hal_kit_control ( ATCAIface  iface,
uint8_t  option,
void *  param,
size_t  paramlen 
)

Kit Protocol Control.

Parameters
[in]ifaceATCAIface instance that is the interface object to send the bytes over
[in]optionControl option to use
Returns
ATCA_STATUS

◆ hal_kit_hid_control()

ATCA_STATUS hal_kit_hid_control ( ATCAIface  iface,
uint8_t  option,
void *  param,
size_t  paramlen 
)

Perform control operations for the kit protocol.

Parameters
[in]ifaceInterface 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.

◆ hal_kit_hid_init()

ATCA_STATUS hal_kit_hid_init ( ATCAIface  iface,
ATCAIfaceCfg cfg 
)

HAL implementation of Kit USB HID init.

Parameters
[in]halpointer to HAL specific data that is maintained by this HAL
[in]cfgpointer to HAL specific configuration data that is used to initialize this HAL
Returns
ATCA_STATUS

◆ hal_kit_hid_post_init()

ATCA_STATUS hal_kit_hid_post_init ( ATCAIface  iface)

HAL implementation of Kit HID post init.

Parameters
[in]ifaceinstance
Returns
ATCA_STATUS

◆ hal_kit_hid_receive()

ATCA_STATUS hal_kit_hid_receive ( ATCAIface  iface,
uint8_t  word_address,
uint8_t *  rxdata,
uint16_t *  rxlength 
)

HAL implementation of send over USB HID.

Parameters
[in]ifaceinstance
[in]word_addressdetermine device transaction type
[in]rxdatapointer to space to receive the data
[in,out]rxsizeptr to expected number of receive bytes to request
Returns
ATCA_STATUS

◆ hal_kit_hid_release()

ATCA_STATUS hal_kit_hid_release ( void *  hal_data)

Close the physical port for HID.

Parameters
[in]hal_dataThe hardware abstraction data specific to this HAL
Returns
ATCA_STATUS

◆ hal_kit_hid_send()

ATCA_STATUS hal_kit_hid_send ( ATCAIface  iface,
uint8_t  word_address,
uint8_t *  txdata,
int  txlength 
)

HAL implementation of kit protocol send over USB HID.

Parameters
[in]ifaceinstance
[in]word_addressdetermine device transaction type
[in]txdatapointer to bytes to send
[in]txlengthnumber of bytes to send
Returns
ATCA_STATUS

◆ hal_kit_init()

ATCA_STATUS hal_kit_init ( ATCAIface  iface,
ATCAIfaceCfg cfg 
)

HAL implementation of Kit USB HID init.

Parameters
[in]ifaceinstance
[in]cfgpointer to HAL specific configuration data that is used to initialize this HAL
Returns
ATCA_STATUS

◆ hal_kit_post_init()

ATCA_STATUS hal_kit_post_init ( ATCAIface  iface)

HAL implementation of Kit HID post init.

Parameters
[in]ifaceinstance
Returns
ATCA_STATUS

◆ hal_kit_receive()

ATCA_STATUS hal_kit_receive ( ATCAIface  iface,
uint8_t  word_address,
uint8_t *  rxdata,
uint16_t *  rxsize 
)

HAL implementation of send over USB HID.

Parameters
[in]ifaceinstance
[in]word_addressdetermine device transaction type
[in]rxdatapointer to space to receive the data
[in,out]rxsizeptr to expected number of receive bytes to request
Returns
ATCA_STATUS

◆ hal_kit_release()

ATCA_STATUS hal_kit_release ( void *  hal_data)

Close the physical port for HID.

Parameters
[in]hal_dataThe hardware abstraction data specific to this HAL
Returns
ATCA_STATUS

◆ hal_kit_send()

ATCA_STATUS hal_kit_send ( ATCAIface  iface,
uint8_t  word_address,
uint8_t *  txdata,
int  txlength 
)

HAL implementation of kit protocol send over USB HID.

Parameters
[in]ifaceinstance
[in]word_addressdetermine device transaction type
[in]txdatapointer to bytes to send
[in]txlengthnumber of bytes to send
Returns
ATCA_STATUS

Add 1 byte to txlength for word address

◆ hal_rtos_delay_ms()

void hal_rtos_delay_ms ( uint32_t  delay)

This function delays for a number of milliseconds.

   You can override this function if you like to do
   something else in your system while delaying.
Parameters
[in]delayNumber of milliseconds to delay

◆ hal_spi_control()

ATCA_STATUS hal_spi_control ( ATCAIface  iface,
uint8_t  option,
void *  param,
size_t  paramlen 
)

Perform control operations for the kit protocol.

Parameters
[in]ifaceInterface 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.

◆ hal_spi_deselect()

ATCA_STATUS hal_spi_deselect ( ATCAIface  iface)

HAL implementation to deassert the device chip select.

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

◆ hal_spi_discover_buses()

ATCA_STATUS hal_spi_discover_buses ( int  spi_buses[],
int  max_buses 
)

discover spi buses available for this hardware this maintains a list of logical to physical bus mappings freeing the application of the a-priori knowledge

Parameters
[in]spi_buses- an array of logical bus numbers
[in]max_buses- maximum number of buses the app wants to attempt to discover
Returns
ATCA_SUCCESS

◆ hal_spi_discover_devices()

ATCA_STATUS hal_spi_discover_devices ( int  bus_num,
ATCAIfaceCfg  cfg[],
int *  found 
)

discover any TA10x devices on a given logical bus number

Parameters
[in]bus_numlogical bus number on which to look for TA10x devices
[out]cfgpointer to head of an array of interface config structures which get filled in by this method
[out]foundnumber of devices found on this bus
Returns
ATCA_SUCCESS

◆ hal_spi_init()

ATCA_STATUS hal_spi_init ( ATCAIface  iface,
ATCAIfaceCfg cfg 
)

initialize an SPI interface using given config

Parameters
[in]hal- opaque ptr to HAL data
[in]cfg- interface configuration
Returns
ATCA_SUCCESS on success, otherwise an error code.

◆ hal_spi_post_init()

ATCA_STATUS hal_spi_post_init ( ATCAIface  iface)

HAL implementation of SPI post init.

Parameters
[in]ifaceinstance
Returns
ATCA_SUCCESS

◆ hal_spi_receive()

ATCA_STATUS hal_spi_receive ( ATCAIface  iface,
uint8_t  word_address,
uint8_t *  rxdata,
uint16_t *  rxlength 
)

HAL implementation of SPI receive function for HARMONY SPI.

Parameters
[in]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.

◆ hal_spi_release()

ATCA_STATUS hal_spi_release ( void *  hal_data)

manages reference count on given bus and releases resource if no more refences exist

Parameters
[in]hal_data- opaque pointer to hal data structure - known only to the HAL implementation
Returns
ATCA_SUCCESS on success, otherwise an error code.

◆ hal_spi_select()

ATCA_STATUS hal_spi_select ( ATCAIface  iface)

HAL implementation to assert the device chip select.

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

◆ hal_spi_send()

ATCA_STATUS hal_spi_send ( ATCAIface  iface,
uint8_t  word_address,
uint8_t *  txdata,
int  txlength 
)

HAL implementation of SPI send over Harmony.

Parameters
[in]ifaceinstance
[in]word_addressdevice transaction type
[in]txdatapointer to space to bytes to send
[in]txlengthnumber of bytes to send
Returns
ATCA_SUCCESS on success, otherwise an error code.

◆ hal_swi_control()

ATCA_STATUS hal_swi_control ( ATCAIface  iface,
uint8_t  option,
void *  param,
size_t  paramlen 
)

Perform control operations for the kit protocol.

Parameters
[in]ifaceInterface 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.

◆ hal_swi_idle()

ATCA_STATUS hal_swi_idle ( ATCAIface  iface)

Send Idle flag via SWI.

Parameters
[in]ifaceinterface of the logical device to idle
Returns
ATCA_SUCCES

◆ hal_swi_init()

ATCA_STATUS hal_swi_init ( ATCAIface  iface,
ATCAIfaceCfg cfg 
)

initialize an SWI interface using given config

Parameters
[in]hal- opaque ptr to HAL data
[in]cfg- interface configuration
Returns
ATCA_SUCCESS on success, otherwise an error code.

◆ hal_swi_post_init()

ATCA_STATUS hal_swi_post_init ( ATCAIface  iface)

HAL implementation of SWI post init.

Parameters
[in]ifaceinstance
Returns
ATCA_SUCCESS

◆ hal_swi_receive()

ATCA_STATUS hal_swi_receive ( ATCAIface  iface,
uint8_t  word_address,
uint8_t *  rxdata,
uint16_t *  rxlength 
)

HAL implementation of SWI receive function over UART.

Parameters
[in]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.

◆ hal_swi_release()

ATCA_STATUS hal_swi_release ( void *  hal_data)

manages reference count on given bus and releases resource if no more refences exist

Parameters
[in]hal_data- opaque pointer to hal data structure - known only to the HAL implementation
Returns
ATCA_SUCCESS on success, otherwise an error code.

◆ hal_swi_send()

ATCA_STATUS hal_swi_send ( ATCAIface  iface,
uint8_t  word_address,
uint8_t *  txdata,
int  txlength 
)

HAL implementation of SWI send command over UART.

Parameters
[in]ifaceinstance
[in]word_addressdevice transaction type
[in]txdatapointer to space to bytes to send
[in]txlengthnumber of bytes to send
Returns
ATCA_SUCCESS on success, otherwise an error code.

Send word address

Send data

◆ hal_swi_sleep()

ATCA_STATUS hal_swi_sleep ( ATCAIface  iface)

Send Sleep flag via SWI.

Parameters
[in]ifaceinterface of the logical device to sleep
Returns
ATCA_SUCCESS

◆ hal_swi_wake()

ATCA_STATUS hal_swi_wake ( ATCAIface  iface)

Send Wake flag via SWI.

Parameters
[in]ifaceinterface of the logical device to wake up
Returns
ATCA_SUCCESS on success, otherwise an error code.

◆ kit_id_from_devtype()

const char * kit_id_from_devtype ( ATCADeviceType  devtype)

Kit Protocol is key

◆ kit_interface()

const char * kit_interface ( ATCAKitType  kittype)

Kit parser physical interface string

◆ kit_interface_from_kittype()

const char * kit_interface_from_kittype ( ATCAKitType  kittype)

Kit interface from device

◆ swi_uart_deinit()

ATCA_STATUS swi_uart_deinit ( ATCASWIMaster_t instance)

Implementation of SWI UART deinit.

HAL implementation of SWI UART deinit.

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

◆ swi_uart_discover_buses()

void swi_uart_discover_buses ( int  swi_uart_buses[],
int  max_buses 
)

discover UART buses available for this hardware this maintains a list of logical to physical bus mappings freeing the application of the a-priori knowledge

Parameters
[in]swi_uart_buses- an array of logical bus numbers
[in]max_buses- maximum number of buses the app wants to attempt to discover

◆ swi_uart_init()

ATCA_STATUS swi_uart_init ( ATCASWIMaster_t instance)

Implementation of SWI UART init.

HAL implementation of SWI UART init.

  • this HAL implementation assumes you've included the ASF SERCOM UART libraries in your project, otherwise, the HAL layer will not compile because the ASF UART drivers are a dependency *
    Parameters
    [in]instanceinstance
    Returns
    ATCA_SUCCESS on success, otherwise an error code.
  • this HAL implementation assumes you've included the START SERCOM UART libraries in your project, otherwise, the HAL layer will not compile because the START UART drivers are a dependency *
    Parameters
    [in]instanceinstance
    Returns
    ATCA_SUCCESS on success, otherwise an error code.

◆ swi_uart_mode()

void swi_uart_mode ( ATCASWIMaster_t instance,
uint8_t  mode 
)

implementation of SWI UART change mode.

HAL implementation of SWI UART change mode.

Parameters
[in]instanceinstance
[in]mode(TRANSMIT_MODE or RECEIVE_MODE)

◆ swi_uart_receive_byte()

ATCA_STATUS swi_uart_receive_byte ( ATCASWIMaster_t instance,
uint8_t *  data 
)

HAL implementation of SWI UART receive bytes over ASF. This function receive one byte over UART.

Parameters
[in]instanceinstance
[out]datapointer to space to receive the data
Returns
ATCA_SUCCESS on success, otherwise an error code.

◆ swi_uart_send_byte()

ATCA_STATUS swi_uart_send_byte ( ATCASWIMaster_t instance,
uint8_t  data 
)

HAL implementation of SWI UART send byte over ASF. This function send one byte over UART.

Parameters
[in]instanceinstance
[in]datanumber of byte to send
Returns
ATCA_SUCCESS on success, otherwise an error code.

◆ swi_uart_setbaud()

void swi_uart_setbaud ( ATCASWIMaster_t instance,
uint32_t  baudrate 
)

implementation of SWI UART change baudrate.

HAL implementation of SWI UART change baudrate.

Parameters
[in]instanceinstance
[in]baudrate(typically 230400 , 160000 or 115200)
[in]instanceinstance
[in]baudrate(typically 230400 or 115200)