コード例 #1
0
ファイル: cc2538_startup.c プロジェクト: JKLLBF/firmware
void
nmi_handler(void)
{
    reset_handler();
    while(1)
    {
        __asm("nop");
    }
}
コード例 #2
0
ファイル: mio_loop.cpp プロジェクト: wsxiaoys/MsgIO
void loop_impl::on_event( kernel::event e )
{
    concurrency_container::ref ref(_handlers);
    shared_handler handler = (*ref)[e.ident()];
    event_impl ev(this, e);
    if (e.events() & EVKERNEL_READ) {
        if (!(*handler)(ev)) {
            reset_handler(e.ident());
        }
    } else {
        _out->on_write(e);
    }
}
コード例 #3
0
ファイル: bcm_p2p_discovery.c プロジェクト: hajuuk/asuswrt
/* reset P2P discovery */
int bcm_p2p_discovery_reset(bcm_p2p_discovery_t *disc)
{
	bcm_p2p_discovery_req_t req;

	WL_TRACE(("bcm_p2p_discovery_reset\n"));

	if (disc == 0) {
		WL_ERROR(("invalid parameter\n"));
		return 0;
	}

	req.handler = reset_handler;
#ifdef BCM_P2P_DISCOVERY_NO_DISPATCHER
	reset_handler(disc, sizeof(req), &req, 0);
	return 1;
#else
	return dspRequest(dsp(), disc, sizeof(req), (uint8 *)&req);
#endif /* BCM_P2P_DISCOVERY_NO_DISPATCHER */
}
コード例 #4
0
ファイル: startup-gcc.c プロジェクト: johangas/thesis
/* Weak interrupt handlers. */
void
nmi_handler(void)
{
  reset_handler();
  while(1);
}
コード例 #5
0
ファイル: MEM_Stream_Test.cpp プロジェクト: asdlei00/ACE
int
run_main (int argc, ACE_TCHAR *argv[])
{
  u_short port = 0;

  if (argc == 1)
    {
      // This is the "master" process.

      ACE_START_TEST (ACE_TEXT ("MEM_Stream_Test"));
      create_reactor ();
      ACE_MEM_Addr server_addr (port);

      reset_handler (NUMBER_OF_REACTIVE_CONNECTIONS);

      test_reactive (argc > 0 ? argv[0] : ACE_TEXT ("MEM_Stream_Test"), server_addr);

      ACE_Reactor::instance ()->reset_reactor_event_loop ();

#if !defined (ACE_WIN32) && defined (_ACE_USE_SV_SEM)
      ACE_ERROR ((LM_DEBUG,
                  ACE_TEXT ("\n *** Platform only supports non-scalable SysV semaphores ***\n\n")));
#endif /* !ACE_WIN32 && _ACE_USE_SV_SEM */
      reset_handler (NUMBER_OF_MT_CONNECTIONS);

      test_concurrent (argc > 0 ? argv[0] : ACE_TEXT ("MEM_Stream_Test"), server_addr);

      ACE_END_TEST;
      return 0;
    }
  else
    {
      // We end up here if this is a child process spawned for one of
      // the test passes.  command line is: -p <port> -r (reactive) |
      // -m (multithreaded)

      ACE_TCHAR lognm[MAXPATHLEN];
      int mypid (ACE_OS::getpid ());
      ACE_OS::sprintf(lognm, ACE_TEXT ("MEM_Stream_Test-%d"), mypid);
      ACE_START_TEST (lognm);

      ACE_Get_Opt opts (argc, argv, ACE_TEXT ("p:rm"));
      int opt, iport, status;
      ACE_MEM_IO::Signal_Strategy model = ACE_MEM_IO::Reactive;

      while ((opt = opts()) != -1)
        {
          switch (opt)
            {
            case 'p':
              iport = ACE_OS::atoi (opts.opt_arg ());
              port = static_cast <u_short> (iport);
              break;

            case 'r':
              model = ACE_MEM_IO::Reactive;
              break;

            case 'm':
              model = ACE_MEM_IO::MT;
              break;

            default:
              ACE_ERROR_RETURN ((LM_ERROR,
                                 ACE_TEXT ("Invalid option (-p <port> -r | -m)\n")),
                                1);
            }
        }
      status = run_client (port, model);
      ACE_END_TEST;
      return status;
    }
}
コード例 #6
0
ファイル: main.c プロジェクト: M-Reimer/IRMP_STM32
int main(void)
{
	uint8_t buf[HID_OUT_BUFFER_SIZE-1], RepeatCounter = 0;
	IRMP_DATA myIRData;
	int8_t ret;
	/* first wakeup slot empty? */
	uint8_t learn_wakeup = eeprom_restore(buf, (MACRO_DEPTH + 1) * SIZEOF_IR/2 * MACRO_SLOTS);

	USB_HID_Init();
	LED_Switch_init();
	IRMP_Init();
	irsnd_init();
	FLASH_Unlock();
	EE_Init();
	Systick_Init();

	while (1) {
		if (!AlarmValue)
			Wakeup();

		wakeup_reset();

		/* test if USB is connected to PC and command is received */
		if (USB_HID_GetStatus() == USB_HID_CONNECTED && USB_HID_ReceiveData(buf) == RX_READY && buf[0] == STAT_CMD) {

			switch ((enum access) buf[1]) {
			case ACC_GET:
				ret = get_handler(buf);
				break;
			case ACC_SET:
				ret = set_handler(buf);
				break;
			case ACC_RESET:
				ret = reset_handler(buf);
				break;
			default:
				ret = -1;
			}

			if (ret == -1) {
				buf[0] = STAT_FAILURE;
				ret = 3;
			} else {
				buf[0] = STAT_SUCCESS;
			}

			/* send configuration data */
			USB_HID_SendData(REPORT_ID_CONFIG, buf, ret);
			toggle_LED();
		}

		/* poll IR-data */
		if (irmp_get_data(&myIRData)) {
			if (learn_wakeup) {
				/* store received wakeup IRData in first wakeup slot */
				eeprom_store((MACRO_DEPTH + 1) * SIZEOF_IR/2 * MACRO_SLOTS, (uint8_t *) &myIRData);
				learn_wakeup = 0;
			}

			if (!(myIRData.flags)) {
				RepeatCounter = 0;
			} else {
				RepeatCounter++;
			}

			if (RepeatCounter == 0 || RepeatCounter >= MIN_REPEATS) {
				toggle_LED();
				/* if macros are sent already, while the trigger IR data are still repeated,
				 * the receiving device may crash */
				check_macros(&myIRData);
				check_wakeups(&myIRData);
			}

			/* send IR-data */
			memcpy(buf, &myIRData, sizeof(myIRData));
			USB_HID_SendData(REPORT_ID_IR, buf, sizeof(myIRData));
		}
	}
}
コード例 #7
0
ファイル: main.c プロジェクト: j1rie/IRMP_STM32
int main(void)
{
	uint8_t buf[HID_OUT_BUFFER_SIZE-1];
	IRMP_DATA myIRData;
	int8_t ret;

	LED_Switch_init();
	Systick_Init();
	USB_Reset();
	USB_HID_Init();
	USB_DISC_release();
	IRMP_Init();
	irsnd_init();
	FLASH_Unlock();
	EE_Init();
	irmp_set_callback_ptr (led_callback);

	while (1) {
		if (!AlarmValue)
			Wakeup();

		if (!send_ir_on_delay)
			send_magic();

		wakeup_reset();

		/* test if USB is connected to PC, sendtransfer is complete and configuration command is received */
		if (USB_HID_GetStatus() == CONFIGURED && PrevXferComplete && USB_HID_ReceiveData(buf) == RX_READY && buf[0] == STAT_CMD) {

			switch ((enum access) buf[1]) {
			case ACC_GET:
				ret = get_handler(buf);
				break;
			case ACC_SET:
				ret = set_handler(buf);
				break;
			case ACC_RESET:
				ret = reset_handler(buf);
				break;
			default:
				ret = -1;
			}

			if (ret == -1) {
				buf[0] = STAT_FAILURE;
				ret = 3;
			} else {
				buf[0] = STAT_SUCCESS;
			}

			/* send configuration data */
			USB_HID_SendData(REPORT_ID_CONFIG, buf, ret);
			blink_LED();
			if(Reboot)
				reboot();
		}

		/* poll IR-data */
		if (irmp_get_data(&myIRData)) {
			myIRData.flags = myIRData.flags & IRMP_FLAG_REPETITION;
			if (!(myIRData.flags)) {
				store_wakeup(&myIRData);
				check_macros(&myIRData);
				check_wakeups(&myIRData);
				check_resets(&myIRData);
				check_reboot(&myIRData);
			}

			/* send IR-data */
			USB_HID_SendData(REPORT_ID_IR, (uint8_t *) &myIRData, sizeof(myIRData));
		}
	}
}
コード例 #8
0
ファイル: cpu.c プロジェクト: x893/OpenBLT
/************************************************************************************//**
** \brief     Perform a soft reset of the microcontroller by starting from the reset ISR.
** \return    none.
**
****************************************************************************************/
void CpuReset(void)
{
  /* perform a software reset by calling the reset ISR routine */
  reset_handler();
} /*** end of CpuReset ***/
コード例 #9
0
ファイル: mio_loop.cpp プロジェクト: wsxiaoys/MsgIO
void loop_impl::event_remove( kernel::event ke )
{
    _kernel->remove(ke);
    reset_handler(ke.ident());
}
コード例 #10
0
ファイル: mio_loop.cpp プロジェクト: wsxiaoys/MsgIO
void loop_impl::remove_handler( int ident )
{
    reset_handler(ident);
    _kernel->remove_fd(ident, NULL);
}