bool ApplicationCommandTarget::isCommandActive (const CommandID commandID)
{
    ApplicationCommandInfo info (commandID);
    info.flags = ApplicationCommandInfo::isDisabled;

    getCommandInfo (commandID, info);

    return (info.flags & ApplicationCommandInfo::isDisabled) == 0;
}
示例#2
0
void NANDController::communicate()
{
	/**************************************************************************************
	 * Read Signals
	 **************************************************************************************/
	for(int i=0; i<NUM_BANKS; i++) {
		RBn[i] = flash_RBn_SSlave[i];
	}



	/* When all banks are idle, set MON_CHABANKIDLE. */
	bool allIdle = true;

	for(int i=0; ( i<NUM_BANKS ) && allIdle; i++) {
		allIdle = getRegister(BSP_FSM(i)) == BS_IDLE;
	}

	if(allIdle && getRegister(WR_STAT) == WR_STAT_IDLE) {
		setRegister(MON_CHABANKIDLE, 0);
	}




	/**************************************************************************************
	 * If Issue flag is on, Execute command
	 **************************************************************************************/
	if(getRegister(FCP_ISSUE) == ISSUE_ENABLE)
	{
		printf( "Command ISSUED\n");

		if(getRegister(WR_STAT) == WR_STAT_BUSY) {
			printf( "Waiting Room is Busy, ignore this command\n");
		}
		else
		{
			getCommandInfo();


			//The Banks FSM is already running.
			if(getRegister(BSP_FSM(curFCPCommand.bank)) != BS_IDLE)
			{
				printf( "%d Bank is busy, put this command into WR\n", curFCPCommand.bank);

				//Active Wating Room.
				setRegister(WR_BANK, curFCPCommand.bank);
				setRegister(WR_STAT, WR_STAT_BUSY);
			}
			else {
				issueCommandToBank(curFCPCommand.bank);
				bIssued[curFCPCommand.bank] = true;
			}

			//set some banks are non-idle.
			setRegister(MON_CHABANKIDLE, 1);
		}

		//Clear ISSUE register
		setRegister(FCP_ISSUE, ISSUE_DISABLE);
	}



	/**************************************************************************************
	 * The bank that has next command in WR will be IDLE state, Issue the command.
	 **************************************************************************************/
	int wrBank = getRegister(WR_BANK);

	if(		getRegister(WR_STAT) == WR_STAT_BUSY		&&
			NextStateOfBanks[wrBank] == BS_IDLE)
	{
		printf( "%d Bank become IDLE, issue CMD to %d Bank from WR\n", wrBank, wrBank);

		issueCommandToBank(wrBank);
		bIssued[wrBank] = true;

		setRegister(WR_STAT, WR_STAT_IDLE);
	}




	/**************************************************************************************
	 * Banks FSM
	 **************************************************************************************/
	for(int i=0; i<NUM_BANKS; i++)
	{
		if(bIssued[i]) {
			runCommand(i);
			bIssued[i] = false;
		}


		combinationalLogicBankFSM(i);
	}




	/**************************************************************************************
	 * Send Drive
	 **************************************************************************************/
	// Send(drive) all the signals set in previous update()
	//ahb_m0_mpms->sendDrive();
	// Send(drive) all the signals set in previous update()
	//ahb_m1_mpms->sendDrive();
	// Send(drive) all the signals set in previous update()
	//ahb_s0_spss->sendDrive();
}