/* Unprotected the contents of the serial flash device.  */
uint8_t s25fl1xx_data_unprotect(struct qspid_t *qspid)
/* Unprotected the contents of the serial flash device.  */
uint8_t s25fl1xx_data_unprotect(struct qspid_t *qspid)
{
	uint8_t status[3];
	status[0]= s25fl1xx_read_status1(qspid);
	status[1]= s25fl1xx_read_status2(qspid);
	status[2]= s25fl1xx_read_status3(qspid);
	if (!(status[0] & S25FL1XX_CHIP_PROTECT_Msk)) {
		return 0;
	}
	status[0] &= (~S25FL1XX_CHIP_PROTECT_Msk);
	s25fl1xx_write_status(qspid, status);
	status[0] = s25fl1xx_read_status(qspid);
	if (status[0] & S25FL1XX_CHIP_PROTECT_Msk) {
		return S25FL1XX_ERROR_PROTECTED;
	}
	else {
		return 0;
	}
}