lib/sw_services/xilflash/src/xilflash_amd.c
int XFlashAmd_DeviceControl(XFlash * InstancePtr, u32 Command,
						DeviceCtrlParam *Parameters)
{
	u32 BlockAddr;
	u32 Offset;
	int Status = (int)XST_FAILURE;
	XFlashVendorData_Amd *DevDataPtr;

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

	DevDataPtr = GET_PARTDATA(InstancePtr);

	switch (Command) {
		case XFL_DEVCTL_GET_GEOMETRY:
			Parameters->GeometryParam.GeometryPtr =
							&InstancePtr->Geometry;
			Status = (XST_SUCCESS);
			break;

		case XFL_DEVCTL_GET_PROPERTIES:
			Parameters->PropertiesParam.PropertiesPtr =
						&InstancePtr->Properties;
			Status = (XST_SUCCESS);
			break;

		case XFL_DEVCTL_ERASE_RESUME:
			BlockAddr = (*((u32*)Parameters));
			Status = EraseResume (InstancePtr, BlockAddr);
			break;

		case XFL_DEVCTL_ERASE_SUSPEND:
			BlockAddr = (*((u32*)Parameters));
			Status = EraseSuspend (InstancePtr, BlockAddr);
			break;

		case XFL_DEVCTL_ENTER_EXT_MODE:
			EnterExtendedBlockMode(InstancePtr);
			Status = (XST_SUCCESS);
			break;

		case XFL_DEVCTL_EXIT_EXT_MODE:
			ExitExtendedBlockMode(InstancePtr);
			Status = (XST_SUCCESS);
			break;

		case XFL_DEVCTL_PROTECTION_STATUS:
			Offset = (*((u32*)Parameters));
			Status = CheckBlockProtection(InstancePtr, Offset);
			break;

		case XFL_DEVCTL_CHIP_ERASE:
			Status = XFlashAmd_EraseChip(InstancePtr);
			break;

		default:
			Status = (XFLASH_NOT_SUPPORTED);
	}

	return (Status);
}
/*****************************************************************************/
/**
*
* Performs the AMD device specific control functions.
*
* @param	InstancePtr is the pointer to the XFlash instance.
* @param	Command is the device specific command to issue.
* @param	Parameters specifies the arguments passed to the device control
*		function.
*
* @return
*		- XST_SUCCESS if successful.
*		- XFLASH_NOT_SUPPORTED if the command is not
* 		  recognized/supported by the device(s).
*
* @note		None.
*
******************************************************************************/
Performs the AMD device specific control functions.
Performs the AMD device specific control functions .
int XFlashAmd_DeviceControl(XFlash * InstancePtr, u32 Command,
						DeviceCtrlParam *Parameters)
{
	u32 BlockAddr;
	u32 Offset;
	int Status = (int)XST_FAILURE;
	XFlashVendorData_Amd *DevDataPtr;
	if(InstancePtr == NULL) {
		return (XST_FAILURE);
	}
	DevDataPtr = GET_PARTDATA(InstancePtr);
	switch (Command) {
		case XFL_DEVCTL_GET_GEOMETRY:
			Parameters->GeometryParam.GeometryPtr =
							&InstancePtr->Geometry;
			Status = (XST_SUCCESS);
			break;
		case XFL_DEVCTL_GET_PROPERTIES:
			Parameters->PropertiesParam.PropertiesPtr =
						&InstancePtr->Properties;
			Status = (XST_SUCCESS);
			break;
		case XFL_DEVCTL_ERASE_RESUME:
			BlockAddr = (*((u32*)Parameters));
			Status = EraseResume (InstancePtr, BlockAddr);
			break;
		case XFL_DEVCTL_ERASE_SUSPEND:
			BlockAddr = (*((u32*)Parameters));
			Status = EraseSuspend (InstancePtr, BlockAddr);
			break;
		case XFL_DEVCTL_ENTER_EXT_MODE:
			EnterExtendedBlockMode(InstancePtr);
			Status = (XST_SUCCESS);
			break;
		case XFL_DEVCTL_EXIT_EXT_MODE:
			ExitExtendedBlockMode(InstancePtr);
			Status = (XST_SUCCESS);
			break;
		case XFL_DEVCTL_PROTECTION_STATUS:
			Offset = (*((u32*)Parameters));
			Status = CheckBlockProtection(InstancePtr, Offset);
			break;
		case XFL_DEVCTL_CHIP_ERASE:
			Status = XFlashAmd_EraseChip(InstancePtr);
			break;
		default:
			Status = (XFLASH_NOT_SUPPORTED);
	}
	return (Status);
}
int XFlashAmd_DeviceControl ( XFlash * InstancePtr , u32 Command , DeviceCtrlParam * Parameters ) { u32 BlockAddr ; u32 Offset ; int Status = ( int ) XST_FAILURE ; XFlashVendorData_Amd * DevDataPtr ; if ( InstancePtr == NULL ) { return ( XST_FAILURE ) ; } DevDataPtr = GET_PARTDATA ( InstancePtr ) ; switch ( Command ) { case XFL_DEVCTL_GET_GEOMETRY : Parameters -> GeometryParam . GeometryPtr = & InstancePtr -> Geometry ; Status = ( XST_SUCCESS ) ; break ; case XFL_DEVCTL_GET_PROPERTIES : Parameters -> PropertiesParam . PropertiesPtr = & InstancePtr -> Properties ; Status = ( XST_SUCCESS ) ; break ; case XFL_DEVCTL_ERASE_RESUME : BlockAddr = ( * ( ( u32 * ) Parameters ) ) ; Status = EraseResume ( InstancePtr , BlockAddr ) ; break ; case XFL_DEVCTL_ERASE_SUSPEND : BlockAddr = ( * ( ( u32 * ) Parameters ) ) ; Status = EraseSuspend ( InstancePtr , BlockAddr ) ; break ; case XFL_DEVCTL_ENTER_EXT_MODE : EnterExtendedBlockMode ( InstancePtr ) ; Status = ( XST_SUCCESS ) ; break ; case XFL_DEVCTL_EXIT_EXT_MODE : ExitExtendedBlockMode ( InstancePtr ) ; Status = ( XST_SUCCESS ) ; break ; case XFL_DEVCTL_PROTECTION_STATUS : Offset = ( * ( ( u32 * ) Parameters ) ) ; Status = CheckBlockProtection ( InstancePtr , Offset ) ; break ; case XFL_DEVCTL_CHIP_ERASE : Status = XFlashAmd_EraseChip ( InstancePtr ) ; break ; default : Status = ( XFLASH_NOT_SUPPORTED ) ; } return ( Status ) ; }
Performs the AMD device specific control functions.
Performs the AMD device specific control functions .
/*
	 * Verify inputs are valid.
	 */