#ifndef __SN32F100_FLASH_H
#define __SN32F100_FLASH_H

/*_____ I N C L U D E S ____________________________________________________*/
#include <SN32F100.h>
#include <SN32F100_Def.h>


/*_____ D E F I N I T I O N S ______________________________________________*/
// Flash Control Register definitions
#define FLASH_PG										0x00000001
#define FLASH_PER										0x00000002
#define FLASH_STARTE									0x00000040

// Flash Status Register definitions
#define FLASH_BUSY									0x00000001
#define FLASH_PGERR									0x00000004
#define FLASH_EOP		0x00000020


/*_____ M A C R O S ________________________________________________________*/

//Flash Status
#define	__FLASH_CLEAR_ERROR_STATUS	SN_FLASH->STATUS &= ~FLASH_PGERR


/*_____ D E C L A R A T I O N S ____________________________________________*/
extern	uint32_t wFLASH_PGRAM[2];

void FLASH_EraseSector (uint32_t);
uint32_t FLASH_ProgramPage (uint32_t, uint32_t, uint8_t *);


#endif	/* __SN32F100_FLASH_H */
