lib/sw_services/xilflash/src/xilflash_amd.c
static int XFlashAmd_ResetBank(XFlash * InstancePtr, u32 Offset, u32 Bytes)
{
	XFlashVendorData_Amd *DevDataPtr;
	u16 Region, Block;
	u32 Dummy;
	u32 Status = (u32)XST_FAILURE;
	XFlashGeometry *GeomPtr;

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

	/*
	 * Handle case when zero bytes is provided.
	 */
	if (Bytes == 0) {
		return XST_SUCCESS;
	}

	DevDataPtr = GET_PARTDATA(InstancePtr);
	GeomPtr = &InstancePtr->Geometry;

	/*
	 * Convert the starting address to block coordinates. This also verifies
	 * the starting address is within the instance's address space.
	 */
	Status = XFlashGeometry_ToBlock(GeomPtr, Offset, &Region,
							&Block, &Dummy);
	if (Status != XST_SUCCESS) {
		return (XFLASH_ADDRESS_ERROR);
	}

	while ((InstancePtr->Geometry.EraseRegion[Region].AbsoluteOffset <=
		(Offset + Bytes - 1)) &&
		(Region < InstancePtr->Geometry.NumEraseRegions)) {
		/*
		 * Send the Command Reset. Use the max write
		 * width to notify parts of all layouts.
		 */
		DevDataPtr->WriteFlash(InstancePtr->Geometry.BaseAddress,
					InstancePtr->Geometry.EraseRegion
					[Region].AbsoluteOffset,
					XFL_AMD_CMD_RESET);
		/*
		 * Increment the region/bank.
		 */
		Region++;
	}

	return (XST_SUCCESS);
}
/*****************************************************************************/
/**
*
* This function places the flash region in the Read Array mode. In this mode the
* flash can be read as normal memory. All of the other functions leave the flash
* in the Read Array mode so this is not strictly necessary. It is provided for
* completeness and in case of problems.
*
* @param	InstancePtr is the pointer to the XFlash instance.
* @param	Offset is the bank/region address.
*
* @return
* 		- XST_SUCCESS if successful.
*		- XST_FAILURE if failed to reset device.
*
* @note		None.
*
******************************************************************************/
This function places the flash region in the Read Array mode. In this mode the
flash can be read as normal memory. All of the other functions leave the flash
in the Read Array mode so this is not strictly necessary. It is provided for
completeness and in case of problems.
This function places the flash region in the Read Array mode . In this mode the flash can be read as normal memory . All of the other functions leave the flash in the Read Array mode so this is not strictly necessary . It is provided for completeness and in case of problems .
static int XFlashAmd_ResetBank(XFlash * InstancePtr, u32 Offset, u32 Bytes)
{
	XFlashVendorData_Amd *DevDataPtr;
	u16 Region, Block;
	u32 Dummy;
	u32 Status = (u32)XST_FAILURE;
	XFlashGeometry *GeomPtr;
	if(InstancePtr == NULL) {
		return (XST_FAILURE);
	}
	if (Bytes == 0) {
		return XST_SUCCESS;
	}
	DevDataPtr = GET_PARTDATA(InstancePtr);
	GeomPtr = &InstancePtr->Geometry;
	Status = XFlashGeometry_ToBlock(GeomPtr, Offset, &Region,
							&Block, &Dummy);
	if (Status != XST_SUCCESS) {
		return (XFLASH_ADDRESS_ERROR);
	}
	while ((InstancePtr->Geometry.EraseRegion[Region].AbsoluteOffset <=
		(Offset + Bytes - 1)) &&
		(Region < InstancePtr->Geometry.NumEraseRegions)) {
		DevDataPtr->WriteFlash(InstancePtr->Geometry.BaseAddress,
					InstancePtr->Geometry.EraseRegion
					[Region].AbsoluteOffset,
					XFL_AMD_CMD_RESET);
		Region++;
	}
	return (XST_SUCCESS);
}
static int XFlashAmd_ResetBank ( XFlash * InstancePtr , u32 Offset , u32 Bytes ) { XFlashVendorData_Amd * DevDataPtr ; u16 Region , Block ; u32 Dummy ; u32 Status = ( u32 ) XST_FAILURE ; XFlashGeometry * GeomPtr ; if ( InstancePtr == NULL ) { return ( XST_FAILURE ) ; } if ( Bytes == 0 ) { return XST_SUCCESS ; } DevDataPtr = GET_PARTDATA ( InstancePtr ) ; GeomPtr = & InstancePtr -> Geometry ; Status = XFlashGeometry_ToBlock ( GeomPtr , Offset , & Region , & Block , & Dummy ) ; if ( Status != XST_SUCCESS ) { return ( XFLASH_ADDRESS_ERROR ) ; } while ( ( InstancePtr -> Geometry . EraseRegion [ Region ] . AbsoluteOffset <= ( Offset + Bytes - 1 ) ) && ( Region < InstancePtr -> Geometry . NumEraseRegions ) ) { DevDataPtr -> WriteFlash ( InstancePtr -> Geometry . BaseAddress , InstancePtr -> Geometry . EraseRegion [ Region ] . AbsoluteOffset , XFL_AMD_CMD_RESET ) ; Region ++ ; } return ( XST_SUCCESS ) ; }
This function places the flash region in the Read Array mode.
This function places the flash region in the Read Array mode .
/*
	 * Verify inputs are valid.
	 */ /*
	 * Handle case when zero bytes is provided.
	 */ /*
	 * Convert the starting address to block coordinates. This also verifies
	 * the starting address is within the instance's address space.
	 */ /*
		 * Send the Command Reset. Use the max write
		 * width to notify parts of all layouts.
		 */ /*
		 * Increment the region/bank.
		 */