Ejemplo n.º 1
0
static bool checkWhose(HighlightItem::Whose whose, S32 objectTeam, S32 playerTeam)
{
   switch(whose)
   {
      case HighlightItem::Any:
         return true;

      case HighlightItem::Team:
         return isTeam(objectTeam, playerTeam);

      case HighlightItem::TorNeut:
         return isTeam(objectTeam, playerTeam) || isNeut(objectTeam);

      case HighlightItem::Enemy:
         return isEnemy(objectTeam, playerTeam);

      case HighlightItem::Hostile:
         return isHost(objectTeam);

      case HighlightItem::EorHostile:
         return isEnemy(objectTeam, playerTeam) || isHost(objectTeam);

      case HighlightItem::EorHorN:
         return isEnemy(objectTeam, playerTeam) || isHost(objectTeam) || isNeut(objectTeam);

      case HighlightItem::Neutral:
         return isNeut(objectTeam);

      default:
         TNLAssert(false, "Unknown value of whose!");
         return false;
   }
}
Ejemplo n.º 2
0
/******************************************************************************
*
* Uninstalls an interrupt handler in the PCI dispatch table
*
* Note: the intline parameter refers to which PCI interrupt INTA - INTD
*
*       the device parameter refers to which SPCI device number is sourcing the
*       interrupt
*
*/
STATUS pci_isr_disconnect (int intline, int bus, int device)
{
	int which_xint;
	int handler_index;

	/* check to see if we are attempting to disconnect a PPCI interrupt and we are not
	   a host card */
	if ((isHost() == FALSE) && (off_ppci_bus(bus) == TRUE))
		return (ERROR);

	if ((intline < INTA) || (intline > INTD))
		return (ERROR);

    (void)pci_to_xint(device, intline, &which_xint);

	for (handler_index = 0; handler_index < MAX_PCI_HANDLERS; handler_index++)
	{
		if ((pci_int_handlers[which_xint][handler_index].bus == bus) &&
			(pci_int_handlers[which_xint][handler_index].device == device))
		{
			pci_int_handlers[which_xint][handler_index].handler = NULL;
			pci_int_handlers[which_xint][handler_index].arg		= (int)NULL;
			pci_int_handlers[which_xint][handler_index].bus		= (int)NULL;
			pci_int_handlers[which_xint][handler_index].device	= (int)NULL;
		}
	}

	/* if the handler was not found in the table return an error */
	if (handler_index == MAX_PCI_HANDLERS)
		return (ERROR);

    return (OK);
}
Ejemplo n.º 3
0
/******************************************************************************
*
* Installs an interrupt handler in the PCI dispatch table, to be called
* by the appropriate PCI isr (above) when an interrupt occurs.
*
* Note: the intline parameter refers to which PCI interrupt INT A - INT D
*
*       device identifies the PCI device number
*
* Note: isrs connected with this function must return 1 if an interrupt is 
*	serviced in order to support the PCI interrupt sharing mechanism
*                                                   
*/
STATUS pci_isr_connect (int intline, int bus, int device, int (*handler)(int), int arg)
{
	int which_xint;
	int handler_index;

	/* check to see if we are attempting to connect to a PPCI interrupt and we are not
	   a host card */
	if ((isHost() == FALSE) && (off_ppci_bus(bus) == TRUE))
		return (ERROR);

	if ((intline < INTA) || (intline > INTD))
		return (ERROR);

    (void)pci_to_xint(device, intline, &which_xint);

	for (handler_index = 0; handler_index < MAX_PCI_HANDLERS; handler_index++)
	{
		if (pci_int_handlers[which_xint][handler_index].handler == NULL)
		{
			pci_int_handlers[which_xint][handler_index].handler = handler;
			pci_int_handlers[which_xint][handler_index].arg		= arg;
			pci_int_handlers[which_xint][handler_index].bus		= bus;
			pci_int_handlers[which_xint][handler_index].device	= device;
			break;
		}
	}

	/* if there is no more room in the table return an error */
	if (handler_index == MAX_PCI_HANDLERS)
		return (ERROR);

    return (OK);
}