static void enable3d(XmLabelHackWidget _new) { if (HACK(_new).insensitive3D && CORE(_new).depth > 4) { if (oldLabelWidgetExposeProc == 0) _replaceLabelExpose(); if (oldLabelGadgetExposeProc == 0) _replaceLabelGadgetExpose(); // Keep around so there is one in the cache HACK(_new).topGC = _topShadowGC((XmLabelWidget)_new); HACK(_new).bottomGC = _bottomShadowGC((XmLabelWidget)_new); } }
static Boolean set_values(Widget old, Widget, Widget _new, ArgList, Cardinal *) { XmLabelHackWidget before = XmLabelHackWidget(old); XmLabelHackWidget after = XmLabelHackWidget(_new); if (HACK(before).insensitive3D != HACK(after).insensitive3D) { if (HACK(after).insensitive3D) enable3d(after); else disable3d(); } return False; // No need to redisplay }
static void initialize(XmLabelHackWidget, XmLabelHackWidget _new, String *, Cardinal *) { XmLabelHackWidgetClass lhwc; lhwc = (XmLabelHackWidgetClass)xmLabelHackWidgetClass; XtInitializeWidgetClass(xmLabelGadgetClass); if (HACK_CLASS(lhwc).on == -1) { enable3d(_new); HACK_CLASS(lhwc).on = HACK(_new).insensitive3D; } if ((CORE(_new).width == 0) || (CORE(_new).height == 0)) { CORE(_new).width = 1; CORE(_new).height = 1; } }
static int32 sis900_rxInterrupt(struct sis_info *info) { int32 handled = B_UNHANDLED_INTERRUPT; int16 releaseRxSem = 0; int16 limit; acquire_spinlock(&info->rxSpinlock); HACK(spin(10000)); // check for packet ownership for (limit = info->rxFree; limit > 0; limit--) { if (!(info->rxDescriptor[info->rxInterruptIndex].status & SiS900_DESCR_OWN)) { // if (limit == info->rxFree) // { //dprintf("here!\n"); // limit++; // continue; // } break; } //dprintf("received frame %d!\n",info->rxInterruptIndex); releaseRxSem++; info->rxInterruptIndex = (info->rxInterruptIndex + 1) & NUM_Rx_MASK; info->rxFree--; } release_spinlock(&info->rxSpinlock); // reenable rx queue write32(info->registers + SiS900_MAC_COMMAND, SiS900_MAC_CMD_Rx_ENABLE); if (releaseRxSem) { release_sem_etc(info->rxSem, releaseRxSem, B_DO_NOT_RESCHEDULE); return B_INVOKE_SCHEDULER; } return handled; }
static int32 sis900_txInterrupt(struct sis_info *info) { int16 releaseTxSem = 0; uint32 status; int16 limit; acquire_spinlock(&info->txSpinlock); HACK(spin(10000)); for (limit = info->txSent; limit > 0; limit--) { status = info->txDescriptor[info->txInterruptIndex].status; //dprintf("txIntr: %d: mem = %lx : hardware = %lx\n",info->txInterruptIndex, // physicalAddress(&info->txDescriptor[info->txInterruptIndex],sizeof(struct buffer_desc)), // read32(info->registers + SiS900_MAC_Tx_DESCR)); /* Does the device generate extra interrupts? */ if (status & SiS900_DESCR_OWN) { struct buffer_desc *descriptor = (void *)read32(info->registers + SiS900_MAC_Tx_DESCR); int16 that; for (that = 0; that < NUM_Tx_DESCR && physicalAddress(&info->txDescriptor[that], sizeof(struct buffer_desc)) != (addr_t)descriptor; that++) { } if (that == NUM_Tx_DESCR) that = 0; //dprintf("tx busy %d: %lx (hardware status %d = %lx)!\n",info->txInterruptIndex,status,that,info->txDescriptor[that].status); // if (limit == info->txSent) // { //dprintf("oh no!\n"); // limit++; // continue; // } break; } if (status & (SiS900_DESCR_Tx_ABORT | SiS900_DESCR_Tx_UNDERRUN | SiS900_DESCR_Tx_OOW_COLLISION)) { dprintf("tx error: %lx\n", status); } else info->txDescriptor[info->txInterruptIndex].status = 0; releaseTxSem++; /* this many buffers are free */ info->txInterruptIndex = (info->txInterruptIndex + 1) & NUM_Tx_MASK; info->txSent--; if (info->txSent < 0 || info->txSent > NUM_Tx_DESCR) dprintf("ERROR interrupt: txSent = %d\n", info->txSent); } release_spinlock(&info->txSpinlock); if (releaseTxSem) { release_sem_etc(info->txSem, releaseTxSem, B_DO_NOT_RESCHEDULE); return B_INVOKE_SCHEDULER; } return B_HANDLED_INTERRUPT; }