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... | |
void sha204c_calculate_crc | ( | uint8_t | length, |
uint8_t * | data, | ||
uint8_t * | crc | ||
) |
This function calculates CRC.
[in] | length | number of bytes in buffer |
[in] | data | pointer to data for which CRC should be calculated |
[out] | crc | pointer to 16-bit CRC |
References counter.
Referenced by sha204c_check_crc(), sha204c_send_and_receive(), and sha204m_execute().
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.
The first byte in tx buffer must be the byte count of the packet. If CRC or count of the response is incorrect, or a command byte got "nacked" (TWI), this function requests re-sending the response. If the response contains an error status, this function resends the command.
[in,out] | args | pointer to parameter structure |
References sha204_send_and_receive_parameters::poll_delay, sha204_send_and_receive_parameters::poll_timeout, sha204_send_and_receive_parameters::rx_buffer, sha204_send_and_receive_parameters::rx_size, SHA204_BUFFER_POS_COUNT, SHA204_BUFFER_POS_STATUS, SHA204_CMD_FAIL, SHA204_CRC_SIZE, SHA204_FUNC_FAIL, SHA204_INVALID_SIZE, SHA204_PARSE_ERROR, SHA204_RESYNC_WITH_WAKEUP, SHA204_RETRY_COUNT, SHA204_RSP_SIZE_MIN, SHA204_RX_NO_RESPONSE, SHA204_STATUS_BYTE_COMM, SHA204_STATUS_BYTE_EXEC, SHA204_STATUS_BYTE_PARSE, SHA204_STATUS_CRC, SHA204_SUCCESS, sha204_timer_expired, sha204c_calculate_crc(), sha204c_check_crc(), sha204c_resync(), sha204h_delay_ms(), sha204h_start_timeout_timer_ms(), sha204p_receive_response(), sha204p_send_command(), status_byte, and sha204_send_and_receive_parameters::tx_buffer.
Referenced by sha204m_check_mac(), sha204m_derive_key(), sha204m_dev_rev(), sha204m_execute(), sha204m_gen_dig(), sha204m_hmac(), sha204m_lock(), sha204m_mac(), sha204m_nonce(), sha204m_pause(), sha204m_random(), sha204m_read(), sha204m_update_extra(), and sha204m_write().
uint8_t sha204c_wakeup | ( | uint8_t * | response | ) |
This function wakes up a SHA204 device and receives a response.
[out] | response | pointer to four-byte response |
References SHA204_BAD_CRC, SHA204_BUFFER_POS_COUNT, SHA204_BUFFER_POS_STATUS, SHA204_COMM_FAIL, SHA204_COMMAND_EXEC_MAX, SHA204_CRC_SIZE, SHA204_INVALID_SIZE, SHA204_RSP_SIZE_MIN, SHA204_STATUS_BYTE_WAKEUP, SHA204_SUCCESS, sha204h_delay_ms(), sha204p_receive_response(), and sha204p_wakeup().
Referenced by sha204c_resync(), and test_sha204_wakeup().