display_options()
{
	/** Display all the available options.. **/

	char *sort_name();

	ClearScreen();
	Centerline(0,"-- ELM Options Editor --");

#ifdef ENABLE_CALENDAR
	PutLine1(2, 0, "C)alendar file       : %s", raw_calendar_file);
#endif
	PutLine1(3, 0, "D)isplay mail using  : %s", raw_pager);
	PutLine1(4, 0, "E)ditor              : %s", raw_editor);
	PutLine1(5, 0, "F)older directory    : %s", raw_folders);
	PutLine1(6, 0, "S)orting criteria    : %s", sort_name(FULL));
	PutLine1(7, 0, "O)utbound mail saved : %s", raw_sentmail);
	PutLine1(8, 0, "P)rint mail using    : %s", raw_printout);
	PutLine1(9, 0, "Y)our full name      : %s", full_username);

	PutLine1(12,0, "A)rrow cursor        : %s", onoff(arrow_cursor));
	PutLine1(13,0, "M)enu display        : %s", onoff(mini_menu));

	PutLine1(15,0, "U)ser level          : %s", level_name(user_level));
	PutLine1(16,0, "N)ames only          : %s", onoff(names_only));
}
Esempio n. 2
0
int
mpssconfig_update_pm(char *name, int cpufreq, int corec6, int pc3, int pc6)
{
	struct mic_info *miclist;
	struct mic_info *mic;
	struct mpss_env menv;
	int err = 0;

	if (mpssenv_init(&menv))
		return CONFIG_ERROR_ENV;


	if ((miclist = mpss_get_miclist(&menv, NULL)) == NULL)
		return CONFIG_ERROR_EXIST;

	if ((mic = mpss_find_micname_inlist(miclist, name)) == NULL) {
		err = CONFIG_ERROR_EXIST;
		goto free_and_ret;
	}

	if (mpss_update_config(&menv, mic->config.name, "PowerManagement", NULL,
			   "PowerManagement \"cpufreq_%s;corec6_%s;pc3_%s;pc6_%s\"\n",
			   onoff(cpufreq), onoff(corec6), onoff(pc3), onoff(pc6)))
		err = CONFIG_ERROR_WRITE;

free_and_ret:
	mpss_free_miclist(miclist);
	return err;
}
Esempio n. 3
0
static int vlv_wait_for_gt_wells(struct drm_i915_private *dev_priv,
				 bool wait_for_on)
{
	u32 mask;
	u32 val;
	int err;

	mask = VLV_GTLC_PW_MEDIA_STATUS_MASK | VLV_GTLC_PW_RENDER_STATUS_MASK;
	val = wait_for_on ? mask : 0;
#define COND ((I915_READ(VLV_GTLC_PW_STATUS) & mask) == val)
	if (COND)
		return 0;

	DRM_DEBUG_KMS("waiting for GT wells to go %s (%08x)\n",
		      onoff(wait_for_on),
		      I915_READ(VLV_GTLC_PW_STATUS));

	/*
	 * RC6 transitioning can be delayed up to 2 msec (see
	 * valleyview_enable_rps), use 3 msec for safety.
	 */
	err = wait_for(COND, 3);
	if (err)
		DRM_ERROR("timeout waiting for GT wells to go %s\n",
			  onoff(wait_for_on));

	return err;
#undef COND
}
irom io_error_t io_mcp_get_pin_info(string_t *dst, const struct io_info_entry_T *info, io_data_pin_entry_t *pin_data, const io_config_pin_entry_t *pin_config, int pin)
{
	int bank, bankpin, tv;
	int io, olat, cached;
	mcp_data_pin_t *mcp_pin_data;

	bank = (pin & 0x08) >> 3;
	bankpin = pin & 0x07;

	mcp_pin_data = &mcp_data_pin_table[info->instance][pin];

	switch(pin_config->llmode)
	{
		case(io_pin_ll_input_analog):
		{
			if(read_register(dst, info->address, GPIO(bank), &tv) != io_ok)
				return(io_error);

			string_format(dst, "current io: %s", onoff(tv & (1 << bankpin)));

			break;
		}

		case(io_pin_ll_counter):
		{
			if(read_register(dst, info->address, GPIO(bank), &tv) != io_ok)
				return(io_error);

			string_format(dst, "current io: %s, debounce: %d", onoff(tv & (1 << bankpin)), mcp_pin_data->debounce);

			break;
		}

		case(io_pin_ll_output_digital):
		{
			if(read_register(dst, info->address, GPIO(bank), &tv) != io_ok)
				return(io_error);

			io = tv & (1 << bankpin);

			if(read_register(dst, info->address, OLAT(bank), &tv) != io_ok)
				return(io_error);

			olat = tv & (1 << bankpin);
			cached = pin_output_cache[bank] & (1 << bankpin);

			string_format(dst, "current latch: %s, io: %s, cache: %s", onoff(io), onoff(olat), onoff(cached));

			break;
		}

		default:
		{
		}
	}

	return(io_ok);
}
Esempio n. 5
0
/* For ILK+ */
void assert_shared_dpll(struct drm_i915_private *dev_priv,
			struct intel_shared_dpll *pll,
			bool state)
{
	bool cur_state;
	struct intel_dpll_hw_state hw_state;

	if (WARN(!pll, "asserting DPLL %s with no DPLL\n", onoff(state)))
		return;

	cur_state = pll->funcs.get_hw_state(dev_priv, pll, &hw_state);
	I915_STATE_WARN(cur_state != state,
	     "%s assertion failure (expected %s, current %s)\n",
			pll->name, onoff(state), onoff(cur_state));
}
Esempio n. 6
0
File: cmds.c Progetto: feng5381/iftp
/* 
 * ===  FUNCTION  ======================================================================
 *         Name:  AUTOLOG
 *  Description:  
 * =====================================================================================
 */
	void
AUTOMATIC(void)
{
	automatic = !automatic;
	printf("automatic login/connect %s.\n", onoff(automatic));
	code = automatic;
}		/* -----  end of function AUTOLOG  ----- */
Esempio n. 7
0
File: cmds.c Progetto: feng5381/iftp
/* 
 * ===  FUNCTION  ======================================================================
 *         Name:  PASSIVE
 *  Description:  
 * =====================================================================================
 */
	void
PASSIVE (void)
{
	passivemode = !passivemode;
	printf("Passive mode %s.\n", onoff(passivemode));
	code = passivemode;
}		/* -----  end of function PASSIVE  ----- */
void MarchingCubesGenerator::initCubes()
{
	if (numCubes < 1)
		return;

	bool ***on = new bool**[numCubes];
	for(int i=0;i<numCubes;i++)
	{
		on[i]=new bool*[numCubes];
		for(int j=0;j<numCubes;j++)
			on[i][j]=new bool[numCubes];
	}
		
	float ***noise=new float**[numCubes];
	for(int i=0;i<numCubes;i++)
	{
		noise[i]=new float*[numCubes];
		for(int j=0;j<numCubes;j++)
			noise[i][j]=new float[numCubes];
	}
			
	Perlin3DNoise noises;
	noises.Generate3DArray(noise,numCubes,numCubes,numCubes, .7 , .5, 10, 1.4);	

	cubes=new Cube**[numCubes-1];
	for(int i=0; i<numCubes-1; i++)
	{
		cubes[i] = new Cube*[numCubes-1];
		for(int j=0; j<numCubes-1; j++)
			cubes[i][j] = new Cube[numCubes-1];
	}
	onoff(on, noise);

	initAllVertNormals();
}
irom static app_action_t set_unset_flag(application_parameters_t ap, bool_t value)
{
	uint16_t length;

	if(ap.nargs < 2)
	{
		length = snprintf(ap.dst, ap.size, "%s", "flags: ");
		ap.dst += length;
		ap.size -= length;

		length = config_flags_to_string(ap.size, ap.dst, config->flags);
		ap.dst += length;
		ap.size -= length;

		strlcpy(ap.dst, "\n", ap.size);

		return(app_action_normal);
	}

	if(!config_set_flag_by_name((*ap.args)[1], value))
	{
		snprintf(ap.dst, ap.size, "> unknown flag %s\n", (*ap.args)[1]);
		return(app_action_error);
	}

	snprintf(ap.dst, ap.size, "> flag %s %s\n", (*ap.args)[1], onoff(value));

	return(app_action_normal);
}
Esempio n. 10
0
static void report(struct slabinfo *s)
{
	if (strcmp(s->name, "*") == 0)
		return;

	printf("\nSlabcache: %-20s  Aliases: %2d Order : %2d Objects: %lu\n",
		s->name, s->aliases, s->order, s->objects);
	if (s->hwcache_align)
		printf("** Hardware cacheline aligned\n");
	if (s->cache_dma)
		printf("** Memory is allocated in a special DMA zone\n");
	if (s->destroy_by_rcu)
		printf("** Slabs are destroyed via RCU\n");
	if (s->reclaim_account)
		printf("** Reclaim accounting active\n");

	printf("\nSizes (bytes)     Slabs              Debug                Memory\n");
	printf("------------------------------------------------------------------------\n");
	printf("Object : %7d  Total  : %7ld   Sanity Checks : %s  Total: %7ld\n",
			s->object_size, s->slabs, onoff(s->sanity_checks),
			s->slabs * (page_size << s->order));
	printf("SlabObj: %7d  Full   : %7ld   Redzoning     : %s  Used : %7ld\n",
			s->slab_size, s->slabs - s->partial - s->cpu_slabs,
			onoff(s->red_zone), s->objects * s->object_size);
	printf("SlabSiz: %7d  Partial: %7ld   Poisoning     : %s  Loss : %7ld\n",
			page_size << s->order, s->partial, onoff(s->poison),
			s->slabs * (page_size << s->order) - s->objects * s->object_size);
	printf("Loss   : %7d  CpuSlab: %7d   Tracking      : %s  Lalig: %7ld\n",
			s->slab_size - s->object_size, s->cpu_slabs, onoff(s->store_user),
			(s->slab_size - s->object_size) * s->objects);
	printf("Align  : %7d  Objects: %7d   Tracing       : %s  Lpadd: %7ld\n",
			s->align, s->objs_per_slab, onoff(s->trace),
			((page_size << s->order) - s->objs_per_slab * s->slab_size) *
			s->slabs);

	ops(s);
	show_tracking(s);
	slab_numa(s, 1);
	slab_stats(s);
}
irom app_action_t application_function_gpio_get(application_parameters_t ap)
{
	unsigned int gpio_index;
	gpio_t *gpio;
	const gpio_config_entry_t *cfg;

	if(ap.nargs < 2)
	{
		snprintf(ap.dst, ap.size, "gpio-get: too little arguments: %u\n", ap.nargs - 1);
		return(app_action_error);
	}

	gpio_index = atoi((*ap.args)[1]);

	if(!(gpio = find_gpio(gpio_index)))
	{
		snprintf(ap.dst, ap.size, "gpio-get: invalid gpio %u\n", gpio_index);
		return(app_action_error);
	}

	cfg = get_config(gpio);

	switch(cfg->mode)
	{
		case(gpio_disabled):
		{
			snprintf(ap.dst, ap.size, "gpio-get: gpio %s is disabled\n", gpio->name);
			return(app_action_error);
		}

		case(gpio_input):
		{
			snprintf(ap.dst, ap.size, "gpio-get: gpio %s is %s\n", gpio->name, onoff(get_input(gpio)));
			return(app_action_normal);
		}

		case(gpio_counter):
		{
			snprintf(ap.dst, ap.size, "gpio-get: gpio %s is %u (state: %s)\n",
					gpio->name, gpio->counter.count, onoff(get_input(gpio)));

			if(cfg->counter.reset_on_get)
				gpio->counter.count = 0;

			gpio->counter.debounce = 0;

			return(app_action_normal);
		}

		case(gpio_output):
		case(gpio_timer):
		{
			snprintf(ap.dst, ap.size, "gpio-get: gpio %s is output\n", gpio->name);
			return(app_action_error);
		}

		case(gpio_pwm):
		{
			dump(&config->gpios, gpio, ap.size, ap.dst);
			return(app_action_normal);
		}

		case(gpio_i2c):
		{
			snprintf(ap.dst, ap.size, "gpio-get: gpio %s is reserved for i2c\n", gpio->name);
			return(app_action_error);
		}

		default:
		{
		}
	}

	snprintf(ap.dst, ap.size, "gpio-get: invalid mode %u\n", cfg->mode);
	return(app_action_error);
}
irom static void dump(const gpio_config_t *cfgs, const gpio_t *gpio_in, unsigned int size, char *str)
{
	unsigned int current;
	unsigned int length;
	const gpio_t *gpio;
	const gpio_config_entry_t *cfg;

	for(current = 0; current < gpio_size; current++)
	{
		gpio = &gpios[current];
		cfg = &cfgs->entry[current];

		if(!gpio_in || (gpio_in->id == gpio->id))
		{
			length = snprintf(str, size, "> gpio: %u, name: %s, mode: ", gpio->index, gpio->name);
			size -= length;
			str += length;
			length = 0;

			switch(cfg->mode)
			{
				case(gpio_disabled):
				{
					length = snprintf(str, size, "disabled");
					break;
				}

				case(gpio_input):
				{
					length = snprintf(str, size, "input, state: %s", onoff(get_input(gpio)));
					break;
				}

				case(gpio_counter):
				{
					length = snprintf(str, size, "counter, state: %s, counter: %u, debounce: %u/%u, reset on get: %s",
							onoff(get_input(gpio)), gpio->counter.count,
							cfg->counter.debounce, gpio->counter.debounce,
							onoff(cfg->counter.reset_on_get));
					break;
				}

				case(gpio_output):
				{
					length = snprintf(str, size, "output, state: %s, startup: %s",
							onoff(get_input(gpio)), onoff(cfg->output.startup_state));
					break;
				}

				case(gpio_timer):
				{
					length = snprintf(str, size, "timer, direction: %s, delay: %u ms, repeat: %s, autotrigger: %s, active: %s, current state: %s",
							cfg->timer.direction == gpio_up ? "up" : "down",
							cfg->timer.delay, onoff(cfg->timer.repeat),
							onoff(cfg->timer.autotrigger), onoff(gpio->timer.delay > 0),
							onoff(get_input(gpio)));
					break;
				}

				case(gpio_pwm):
				{
					length = snprintf(str, size, "pwm, ");
					str += length;
					size -= length;

					if(gpio_flags.pwm_subsystem_active)
						length = snprintf(str, size, "active, channel: %u, current frequency: %u Hz, current duty: %u",
								gpio->pwm.channel, 1000000 / pwm_get_period(), pwm_get_duty(gpio->pwm.channel));
					else
						length = snprintf(str, size, "inactive");

					str += length;
					size -= length;

					length = snprintf(str, size, "\ndefault min duty: %u, max duty: %u, delay: %u",
							cfg->pwm.min_duty, cfg->pwm.max_duty, cfg->pwm.delay);

					str += length;
					size -= length;

					length = snprintf(str, size, "\ncurrent min duty: %u, max duty %u, delay: %u",
							gpio->pwm.min_duty, gpio->pwm.max_duty, gpio->pwm.delay_top);

					break;
				}

				case(gpio_i2c):
				{
					length = snprintf(str, size, "i2c, pin: %s", cfg->i2c.pin == gpio_i2c_sda ? "sda" : "scl");

					break;
				}


				default:
				{
					length = snprintf(str, size, "unknown mode");
					break;
				}
			}

			str += length;
			size =- length;

			length = snprintf(str, size, "\n");
			str += length;
			size -= length;
		}
	}
}
Esempio n. 13
0
irom void config_flags_to_string(string_t *dst, const char *pre, const char *post, int flags)
{
	config_flag_enum_t current;

	if(pre)
		string_format(dst, "%s", pre);

	for(current = 0; current < config_flag_size; current++)
		string_format(dst, "%s%s:%s", string_length(dst) > 0 ? " " : "", config_flag[current].long_name, onoff(flags & 1 << current));

	if(post)
		string_format(dst, "%s", post);
}
Esempio n. 14
0
irom void io_config_dump(string_t *dst, const config_t *cfg, int io_id, int pin_id, bool html)
{
	const io_info_entry_t *info;
	io_data_entry_t *data;
	io_data_pin_entry_t *pin_data;
	const io_config_pin_entry_t *pin_config;
	const string_array_t *strings;
	int io, pin, value;
	io_error_t error;

	if(html)
		strings = &dump_strings.html;
	else
		strings = &dump_strings.plain;

	string_cat_ptr(dst, (*strings)[ds_id_header]);

	for(io = 0; io < io_id_size; io++)
	{
		if((io_id >= 0) && (io_id != io))
			continue;

		info = &io_info[io];
		data = &io_data[io];

		string_cat_ptr(dst, (*strings)[ds_id_preline]);
		string_format_ptr(dst, (*strings)[ds_id_io], io, info->name, info->address);
		string_cat_ptr(dst, (*strings)[ds_id_postline]);

		if(!data->detected)
		{
			string_cat_ptr(dst, (*strings)[ds_id_preline]);
			string_cat_ptr(dst, (*strings)[ds_id_not_detected]);
			string_cat_ptr(dst, (*strings)[ds_id_postline]);
			continue;
		}

		for(pin = 0; pin < info->pins; pin++)
		{
			if((pin_id >= 0) && (pin_id != pin))
				continue;

			pin_config = &cfg->io_config[io][pin];
			pin_data = &data->pin[pin];

			string_cat_ptr(dst, (*strings)[ds_id_preline]);
			string_format_ptr(dst, (*strings)[ds_id_pin], pin);

			string_cat_ptr(dst, (*strings)[ds_id_flags_1]);
			pin_string_from_flags(dst, pin_config);
			string_cat_ptr(dst, (*strings)[ds_id_flags_2]);

			string_cat_ptr(dst, (*strings)[ds_id_mode]);

			if((pin_config->mode != io_pin_disabled) && (pin_config->mode != io_pin_i2c) && (pin_config->mode != io_pin_uart))
				if((error = io_read_pin_x(dst, info, pin_data, pin_config, pin, &value)) != io_ok)
					string_cat(dst, "\n");
				else
					(void)0;
			else
				error = io_ok;

			switch(pin_config->mode)
			{
				case(io_pin_disabled):
				{
					string_cat_ptr(dst, (*strings)[ds_id_disabled]);

					break;
				}

				case(io_pin_input_digital):
				{
					if(error == io_ok)
						string_format_ptr(dst, (*strings)[ds_id_input], onoff(value));
					else
						string_cat_ptr(dst, (*strings)[ds_id_error]);

					break;
				}

				case(io_pin_counter):
				{
					if(error == io_ok)
						string_format_ptr(dst, (*strings)[ds_id_counter], value, pin_config->speed);
					else
						string_cat_ptr(dst, (*strings)[ds_id_error]);

					break;
				}

				case(io_pin_trigger):
				{
					if(error == io_ok)
					{
						string_format_ptr(dst, (*strings)[ds_id_trigger_1], value, pin_config->speed,
								pin_config->shared.trigger.io.io,
								pin_config->shared.trigger.io.pin);

						trigger_type_to_string(pin_config->shared.trigger.trigger_mode, dst);

						string_cat_ptr(dst, (*strings)[ds_id_trigger_2]);
					}
					else
						string_cat_ptr(dst, (*strings)[ds_id_error]);

					break;
				}

				case(io_pin_output_digital):
				{
					if(error == io_ok)
						string_format_ptr(dst, (*strings)[ds_id_output], onoff(value));
					else
						string_cat_ptr(dst, (*strings)[ds_id_error]);

					break;
				}

				case(io_pin_timer):
				{
					if(error == io_ok)
						string_format_ptr(dst, (*strings)[ds_id_timer],
								pin_config->direction == io_dir_up ? "up" : (pin_config->direction == io_dir_down ? "down" : "none"),
								pin_config->speed,
								pin_data->direction == io_dir_up ? "up" : (pin_data->direction == io_dir_down ? "down" : "none"),
								pin_data->speed,
								onoff(value));
					else
						string_cat_ptr(dst, (*strings)[ds_id_error]);

					break;
				}

				case(io_pin_output_analog):
				{
					if(error == io_ok)
						string_format_ptr(dst, (*strings)[ds_id_analog_output],
								pin_config->shared.output_analog.lower_bound,
								pin_config->shared.output_analog.upper_bound,
								pin_config->speed,
								pin_data->direction == io_dir_up ? "up" : (pin_data->direction == io_dir_down ? "down" : "none"),
								value);
					else
						string_cat_ptr(dst, (*strings)[ds_id_error]);

					break;
				}

				case(io_pin_i2c):
				{
					if(pin_config->shared.i2c.pin_mode == io_i2c_sda)
						string_cat_ptr(dst, (*strings)[ds_id_i2c_sda]);
					else
						string_cat_ptr(dst, (*strings)[ds_id_i2c_scl]);

					break;
				}

				case(io_pin_uart):
				{
					string_cat_ptr(dst, (*strings)[ds_id_uart]);

					break;
				}

				case(io_pin_lcd):
				{
					string_cat_ptr(dst, (*strings)[ds_id_lcd]);
					string_cat(dst, "/");
					io_string_from_lcd_mode(dst, pin_config->shared.lcd.pin_use);

					break;
				}


				default:
				{
					string_cat_ptr(dst, (*strings)[ds_id_unknown]);

					break;
				}
			}

			string_cat(dst, " [hw: ");
			io_string_from_ll_mode(dst, pin_config->llmode);
			string_cat(dst, "]");

			if(info->get_pin_info_fn)
			{
				string_cat_ptr(dst, (*strings)[ds_id_info_1]);
				info->get_pin_info_fn(dst, info, pin_data, pin_config, pin);
				string_cat_ptr(dst, (*strings)[ds_id_info_2]);
			}

			string_cat_ptr(dst, (*strings)[ds_id_postline]);
		}
	}

	string_cat_ptr(dst, (*strings)[ds_id_footer]);
}