コード例 #1
0
ファイル: shell.c プロジェクト: hydra/freewpc
void shell_button_finish (void)
{
	while (sw_logical[0] != 0)
	{
		task_runs_long ();
	}
}
コード例 #2
0
ファイル: switches.c プロジェクト: Curbfeeler/freewpc
/** Periodic switch processing.  This function is called frequently
 * to scan pending switches and spawn new tasks to handle them.
 */
void switch_periodic (void)
{
	register U16 col = 0;
	extern U8 sys_init_complete;
	U8 rows;

	/* If there are row/column shorts, ignore the switch matrix. */
	if (unlikely (sw_short_timer))
		return;

	/* Prior to system initialization, switches are not serviced.
	Any switch closures during this time continue to be queued up.
	However, at the least, allow the coin door switches to be polled. */
	if (unlikely (sys_init_complete == 0))
	{
		sw_logical[0] = sw_raw[0];
		return;
	}

	/* Check for shorted switch rows/columns. */
	switch_short_detect ();

	/* Service the switch queue.  Note that this is done BEFORE
	 * polling switches; please do not change this!  In case
	 * idle is not invoked fast enough, it is possible that a
	 * switch might have legitimately completed its debounce period,
	 * but we just didn't see it in time before it transitioned
	 * back.  In that case, to be fair, consider the transition
	 * anyway.  The service function does not actually poll the
	 * current switch readings at all, so it is safe to do this
	 * even if there are hardware errors. */
	switch_service_queue ();

	/* Iterate over each switch column to see what needs to be done. */
	task_dispatching_ok = TRUE;
	for (col=0; col < SWITCH_BITS_SIZE; col++)
	{
		/* Each bit in sw_stable indicates a switch
		that just transitioned and may need to be processed */
		if (unlikely (rows = sw_stable[col]))
		{
			U8 sw = col * 8;
			do {
				if ((rows & 1) && !bit_test (sw_queued, sw))
					switch_update_stable (sw);
				rows >>= 1;
				sw++;
			} while (rows);
		}
		task_runs_long ();
	}
}
コード例 #3
0
ファイル: db.c プロジェクト: Curbfeeler/freewpc
/**
 * Handle a breakpoint.  The system is stopped until the user forces it
 * to continue, either by pressing 'p' in the debug console, or presses
 * the Escape Button.  Interrupt-level functions continue to run while
 * paused; only regular task scheduling is paused.  In order to poll for
 * the continue, we have to invoke the switch and debugger periodic
 * functions.
 */
void bpt_hit (void)
{
	U8 key;

	db_paused = 1 - db_paused;
	if (db_paused == 1)
	{
		callset_invoke (debug_enter);
		db_tilt_flag = in_tilt;
		in_tilt = FALSE;
		bpt_display ();
	}
	else
	{
		in_tilt = db_tilt_flag;
		callset_invoke (debug_exit);
	}

	while (db_paused == 1)
	{
		if ((key = button_check (SW_ENTER)))
		{
			/* Enter = change active field */
			bpt_display ();
		}
		else if ((key = button_check (SW_UP)))
		{
			/* Up = increase field value */
			bpt_mem_addr += key * 4;
			bpt_mem_addr = (void *) (((U16)bpt_mem_addr) & 0x1FFFUL);
			bpt_display ();
		}
		else if ((key = button_check (SW_DOWN)))
		{
			/* Down = decrease field value */
			bpt_mem_addr -= key * 4;
			bpt_mem_addr = (void *) (((U16)bpt_mem_addr) & 0x1FFFUL);
			bpt_display ();
		}
		else
		{
			switch_periodic ();
			db_periodic ();
			task_runs_long ();
		}
	}
#ifdef CONFIG_DMD_OR_ALPHA
	dmd_alloc_low_clean ();
	dmd_show_low ();
#endif
}
コード例 #4
0
ファイル: device.c プロジェクト: Dmilo/freewpc
void device_debug_all (void)
{
	devicenum_t devno;

	for (devno = 0; devno < NUM_DEVICES; devno++)
	{
		device_t *dev = &device_table[devno];
		device_debug (dev);
	}
	task_runs_long ();
	dbprintf ("Found: %d   ", counted_balls);
	dbprintf ("Lost: %d   ", missing_balls - live_balls + held_balls);
	dbprintf ("Live: %d   ", live_balls);
	dbprintf ("Held: %d\n", held_balls);
}
コード例 #5
0
ファイル: shell.c プロジェクト: hydra/freewpc
void debug_shell (void)
{
	shell_cursor = 0;
	for (;;)
	{
		if (switch_poll (SW_ESCAPE))
		{
			if (shell_cursor == shell_cmd)
			{
			}
			else
			{
				--shell_cursor;
			}
			shell_button_finish ();
		}
		else if (switch_poll (SW_UP))
		{
			shell_cmd[shell_cursor]++;
			shell_button_finish ();
		}
		else if (switch_poll (SW_DOWN))
		{
			shell_cmd[shell_cursor]--;
			shell_button_finish ();
		}
		else if (switch_poll (SW_ENTER))
		{
			if (shell_ctx[shell_cursor].exec)
			{
			}
			else
			{
				shell_cursor++;
			}
			shell_button_finish ();
		}
		else
		{
			switch_periodic ();
			task_runs_long ();
		}
	}
}
コード例 #6
0
ファイル: switches.c プロジェクト: Curbfeeler/freewpc
void switch_queue_dump (void)
{
	pending_switch_t *entry = switch_queue;

	dbprintf ("Switch queue base: %p\n", switch_queue);
	dbprintf ("Switch queue top: %p\n", switch_queue_top);
	while (entry != switch_queue_top)
	{
		dbprintf ("Pending: SW%d  %d\n", entry->id, entry->timer);
		entry++;
	}
	switch_matrix_dump ("Raw     ", sw_raw);
	switch_matrix_dump ("Logical ", sw_logical);
	switch_matrix_dump ("Edge    ", sw_edge);
	task_runs_long ();
	switch_matrix_dump ("Stable  ", sw_stable);
	switch_matrix_dump ("Unstable", sw_unstable);
	switch_matrix_dump ("Queued  ", sw_queued);
}
コード例 #7
0
ファイル: db.c プロジェクト: Curbfeeler/freewpc
/**
 * Debounce a button press, waiting for it to clear.
 */
U8 button_check (U8 sw)
{
	volatile U16 x;

	if (!switch_poll (sw))
		return 0;

	for (x=bpt_debounce_timer; x ; --x)
	{
		task_runs_long ();
		barrier ();
	}
	switch_periodic ();
	if (!switch_poll (sw))
	{
		bpt_repeat_count = 0;
		bpt_debounce_timer = 0x1C00;
		return 1;
	}
	else
	{
		bpt_repeat_count++;
		if (bpt_repeat_count >= 32)
		{
			bpt_repeat_count = 32;
			bpt_debounce_timer = 0x80;
			return 8;
		}
		else if (bpt_repeat_count >= 4)
		{
			bpt_debounce_timer = 0x600;
			return 4;
		}
		else
			return 1;
	}
}