lib/sw_services/xilflash/src/xilflash_amd.c
int XFlashAmd_EraseChip(XFlash * InstancePtr)
{
	int Status = (int)XST_FAILURE;
	XFlashGeometry *GeomPtr;
	XFlashVendorData_Amd *DevDataPtr;

	/*
	 * Verify inputs are valid.
	 */
	if(InstancePtr == NULL) {
		return (XST_FAILURE);
	}

	DevDataPtr = GET_PARTDATA(InstancePtr);

	GeomPtr = &InstancePtr->Geometry;

	/*
	 * Send Chip Erase command.
	 */
	DevDataPtr->SendCmdSeq(GeomPtr->BaseAddress,
			XFL_AMD_CMD1_ADDR, XFL_AMD_CMD2_ADDR,
			XFL_AMD_CMD1_DATA, XFL_AMD_CMD2_DATA);
	DevDataPtr->SendCmd(GeomPtr->BaseAddress,
			XFL_AMD_CMD1_ADDR, XFL_AMD_CMD_ERASE1);
	DevDataPtr->SendCmdSeq(GeomPtr->BaseAddress,
			XFL_AMD_CMD1_ADDR, XFL_AMD_CMD2_ADDR,
			XFL_AMD_CMD1_DATA, XFL_AMD_CMD2_DATA);

	DevDataPtr->SendCmd(GeomPtr->BaseAddress,
			XFL_AMD_CMD1_ADDR, XFL_AMD_CMD_ERASE_CHIP);


	/*
	 * Wait until Program/Erase Controller starts.
	 */
	Status = DevDataPtr->PollSR(GeomPtr->BaseAddress, 0);
	(void) XFlashAmd_Reset(InstancePtr);
	if (Status != XFLASH_READY) {
		return (Status);
	}

	return (XST_SUCCESS);
}
/*****************************************************************************/
/**
*
* The function can be used to erase the whole flash chip. Each Block is erased
* in turn. The function only returns when all of the Blocks have been erased or
* have generated an error..
*
* @param	InstancePtr is the pointer to the XFlash instance.
*
* @return
*		- XST_SUCCESS if successful.
*		- XST_FAILURE if fail.
*
* @note		Application has to check block protection status of all the
*		blocks before calling this API. If any block is protected then
*		this API will return error.
*
******************************************************************************/
The function can be used to erase the whole flash chip. Each Block is erased
in turn. The function only returns when all of the Blocks have been erased or
have generated an error
The function can be used to erase the whole flash chip . Each Block is erased in turn . The function only returns when all of the Blocks have been erased or have generated an error
int XFlashAmd_EraseChip(XFlash * InstancePtr)
{
	int Status = (int)XST_FAILURE;
	XFlashGeometry *GeomPtr;
	XFlashVendorData_Amd *DevDataPtr;
	if(InstancePtr == NULL) {
		return (XST_FAILURE);
	}
	DevDataPtr = GET_PARTDATA(InstancePtr);
	GeomPtr = &InstancePtr->Geometry;
	DevDataPtr->SendCmdSeq(GeomPtr->BaseAddress,
			XFL_AMD_CMD1_ADDR, XFL_AMD_CMD2_ADDR,
			XFL_AMD_CMD1_DATA, XFL_AMD_CMD2_DATA);
	DevDataPtr->SendCmd(GeomPtr->BaseAddress,
			XFL_AMD_CMD1_ADDR, XFL_AMD_CMD_ERASE1);
	DevDataPtr->SendCmdSeq(GeomPtr->BaseAddress,
			XFL_AMD_CMD1_ADDR, XFL_AMD_CMD2_ADDR,
			XFL_AMD_CMD1_DATA, XFL_AMD_CMD2_DATA);
	DevDataPtr->SendCmd(GeomPtr->BaseAddress,
			XFL_AMD_CMD1_ADDR, XFL_AMD_CMD_ERASE_CHIP);
	Status = DevDataPtr->PollSR(GeomPtr->BaseAddress, 0);
	(void) XFlashAmd_Reset(InstancePtr);
	if (Status != XFLASH_READY) {
		return (Status);
	}
	return (XST_SUCCESS);
}
int XFlashAmd_EraseChip ( XFlash * InstancePtr ) { int Status = ( int ) XST_FAILURE ; XFlashGeometry * GeomPtr ; XFlashVendorData_Amd * DevDataPtr ; if ( InstancePtr == NULL ) { return ( XST_FAILURE ) ; } DevDataPtr = GET_PARTDATA ( InstancePtr ) ; GeomPtr = & InstancePtr -> Geometry ; DevDataPtr -> SendCmdSeq ( GeomPtr -> BaseAddress , XFL_AMD_CMD1_ADDR , XFL_AMD_CMD2_ADDR , XFL_AMD_CMD1_DATA , XFL_AMD_CMD2_DATA ) ; DevDataPtr -> SendCmd ( GeomPtr -> BaseAddress , XFL_AMD_CMD1_ADDR , XFL_AMD_CMD_ERASE1 ) ; DevDataPtr -> SendCmdSeq ( GeomPtr -> BaseAddress , XFL_AMD_CMD1_ADDR , XFL_AMD_CMD2_ADDR , XFL_AMD_CMD1_DATA , XFL_AMD_CMD2_DATA ) ; DevDataPtr -> SendCmd ( GeomPtr -> BaseAddress , XFL_AMD_CMD1_ADDR , XFL_AMD_CMD_ERASE_CHIP ) ; Status = DevDataPtr -> PollSR ( GeomPtr -> BaseAddress , 0 ) ; ( void ) XFlashAmd_Reset ( InstancePtr ) ; if ( Status != XFLASH_READY ) { return ( Status ) ; } return ( XST_SUCCESS ) ; }
The function can be used to erase the whole flash chip.
The function can be used to erase the whole flash chip .
/*
	 * Verify inputs are valid.
	 */ /*
	 * Send Chip Erase command.
	 */ /*
	 * Wait until Program/Erase Controller starts.
	 */