void refiq() { register struct mbuf *bp; char i_state; #ifdef PI /* Temp hack to satisfy PI DMA requirements */ int32 dma_abs; /* TEMP */ int16 dma_page; /* TEMP */ #endif /* Empty the garbage */ if(Garbq != NULLBUF){ i_state = dirps(); bp = Garbq; Garbq = NULLBUF; restore(i_state); free_p(bp); } /* Replenish interrupt buffer pool */ /* G1EMM and HB9RWM fix */ while((Intqlen < Nibufs) && (Memthresh < availmem()) ){ #ifdef notdef while(Intqlen < Nibufs){ #endif if((bp = alloc_mbuf(Ibufsize)) == NULLBUF) break; #ifdef PI /* Temp hack to satisfy PI DMA requirements */ dma_abs = ((long)FP_SEG(bp->data) << 4) + (long)FP_OFF(bp->data); dma_page = dma_abs >> 16; if(((dma_abs+Ibufsize) >> 16) != dma_page){ i_state = dirps(); bp->next = Garbq; Garbq = bp; restore(i_state); continue; } #endif i_state = dirps(); bp->next = Intq; Intq = bp; Intqlen++; restore(i_state); } if(Iminfree == -1) Iminfree = Intqlen; } void iqstat() { tprintf("Intqlen %u Ibufsize %u Iminfree %u Ibuffail %lu Imaxrq %u\n", Intqlen,Ibufsize,Iminfree,Ibuffail,Ibuf_max_rq); /* g8fsl */ }
void _enter_critical_ex(_lock *plock, _irqL *pirqL) { //eason 20100210 spin_lock_irqsave(plock, *pirqL); cyg_mutex_t * mut_t = plock; *pirqL = dirps(); cyg_mutex_lock(mut_t); }
//*************************************************************************** //* //* IPXInput( p ) //* //* Called by the packet input to get a new ip packet. Checks the //* validity of the packet (checksum, flags) and then passes it on to the //* appropriate protocol handler. //* //*************************************************************************** WORD IPXInput(WORD InputFrameType, BYTE *SrcAddress,IPXHeader *p,int16 DataLen) { WORD i = 0,j; BYTE *PKTDataPoint; BYTE ECBFound = 0; ECB *listenECB; WORD CopyLen; int i_state; i_state = dirps(); //eCos #ifdef SNMPIPX if(NGET16(p->destination.socket) == 0x5204 && NGET32(&(p[1])) != 0x0C030100) { return 0; } #endif SNMPIPX for(i = 0 ; (!ECBFound && i < socketTablePointer) ; i++ ) { if( NGET16(p->destination.socket) == socketTable[i].socketNumber) { if(socketTable[i].ECBLinkList == NULL) { break; } listenECB = socketTable[i].ECBLinkList; socketTable[i].ECBLinkList = listenECB->linkAddress; if( listenECB->inUseFlag == RECEIVING ) { memcpy(listenECB->immediateAddress, SrcAddress, 6); PKTDataPoint = (BYTE *) p; for(j=0 ; j < listenECB->fragmentCount ; j++ ) { if(DataLen <= 0) break; if((listenECB->fragmentDescriptor[j].size != 0) && (listenECB->fragmentDescriptor[j].address != NULL)){ //queue ipx CopyLen = listenECB->fragmentDescriptor[j].recv_size = min(DataLen,listenECB->fragmentDescriptor[j].size); memcpy(listenECB->fragmentDescriptor[j].address, PKTDataPoint, CopyLen); PKTDataPoint = PKTDataPoint + listenECB->fragmentDescriptor[j].size; DataLen -= CopyLen; } } listenECB->inUseFlag = OKAY; listenECB->completionCode = OKAY; listenECB->IPXFrameType = InputFrameType; //3/16/98 if(listenECB->ESRAddress != NULL) { (listenECB->ESRAddress)(); // Go To Service ESR Routine } } ECBFound = 1; } } restore(i_state); //eCos return(0); }