static void sdhci_write_dataport(SDHCIState *s, uint32_t value, unsigned size)

{

    unsigned i;



    /* Check that there is free space left in a buffer */

    if (!(s->prnsts & SDHC_SPACE_AVAILABLE)) {

        ERRPRINT("Can't write to data buffer: buffer full\n");

        return;

    }



    for (i = 0; i < size; i++) {

        s->fifo_buffer[s->data_count] = value & 0xFF;

        s->data_count++;

        value >>= 8;

        if (s->data_count >= (s->blksize & 0x0fff)) {

            DPRINT_L2("write buffer filled with %u bytes of data\n",

                    s->data_count);

            s->data_count = 0;

            s->prnsts &= ~SDHC_SPACE_AVAILABLE;

            if (s->prnsts & SDHC_DOING_WRITE) {

                SDHCI_GET_CLASS(s)->write_block_to_card(s);

            }

        }

    }

}

static void sdhci_write_dataport(SDHCIState *s, uint32_t value, unsigned size)

{

    unsigned i;



    

    if (!(s->prnsts & SDHC_SPACE_AVAILABLE)) {

        ERRPRINT("Can't write to data buffer: buffer full\n");

        return;

    }



    for (i = 0; i < size; i++) {

        s->fifo_buffer[s->data_count] = value & 0xFF;

        s->data_count++;

        value >>= 8;

        if (s->data_count >= (s->blksize & 0x0fff)) {

            DPRINT_L2("write buffer filled with %u bytes of data\n",

                    s->data_count);

            s->data_count = 0;

            s->prnsts &= ~SDHC_SPACE_AVAILABLE;

            if (s->prnsts & SDHC_DOING_WRITE) {

                SDHCI_GET_CLASS(s)->write_block_to_card(s);

            }

        }

    }

}

static void FUNC_0(SDHCIState *VAR_0, uint32_t VAR_1, unsigned VAR_2)

{

    unsigned VAR_3;



    

    if (!(VAR_0->prnsts & SDHC_SPACE_AVAILABLE)) {

        ERRPRINT("Can't write to data buffer: buffer full\n");

        return;

    }



    for (VAR_3 = 0; VAR_3 < VAR_2; VAR_3++) {

        VAR_0->fifo_buffer[VAR_0->data_count] = VAR_1 & 0xFF;

        VAR_0->data_count++;

        VAR_1 >>= 8;

        if (VAR_0->data_count >= (VAR_0->blksize & 0x0fff)) {

            DPRINT_L2("write buffer filled with %u bytes of data\n",

                    VAR_0->data_count);

            VAR_0->data_count = 0;

            VAR_0->prnsts &= ~SDHC_SPACE_AVAILABLE;

            if (VAR_0->prnsts & SDHC_DOING_WRITE) {

                SDHCI_GET_CLASS(VAR_0)->write_block_to_card(VAR_0);

            }

        }

    }

}

static void FUNC_0(SDHCIState *VAR_0, uint32_t VAR_1, unsigned VAR_2)
{ unsigned VAR_3; if (!(VAR_0->prnsts & SDHC_SPACE_AVAILABLE)) { ERRPRINT("Can't write to data buffer: buffer full\n"); return; } for (VAR_3 = 0; VAR_3 < VAR_2; VAR_3++) { VAR_0->fifo_buffer[VAR_0->data_count] = VAR_1 & 0xFF; VAR_0->data_count++; VAR_1 >>= 8; if (VAR_0->data_count >= (VAR_0->blksize & 0x0fff)) { DPRINT_L2("write buffer filled with %u bytes of data\n",
VAR_0->data_count); VAR_0->data_count = 0; VAR_0->prnsts &= ~SDHC_SPACE_AVAILABLE; if (VAR_0->prnsts & SDHC_DOING_WRITE) { SDHCI_GET_CLASS(VAR_0)->write_block_to_card(VAR_0); } } } }