Functions | |
uint8_t | sha204p_idle (void) |
This I2C function puts the SHA204 device into idle state. More... | |
void | sha204p_init (void) |
This function initializes peripherals (timer and communication). More... | |
uint8_t | sha204p_receive_response (uint8_t size, uint8_t *response) |
This I2C function receives a response from the SHA204 device. More... | |
uint8_t | sha204p_reset_io (void) |
This I2C function resets the I/O buffer of the SHA204 device. More... | |
uint8_t | sha204p_resync (uint8_t size, uint8_t *response) |
This I2C function resynchronizes communication. More... | |
uint8_t | sha204p_send_command (uint8_t count, uint8_t *command) |
This I2C function sends a command to the device. More... | |
void | sha204p_set_device_id (uint8_t id) |
This I2C function sets the I2C address. More... | |
uint8_t | sha204p_sleep (void) |
This I2C function puts the SHA204 device into low-power state. More... | |
uint8_t | sha204p_wakeup (void) |
This I2C function generates a Wake-up pulse and delays. More... | |
uint8_t sha204p_idle | ( | void | ) |
This I2C function puts the SHA204 device into idle state.
References SHA204_I2C_PACKET_FUNCTION_IDLE, and sha204p_send().
void sha204p_init | ( | void | ) |
This function initializes peripherals (timer and communication).
References cpu_irq_enable, and sha204h_timer_init().
Referenced by security_board_init().
uint8_t sha204p_receive_response | ( | uint8_t | size, |
uint8_t * | response | ||
) |
This I2C function receives a response from the SHA204 device.
[in] | size | size of receive buffer |
[out] | response | pointer to receive buffer |
References twi_package_t::buffer, twi_package_t::chip, device_address, ERR_TIMEOUT, twi_package_t::length, SHA204_BUFFER_POS_COUNT, SHA204_COMM_FAIL, SHA204_INVALID_SIZE, SHA204_RSP_SIZE_MAX, SHA204_RSP_SIZE_MIN, SHA204_RX_NO_RESPONSE, SHA204_SUCCESS, SHA204_TIMEOUT, STATUS_OK, and twi_master_read().
Referenced by sha204c_send_and_receive(), and sha204c_wakeup().
uint8_t sha204p_reset_io | ( | void | ) |
This I2C function resets the I/O buffer of the SHA204 device.
References SHA204_I2C_PACKET_FUNCTION_RESET, and sha204p_send().
Referenced by sha204p_resync().
uint8_t sha204p_resync | ( | uint8_t | size, |
uint8_t * | response | ||
) |
This I2C function resynchronizes communication.
Parameters are not used for I2C.
Re-synchronizing communication is done in a maximum of three steps listed below. This function implements the first step. Since steps 2 and 3 (sending a Wake-up token and reading the response) are the same for I2C and SWI, they are implemented in the communication layer (sha204c_resync). See the excerpt from the SHA204 data sheet below.
[in] | size | size of response buffer |
[out] | response | pointer to response buffer |
References twi_package_t::chip, sha204p_reset_io(), and twi_master_read().
Referenced by sha204c_resync().
uint8_t sha204p_send_command | ( | uint8_t | count, |
uint8_t * | command | ||
) |
This I2C function sends a command to the device.
[in] | count | number of bytes to send |
[in] | command | pointer to command buffer |
References SHA204_I2C_PACKET_FUNCTION_NORMAL, and sha204p_send().
Referenced by sha204c_send_and_receive(), and test_sha204_wakeup().
void sha204p_set_device_id | ( | uint8_t | id | ) |
This I2C function sets the I2C address.
Communication functions will use this address.
[in] | id | I2C address |
References device_address.
Referenced by main(), sha204_sleep_all(), and test_all_devices().
uint8_t sha204p_sleep | ( | void | ) |
This I2C function puts the SHA204 device into low-power state.
References SHA204_I2C_PACKET_FUNCTION_SLEEP, and sha204p_send().
Referenced by main(), sha204_sleep_all(), sha204c_resync(), test_all_devices(), and test_sha204_wakeup().
uint8_t sha204p_wakeup | ( | void | ) |
This I2C function generates a Wake-up pulse and delays.
References twi_package_t::addr_length, twi_package_t::buffer, twi_package_t::chip, twi_package_t::length, SHA204_COMM_FAIL, SHA204_WAKEUP_DELAY, sha204h_delay_ms(), twi_options_t::speed, STATUS_OK, twi_master_disable(), twi_master_enable(), twi_master_setup(), and twi_master_write().
Referenced by main(), sha204c_wakeup(), and test_all_devices().