#ifndef _I2C_MASTER_MOD_FNS_H
#define _I2C_MASTER_MOD_FNS_H

#include <atmel_start.h>

#define ADDR_WRITTEN_FW_SIZE    0xD1
#define ADDR_WRITTEN_FW_BLOCK   0xD2
#define ADDR_WRITTEN_FW_CHKSUM  0xD3
#define ADDR_LOCAL_FW_CHKSUM    0xD4
#define ADDR_BOOT_NEW_FW        0xD5
#define ADDR_UC_RESET           0xD6
#define ADDR_UPTIME_SECS        0xD7
#define ADDR_TMR_ERROR_CNT      0xD8
#define ADDR_USE_PEC            0xD9
#define ADDR_TEMP_CURVE_POINTS  0xE0
#define ADDR_TEMP_MATRIX_ROW    0xE1
#define ADDR_TC_ONOFF           0xE2

#define PEC_ON_MAGIC      0x37
#define PEC_OFF_MAGIC     0x0F

int32_t i2c_m_sync_blk_cmd_write_and_read(struct i2c_m_sync_desc *i2c, uint8_t cmd, uint8_t *wr_buffer, uint8_t wr_length, uint8_t *rd_buffer, uint8_t *rd_length);

int32_t i2c_m_sync_my_cmd_write(struct i2c_m_sync_desc *i2c, uint8_t cmd, uint8_t *buffer, uint8_t length);

int32_t i2c_m_sync_my_cmd_read(struct i2c_m_sync_desc *i2c, uint8_t reg, uint8_t *buffer, uint8_t length);

int32_t i2c_m_sync_ext_cmd_write(struct i2c_m_sync_desc *i2c, uint8_t cmd, uint8_t *buffer, uint8_t length);

int32_t i2c_m_sync_ext_cmd_read(struct i2c_m_sync_desc *i2c, uint8_t cmd, uint8_t *buffer, uint8_t length);

int32_t i2c_m_sync_blk_cmd_write(struct i2c_m_sync_desc *i2c, uint8_t cmd, uint8_t *buffer, uint8_t length);

int32_t i2c_m_sync_blk_cmd_read(struct i2c_m_sync_desc *i2c, uint8_t cmd, uint8_t *buffer, uint8_t *length);

int32_t i2c_m_sync_ext_blk_cmd_write(struct i2c_m_sync_desc *i2c, uint8_t cmd, uint8_t *buffer, uint8_t length);

int32_t i2c_m_sync_ext_blk_cmd_read(struct i2c_m_sync_desc *i2c, uint8_t cmd, uint8_t *buffer, uint8_t *length);

int32_t enable_pec(struct i2c_m_sync_desc *i2c);

int32_t disable_pec(struct i2c_m_sync_desc *i2c);

#endif
