#pragma once

#include "s600.h"

#define APP_BOOT_OK			0x11223344

#define PART_FACTORY		0x08001FF0
#define PART_APP			0x08002000
#define PART_NAME			0x08002800
#define PART_VERSION		0x08002808

#define S600_IAP_CRC32		1

typedef struct {
	u32 length;
	u32 checksum;
	u32 success;
} s600_iap_info_t;

void s600_iap_write_begin(void);
bool s600_iap_write_end(u32 length, u32 checksum);
bool s600_iap_write_page(u32 addr, const void *buff, u16 length, bool erase);
bool s600_iap_flush(u32 length);
bool s600_iap_write(const u8 *buff, u16 length);
bool s600_iap_write_u32(u32 value);
bool s600_iap_boot(bool normal);
u32 s600_iap_checksum(u32 addr, u32 length);
