/******************************************************************************* * Function Name : SCSI_Format_Cmd * Description : Format Commands routine. * Input : None. * Output : None. * Return : None. *******************************************************************************/ void SCSI_Format_Cmd(uint8_t lun) { if (MAL_GetStatus(lun)) { Set_Scsi_Sense_Data(CBW.bLUN, NOT_READY, MEDIUM_NOT_PRESENT); Set_CSW (CSW_CMD_FAILED, SEND_CSW_ENABLE); Bot_Abort(DIR_IN); return; } else { NAND_Format(); Set_CSW (CSW_CMD_PASSED, SEND_CSW_ENABLE); } }
/******************************************************************************* * Function Name : SCSI_Format_Cmd * Description : Format Commands routine. * Input : None. * Output : None. * Return : None. *******************************************************************************/ void SCSI_Format_Cmd(uint8_t lun) { if (DRV_MSp_UpdateStatus(lun)) { Set_Scsi_Sense_Data(CBW.bLUN, NOT_READY, MEDIUM_NOT_PRESENT); Set_CSW (CSW_CMD_FAILED, SEND_CSW_ENABLE); Bot_Abort(DIR_IN); return; } #ifdef USE_STM3210E_EVAL else { NAND_Format(); Set_CSW (CSW_CMD_PASSED, SEND_CSW_ENABLE); } #endif }
/******************************************************************************* * Function Name : SCSI_Format_Cmd * Description : Format Commands routine. * Input : None. * Output : None. * Return : None. *******************************************************************************/ void SCSI_Format_Cmd(uint8_t lun) { if (MAL_GetStatus(lun)) { //This is STs code - spec says this always has to be supported, even with SD cards //Set_Scsi_Sense_Data(CBW.bLUN, NOT_READY, MEDIUM_NOT_PRESENT); //Set_CSW (CSW_CMD_FAILED, SEND_CSW_ENABLE); //Bot_Abort(DIR_IN); Set_CSW (CSW_CMD_PASSED, SEND_CSW_ENABLE); return; } #ifdef USE_STM3210E_EVAL else { NAND_Format(); Set_CSW (CSW_CMD_PASSED, SEND_CSW_ENABLE); } #endif }
/******************************************************************************* * Function Name : Mass_Storage_Recovery * Description : Erases the NAND Flash Content. * Input : None * Output : None * Return : None *******************************************************************************/ void Mass_Storage_Recovery (void) { /* Disble the JoyStick interrupts */ IntExtOnOffConfig(DISABLE); while(ReadKey() != NOKEY) { } LCD_Clear(White); RCC_AHBPeriphClockCmd(RCC_AHBPeriph_FSMC, ENABLE); /* Set the Back Color */ LCD_SetBackColor(Blue); /* Set the Text Color */ LCD_SetTextColor(White); LCD_DisplayStringLine(Line4, " Erase NAND Content "); LCD_DisplayStringLine(Line5, "Please wait... "); /* FSMC Initialization */ FSMC_NAND_Init(); NAND_Format(); /* Display the "To stop Press SEL" message */ LCD_DisplayStringLine(Line4, " NAND Erased "); LCD_DisplayStringLine(Line5, " To exit Press SEL "); /* Loop until SEL key pressed */ while(ReadKey() != SEL) { } LCD_Clear(White); DisplayMenu(); IntExtOnOffConfig(ENABLE); }