Exemple #1
0
WORD    MACRxbufGetArray(BYTE *val, WORD len)
{
    /*
     * This function does not verify requested bytes against available
     * bytes in current packet.  Higher level logic must always validate
     * packet and fetch data according to packet header.
     */

    while( len-- )
        *val++ = MACRxbufGet();
    return len;
}
/**
 * Discard the contents of the current RX buffer. 
 */
void MACRxbufDiscard(void)
{
    BYTE newBoundary;
    WORD_VAL t;

    //Read the "Next Packet Pointer" from current MAC RX buffer. The first 4 bytes of the current
    //buffer contains the status, next packet pointer and length bytes.
    //Set 
    t.v[1] = MACCurrRxbuf;   //Page poiner to current MAC Rx Buffer
    t.v[0] = 1;              //"Next packet pointer" is second byte of packet
    NICSetAddr(t.Val);
    newBoundary = MACRxbufGet();

    //Update BNRY pointer with new value - this will remove current MAC RX Buffer from ring!
    //NICPut(CMDR, 0x20);         // Select PAGE 0, Abort remote DMA
    NICPut(BNRY, newBoundary);  //BNRY is the receive buffer's GET pointer
    return;
}