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

enum EdbgCommands {
    //**********************************************************
    // Protocol commands
    //**********************************************************

    // Basics
    CMD_EDBG_QUERY                                      = 0x00,
    CMD_EDBG_SET                                        = 0x01,
    CMD_EDBG_GET                                        = 0x02,
};

enum EdbgResponses {
    //**********************************************************
    // Protocol responses
    //**********************************************************

    RSP_EDBG_OK                                         = 0x80,
    RSP_EDBG_LIST                                       = 0x81,
    RSP_EDBG_DATA                                       = 0x84,
    RSP_EDBG_FAILED                                     = 0xA0
};


enum EdbgFailureCodes {
    //**********************************************************
    // Failure response codes (RSP_FAILED)
    //**********************************************************

    EDBG_FAILED_OK                                      = 0x00,
    EDBG_FAILED_NOT_SUPPORTED                           = 0x01,
    EDBG_FAILED_ILLEGAL_GPIO_PIN                        = 0x10,
    EDBG_FAILED_ILLEGAL_GPIO_MODE                       = 0x11,
    EDBG_FAILED_ILLEGAL_VOLTAGE_RANGE                   = 0x12,
    EDBG_FAILED_ILLEGAL_INTERVAL                        = 0x13,
    EDBG_FAILED_ILLEGAL_MAX_THRESHOLD                   = 0x14,
    EDBG_FAILED_ILLEGAL_MIN_THRESHOLD                   = 0x15,
    EDBG_FAILED_ILLEGAL_ACTION                          = 0x16,
    EDBG_FAILED_ILLEGAL_FREQUENCY                       = 0x17,
    EDBG_FAILED_ILLEGAL_MODE                            = 0x18,
    EDBG_FAILED_ILLEGAL_FLAGS                           = 0x19,
    EDBG_FAILED_FLASH_WRITE                             = 0x20,
    EDBG_FAILED_OVERFLOW                                = 0x30,
    EDBG_FAILED_UNKNOWN                                 = 0xFF
};

enum EdbgConfigTypes {
    EDBG_CONFIGTYPE_CHAR                                = 0x00,
    EDBG_CONFIGTYPE_SHORT                               = 0x01,
    EDBG_CONFIGTYPE_WORD                                = 0x02,
    EDBG_CONFIGTYPE_BIT                                 = 0x03,
    EDBG_CONFIGTYPE_STRING                              = 0x10,
    EDBG_CONFIGTYPE_ARRAY                               = 0x20,
};

enum EdbgConfigTags {
    //**********************************************************
    // EDBG Configuration Tags
    //**********************************************************

    EDBG_CONFIG_VERSION                                 = 0x00,
    EDBG_CONFIG_SERIAL_NUMBER                           = 0x01,
    EDBG_CONFIG_BOARD_NAME                              = 0x02,
    EDBG_CONFIG_MANUFACTURER_NAME                       = 0x03,
    EDBG_CONFIG_TARGET_NAME                             = 0x04,
    EDBG_CONFIG_TARGET_SIGNATURE                        = 0x05,
    EDBG_CONFIG_TARGET_JTAGID                           = 0x06,
    EDBG_CONFIG_TARGET_CHIPID                           = 0x07,
    EDBG_CONFIG_INTERFACES                              = 0x08,
    EDBG_CONFIG_DGI_GPIO_MAP                            = 0x09,
    EDBG_CONFIG_EXTENSION_MAP                           = 0x0A,
    EDBG_CONFIG_EXTENSION_STATUS                        = 0x0B,
    EDBG_CONFIG_EXTENSION_MANUFACTURER                  = 0x0C,
    EDBG_CONFIG_EXTENSION_PRODUCT                       = 0x0D,
    EDBG_CONFIG_EXTENSION_REVISION                      = 0x0E,
    EDBG_CONFIG_EXTENSION_SERIAL                        = 0x0F,
    EDBG_CONFIG_EXTENSION_MIN_VOLTAGE                   = 0x10,
    EDBG_CONFIG_EXTENSION_MAX_VOLTAGE                   = 0x11,
    EDBG_CONFIG_EXTENSION_CURRENT                       = 0x12,
    EDBG_CONFIG_BOARD_TYPE                              = 0x13,
    EDBG_CONFIG_FAMILY_NAME                             = 0x14,
    EDBG_CONFIG_TVS                                     = 0x15,
    EDBG_CONFIG_VERSION_MINOR                           = 0x16,
    EDBG_CONFIG_USB_ID                                  = 0x17,
    EDBG_CONFIG_KIT_DATA                                = 0x20,
};

enum EdbgInterfaces {
    //**********************************************************
    // EDBG Configuration Tags
    //********************************************************** 
    // GPIO, USART, UART, TWI, SPI, CDC
    // SWD, ARMJTAG, AVRJTAG, aW, dW, PDI, ISP, DBG_EN

    EDBG_IF_DBG_EN                                      = 15,
    EDBG_IF_DBG_ISP                                     = 14,
    EDBG_IF_DBG_PDI                                     = 13,
    EDBG_IF_DBG_DW                                      = 12,
    EDBG_IF_DBG_AW                                      = 11,
    EDBG_IF_DBG_AVRJTAG                                 = 10,
    EDBG_IF_DBG_ARMJTAG                                 = 9,
    EDBG_IF_DBG_SWD                                     = 8,
    
    EDBG_IF_DGI_SPI                                     = 0,
    EDBG_IF_DGI_TWI                                     = 1,
    EDBG_IF_DGI_UART                                    = 2,
    EDBG_IF_DGI_USART                                   = 3,
    EDBG_IF_DGI_GPIO                                    = 4,
    EDBG_IF_CDC                                         = 5,
    
    EDBG_IF_ERASE_PIN                                   = 7,
};
enum EDBGQueryContexts {
    // QUERY types on this protocol
    EDBG_QUERY_COMMANDS                                 = 0x00
};
    
enum EDBGSetGetContexts {
    EDBG_CONTEXT_CONTROL                                = 0x00,
    EDBG_CONTEXT_CONFIG0                                = 0x10,
    EDBG_CONTEXT_CONFIG1                                = 0x11,
}; 

enum EDBGControlContextParameters {
    EDBG_CONTROL_LED_USAGE                              = 0x00,
    EDBG_CONTROL_EXT_PROG                               = 0x01,
    EDBG_CONTROL_TARGET_POWER                           = 0x10
};

enum SerialTraceCommands {
    ST_SET_TRANSPORT_MODE                               = 0x00,
    ST_SET_CAPTURE_MODE                                 = 0x01,
    ST_SET_BAUD                                         = 0x02,
    ST_START                                            = 0x03,
    ST_STOP                                             = 0x04,
    ST_GET_DATA                                         = 0x08,
    ST_GET_STATUS                                       = 0x09,
    ST_GET_BUFFER_SIZE                                  = 0x0A,
    ST_SIGNON                                           = 0x0F
};

enum SerialTraceTransportModes {
    TRANSPORT_OFF                                       = 0x00,
    TRANSPORT_HID                                       = 0x01
};

enum SerialTraceTransportModes {
    CAPTURE_OFF                                         = 0x00,
    CAPTURE_UART                                        = 0x02
};

enum SerialTraceErrorBits {
    ERROR_OVERFLOW                                      = 15,
    ERROR_RECEIVER                                      = 14,
    RECEIVER_DISABLED                                   = 9
};