# Autogenerated constants for Bootloader service
from enum import IntEnum
from jacdac.constants import *
from jacdac.system.constants import *
JD_SERVICE_CLASS_BOOTLOADER = const(0x1ffa9948)


class BootloaderError(IntEnum):
    NO_ERROR = const(0x0)
    PACKET_TOO_SMALL = const(0x1)
    OUT_OF_FLASHABLE_RANGE = const(0x2)
    INVALID_PAGE_OFFSET = const(0x3)
    NOT_PAGE_ALIGNED = const(0x4)


JD_BOOTLOADER_CMD_INFO = const(JD_CMD_ANNOUNCE)
JD_BOOTLOADER_CMD_SET_SESSION = const(0x81)
JD_BOOTLOADER_CMD_PAGE_DATA = const(0x80)
JD_BOOTLOADER_PACK_FORMATS = {
    JD_BOOTLOADER_CMD_SET_SESSION: "u32",
    JD_BOOTLOADER_CMD_PAGE_DATA: "u32 u16 u8 u8 u32 u32 u32 u32 u32 b[208]"
}
