/* Check if IO range is illegal in current partition.  */
static status_t MMC_CheckIORange(mmc_card_t *card, uint32_t startBlock, uint32_t blockCount)
/* Check if IO range is illegal in current partition.  */
static status_t MMC_CheckIORange(mmc_card_t *card, uint32_t startBlock, uint32_t blockCount)
{
    status_t error = kStatus_Success;
    switch (card->currentPartition)
    {
        case kMMC_AccessPartitionUserAera:
        {
            if ((startBlock + blockCount) > (card->userPartitionBlocks))
            {
                error = kStatus_InvalidArgument;
            }
            break;
        }
        case kMMC_AccessPartitionBoot1:
        case kMMC_AccessPartitionBoot2:
        {
            if ((startBlock + blockCount) > card->bootPartitionBlocks)
            {
                error = kStatus_InvalidArgument;
            }
            break;
        }
        default:
            error = kStatus_InvalidArgument;
            break;
    }
    return error;
}