"""
Mapping AVR8protocol error codes to more human friendly strings
"""

AVR8_ERRORS = {}

AVR8_ERRORS[0] = 'SUCCESS'

AVR8_ERRORS[0x10] = 'AVR8_FAILURE_DW_PHY_ERROR: debugWIRE physical error'
AVR8_ERRORS[0x11] = 'AVR8_FAILURE_JTAGM_INIT_ERROR: JTAGM failed to initialise'
AVR8_ERRORS[0x12] = 'AVR8_FAILURE_JTAGM_ERROR: JTAGM unknown error'
AVR8_ERRORS[0x13] = 'AVR8_FAILURE_JTAG_ERROR: JTAG driver error'
AVR8_ERRORS[0x14] = 'AVR8_FAILURE_JTAGM_VERSION: Unsupported version of JTAG master hardware'
AVR8_ERRORS[0x15] = 'AVR8_FAILURE_JTAGM_TIMEOUT: JTAG master timed out'
AVR8_ERRORS[0x16] = 'AVR8_FAILURE_JTAG_BIT_BANGER_TIMEOUT: JTAG bit banger timed out'
AVR8_ERRORS[0x17] = 'AVR8_FAILURE_PARITY_ERROR: Parity error in received data'
AVR8_ERRORS[0x18] = 'AVR8_FAILURE_EB_ERROR: Did not receive EMPTY byte when writing'
AVR8_ERRORS[0x19] = 'AVR8_FAILURE_PDI_TIMEOUT: PDI physical timed out'
AVR8_ERRORS[0x1A] = 'AVR8_FAILURE_COLLISION: Collision on physical level'
AVR8_ERRORS[0x1B] = 'AVR8_FAILURE_PDI_ENABLE: PDI enable failed'
AVR8_ERRORS[0x1C] = 'AVR8_FAILURE_FRAMING_ERROR: Framing error'
AVR8_ERRORS[0x1D] = 'AVR8_FAILURE_DMA_ERROR: DMA error during transfer'
AVR8_ERRORS[0x20] = 'AVR8_FAILURE_NO_DEVICE_FOUND: no devices detected'
AVR8_ERRORS[0x21] = 'AVR8_FAILURE_CLOCK_ERROR: Failure when increasing communication clock rate'
AVR8_ERRORS[0x22] = 'AVR8_FAILURE_NO_TARGET_POWER: Target power not detected (or low voltage)'
AVR8_ERRORS[0x23] = 'AVR8_FAILURE_NOT_ATTACHED: Run attach command first'
AVR8_ERRORS[0x24] = 'AVR8_FAILURE_DAISY_CHAIN_TOO_LONG: more than 31 devices detected'
AVR8_ERRORS[0x25] = 'AVR8_FAILURE_DAISY_CHAIN_CONFIG: configured dev bits do not add up to detected ones'
AVR8_ERRORS[0x31] = 'AVR8_FAILURE_INVALID_PHYSICAL_STATE: Physical was already activated. (Previous session aborted?)'
AVR8_ERRORS[0x32] = 'AVR8_FAILURE_ILLEGAL_STATE: Illegal run / stopped state'
AVR8_ERRORS[0x33] = 'AVR8_FAILURE_INVALID_CONFIG: Invalid configuration for activate physical'
AVR8_ERRORS[0x34] = 'AVR8_FAILURE_INVALID_MEMTYPE: Not a valid memtype'
AVR8_ERRORS[0x35] = 'AVR8_FAILURE_INVALID_SIZE: Asked for too many or too few bytes'
AVR8_ERRORS[0x36] = 'AVR8_FAILURE_INVALID_ADDRESS: Asked for a bad address'
AVR8_ERRORS[0x37] = 'AVR8_FAILURE_INVALID_ALIGNMENT: Asked for a badly aligned address'
AVR8_ERRORS[0x38] = 'AVR8_FAILURE_ILLEGAL_MEMORY_RANGE: Address not within legal range'
AVR8_ERRORS[0x39] = 'AVR8_FAILURE_ILLEGAL_VALUE: Value not within legal range'
AVR8_ERRORS[0x3A] = 'AVR8_FAILURE_ILLEGAL_ID: Illegal target ID'
AVR8_ERRORS[0x3B] = 'AVR8_FAILURE_INVALID_CLOCK_SPEED'
AVR8_ERRORS[0x3C] = 'AVR8_FAILURE_TIMEOUT: It just took too long'
AVR8_ERRORS[0x3D] = 'AVR8_FAILURE_ILLEGAL_OCD_STATUS: Read an OCD status that is illegal (reserved bits set)'
AVR8_ERRORS[0x40] = 'AVR8_FAILURE_NVM_ENABLE: NVM enable failed'
AVR8_ERRORS[0x41] = 'AVR8_FAILURE_NVM_DISABLE: NVM disable failed'
AVR8_ERRORS[0x42] = 'AVR8_FAILURE_CS_ERROR: Error accessing Control/Status space'
AVR8_ERRORS[0x43] = 'AVR8_FAILURE_CRC_FAILURE: CRC error'
AVR8_ERRORS[0x44] = 'AVR8_FAILURE_OCD_LOCKED: Unable to access OCD - device is locked'
AVR8_ERRORS[0x45] = 'AVR8_FAILURE_KEY_ERROR: Invalid key, or key not accepted'
AVR8_ERRORS[0x46] = 'AVR8_FAILURE_BOOT_ERROR: Error booting device'
AVR8_ERRORS[0x47] = 'AVR8_FAILURE_ACK_ERROR: ACK not received from device'
AVR8_ERRORS[0x50] = 'AVR8_FAILURE_NO_OCD_CONTROL: Unable to gain control of OCD.  Clock could be too fast.'
AVR8_ERRORS[0x51] = 'AVR8_FAILURE_PLEASE_TOGGLE_POWER: Toggle power now to enable UPDI using high-voltage'
AVR8_ERRORS[0x52] = 'AVR8_FAILURE_NO_VOUT_SET: Output voltage not set'
AVR8_ERRORS[0x53] = 'AVR8_FAILURE_VOUT_ERROR: Error with output voltage setting'
AVR8_ERRORS[0x60] = 'AVR8_FAILURE_PC_READ_FAILED: Error when reading PC'
AVR8_ERRORS[0x61] = 'AVR8_FAILURE_REGISTER_READ_FAILED: Error when reading register'
AVR8_ERRORS[0x70] = 'AVR8_FAILURE_READ_ERROR: Error reading memory'
AVR8_ERRORS[0x71] = 'AVR8_FAILURE_WRITE_ERROR: Error writing memory'
AVR8_ERRORS[0x72] = 'AVR8_FAILURE_WRITE_TIMEOUT: Write to memory timed out'
AVR8_ERRORS[0x80] = 'AVR8_FAILURE_ILLEGAL_BREAKPOINT: Breakpoint at this location is not allowed'
AVR8_ERRORS[0x81] = 'AVR8_FAILURE_TOO_MANY_BREAKPOINTS: Breakpoint memory is full'
AVR8_ERRORS[0x90] = 'AVR8_FAILURE_NOT_SUPPORTED: The command is not supported on this implementation'
AVR8_ERRORS[0x91] = 'AVR8_FAILURE_NOT_IMPLEMENTED: The command has not been implemented'
AVR8_ERRORS[0xFF] = 'AVR8_FAILURE_UNKNOWN: An unknown error occurred'
