Ejemplo n.º 1
0
/*
**  Name:	int dpeth_task(void)
**  Function:	Main entry for dp task
*/
PUBLIC int main(int argc, char **argv)
{
  message m;
  int ipc_status;
  int rc;

  /* SEF local startup. */
  env_setargs(argc, argv);
  sef_local_startup();

  while (TRUE) {
	if ((rc = netdriver_receive(ANY, &m, &ipc_status)) != OK){
		panic(RecvErrMsg, rc);
	}

	DEBUG(printf("eth: got message %d, ", m.m_type));

	if (is_ipc_notify(ipc_status)) {
		switch(_ENDPOINT_P(m.m_source)) {
			case CLOCK:
				/* to be defined */
				do_watchdog(&m);
				break;
			case HARDWARE:
				/* Interrupt from device */
				handle_hw_intr();
				break;
			case TTY_PROC_NR:
				/* Function key pressed */
				do_dump(&m);
				break;
			default:	
				/* Invalid message type */
				panic(TypeErrMsg, m.m_type);
				break;
		}
		/* message processed, get another one */
		continue;
	}

	switch (m.m_type) {
	    case DL_WRITEV_S:	/* Write message to device */
		do_vwrite_s(&m);
		break;
	    case DL_READV_S:	/* Read message from device */
		do_vread_s(&m);
		break;
	    case DL_CONF:	/* Initialize device */
		do_init(&m);
		break;
	    case DL_GETSTAT_S:	/* Get device statistics */
		do_getstat_s(&m);
		break;
	    default:		/* Invalid message type */
		panic(TypeErrMsg, m.m_type);
		break;
	}
  }
  return OK;			/* Never reached, but keeps compiler happy */
}
Ejemplo n.º 2
0
/*===========================================================================*
 *				main					     *
 *===========================================================================*/
int main(int argc, char *argv[])
{
	int r;
	int ipc_status;

	/* SEF local startup. */
	env_setargs(argc, argv);
	sef_local_startup();

	while (TRUE) {
		if ((r = netdriver_receive(ANY, &m, &ipc_status)) != OK)
			panic("netdriver_receive failed: %d", r);

		if (is_ipc_notify(ipc_status)) {
			switch (_ENDPOINT_P(m.m_source)) {
			case CLOCK:
				/*
				 * Under MINIX, synchronous alarms are used
				 * instead of watchdog functions.
				 * The approach is very different: MINIX VMD
				 * timeouts are handled within the kernel
				 * (the watchdog is executed by CLOCK), and
				 * notify() the driver in some cases. MINIX
				 * timeouts result in a SYN_ALARM message to
				 * the driver and thus are handled where they
				 * should be handled. Locally, watchdog
				 * functions are used again.
				 */
				rl_watchdog_f(NULL);
				break;
			case HARDWARE:
				do_hard_int();
				if (int_event_check) {
					check_int_events();
				}
				break ;
			default:
				panic("illegal notify from: %d",	m.m_type);
			}

			/* done, get nwe message */
			continue;
		}

		switch (m.m_type) {
		case DL_WRITEV_S:	rl_writev_s(&m, FALSE);	 break;
		case DL_READV_S:	rl_readv_s(&m, FALSE);	 break;
		case DL_CONF:		rl_init(&m);		 break;
		case DL_GETSTAT_S:	rl_getstat_s(&m);	 break;
		default:
			panic("illegal message: %d", m.m_type);
		}
	}
}
Ejemplo n.º 3
0
/*===========================================================================*
 *				main					     *
 *===========================================================================*/
int main(int argc, char *argv[])
{
  dpeth_t *dep;
  message m;
  int ipc_status;
  int r;

  /* SEF local startup. */
  env_setargs(argc, argv);
  sef_local_startup();
  
  while (TRUE)
    {
      if ((r= netdriver_receive(ANY, &m, &ipc_status)) != OK)
	panic("netdriver_receive failed: %d", r);

		if(is_ipc_notify(ipc_status)) {
			switch(_ENDPOINT_P(m.m_source)) {
				case CLOCK:
					do_watchdog(&m);
					break;

	case HARDWARE:
	  dep = &de_state;
	  if (dep->de_mode == DEM_ENABLED) {
	    do_interrupt(dep);
	    if (dep->de_flags & (DEF_ACK_SEND | DEF_ACK_RECV))
	    do_reply(dep);
	    sys_irqenable(&dep->de_hook);
	  }
	  break;
	 default:
	 	printf("ignoring notify from %d\n", m.m_source);
	 	break;
			}
			continue;
		}
      
      switch (m.m_type)
	{
	case DL_WRITEV_S:  do_vwrite_s(&m, FALSE); break;
	case DL_READV_S:   do_vread_s(&m, FALSE);  break;	  
	case DL_CONF:      do_conf(&m);            break;  
	case DL_GETSTAT_S: do_get_stat_s(&m);      break;

	default:  
		printf("message 0x%x; %d from %d\n",
			m.m_type, m.m_type-DL_RQ_BASE, m.m_source);
		panic("illegal message: %d", m.m_type);
	}
    }
}
Ejemplo n.º 4
0
Archivo: atl2.c Proyecto: ssinghi/minix
/*===========================================================================*
 *				main					     *
 *===========================================================================*/
int main(int argc, char **argv)
{
	/* Driver task.
	 */
	message m;
	int ipc_status;
	int r;

	/* Initialize SEF. */
	env_setargs(argc, argv);
	sef_local_startup();

	while (TRUE) {
		if ((r = netdriver_receive(ANY, &m, &ipc_status)) != OK)
			panic("netdriver_receive failed: %d", r);

		if (is_ipc_notify(ipc_status)) {
			switch (m.m_source) {
			case HARDWARE:		/* interrupt */
				atl2_intr(&m);

				break;

			case TTY_PROC_NR:	/* function key */
				atl2_dump();

				break;

			default:
				printf("ATL2: illegal notify from %d\n",
					m.m_source);
			}

			continue;
		}

		/* Process requests from Inet. */
		switch (m.m_type) {
		case DL_CONF:		atl2_conf(&m);			break;
		case DL_GETSTAT_S:	atl2_getstat(&m);		break;
		case DL_WRITEV_S:	atl2_writev(&m, FALSE);		break;
		case DL_READV_S:	atl2_readv(&m, FALSE);		break;
		default:
			printf("ATL2: illegal message %d from %d\n",
				m.m_type, m.m_source);
		}
	}
}
Ejemplo n.º 5
0
/*===========================================================================*
 *				main					     *
 *===========================================================================*/
int main(int argc, char *argv[])
{
    message m;
    int ipc_status;
    int r;

    /* SEF local startup. */
    env_setargs(argc, argv);
    sef_local_startup();

    /*
     * Enter the main driver loop.
     */
    while (TRUE)
    {
	if ((r= netdriver_receive(ANY, &m, &ipc_status)) != OK)
	{
	    panic("netdriver_receive failed: %d", r);
	}

	if (is_ipc_notify(ipc_status))
	{
	    switch (_ENDPOINT_P(m.m_source))
	    {
                case HARDWARE:
		    e1000_interrupt(&m);
		    break;

		case CLOCK:
                    break;
	    }
	    continue;
	}
	switch (m.m_type)
	{
	    case DL_WRITEV_S:   e1000_writev_s(&m, FALSE);	break;
	    case DL_READV_S:    e1000_readv_s(&m, FALSE);	break;
	    case DL_CONF:	e1000_init(&m);			break;
	    case DL_GETSTAT_S:  e1000_getstat_s(&m);		break;
	    default:
		panic("illegal message: %d", m.m_type);
	}
    }
}
Ejemplo n.º 6
0
/*===========================================================================*
 *				dpeth_task				     *
 *===========================================================================*/
int main(int argc, char *argv[])
{
	message m;
	int ipc_status;
	int r;

	/* SEF local startup. */
	env_setargs(argc, argv);
	sef_local_startup();

	while (TRUE)
	{
		if ((r= netdriver_receive(ANY, &m, &ipc_status)) != OK)
			panic("dp8390: netdriver_receive failed: %d", r);

		if (is_ipc_notify(ipc_status)) {
			switch (_ENDPOINT_P(m.m_source)) {
				case HARDWARE:
					handle_hw_intr();
					break;
				case CLOCK:
					printf("dp8390: notify from CLOCK\n");
					break;
				default:
					panic("dp8390: illegal notify from: %d",
						m.m_source);
			}

			/* done, get a new message */
			continue;
		}

		switch (m.m_type)
		{
		case DL_WRITEV_S: do_vwrite_s(&m, FALSE);	break;
		case DL_READV_S: do_vread_s(&m);		break;
		case DL_CONF:	do_init(&m);			break;
		case DL_GETSTAT_S: do_getstat_s(&m);		break;
		default:
			panic("dp8390: illegal message: %d", m.m_type);
		}
	}
}
Ejemplo n.º 7
0
static void
virtio_net_main_loop(void)
{
	message m;
	int ipc_status;
	int r;

	while (TRUE) {

		virtio_net_refill_rx_queue();

		if ((r = netdriver_receive(ANY, &m, &ipc_status)) != OK)
			panic("%s: netdriver_receive failed: %d", name, r);

		if (is_ipc_notify(ipc_status))
			virtio_net_notify(&m);
		else
			virtio_net_msg(&m);
	}
}
Ejemplo n.º 8
0
/*===========================================================================*
 *                              main                                         *
 *===========================================================================*/
int main( int argc, char **argv )
{
   message m;
   int ipc_status;
   int r;
   ether_card_t *ec;

   /* SEF local startup. */
   env_setargs(argc, argv);
   sef_local_startup();

   ec= &ec_state;

   while (TRUE)
   {
      if (ec->ec_irq != 0)
         sys_irqenable(&ec->ec_hook);

      if ((r= netdriver_receive(ANY, &m, &ipc_status)) != OK)
        panic("netdriver_receive failed: %d", r);
        
      if (ec->ec_irq != 0)
         sys_irqdisable(&ec->ec_hook);

      if (is_ipc_notify(ipc_status)) {
	      switch(_ENDPOINT_P(m.m_source)) {
		      case TTY_PROC_NR:
			      lance_dump();
			      break;
		      case HARDWARE:
			      if (ec->mode == EC_ENABLED)
			      {
				 ec->ec_int_pending = 0;
				 ec_check_ints(ec);
				 do_int(ec);
			      }
			      break;
		      default:
			      panic("illegal notify source: %d", m.m_source);
	      }

	      /* get next message */
	      continue;
      }
  
      switch (m.m_type)
      {
      case DL_WRITEV_S:
         do_vwrite_s(&m, FALSE);
         break;
      case DL_READV_S:
         do_vread_s(&m);
         break;
      case DL_CONF:
         do_init(&m);
         break;
      case DL_GETSTAT_S:
         do_getstat_s(&m);
         break;
      default:
         panic("illegal message: %d", m.m_type);
      }
   }

   return 0;
}