Ejemplo n.º 1
0
void print_disk_tree (int block_nr)
{
    struct buffer_head * bh;

    bh = bread (g_sb.s_dev, block_nr, g_sb.s_blocksize);
    if (B_IS_KEYS_LEVEL (bh)) {
	int i;
	struct disk_child * dc;

	g_stat_info.nr_internals ++;
	print_block (bh, print_mode (), -1, -1);
      
	dc = B_N_CHILD (bh, 0);
	for (i = 0; i <= B_NR_ITEMS (bh); i ++, dc ++)
	    print_disk_tree (dc->dc_block_number);

    } else if (B_IS_ITEMS_LEVEL (bh)) {
	g_stat_info.nr_leaves ++;
	print_block (bh, print_mode (), -1, -1);
    } else {
	print_block (bh, print_mode (), -1, -1);
	die ("print_disk_tree: bad block type");
    }
    brelse (bh);
}
Ejemplo n.º 2
0
int
main(int argc, char *argv[])
{
    SDL_DisplayMode mode;
    int num_displays, dpy;

	/* Enable standard application logging */
	SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);

    /* Load the SDL library */
    if (SDL_Init(SDL_INIT_VIDEO) < 0) {
        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError());
        return 1;
    }

    SDL_Log("Using video target '%s'.\n", SDL_GetCurrentVideoDriver());
    num_displays = SDL_GetNumVideoDisplays();

    SDL_Log("See %d displays.\n", num_displays);

    for (dpy = 0; dpy < num_displays; dpy++) {
        const int num_modes = SDL_GetNumDisplayModes(dpy);
        SDL_Rect rect = { 0, 0, 0, 0 };
        int m;

        SDL_GetDisplayBounds(dpy, &rect);
        SDL_Log("%d: \"%s\" (%dx%d, (%d, %d)), %d modes.\n", dpy, SDL_GetDisplayName(dpy), rect.w, rect.h, rect.x, rect.y, num_modes);

        if (SDL_GetCurrentDisplayMode(dpy, &mode) == -1) {
            SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "    CURRENT: failed to query (%s)\n", SDL_GetError());
        } else {
            print_mode("CURRENT", &mode);
        }

        if (SDL_GetDesktopDisplayMode(dpy, &mode) == -1) {
            SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "    DESKTOP: failed to query (%s)\n", SDL_GetError());
        } else {
            print_mode("DESKTOP", &mode);
        }

        for (m = 0; m < num_modes; m++) {
            if (SDL_GetDisplayMode(dpy, m, &mode) == -1) {
                SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "    MODE %d: failed to query (%s)\n", m, SDL_GetError());
            } else {
                char prefix[64];
                SDL_snprintf(prefix, sizeof (prefix), "    MODE %d", m);
                print_mode(prefix, &mode);
            }
        }

        SDL_Log("\n");
    }

    return 0;
}
Ejemplo n.º 3
0
int8_t Rover::test_failsafe(uint8_t argc, const Menu::arg *argv)
{
	uint8_t fail_test = 0;
	print_hit_enter();
	for(int i = 0; i < 50; i++){
		delay(20);
		read_radio();
	}

	// read the radio to set trims
	// ---------------------------
	trim_radio();

	oldSwitchPosition = readSwitch();

	cliSerial->println("Unplug battery, throttle in neutral, turn off radio.");
	while(channel_throttle->get_control_in() > 0){
		delay(20);
		read_radio();
	}

	while(1){
		delay(20);
		read_radio();

		if(channel_throttle->get_control_in() > 0){
			cliSerial->printf("THROTTLE CHANGED %d \n", channel_throttle->get_control_in());
			fail_test++;
		}

		if (oldSwitchPosition != readSwitch()){
			cliSerial->print("CONTROL MODE CHANGED: ");
            print_mode(cliSerial, readSwitch());
            cliSerial->println();
			fail_test++;
		}

        if(throttle_failsafe_active()) {
			cliSerial->printf("THROTTLE FAILSAFE ACTIVATED: %d, ", channel_throttle->get_radio_in());
            print_mode(cliSerial, readSwitch());
            cliSerial->println();
			fail_test++;
		}

		if(fail_test > 0){
			return (0);
		}
		if(cliSerial->available() > 0){
			cliSerial->println("LOS caused no change in APM.");
			return (0);
		}
	}
}
Ejemplo n.º 4
0
void first()
{
  bwprintf (COM2, "I AM FIRST USER.\n\tMODE IS ");
  print_mode ();
  bwputstr (COM2, ".\n\tCREATE???\n");
  //int z = Create (0xABCDEF01, (void*)0x10FEDCBA);
  int z = Create (3, second);
  int i=0,j=0,k=0;
  while (1) {
    bwprintf (COM2, "I AM FIRST USER.\n\tKERNEL SAID %d\n\tMODE IS ",z);
    print_mode ();
    bwputstr (COM2, ".\n\tPASS??\n");
    i++;
    if (i>10) j++;
    if (j>10) k++;
    i %= 11; j %= 11;
//    bwprintf (COM2, "(i,j,k) = (%d,%d,%d)\n",i,j,k);
    Pass();
    bwprintf (COM2, "I AM FIRST USER.\n\tMODE IS ");
    print_mode ();
    bwputstr (COM2, ".\n\tEXIT????\n");
    Exit();
  }

//  int i = 0xFFFFF;
  int r;
  while (i--) {
    bwprintf(COM2, "Hey, I'm a user(%d)!\n", i);
    r = swtch(i);
    bwprintf(COM2, "And the kernel gave me %d!\n", r);
    for (r = 0; r < 500000; ++r);
  }
  bwputstr (COM2, "CPU Mode: ");
  print_mode();
  bwputstr (COM2, "\n\n");
  int x = 42;
  int b[5];
  b[0] = 0xDEADBEEF;
  b[1] = 0xDEADBEEF;
  b[2] = 0xDEADBEEF;
  b[3] = 0xDEADBEEF;
  b[4] = 0xDEADBEEF;
  bwprintf (COM2, "x is %d\n", x);
  i = 5; while (i--) { bwprintf (COM2, "b[%d] = ", i); bwputr(COM2, b[i]); bwputstr (COM2, "\n");}
  b[2] -= x;
  b[3]--;
  bwputstr (COM2, "now b[2] = b[2] - x  and b[3] = b[3] - 1...\n");
  i = 5; while (i--) { bwprintf (COM2, "b[%d] = ", i); bwputr(COM2, b[i]); bwputstr (COM2, "\n");}
}
Ejemplo n.º 5
0
void tex::you_cant ()
	{
	print_err("You can't use `");
	print_cmd_chr(cur_cmd, cur_chr);
	print("' in ");
	print_mode(mode);
	}
Ejemplo n.º 6
0
int main(int argc, char *argv[]) {
        static const char* const sulogin_cmdline[] = {SULOGIN, NULL};
        _cleanup_(sd_bus_flush_close_unrefp) sd_bus *bus = NULL;
        int r;

        log_set_target(LOG_TARGET_AUTO);
        log_parse_environment();
        log_open();

        print_mode(argc > 1 ? argv[1] : "");

        (void) fork_wait(sulogin_cmdline);

        r = bus_connect_system_systemd(&bus);
        if (r < 0) {
                log_warning_errno(r, "Failed to get D-Bus connection: %m");
                r = 0;
        } else {
                (void) reload_manager(bus);

                r = start_default_target(bus);
        }

        return r >= 0 ? EXIT_SUCCESS : EXIT_FAILURE;
}
Ejemplo n.º 7
0
static void print_entry(char *prefix, const struct ipt_policy_elem *e,
                        int numeric)
{
	if (e->match.reqid) {
		PRINT_INVERT(e->invert.reqid);
		printf("%sreqid %u ", prefix, e->reqid);
	}
	if (e->match.spi) {
		PRINT_INVERT(e->invert.spi);
		printf("%sspi 0x%x ", prefix, e->spi);
	}
	if (e->match.proto) {
		PRINT_INVERT(e->invert.proto);
		print_proto(prefix, e->proto, numeric);
	}
	if (e->match.mode) {
		PRINT_INVERT(e->invert.mode);
		print_mode(prefix, e->mode, numeric);
	}
	if (e->match.daddr) {
		PRINT_INVERT(e->invert.daddr);
		printf("%stunnel-dst %s%s ", prefix,
		       addr_to_dotted((struct in_addr *)&e->daddr),
		       mask_to_dotted((struct in_addr *)&e->dmask));
	}
	if (e->match.saddr) {
		PRINT_INVERT(e->invert.saddr);
		printf("%stunnel-src %s%s ", prefix,
		       addr_to_dotted((struct in_addr *)&e->saddr),
		       mask_to_dotted((struct in_addr *)&e->smask));
	}
}
Ejemplo n.º 8
0
static void msg_multi_mode(IRC_CHANNEL_REC *channel, const char *sender,
			   const char *addr, const char *mode)
{
	MODE_REC *rec;

	if (modes == NULL)
		signal_add("print starting", (SIGNAL_FUNC) sig_print_starting);

	rec = mode_find_channel(channel);
	if (rec != NULL && strcmp(rec->mode, mode) != 0) {
		/* different mode than last time, show and remove the old */
		print_mode(rec);
		mode_destroy(rec);
		rec = NULL;
	}

	if (rec == NULL) {
                /* no previous mode, create new */
		rec = g_new0(MODE_REC, 1);
		modes = g_slist_append(modes, rec);

		rec->channel = channel;
		rec->mode = g_strdup(mode);
	}

	rec->nicks = g_slist_append(rec->nicks, g_strdup(sender));
	rec->last_mode = time(NULL);

	signal_stop();
}
Ejemplo n.º 9
0
static void
hashlimit_mt_print(const struct xt_hashlimit_mtinfo1 *info, unsigned int dmask)
{
	if (info->cfg.mode & XT_HASHLIMIT_INVERT)
		fputs("limit: above ", stdout);
	else
		fputs("limit: up to ", stdout);
	print_rate(info->cfg.avg);
	printf("burst %u ", info->cfg.burst);
	if (info->cfg.mode & (XT_HASHLIMIT_HASH_SIP | XT_HASHLIMIT_HASH_SPT |
	    XT_HASHLIMIT_HASH_DIP | XT_HASHLIMIT_HASH_DPT)) {
		fputs("mode ", stdout);
		print_mode(info->cfg.mode, '-');
	}
	if (info->cfg.size != 0)
		printf("htable-size %u ", info->cfg.size);
	if (info->cfg.max != 0)
		printf("htable-max %u ", info->cfg.max);
	if (info->cfg.gc_interval != XT_HASHLIMIT_GCINTERVAL)
		printf("htable-gcinterval %u ", info->cfg.gc_interval);
	if (info->cfg.expire != XT_HASHLIMIT_EXPIRE)
		printf("htable-expire %u ", info->cfg.expire);

	if (info->cfg.srcmask != dmask)
		printf("srcmask %u ", info->cfg.srcmask);
	if (info->cfg.dstmask != dmask)
		printf("dstmask %u ", info->cfg.dstmask);
}
Ejemplo n.º 10
0
/* something is going to be printed to screen, print our current netsplit
   message before it. */
static void sig_print_starting(void)
{
	while (modes != NULL) {
		print_mode(modes->data);
                mode_destroy(modes->data);
	}
}
/* Saves the union ipt_targinfo in parsable form to stdout. */
static void
save(const struct ipt_ip *ip, const struct ipt_entry_target *target)
{
	struct ipt_porttrigger_info *info = (struct ipt_porttrigger_info *)(target)->data;

	print_mode(info->mode);
	/* 
	  Modification: for protocol type==all(any) can't work
      Modified by: ken_chiang 
      Date:2007/8/21
    */
	//if( info->trigger_proto ) {
		printf("--trigger-proto:");
		print_proto(info->trigger_proto);
	//}

	//if( info->forward_proto ) {
		printf("--forward-proto:");
		print_proto(info->forward_proto);
	//}

	if( info->trigger_ports.ports[0]) {
		printf("--trigger-ports: ");
		print_multi_ports(info->trigger_ports);
	}

	if( info->forward_ports.ports[0] ) {
		printf("  --forward-ports: ");
		print_multi_ports(info->forward_ports);
	}

	if( info->timer >0) {
		printf("  --timer: %d", info->timer);
	}
}
Ejemplo n.º 12
0
// Muestro primera y segunda fila (header)
// tambien maneja posicion del cursor
void show_header(WINDOW * win) {

    clr_header(win, 0);
    clr_header(win, 1);

    print_mult_pend(win);

    // imprimo modo
    print_mode(win);

    // imprimo texto de input
    #ifdef USECOLORS
    set_ucolor(win, &ucolors[INPUT]);
    #endif
    switch (curmode) {
        case COMMAND_MODE:
            mvwprintw(win, 0, 0 + rescol, ":%s", inputline);
            wmove(win, 0, inputline_pos + 1 + rescol);
            break;
        case INSERT_MODE:
            mvwprintw(win, 0, 1 + rescol, "%s", inputline);
            wmove(win, 0, inputline_pos + 1 + rescol);
            break;
        case EDIT_MODE:
            mvwprintw(win, 0, 0 + rescol, " %s", inputline);
            wmove(win, 0, inputline_pos + 1 + rescol);
            break;
    }
    wrefresh(win);

    return;
}
Ejemplo n.º 13
0
static void
hashlimit_mt_save(const struct xt_hashlimit_mtinfo1 *info, unsigned int dmask)
{
	if (info->cfg.mode & XT_HASHLIMIT_INVERT)
		fputs("--hashlimit-above ", stdout);
	else
		fputs("--hashlimit-upto ", stdout);
	print_rate(info->cfg.avg);
	if (info->cfg.burst != XT_HASHLIMIT_BURST)
		printf("--hashlimit-burst %u ", info->cfg.burst);

	if (info->cfg.mode & (XT_HASHLIMIT_HASH_SIP | XT_HASHLIMIT_HASH_SPT |
	    XT_HASHLIMIT_HASH_DIP | XT_HASHLIMIT_HASH_DPT)) {
		fputs("--hashlimit-mode ", stdout);
		print_mode(info->cfg.mode, ',');
	}

	printf("--hashlimit-name %s ", info->name);

	if (info->cfg.size != 0)
		printf("--hashlimit-htable-size %u ", info->cfg.size);
	if (info->cfg.max != 0)
		printf("--hashlimit-htable-max %u ", info->cfg.max);
	if (info->cfg.gc_interval != XT_HASHLIMIT_GCINTERVAL)
		printf("--hashlimit-htable-gcinterval %u", info->cfg.gc_interval);
	if (info->cfg.expire != XT_HASHLIMIT_EXPIRE)
		printf("--hashlimit-htable-expire %u ", info->cfg.expire);

	if (info->cfg.srcmask != dmask)
		printf("--hashlimit-srcmask %u ", info->cfg.srcmask);
	if (info->cfg.dstmask != dmask)
		printf("--hashlimit-dstmask %u ", info->cfg.dstmask);
}
Ejemplo n.º 14
0
static void print_info(const struct iwinfo_ops *iw, const char *ifname)
{
	printf("%-9s ESSID: %s\n",
		ifname,
		print_ssid(iw, ifname));
	printf("          Access Point: %s\n",
		print_bssid(iw, ifname));
	printf("          Type: %s  HW Mode(s): %s\n",
		print_type(iw, ifname),
		print_hwmodes(iw, ifname));
	printf("          Mode: %s  Channel: %s (%s)\n",
		print_mode(iw, ifname),
		print_channel(iw, ifname),
		print_frequency(iw, ifname));
	printf("          Tx-Power: %s  Link Quality: %s/%s\n",
		print_txpower(iw, ifname),
		print_quality(iw, ifname),
		print_quality_max(iw, ifname));
	printf("          Signal: %s  Noise: %s\n",
		print_signal(iw, ifname),
		print_noise(iw, ifname));
	printf("          Bit Rate: %s\n",
		print_rate(iw, ifname));
	printf("          Encryption: %s\n",
		print_encryption(iw, ifname));
	printf("          Supports VAPs: %s\n",
		print_mbssid_supp(iw, ifname));
}
Ejemplo n.º 15
0
int update_display_mode(struct display_controller *disp_ctrl,
			       struct soc_nvidia_tegra132_config *config)
{
	print_mode(config);

	printk(BIOS_ERR, "config:      xres:yres: %d x %d\n ",
			config->xres, config->yres);
	printk(BIOS_ERR, "   href_sync:vref_sync: %d x %d\n ",
			config->href_to_sync, config->vref_to_sync);
	printk(BIOS_ERR, " hsyn_width:vsyn_width: %d x %d\n ",
			config->hsync_width, config->vsync_width);
	printk(BIOS_ERR, " hfnt_porch:vfnt_porch: %d x %d\n ",
			config->hfront_porch, config->vfront_porch);
	printk(BIOS_ERR, "   hbk_porch:vbk_porch: %d x %d\n ",
			config->hback_porch, config->vback_porch);

	WRITEL(0x0, &disp_ctrl->disp.disp_timing_opt);
	WRITEL(0x0, &disp_ctrl->disp.disp_color_ctrl);

	/* select win opt */
	WRITEL(config->win_opt, &disp_ctrl->disp.disp_win_opt);

	WRITEL(config->vref_to_sync << 16 | config->href_to_sync,
		&disp_ctrl->disp.ref_to_sync);

	WRITEL(config->vsync_width << 16 | config->hsync_width,
		&disp_ctrl->disp.sync_width);


	WRITEL((config->vback_porch << 16) | config->hback_porch,
		&disp_ctrl->disp.back_porch);

	WRITEL((config->vfront_porch << 16) | config->hfront_porch,
		&disp_ctrl->disp.front_porch);

	WRITEL(config->xres | (config->yres << 16),
		&disp_ctrl->disp.disp_active);

	/**
	 * We want to use PLLD_out0, which is PLLD / 2:
	 *   PixelClock = (PLLD / 2) / ShiftClockDiv / PixelClockDiv.
	 *
	 * Currently most panels work inside clock range 50MHz~100MHz, and PLLD
	 * has some requirements to have VCO in range 500MHz~1000MHz (see
	 * clock.c for more detail). To simplify calculation, we set
	 * PixelClockDiv to 1 and ShiftClockDiv to 1. In future these values
	 * may be calculated by clock_configure_plld(), to allow wider
	 * frequency range.
	 *
	 * Note ShiftClockDiv is a 7.1 format value.
	 */
	const u32 shift_clock_div = 1;
	WRITEL((PIXEL_CLK_DIVIDER_PCD1 << PIXEL_CLK_DIVIDER_SHIFT) |
	       ((shift_clock_div - 1) * 2 + 1) << SHIFT_CLK_DIVIDER_SHIFT,
	       &disp_ctrl->disp.disp_clk_ctrl);
	printk(BIOS_DEBUG, "%s: PixelClock=%u, ShiftClockDiv=%u\n",
	       __func__, config->pixel_clock, shift_clock_div);
	return 0;
}
Ejemplo n.º 16
0
/* something is going to be printed to screen, print our current netsplit
   message before it. */
static void sig_print_starting(void)
{
	while (modes != NULL) {
		print_mode(modes->data);
                mode_destroy(modes->data);
	}

	signal_remove("print starting", sig_print_starting);
}
Ejemplo n.º 17
0
static void ratelimit_print(const void *ip, const struct xt_entry_match *match,
    int numeric)
{
	const struct xt_ratelimit_mtinfo *info = (const void *)match->data;

	fputs("ratelimit:", stdout);
	printf(" set %s", info->name);
	fputs(" mode ", stdout);
	print_mode(info->mode);
}
Ejemplo n.º 18
0
Archivo: myls.c Proyecto: yumm007/C
static void print_file_info(const struct stat *file_st, const struct print_f *format) {

	print_mode(file_st->st_mode, format->mode_flag);
	print_nlink(file_st->st_nlink, format->link_flag);
	print_uid(file_st->st_uid, format->id_name_flag);
	print_gid(file_st->st_gid, format->id_name_flag);
	print_size(file_st->st_size, format->size_flag);
	print_time(file_st, format->date_flag, format->time_form);

	return;
}
Ejemplo n.º 19
0
static void ratelimit_save(const void *ip, const struct xt_entry_match *match)
{
	const struct xt_ratelimit_mtinfo *info = (const void *)match->data;

	if (strcmp("DEFAULT", info->name))
		printf(" --ratelimit-set %s", info->name);
	if (info->mode & XT_RATELIMIT_MODE) {
		fputs(" --ratelimit-mode ", stdout);
		print_mode(info->mode);
	}

}
Ejemplo n.º 20
0
void draw_system(World * w)
{
	char hp_str[32];
	sprintf(hp_str, "HP:%7d", w->hero->hp);
	set_str((CHAR_INFO *) screen_buffer, hp_str, 62, 0, 0, 4 + 8);
	print_gauge(62, 1, w->hero->max_hp, w->hero->hp, 4 + 8, 4);
	char mp_str[32];
	sprintf(mp_str, "MP:%7d", w->hero->mp);
	set_str((CHAR_INFO *) screen_buffer, mp_str, 62, 2, 0, 1 + 8);
	print_gauge(62, 3, w->hero->max_mp, w->hero->mp, 1 + 8, 1);
	print_mode(62, 4, w->hero);
	print_notice(w->hero, 0, 21);
	draw_examine(60, 20, w, w->hero->x, w->hero->y, w->hero);
}
Ejemplo n.º 21
0
void Summary::print(xmrig::Controller *controller)
{
    print_versions(controller);
    print_mode(controller);
    print_algo(controller);
    printPools(controller->config());
    print_bind(controller);

#   ifndef XMRIG_NO_API
    print_api(controller);
#   endif

    print_commands(controller);
}
Ejemplo n.º 22
0
void
show_cur_cmd_chr()
{
	begin_diagnostic();
	print_nl("{");
	if (mode != shown_mode) {
		print_mode(mode);
		print(": ");
		shown_mode = mode;
	}
	print_cmd_chr(cur_cmd, cur_chr);
	print("}");
	end_diagnostic(FALSE);
}
Ejemplo n.º 23
0
int tegra_dc_set_mode(struct tegra_dc *dc, const struct tegra_dc_mode *mode)
{
	memcpy(&dc->mode, mode, sizeof(dc->mode));

	if (dc->out->type == TEGRA_DC_OUT_RGB)
		panel_sync_rate = tegra_dc_calc_refresh(mode);
	else if (dc->out->type == TEGRA_DC_OUT_DSI)
		panel_sync_rate = dc->out->dsi->rated_refresh_rate * 1000;

	print_mode(dc, mode, __func__);
	dc->frametime_ns = calc_frametime_ns(mode);

	return 0;
}
Ejemplo n.º 24
0
void init()
{
	freenect_context *ctx;
	freenect_device *dev;
	if (freenect_init(&ctx, 0)) {
		printf("Error: Cannot get context\n");
		return;
	}

	// fakenect doesn't support audio yet, so don't bother claiming the device
	freenect_select_subdevices(ctx, (freenect_device_flags)(FREENECT_DEVICE_MOTOR | FREENECT_DEVICE_CAMERA));

	if (freenect_open_device(ctx, &dev, 0)) {
		printf("Error: Cannot get device\n");
		return;
	}
	print_mode("Depth", freenect_find_depth_mode(FREENECT_RESOLUTION_MEDIUM, FREENECT_DEPTH_11BIT));
	print_mode("Video", freenect_find_video_mode(FREENECT_RESOLUTION_MEDIUM, FREENECT_VIDEO_RGB));
	freenect_set_depth_mode(dev, freenect_find_depth_mode(FREENECT_RESOLUTION_MEDIUM, FREENECT_DEPTH_11BIT));
	freenect_start_depth(dev);
	freenect_set_video_mode(dev, freenect_find_video_mode(FREENECT_RESOLUTION_MEDIUM, FREENECT_VIDEO_RGB));
	freenect_start_video(dev);
	if (use_ffmpeg) {
		init_ffmpeg_streams();
		freenect_set_depth_callback(dev, depth_cb_ffmpeg);
		freenect_set_video_callback(dev, rgb_cb_ffmpeg);
	} else {
		freenect_set_depth_callback(dev, depth_cb);
		freenect_set_video_callback(dev, rgb_cb);
	}
	while (running && freenect_process_events(ctx) >= 0)
		snapshot_accel(dev);
	freenect_stop_depth(dev);
	freenect_stop_video(dev);
	freenect_close_device(dev);
	freenect_shutdown(ctx);
}
Ejemplo n.º 25
0
void
fb_io_device::init (int width, int height, int mode)
{
    m_width  = width;
    m_height = height;
    m_mode   = mode;

    DPRINTF ("init() %d %d %d\n", width, height, mode);

    switch(m_mode)
    {
    case NONE:
        EPRINTF("Mode not set\n");
        break;
    case GREY:
        m_buf_size       = height * width;
        break;
    case RGB:
    case BGR:
        m_buf_size       = 3 * height * width;
        break;
    case ARGB:
    case BGRA:
        m_buf_size       = 4 * height * width;
        break;
    case YVYU: /* YUV 4:2:2 */
    case YV16:
        m_buf_size       = 3 * height * width;
        break;
    case YV12: /* YUV 4:2:0 */
    case IYUV: /* YUV 4:2:0 */
        m_buf_size       = 3 * height * width;
        break;
    default:
        EPRINTF ("Bad mode\n");
    }

    DPRINTF ("new framebuffer: %dx%d mode: %s\n", width, height, print_mode(mode));
    DPRINTF ("                 buf_size: [%dB--0x%xB]\n", m_buf_size, m_buf_size);

    if (nb_fb == 0)
        atexit (close_ramdacs);

    init_viewer ();

    m_io_res->mem      = m_shm_buf;
    m_io_res->mem_size = m_buf_size;
    m_regs->m_status   = FB_IO_RUNNING;
}
Ejemplo n.º 26
0
void AircraftSim::update_mode()  
{
  
  const ElementStat stat = task_manager.get_stats().current_leg;
  
  switch (acstate) {
  case Cruise:
    if ((awp>0) && 
        (task_manager.get_stats().total.solution_remaining.DistanceToFinal<= state.Speed)) {
      print_mode("# mode fg\n");
      acstate = FinalGlide;
    } else {
      if (state.NavAltitude<=target_height()) {
        print_mode("# mode climb\n");
        acstate = Climb;
      }
    }
    break;
  case FinalGlide:
    if (task_manager.get_stats().total.solution_remaining.AltitudeDifference<-fixed_20) {
      print_mode("# mode climb\n");
      acstate = Climb;
    }
    break;
  case Climb:
    if ((awp>0) && 
        (task_manager.get_stats().total.solution_remaining.DistanceToFinal<= state.Speed)) {
      print_mode("# mode fg\n");
      acstate = FinalGlide;
    } else if (state.NavAltitude>=fixed_1500) {
      acstate = Cruise;
      print_mode("# mode cruise\n");
    }
    break;
  };
}
Ejemplo n.º 27
0
/*
 * Check options and call the proper handler
 */
static int
print_one_device(int		skfd,
		 int		format,
		 int		wtype,
		 const char*	ifname)
{
  int ret;

  /* Check wtype */
  switch(wtype)
    {
    case WTYPE_AP:
      /* Try to print an AP */
      ret = print_ap(skfd, ifname, format);
      break;

    case WTYPE_CHANNEL:
      /* Try to print channel */
      ret = print_channel(skfd, ifname, format);
      break;

    case WTYPE_FREQ:
      /* Try to print frequency */
      ret = print_freq(skfd, ifname, format);
      break;

    case WTYPE_MODE:
      /* Try to print the mode */
      ret = print_mode(skfd, ifname, format);
      break;

    case WTYPE_PROTO:
      /* Try to print the protocol */
      ret = print_protocol(skfd, ifname, format);
      break;

    default:
      /* Try to print an ESSID */
      ret = print_essid(skfd, ifname, format);
      if(ret < 0)
	{
	  /* Try to print a nwid */
	  ret = print_nwid(skfd, ifname, format);
	}
    }

  return(ret);
}
Ejemplo n.º 28
0
void print_crtc(Crtc& cc, int ind)
{
	printf("%sCRTC Id %d BufferId %d %dx%d at %dx%d gamma_size %d\n",
	       width(ind, "").c_str(), cc.id(), cc.buffer_id(), cc.width(),
	       cc.height(), cc.x(), cc.y(), cc.gamma_size());

	printf("%s   Mode ", width(ind, "").c_str());
	print_mode(cc.mode(), 0);

	if (opts.print_props)
		print_properties(cc, ind+2);

	if (opts.recurse)
		for (auto p : cc.get_possible_planes())
			print_plane(*p, ind + 2);
}
Ejemplo n.º 29
0
void print(struct dirent *dir, struct stat *stbuf, int depth) {
	if (dir->d_name[0] == '.') 
		return;
	for (int i = 0; i < depth*4; i++)
		printf(" ");
	if (l == 1) {
		print_mode(stbuf->st_mode);
		printf("%d ", (int)stbuf->st_nlink);
		printf("%s ", getpwuid(stbuf->st_uid)->pw_name);
		printf("%s ", getgrgid(stbuf->st_gid)->gr_name);
		printf("%.12s ", 4 + ctime(&(stbuf->st_mtime)));
		printf("%ld ", (long) stbuf->st_size);
	}
	printf("%s\n", dir->d_name);
	return;
} 
Ejemplo n.º 30
0
int update_display_mode(struct display_controller *disp_ctrl,
			       struct soc_nvidia_tegra132_config *config)
{
	print_mode(config);

	printk(BIOS_ERR, "config:      xres:yres: %d x %d\n ",
			config->xres, config->yres);
	printk(BIOS_ERR, "   href_sync:vref_sync: %d x %d\n ",
			config->href_to_sync, config->vref_to_sync);
	printk(BIOS_ERR, " hsyn_width:vsyn_width: %d x %d\n ",
			config->hsync_width, config->vsync_width);
	printk(BIOS_ERR, " hfnt_porch:vfnt_porch: %d x %d\n ",
			config->hfront_porch, config->vfront_porch);
	printk(BIOS_ERR, "   hbk_porch:vbk_porch: %d x %d\n ",
			config->hback_porch, config->vback_porch);

	WRITEL(0x0, &disp_ctrl->disp.disp_timing_opt);
	WRITEL(0x0, &disp_ctrl->disp.disp_color_ctrl);

	/* select win opt */
	WRITEL(config->win_opt, &disp_ctrl->disp.disp_win_opt);

	WRITEL(config->vref_to_sync << 16 | config->href_to_sync,
		&disp_ctrl->disp.ref_to_sync);

	WRITEL(config->vsync_width << 16 | config->hsync_width,
		&disp_ctrl->disp.sync_width);


	WRITEL((config->vback_porch << 16) | config->hback_porch,
		&disp_ctrl->disp.back_porch);

	WRITEL((config->vfront_porch << 16) | config->hfront_porch,
		&disp_ctrl->disp.front_porch);

	WRITEL(config->xres | (config->yres << 16),
		&disp_ctrl->disp.disp_active);

	/*
	 *   PixelClock = (PLLD / 2) / ShiftClockDiv / PixelClockDiv.
	 *
	 *   default: Set both shift_clk_div and pixel_clock_div to 1
	 */
	update_display_shift_clock_divider(disp_ctrl, SHIFT_CLK_DIVIDER(1));

	return 0;
}