from __future__ import annotations

"""Result code constants exposed by the CosmicSDK C API."""

SUCCESS = 0x0000

FW_UNSUPPORTED_COMMAND = 0x0001
FW_INVALID_COMMAND = 0x0002
FW_FULL_RECEPTION_QUEUE = 0x0003
FW_INVALID_PARAMETER = 0x0004
FW_FEATURE_NOT_SUPPORTED_BY_HARDWARE = 0x0005
FW_INTERFACE_NOT_INITIALIZED = 0x0006
FW_INTERFACE_ALREADY_INITIALIZED = 0x0007
FW_BUS_NOT_SUPPORTED = 0x0008
FW_BUS_TIMEOUT = 0x0009
FW_RX_FIFO_FULL = 0x000A
FW_TX_FIFO_EMPTY = 0x000B
FW_UNHANDLED_ERROR = 0x000C

FW_VOLTAGE_OUT_OF_RANGE = 0x0101
FW_EXTERNAL_VOLTAGE_DETECTED = 0x0102
FW_VOLTAGE_ADJUSTMENT_FAILURE = 0x0103
FW_I3C_PORTS_NOT_POWERED = 0x0104
FW_BOTH_I3C_PORTS_POWERED = 0x0105
FW_VOLTAGE_OUT_OF_RANGE_ON_I3C_LV = 0x0106
FW_VOLTAGE_OUT_OF_RANGE_ON_I3C_HV = 0x0107

FW_I2C_PULLUP_RESISTOR_SETTING_FAILURE = 0x0201
FW_I2C_ARBITRATION_LOST = 0x0202
FW_I2C_NACK_ADDRESS = 0x0203
FW_I2C_NACK_BYTE = 0x0204
FW_I2C_BIT_ERROR = 0x0205
FW_I2C_START_STOP_ERROR = 0x0206
FW_I2C_BUSY = 0x0207
FW_I2C_TIMEOUT_CONTINUE_TRANSFER = 0x0208
FW_I2C_TIMEOUT_WAITING_BUS_EVENT = 0x0209
FW_I2C_TIMEOUT_SCL_LOW = 0x020A
FW_I2C_DMA_REQUEST_FAIL = 0x020B
FW_I2C_INVALID_PARAMETER = 0x020C
FW_I2C_NO_TRANSFER_IN_PROGRESS = 0x020D
FW_I2C_UNEXPECTED_STATE = 0x020E
FW_I2C_BUS_WITH_NO_TARGETS_CONNECTED = 0x020F

FW_GPIO_NOT_CONFIGURED = 0x0501
FW_GPIO_WRONG_CONFIGURATION = 0x0502

FW_FULL_TARGET_DEVICES_TABLE = 0x0601
FW_NOT_ENOUGH_SPACE_IN_TARGET_DEVICES_TABLE = 0x0602
FW_TARGET_DEVICES_TABLE_OVERFLOW = 0x0603
FW_TARGET_ADDRESS_NOT_FOUND_IN_THE_TABLE = 0x0604
FW_REPEATED_TARGET_ADDRESS = 0x0605
FW_INVALID_TARGET_ADDRESS = 0x0606
FW_I3C_BUS_INIT_NACK_RSTDAA = 0x0607
FW_I3C_BUS_INIT_NACK_SETDASA = 0x0608
FW_I3C_BUS_INIT_NACK_SETAASA = 0x0609
FW_I3C_BUS_INIT_NACK_ENTDAA = 0x060A
FW_I3C_NACK_ADDRESS = 0x060B
FW_I3C_I2C_NACK_BYTE = 0x060C
FW_I3C_TRANSFER_ABORTED_BY_CONTROLLER = 0x060D
FW_I3C_TRANSFER_MWL_REACHED = 0x060E
FW_I3C_TRANSFER_MRL_REACHED = 0x060F
FW_I3C_TRANSFER_PARITY_ERROR = 0x0610

SDK_ERROR_TIMEOUT = 0x2000
SDK_ERROR_DISCONNECT = 0x4000
SDK_ERROR_UNEXPECTED_RESPONSE = 0x6000
SDK_ERROR_WRONG_REQUEST = 0x8000
SDK_ERROR_WRONG_RESPONSE = 0xA000

__all__ = [name for name in globals() if name.isupper()]
