Пример #1
0
void debug_init()
{
  if(clocked_cpu) {
    runfn = cpu_run_clocked;
    stepfn = cpu_step_instr_clocked;
  } else {
    runfn = cpu_run;
    stepfn = cpu_step_instr;
  }
  display_setup();
  win_setup_default();
  display_swap_screen();
}
Пример #2
0
/*!
	Contains the code execution loop
 */
int main()
{
	float temp;
	
	// setup
	temperature_setup();
	display_setup();
	SysTick_Config(SystemCoreClock / 50);
	
	// super loop
	while(1)
	{
		while (!ticks);
		ticks = 0;
		temp = get_temperature();
		printf("%f\n", temp);
		show_temperature(temp);
		blink_leds();
	}
}
Пример #3
0
/*
 *	VSYNCイベント
 */
static BOOL FASTCALL
display_vsync(void)
{
	if (!vsync_flag) {
		if ((blank_count & 0xfff) > 0) {
			/* 一巡した */
			display_setup();
			return TRUE;
		}

		/* これから垂直同期 */
		vsync_flag = TRUE;
#if (XM7_VER >= 3) || (XM7_VER == 1 && defined(L4CARD))
		if (blank_count & 0x1000) {
			/* 400ライン(24kHzモード) 0.33ms */
			schedule_setevent(EVENT_VSYNC, 330, display_vsync);
		}
		else {
			/* 200ライン(15kHzモード) 0.51ms */
			schedule_setevent(EVENT_VSYNC, 510, display_vsync);
		}
#else
		/* 200ライン(15kHzモード) 0.51ms */
		schedule_setevent(EVENT_VSYNC, 510, display_vsync);
#endif

		/* ビデオディジタイズ */
#if XM7_VER >= 2
		if (digitize_enable) {
			if (digitize_keywait || simpose_mode == 0x03) {
				digitize_notify();
			}
		}
#else
		blank_count++;
#endif
	}
	else {
		/* これから垂直表示 */
		now_raster = 0;
		vblankperiod_notify();
		vsync_flag = FALSE;
#if (XM7_VER >= 3) || (XM7_VER == 1 && defined(L4CARD))
		if (blank_count & 0x1000) {
			/* 400ライン(24kHzモード) 0.98ms + 16.4ms */
			schedule_setevent(EVENT_VSYNC, 980 + 16400, display_vsync);
		}
		else {
			/* 200ライン(15kHzモード) 1.91ms + 12.7ms */
			schedule_setevent(EVENT_VSYNC, 1910 + 12700, display_vsync);
		}
#else
		/* 200ライン(15kHzモード) 1.91ms + 12.7ms */
		schedule_setevent(EVENT_VSYNC, 1910 + 12700, display_vsync);
#endif

		/* VSYNC通知 */
		if (draw_aftervsync) {
			vsync_notify();
		}
	}

	return TRUE;
}
Пример #4
0
/*
 *	ディスプレイ
 *	リセット
 */
void FASTCALL
display_reset(void)
{
#if XM7_VER >= 2
	int i;
#endif

	/* リセット時のスクロール位置補正 */
#if XM7_VER >= 2
	for (i = 0; i < 2; i++) {
		vram_scroll((WORD) - crtc_offset[i]);
	}
#else
	vram_scroll((WORD) - crtc_offset[0]);
#endif

	/* CRTレジスタ */
	crt_flag = FALSE;
	vrama_flag = FALSE;
	memset(vram_offset, 0, sizeof(vram_offset));
	memset(crtc_offset, 0, sizeof(crtc_offset));
	vram_offset_flag = FALSE;
	memset(vram_offset_count, 0, sizeof(vram_offset_count));
	now_raster = 0;

#if XM7_VER >= 2
	/* 割り込み、イベント */
	subnmi_flag = TRUE;
	vsync_flag = FALSE;
	blank_flag = TRUE;

	/* アクティブページ、表示ページ初期化 */
	vram_active = 0;
	vram_aptr = vram_c;
	vram_display = 0;
	vram_dptr = vram_c;
#if XM7_VER >= 3
	subram_vrambank = 0;

	/* ハードウェアウィンドウ初期化 */
	window_x1 = window_x2 = 0;
	window_y1 = window_y2 = 0;
	window_dx1 = window_dx2 = 0;
	window_dy1 = window_dy2 = 0;
	window_open = FALSE;

	/* アクティブブロック、表示ブロック初期化 */
	block_active = 0;
	block_display = 0;
	vram_ablk = vram_c;
	vram_dblk = vram_c;
	vram_bdptr = vram_c + 0x18000;
	vram_bdblk = vram_bdptr;

	/* サブ側漢字ROM初期化 */
	sub_kanji_addr = 0;
	sub_kanji_bank = FALSE;
#endif /* XM7_VER >= 3 */
#endif /* XM7_VER >= 2 */

#if XM7_VER == 1 && defined(L4CARD)
	/* 割り込み、イベント */
	vsync_flag = FALSE;
	blank_flag = TRUE;

	/* TextVRAM */
	text_cursor_count = 0;
	text_scroll_count = 0;
	text_start_addr = 0x0000;
	text_blink = TRUE;
	cursor_addr = 0x0000;
	cursor_blink = TRUE;
	text_blink_count = 0;
	cursor_blink_count = 0;
	workram_select = FALSE;

	/* CRTC */
	crtc_regnum = 0;
	memset(crtc_register, 0, sizeof(crtc_register));

	/* サブ側漢字ROM初期化 */
	sub_kanji_addr = 0;

	/* 400ラインモード時はテキストブリンクイベントを追加 */
	if (enable_400line && enable_400linecard) {
		schedule_setevent(EVENT_TEXT_BLINK, 160 * 1000, display_text_blink);
	}
	else {
		schedule_delevent(EVENT_TEXT_BLINK);
	}
#endif

	/* 20msごとに起こすイベントを追加 */
	schedule_setevent(EVENT_SUBTIMER, 20000, subcpu_event);

	/* VSYNC, VBLANK, HBLANKのセットアップ */
	display_setup();
}
Пример #5
0
static int display_connected(display_t *d, frame_ctl_rsp_init *init)
{
  int size;

  /* Hook root frame buffer */
  debug(DEBUG_CONNECT, "CONNECTED: name='%s' shmid=%d cwd='%s'\n", d->desktop.name, init->shmid, init->cwd);
  if ( display_desktop_init_root(&(d->desktop), init->shmid) ) {
    error("connect: failed to map root frame buffer (shmid=%d)\n", init->shmid);
    return -1;
  }

  /* Set capture device capabilities */
  d->cap = init->cap;

  /* Chdir to client's cwd */
  if ( init->cwd[0] != '\0' ) {
    if ( chdir(init->cwd) == -1 ) {
      error("chdir('%s'): %s\n", init->cwd, strerror(errno));
    }
  }

  /* Alloc display buffers */
  d->rgb_width = d->desktop.root.g0.width;
  d->rgb_height = d->desktop.root.g0.height;
  size = DISPLAY_BPP * d->rgb_width * d->rgb_height;
  debug(DEBUG_CONNECT, "RGB: name='%s' %ux%d, %d bytes\n", d->desktop.name, d->rgb_width, d->rgb_height, size);
  if ( d->rgb != NULL )
    free(d->rgb);
  d->rgb = malloc(size);

  /* Set active window geometry to physical display */
  d->rgb_window = d->desktop.root.g0;

  /* Clear matching indicator */
  display_pad_setup(&d->pad, d->rgb, d->rgb_width, d->rgb_height);

  /* Update frame display */
  display_update(d, NULL);

  /* Show connection status */
  display_desktop_show(d, DISPLAY_DESKTOP_CONNECTED);

  /* Setup drawing area size */
  display_setup(d);

  /* Setup and clear pattern management */
  display_pattern_set_ctl(d->sock);
  display_pattern_set_selection(&(d->sel_window));
  display_pattern_clear();

  /* Setup refresh control */
  display_refresh_set_ctl(d->sock);
  display_refresh_set_selection(&(d->sel_window));

  /* Setup screenshot management */
  display_screenshot_set_dir();
  display_screenshot_set_selection(&(d->sel_window));

  /* Setup input control */
  gtk_toggle_tool_button_set_active(display_button_input, 0);
  gtk_widget_set_sensitive(GTK_WIDGET(display_button_input), (d->cap & CAPTURE_CAP_INPUT));
  display_input_clicked();

  display_record_set_ctl(d->sock, d->cap);

  /* Enable manual command entry */
  display_command_connect(d->sock);

  return 0; 
}
Пример #6
0
static gboolean display_desktop_select(GtkTreeSelection *selection, GtkTreeModel *model,
				       GtkTreePath *path, gboolean path_currently_selected,
				       void *data)
{
  int path_newly_selected = path_currently_selected ? 0:1;
  display_t *d = NULL;
  frame_hdr_t *frame = NULL;
  GtkTreeIter iter;

  if ( path_newly_selected ) {
    if ( gtk_tree_model_get_iter(model, &iter, path) ) {
      gtk_tree_model_get(model, &iter,
			 DESKTOP_TREE_DISPLAY, &d,
			 DESKTOP_TREE_FRAME, &frame,
			 -1);
    }
  }

  /* Manage desktop switch */
  if ( (d != NULL) && (d != display_current) ) {
    display_t *display_previous;

    /* Select new desktop */
    display_previous = display_current;
    display_current = d;
    display_current_iter = iter;

    /* Disconnect previously selected desktop */
    display_disconnect(display_previous);

    debug(DEBUG_FRAME, "SELECT DESKTOP name='%s'\n", d->desktop.name);

    /* Start connection if display is available */
    if ( d->desktop.available ) {
      if ( display_connect(d) )
	display_desktop_available(d, 0);
    }

    /* Show jammed screen if display not available */
    else {
      display_setup(d);
    }
  }

  if ( (frame != NULL) && (frame != display_current_frame) ) {
    display_current_frame = frame;
    display_current_frame_iter = iter;

    debug(DEBUG_FRAME, "SELECT FRAME id='%s'\n", frame->id);

    display_desktop_map_layers(&(display_current->desktop));
    display_refresh(display_current, &(display_current->desktop.root.g0));
    display_selection_show(display_current);
    display_pattern_set_frame(frame);
    display_screenshot_set_frame(frame);

    display_desktop_highlight_frame(frame);
  }

  return TRUE;
}