CryptoAuthLib v3.7.4
Microchip CryptoAuthentication Library
 
Loading...
Searching...
No Matches
hal_uart_harmony.c File Reference

ATCA Hardware abstraction layer for SWI uart over Harmony PLIB. More...

#include "atca_config.h"
#include "cryptoauthlib.h"

Functions

ATCA_STATUS hal_uart_init (ATCAIface iface, ATCAIfaceCfg *cfg)
 Initialize an uart interface using given config.
 
ATCA_STATUS hal_uart_post_init (ATCAIface iface)
 HAL implementation of SWI post init.
 
ATCA_STATUS hal_uart_send (ATCAIface iface, uint8_t word_address, uint8_t *txdata, int txlength)
 Send byte(s) via SWI.
 
ATCA_STATUS hal_uart_receive (ATCAIface iface, uint8_t word_address, uint8_t *rxdata, uint16_t *rxlength)
 Receive byte(s) via SWI.
 
ATCA_STATUS hal_uart_control (ATCAIface iface, uint8_t option, void *param, size_t paramlen)
 
ATCA_STATUS hal_uart_release (void *hal_data)
 Manages reference count on given bus and releases resource if no more reference(s) exist.
 

Variables

PLIB_SWI_SERIAL_SETUP serial_setup
 

Detailed Description

ATCA Hardware abstraction layer for SWI uart over Harmony PLIB.

This code is structured in two parts. Part 1 is the connection of the ATCA HAL API to the physical I2C implementation. Part 2 is the Harmony UART (ring buffer mode) primitives to set up the interface.

Function Documentation

◆ hal_uart_init()

ATCA_STATUS hal_uart_init ( ATCAIface  iface,
ATCAIfaceCfg cfg 
)

Initialize an uart interface using given config.

Parameters
[in]halopaque pointer to HAL data
[in]cfginterface configuration
Returns
ATCA_SUCCESS on success, otherwise an error code.

◆ hal_uart_post_init()

ATCA_STATUS hal_uart_post_init ( ATCAIface  iface)

HAL implementation of SWI post init.

Parameters
[in]ifaceATCAIface instance
Returns
ATCA_SUCCESS

◆ hal_uart_receive()

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

Receive byte(s) via SWI.

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_uart_release()

ATCA_STATUS hal_uart_release ( void *  hal_data)

Manages reference count on given bus and releases resource if no more reference(s) exist.

Parameters
[in]hal_dataopaque pointer to hal data structure - known only to the HAL implementation
Returns
ATCA_SUCCESS

◆ hal_uart_send()

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

Send byte(s) via SWI.

Parameters
[in]ifaceinterface of the logical device to send data to
[in]word_addressdevice transaction type
[in]txdatapointer to bytes to send
[in]txlengthnumber of bytes to send
Returns
ATCA_SUCCESS

Variable Documentation

◆ serial_setup

PLIB_SWI_SERIAL_SETUP serial_setup
Initial value:
= {
.parity = PLIB_SWI_PARITY_NONE,
.dataWidth = PLIB_SWI_DATA_WIDTH,
.stopBits = PLIB_SWI_STOP_BIT
}