Microchip® Advanced Software Framework

sha204_comm.h File Reference
#include <compiler.h>
#include "sha204_physical.h"

Data Structures

struct  sha204_send_and_receive_parameters
 This structure contains the parameters for the sha204c_send_and_receive function. More...
 

Macros

#define SHA204_BUFFER_POS_DATA   (1)
 buffer index of first data byte in data response More...
 
#define SHA204_BUFFER_POS_STATUS   (1)
 buffer index of status byte in status response More...
 
#define SHA204_CMD_SIZE_MAX   ((uint8_t) 84)
 maximum size of command packet (CheckMac) More...
 
#define SHA204_CMD_SIZE_MIN   ((uint8_t) 7)
 minimum number of bytes in command (from count byte to second CRC byte) More...
 
#define SHA204_COMMAND_EXEC_MAX   (69)
 < compiler dependent definitions More...
 
#define SHA204_CRC_SIZE   ((uint8_t) 2)
 number of CRC bytes More...
 
#define SHA204_STATUS_BYTE_COMM   ((uint8_t) 0xFF)
 communication error More...
 
#define SHA204_STATUS_BYTE_EXEC   ((uint8_t) 0x0F)
 command execution error More...
 
#define SHA204_STATUS_BYTE_PARSE   ((uint8_t) 0x03)
 command parse error More...
 
#define SHA204_STATUS_BYTE_WAKEUP   ((uint8_t) 0x11)
 status byte after wake-up More...
 

Functions

void sha204c_calculate_crc (uint8_t length, uint8_t *data, uint8_t *crc)
 This function calculates CRC. More...
 
uint8_t sha204c_send_and_receive (struct sha204_send_and_receive_parameters *args)
 This function runs a communication sequence: Append CRC to tx buffer, send command, delay, and verify response after receiving it. More...
 
uint8_t sha204c_wakeup (uint8_t *response)
 This function wakes up a SHA204 device and receives a response. More...
 

#define SHA204_BUFFER_POS_DATA   (1)

buffer index of first data byte in data response

Referenced by main().

#define SHA204_BUFFER_POS_STATUS   (1)

buffer index of status byte in status response

Referenced by sha204c_send_and_receive(), and sha204c_wakeup().

#define SHA204_CMD_SIZE_MAX   ((uint8_t) 84)

maximum size of command packet (CheckMac)

#define SHA204_CMD_SIZE_MIN   ((uint8_t) 7)

minimum number of bytes in command (from count byte to second CRC byte)

Referenced by main(), sha204m_check_parameters(), and sha204m_execute().

#define SHA204_COMMAND_EXEC_MAX   (69)

< compiler dependent definitions

< declarations that are common to all interface implementations maximum command delay

Referenced by sha204c_wakeup(), and sha204m_execute().

#define SHA204_CRC_SIZE   ((uint8_t) 2)
#define SHA204_STATUS_BYTE_COMM   ((uint8_t) 0xFF)

communication error

Referenced by sha204c_send_and_receive().

#define SHA204_STATUS_BYTE_EXEC   ((uint8_t) 0x0F)

command execution error

Referenced by sha204c_send_and_receive().

#define SHA204_STATUS_BYTE_PARSE   ((uint8_t) 0x03)

command parse error

Referenced by sha204c_send_and_receive().

#define SHA204_STATUS_BYTE_WAKEUP   ((uint8_t) 0x11)

status byte after wake-up

Referenced by sha204c_wakeup().