30#define NILE_MCU_BOOT_ACK 0x79
31#define NILE_MCU_BOOT_NACK 0x1F
32#define NILE_MCU_BOOT_START 0x5A
33#define NILE_MCU_BOOT_GET 0x00
34#define NILE_MCU_BOOT_GET_VERSION 0x01
35#define NILE_MCU_BOOT_GET_ID 0x02
36#define NILE_MCU_BOOT_READ_MEMORY 0x11
37#define NILE_MCU_BOOT_JUMP 0x21
38#define NILE_MCU_BOOT_WRITE_MEMORY 0x31
39#define NILE_MCU_BOOT_ERASE_MEMORY 0x44
40#define NILE_MCU_BOOT_SPECIAL 0x50
41#define NILE_MCU_BOOT_EXT_SPECIAL 0x51
42#define NILE_MCU_BOOT_WRITE_LOCK 0x63
43#define NILE_MCU_BOOT_WRITE_UNLOCK 0x73
44#define NILE_MCU_BOOT_READ_LOCK 0x82
45#define NILE_MCU_BOOT_READ_UNLOCK 0x92
46#define NILE_MCU_BOOT_GET_CRC 0xA1
48#define NILE_MCU_BOOT_ERASE_ALL_SECTORS 0xFFFF
50#define NILE_MCU_BOOT_FLAG_SIZE 0x01
51#define NILE_MCU_BOOT_FLAG_CHECKSUM 0x02
53#define NILE_MCU_FLASH_START 0x08000000
54#define NILE_MCU_FLASH_PAGE_SIZE 2048
56#define NILE_MCU_NATIVE_CMD(cmd, arg) (((cmd) & 0x7F) | ((arg) << 7))
63#define NILE_MCU_NATIVE_RESET_TIME_US 40000
71#define NILE_MCU_NATIVE_MODESWITCH_TIME_US 2500
148#define NILE_MCU_NATIVE_ERROR_SPI -1
153#define NILE_MCU_NATIVE_ERROR_MCU -2
165 int16_t __nile_mcu_native_send_cmd_async(uint16_t cmd,
int buflen,
const void __far* buffer);
166 return __nile_mcu_native_send_cmd_async(cmd, buflen, buffer);
210 int16_t result, bytes = 0;
static int16_t nile_mcu_native_recv_cmd_response_none(void)
uint8_t nile_mcu_boot_get_version(void)
Get the version of the SPI protocol used. More information is available in the Application Note AN428...
int16_t nile_mcu_native_recv_cmd(void __far *buffer, uint16_t buflen)
Receive the response of a "native protocol" MCU command synchronously.
uint16_t nile_mcu_boot_get_id(void)
Get the chip ID. More information is available in the Application Note AN4286.
bool nile_mcu_boot_send_data(const void __far *buffer, uint16_t len, uint8_t flags)
static int16_t nile_mcu_native_recv_cmd_response_uint8(void)
bool nile_mcu_boot_read_memory(uint32_t address, void __far *buffer, uint16_t buflen)
Request bytes from the MCU's address space.
bool nile_mcu_reset(bool to_bootloader)
Reset the MCU.
static int16_t nile_mcu_native_recv_cmd_response_int16(void)
int16_t nile_mcu_native_recv_cmd_start(uint16_t resplen)
Start receiving the response of a "native protocol" MCU command asynchronously.
bool nile_mcu_boot_jump(uint32_t address)
Request that the MCU branch to a specific address in memory.
bool nile_mcu_boot_send_cmd(uint8_t cmd)
static bool nile_mcu_boot_erase_all_memory(void)
Erase all of the MCU's flash memory.
bool nile_mcu_boot_write_memory(uint32_t address, const void __far *buffer, uint16_t buflen)
Write bytes to the MCU's address space (RAM or flash memory).
static int16_t nile_mcu_native_send_cmd(uint16_t cmd, const void __far *buffer, int buflen)
Send a "native protocol" MCU command asynchronously.
uint16_t nile_mcu_boot_recv_data(void __far *buffer, uint16_t buflen, uint8_t flags)
bool nile_mcu_boot_erase_memory(uint16_t sector_address, uint16_t sector_count)
Erase pages of the MCU's flash memory.
#define NILE_MCU_BOOT_ERASE_ALL_SECTORS
bool nile_mcu_boot_wait_ack(void)
int16_t nile_mcu_native_recv_cmd_finish(void __far *buffer, uint16_t buflen)
Finish receiving the response of a "native protocol" MCU command.