static void sd_erase(SDState *sd)

{

    int i, start, end;

    if (!sd->erase_start || !sd->erase_end) {

        sd->card_status |= ERASE_SEQ_ERROR;

        return;

    }



    start = sd->erase_start >>

            (HWBLOCK_SHIFT + SECTOR_SHIFT + WPGROUP_SHIFT);

    end = sd->erase_end >>

            (HWBLOCK_SHIFT + SECTOR_SHIFT + WPGROUP_SHIFT);

    sd->erase_start = 0;

    sd->erase_end = 0;

    sd->csd[14] |= 0x40;



    for (i = start; i <= end; i ++)

        if (sd->wp_groups[i])

            sd->card_status |= WP_ERASE_SKIP;

}

static void sd_erase(SDState *sd)

{

    int i, start, end;

    if (!sd->erase_start || !sd->erase_end) {

        sd->card_status |= ERASE_SEQ_ERROR;

        return;

    }



    start = sd->erase_start >>

            (HWBLOCK_SHIFT + SECTOR_SHIFT + WPGROUP_SHIFT);

    end = sd->erase_end >>

            (HWBLOCK_SHIFT + SECTOR_SHIFT + WPGROUP_SHIFT);

    sd->erase_start = 0;

    sd->erase_end = 0;

    sd->csd[14] |= 0x40;



    for (i = start; i <= end; i ++)

        if (sd->wp_groups[i])

            sd->card_status |= WP_ERASE_SKIP;

}

static void FUNC_0(SDState *VAR_0)

{

    int VAR_1, VAR_2, VAR_3;

    if (!VAR_0->erase_start || !VAR_0->erase_end) {

        VAR_0->card_status |= ERASE_SEQ_ERROR;

        return;

    }



    VAR_2 = VAR_0->erase_start >>

            (HWBLOCK_SHIFT + SECTOR_SHIFT + WPGROUP_SHIFT);

    VAR_3 = VAR_0->erase_end >>

            (HWBLOCK_SHIFT + SECTOR_SHIFT + WPGROUP_SHIFT);

    VAR_0->erase_start = 0;

    VAR_0->erase_end = 0;

    VAR_0->csd[14] |= 0x40;



    for (VAR_1 = VAR_2; VAR_1 <= VAR_3; VAR_1 ++)

        if (VAR_0->wp_groups[VAR_1])

            VAR_0->card_status |= WP_ERASE_SKIP;

}

static void FUNC_0(SDState *VAR_0)
{ int VAR_1, VAR_2, VAR_3; if (!VAR_0->erase_start || !VAR_0->erase_end) { VAR_0->card_status |= ERASE_SEQ_ERROR; return; } VAR_2 = VAR_0->erase_start >>
(HWBLOCK_SHIFT + SECTOR_SHIFT + WPGROUP_SHIFT); VAR_3 = VAR_0->erase_end >>
(HWBLOCK_SHIFT + SECTOR_SHIFT + WPGROUP_SHIFT); VAR_0->erase_start = 0; VAR_0->erase_end = 0; VAR_0->csd[14] |= 0x40; for (VAR_1 = VAR_2; VAR_1 <= VAR_3; VAR_1 ++) if (VAR_0->wp_groups[VAR_1])
VAR_0->card_status |= WP_ERASE_SKIP; }