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
/*===========================================================================*
 *				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.º 3
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;
}