コード例 #1
0
ファイル: scc.hpp プロジェクト: zhuoyw/x-stream-copy
    void scc<F>::scc_do_elim()
    {
      const x_lib::configuration *config = graph_storage->get_config();
      scc_pcpu::current_step = step_elim_push;
      graph_storage->rewind_stream(edges_stream);
      for(unsigned long i=0;i<config->super_partitions;i++) {
	state_load(false, i);
	x_lib::do_stream< scc<F>, 
			  scc_edge_wrapper, 
			  scc_message_wrapper >
	  (graph_storage, i, edges_stream, messages_stream0, NULL);
	graph_storage->reset_stream(edges_stream, i);
	state_store(i);
      }
      graph_storage->rewind_stream(messages_stream0);
      scc_pcpu::current_step = step_elim_write;
      for(unsigned long i=0;i<config->super_partitions;i++) {
	state_load(false, i);
	x_lib::do_stream< scc<F>, 
			  scc_message_wrapper, 
			  scc_edge_wrapper >
	  (graph_storage, i, messages_stream0, edges_stream, NULL);
	graph_storage->reset_stream(messages_stream0, i);
	state_store(i);
      }
    }
コード例 #2
0
/* Forced cleanse routine, usually called just before a software-initiated
   powerdown */
extern void state_cleanse(void)
{
	/* Is the state dirty? Flush it if it is */
	if (dirty) {
		unsigned long flags;
		save_flags_cli(flags);
		state_store();
		restore_flags(flags);
	}
}
コード例 #3
0
ファイル: state.cpp プロジェクト: TheFlav/RACE-NGPC-Emulator
BOOL state_store(char* filename)
{
  // Save
  FILE *stream;
  if (!(stream = fopen(filename, "w")))
    return 0;

  int status = state_store(stream);
  fclose(stream);

  return status;
}
コード例 #4
0
static void powerfail_interrupt(int irq, void *dev_id, struct pt_regs *regs)
{
	if (powerfail_enabled()) {
		/* Power is failing, quickly do things... */
		struct state_dev *dev = state_devices;

		/* Mute audio */
		GPCR=EMPEG_DSPPOM;

		/* Store state if it's changed, or if we've been
                   powered on for 30+ seconds */
		if (dirty || ((unsigned int)xtime.tv_sec-unixtime)>=30) state_store();

		/* NOTE! This used to be BEFORE the dirty save, but on the
		   issue9 and later players, turning the display off involves
		   sending a command serially to the power PIC, which can take
		   time. Doing it here is probably ok */

#if CONFIG_EMPEG_DISPLAY
		/* Turn display off: this will buy us a little time
		   due to decreased power drain. We also disable the
		   LCD controller as this stops static junk being on
		   the screen during powerdown */
		display_powerfail_action();
#endif
		
		/* Something so we can see how close the actual
                   powerfail *is*! */
#if DEBUG
		  printk("The quick brown fox jumped over the lazy dog.\n");
#endif

		/* Queue up a powerfail timeout call just in case the
		 * power hasn't really gone away. */
		if (timer_pending(&dev->powerfail_timer))
			del_timer(&dev->powerfail_timer);
		dev->powerfail_timer.expires = jiffies + POWERFAIL_TIMEOUT * HZ;
		dev->powerfail_timer.function = powerfail_disabled_timeout;
		add_timer(&dev->powerfail_timer);
		
		/* We don't want multiple interrupts happening. */
		enable_powerfail(FALSE);
	} else
		erroneous_interrupts++;

	/* Clear edge detect register */
	GEDR = EMPEG_POWERFAIL;
}
コード例 #5
0
ファイル: scc.hpp プロジェクト: zhuoyw/x-stream-copy
    void scc<F>::scc_do_cc(bool&do_init)
    {
      const x_lib::configuration *config = graph_storage->get_config();
      unsigned long PHASE = 0;
      unsigned long messages_in_stream;
      unsigned long messages_out_stream;
      scc_pcpu::wcc_iteration = 0;
      do {
	if(PHASE == 0) {
	  messages_in_stream  = messages_stream0;
	  messages_out_stream = messages_stream1;
	}
	else {
	  messages_in_stream  = messages_stream1;
	  messages_out_stream = messages_stream0;
	}
	graph_storage->rewind_stream(messages_in_stream);
	graph_storage->rewind_stream(edges_stream);
	for(unsigned long i=0;i<config->super_partitions;i++) {
	  state_load(do_init, i);
	  do_init = false;
	  scc_pcpu::current_step = step_wcc_in;
	  if(scc_pcpu::wcc_iteration == 0) {
	    x_lib::do_state_iter<scc<F> > (graph_storage, i);
	  }
	  x_lib::do_stream< scc<F>, 
			    scc_message_wrapper, 
			    scc_message_wrapper >
	    (graph_storage, i, messages_in_stream, ULONG_MAX, NULL);
	  graph_storage->reset_stream(messages_in_stream, i);
	  scc_pcpu::current_step = step_wcc_out;
	  x_lib::do_stream< scc<F>, 
			    scc_edge_wrapper, 
			    scc_message_wrapper >
	    (graph_storage, i, edges_stream, messages_out_stream, NULL);
	  state_store(i);
	}
	PHASE = 1 - PHASE;
	scc_pcpu::wcc_iteration++;
      } while(!graph_storage->stream_empty(messages_out_stream));
    }
コード例 #6
0
int state_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
	     unsigned long arg)
{
	/*struct state_dev *dev = filp->private_data;*/

	switch(cmd)
	{
	case EMPEG_STATE_FORCESTORE:
		return state_store();
		break;

	case EMPEG_STATE_FAKEPOWERFAIL:
	{
		unsigned long flags;
		save_flags_cli(flags);
		powerfail_interrupt(0,NULL,NULL);
		restore_flags(flags);
		return 0;
	}
	default:
		return -EINVAL;
	}
}