AVR32GENERIC ID Definitions

This section includes the header file defining the different command and response IDs for the AVR32 protocol. It also defines the different possible failure codes.

enum Avr32GenericCommands {
    AVR32_CMD_QUERY                 = 0x00, //! Capability discovery 
    AVR32_CMD_SET                   = 0x01, //! Set parameters
    AVR32_CMD_GET                   = 0x02, //! Get parameters
    AVR32_CMD_ACTIVATE_PHYSICAL     = 0x03, //! Connect physically
    AVR32_CMD_DEACTIVATE_PHYSICAL   = 0x04, //! Disconnect physically
    AVR32_CMD_GET_ID                = 0x10, //! Read the ID
    AVR32_CMD_ERASE                 = 0x11, //! Erase the device
    AVR32_CMD_HALT                  = 0x12, //! Stop or start execution
    AVR32_CMD_RESET                 = 0x13, //! Apply or release reset
    AVR32_CMD_STEP                  = 0x14, //! Single step
    AVR32_CMD_READ                  = 0x15, //! Read memory
    AVR32_CMD_WRITE                 = 0x16, //! Write memory
    AVR32_CMD_TAP                   = 0x17, //! Low-level JTAG commands
    AVR32_CMD_IS_PROTECTED          = 0x18, //! Check protected bit
    AVR32_CMD_ERASE_SECTION         = 0x19  //! Partial erase
};

enum Avr32GenericResponses {
    AVR32_RSP_FAILED                = 0xA0, //! Execution failed
    AVR32_RSP_OK                    = 0x80, //! All OK
    AVR32_RSP_LIST                  = 0x81, //! List of items returned
    AVR32_RSP_ID                    = 0x82, //! ID value returned
    AVR32_RSP_PC                    = 0x83, //! PC value returned
    AVR32_RSP_DATA                  = 0x84  //! Data returned
};

enum Avr32GenericQueryContexts {
    AVR32_QUERY_COMMANDS             = 0x00, //! Supported command list
    AVR32_QUERY_CONFIGURATION        = 0x05, //! Supported configuration list
    AVR32_QUERY_READ_MEMTYPES        = 0x06, //! Supported read memtypes list
    AVR32_QUERY_WRITE_MEMTYPES       = 0x07, //! Supported write memtypes list
    AVR32_QUERY_COMMAND_VERSIONS     = 0x08  //! Version map of command list
};
 
enum Avr32GenericSetGetContexts {
    AVR32_CTXT_USB                  = 0x03, //! Transport-related settings
    AVR32_CTXT_SESSION              = 0x04, //! Session-related settings
    AVR32_CTXT_PHYSICAL             = 0x80, //! Physical interface related
    AVR32_CTXT_DEVICE                = 0x82, //! Device specific settings
};

enum Avr32GenericSessionContextParameters {
    AVR32_SESS_RUN_LED              = 0x00, //! Control the LED
};

enum Avr32GenericUsbContextParameters {
    AVR32_USB_MAX_READ              = 0x00, //! Read payload size
    AVR32_USB_MAX_WRITE             = 0x01  //! Write payload size
};

enum Avr32GenericPhysicalContextParameters {
    AVR32_PHY_PHYSICAL              = 0x00, //! Physical interface selector
    AVR32_PHYL_JTAG_CLOCK           = 0x01, //! JTAG clock value
    AVR32_PHY_AW_MAXBAUD            = 0x02, //! Maximum aWire baud
    AVR32_PHY_DAISY                 = 0x03, //! JTAG daisy chain settings
    AVR32_PHY_AWIRE_BAUD            = 0x04, //! Current aWire baud
    AVR32_PHY_AWIRE_VERSION         = 0x05, //! aWire slave version
    AVR32_PHY_EXT_RESET             = 0x0C, //! External reset control
};

enum Avr32GenericDeviceContext {
    AVR32_FLASH_CTRL_BASE           = 0x02, //! Flash controller base address
    AVR32_FLASH_PAGEBYTES           = 0x06, //! Number of bytes in one flash page
    AVR32_RESET_DOMAINS         = 0x0A, //! Number of reset domains
    AVR32_FLASH_PAGES               = 0x0B, //! Number of pages in the flash block
    AVR32_AWIRE_BASE                = 0x10  //! Base address for aWire module
};

enum Avr32GenericMemoryTypes {
    AVR32_MEMTYPE_SAB               = 0x80, //! Service Access Bus (SAB) word access
    AVR32_MEMTYPE_NEXUS             = 0x81, //! Nexus mode access to SAB
    AVR32_MEMTYPE_MEMORY_SERVICE    = 0x82, //! Memory Service mode access to SAB
    AVR32_MEMTYPE_BLOCK             = 0x83, //! Block access to SAB
    AVR32_MEMTYPE_BYTE              = 0x84, //! 8-bit access to SAB
    AVR32_MEMTYPE_HALF_WORD         = 0x85, //! 16-bit access to SAB
    AVR32_MEMTYPE_INTERNAL_FLASH    = 0x90, //! Write access to internal FLASH
    AVR32_MEMTYPE_SYSREG            = 0x91, //! Access to system registers
    AVR32_MEMTYPE_REGFILE           = 0x92, //! Access to register file
    AVR32_MEMTYPE_USER_PAGE         = 0x93  //! Access to User Page in flash
};

enum Avr32GenericPhysicalInterfaces {
    AVR32_PHYSICAL_INTERFACE_NONE   = 0x00, //! No physical
    AVR32_PHYSICAL_INTERFACE_JTAG   = 0x04, //! JTAG physical
    AVR32_PHYSICAL_INTERFACE_AWIRE  = 0x07  //! aWire physical
};

enum Avr32TapCommands {
    AVR32_TAP_IR                    = 0x00, //! JTAG Instruction Register access
    AVR32_TAP_DR                    = 0x01  //! JTAG Data Register access
};

enum Avr32GenericFailureCodes {
    AVR32_FAILURE_OK                        = 0x00, //! All OK
    AVR32_FAILURE_NACK                      = 0x01, //! NACK received from target
    AVR32_FAILURE_LENGTH                    = 0x02, //! Incorrect packet length
    AVR32_FAILURE_RECEIVE_TIMEOUT           = 0x03, //! Receive function timeout
    AVR32_FAILURE_RECEIVE_SYNC              = 0x04, //! Receive did not sync
    AVR32_FAILURE_RECEIVE_LENGTH            = 0x05, //! Incorrect packet length
    AVR32_FAILURE_TRANSMIT_OVERFLOW         = 0x06, //! Transmit buffer overflow
    AVR32_FAILURE_INVALID_MEMTYPE           = 0x07, //! Invalid memtype given
    AVR32_FAILURE_WRITE_ERROR               = 0x08, //! A write error occurred 
    AVR32_FAILURE_WRITE_BUSY                = 0x09, //! Busy signal received
    AVR32_FAILURE_READ_SHORT                = 0x0A, //! Short-packet received
    AVR32_FAILURE_ERASE_TIMEOUT             = 0x0B, //! Erase command timeout 
    AVR32_FAILURE_FLASHREADY_TIMEOUT        = 0x0C, //! Flash controller busy
    AVR32_FAILURE_ILLEGAL_STATE             = 0x0D, //! Illegal state specified
    AVR32_FAILURE_NOT_SUPPORTED             = 0x0E, //! Feature not supported
    AVR32_FAILURE_PROGE                     = 0x0F, //! Programming error
    AVR32_FAILURE_LOCKE                     = 0x10, //! Lock error
    AVR32_FAILURE_STEP_TIMEOUT              = 0x11, //! Single stepping timeout
    AVR32_FAILURE_READ_BUSY                 = 0x12, //! Busy bit was set
    AVR32_FAILURE_READ_ERROR                = 0x13, //! Error bit was set
    AVR32_FAILURE_HARDWARE_ERROR            = 0x14, //! aWire hardware init error
    AVR32_FAILURE_NO_CONTACT                = 0x15, //! No response from aWire 
    AVR32_FAILURE_NO_TARGET_POWER           = 0x16, //! No target power 
    AVR32_FAILURE_NOT_IMPLEMENTED           = 0x17, //! Command not implemented
    AVR32_FAILURE_UNSUPPORTED_HARDWARE      = 0x18, //! Hardware not supported
    AVR32_FAILURE_JTAGM_INIT_ERROR          = 0x19, //! JTAG master init error
    AVR32_FAILURE_NO_DEVICE_FOUND           = 0x1A, //! devices == 0!    
    AVR32_FAILURE_JTAGM_ERROR               = 0x1B, //! JTAG master error
    AVR32_FAILURE_INVALID_SIZE              = 0x1D, //! Too many or too few bytes
    AVR32_FAILURE_INVALID_ADDRESS           = 0x1E, //! Bad address requested
    AVR32_FAILURE_AWIRE_SET_BAUD_ERROR      = 0x1F, //! Failure setting baud   
    AVR32_FAILURE_INVALID_DATA              = 0x20, //! Data invalid, discard it
    AVR32_FAILURE_INVALID_PHYSICAL_MODE     = 0x21, //! Physical mode not valid  
    AVR32_FAILURE_INVALID_CLOCK_SPEED       = 0x22, //! The clock is not valid
    AVR32_FAILURE_AWIRE_ERROR_RESPONSE      = 0x23, //! Error response received
    AVR32_FAILURE_AWIRE_OVERFLOW            = 0x24, //! Overflow data RX overflow
    AVR32_FAILURE_AWM_ERROR                 = 0x24, //! aWire master error
    AVR32_FAILURE_AWIRE_CRC                 = 0x25, //! aWire CRC error
    AVR32_FAILURE_AWIRE_TUNE                = 0x26, //! aWire TUNE error
    AVR32_FAILURE_JTAGM_WAS_BUSY            = 0x29, //! JTAG master busy 
    AVR32_FAILURE_JTAGM_TIMEOUT             = 0x2A, //! JTAG master timeout
    AVR32_FAILURE_BAD_VALUE                 = 0x2B, //! Invalid parameter value
    AVR32_FAILURE_ERASE_ERROR               = 0x2C, //! Erase error
    AVR32_FAILURE_CONFIG_ERROR              = 0x2D, //! Insufficient config info
    AVR32_FAILURE_INVALID_EMULATOR_MODE     = 0x2E, //! Mode is not valid 
    AVR32_FAILURE_CPU_DIRTY_TIMEOUT         = 0x2F, //! CPU wait timeout
    AVR32_FAILURE_CPU_MODE                  = 0x30, //! CPU not in debug mode 
    AVR32_FAILURE_CPU_DEBUG_MODE_TIMEOUT    = 0x31, //! CPU debug mode timeout
    AVR32_FAILURE_AWIRE_RW_STATUS           = 0x32, //! Unexpected status
    AVR32_FAILURE_TRANSMIT_TIMEOUT          = 0x33, //! Data TX timeout
    AVR32_FAILURE_INTERNAL_RESPONSE_ERROR   = 0xFE, //! Near disaster
    AVR32_FAILURE_UNKNOWN                   = 0xFF, //! Disaster
};