static void stellaris_enet_receive(void *opaque, const uint8_t *buf, size_t size)

{

    stellaris_enet_state *s = (stellaris_enet_state *)opaque;

    int n;

    uint8_t *p;

    uint32_t crc;



    if ((s->rctl & SE_RCTL_RXEN) == 0)

        return;

    if (s->np >= 31) {

        DPRINTF("Packet dropped\n");

        return;

    }



    DPRINTF("Received packet len=%d\n", size);

    n = s->next_packet + s->np;

    if (n >= 31)

        n -= 31;

    s->np++;



    s->rx[n].len = size + 6;

    p = s->rx[n].data;

    *(p++) = (size + 6);

    *(p++) = (size + 6) >> 8;

    memcpy (p, buf, size);

    p += size;

    crc = crc32(~0, buf, size);

    *(p++) = crc;

    *(p++) = crc >> 8;

    *(p++) = crc >> 16;

    *(p++) = crc >> 24;

    /* Clear the remaining bytes in the last word.  */

    if ((size & 3) != 2) {

        memset(p, 0, (6 - size) & 3);

    }



    s->ris |= SE_INT_RX;

    stellaris_enet_update(s);

}

static void stellaris_enet_receive(void *opaque, const uint8_t *buf, size_t size)

{

    stellaris_enet_state *s = (stellaris_enet_state *)opaque;

    int n;

    uint8_t *p;

    uint32_t crc;



    if ((s->rctl & SE_RCTL_RXEN) == 0)

        return;

    if (s->np >= 31) {

        DPRINTF("Packet dropped\n");

        return;

    }



    DPRINTF("Received packet len=%d\n", size);

    n = s->next_packet + s->np;

    if (n >= 31)

        n -= 31;

    s->np++;



    s->rx[n].len = size + 6;

    p = s->rx[n].data;

    *(p++) = (size + 6);

    *(p++) = (size + 6) >> 8;

    memcpy (p, buf, size);

    p += size;

    crc = crc32(~0, buf, size);

    *(p++) = crc;

    *(p++) = crc >> 8;

    *(p++) = crc >> 16;

    *(p++) = crc >> 24;

    

    if ((size & 3) != 2) {

        memset(p, 0, (6 - size) & 3);

    }



    s->ris |= SE_INT_RX;

    stellaris_enet_update(s);

}

static void FUNC_0(void *VAR_0, const uint8_t *VAR_1, size_t VAR_2)

{

    stellaris_enet_state *s = (stellaris_enet_state *)VAR_0;

    int VAR_3;

    uint8_t *p;

    uint32_t crc;



    if ((s->rctl & SE_RCTL_RXEN) == 0)

        return;

    if (s->np >= 31) {

        DPRINTF("Packet dropped\VAR_3");

        return;

    }



    DPRINTF("Received packet len=%d\VAR_3", VAR_2);

    VAR_3 = s->next_packet + s->np;

    if (VAR_3 >= 31)

        VAR_3 -= 31;

    s->np++;



    s->rx[VAR_3].len = VAR_2 + 6;

    p = s->rx[VAR_3].data;

    *(p++) = (VAR_2 + 6);

    *(p++) = (VAR_2 + 6) >> 8;

    memcpy (p, VAR_1, VAR_2);

    p += VAR_2;

    crc = crc32(~0, VAR_1, VAR_2);

    *(p++) = crc;

    *(p++) = crc >> 8;

    *(p++) = crc >> 16;

    *(p++) = crc >> 24;

    

    if ((VAR_2 & 3) != 2) {

        memset(p, 0, (6 - VAR_2) & 3);

    }



    s->ris |= SE_INT_RX;

    stellaris_enet_update(s);

}

static void FUNC_0(void *VAR_0, const uint8_t *VAR_1, size_t VAR_2)
{ stellaris_enet_state *s = (stellaris_enet_state *)VAR_0; int VAR_3; uint8_t *p; uint32_t crc; if ((s->rctl & SE_RCTL_RXEN) == 0)
return; if (s->np >= 31) { DPRINTF("Packet dropped\VAR_3"); return; } DPRINTF("Received packet len=%d\VAR_3", VAR_2); VAR_3 = s->next_packet + s->np; if (VAR_3 >= 31)
VAR_3 -= 31; s->np++; s->rx[VAR_3].len = VAR_2 + 6; p = s->rx[VAR_3].data; *(p++) = (VAR_2 + 6); *(p++) = (VAR_2 + 6) >> 8; memcpy (p, VAR_1, VAR_2); p += VAR_2; crc = crc32(~0, VAR_1, VAR_2); *(p++) = crc; *(p++) = crc >> 8; *(p++) = crc >> 16; *(p++) = crc >> 24; if ((VAR_2 & 3) != 2) { memset(p, 0, (6 - VAR_2) & 3); } s->ris |= SE_INT_RX; stellaris_enet_update(s); }