Esempio n. 1
0
void console_putc(unsigned int ch, char c)
{
	struct console_device *cdev;
	int init = initialized;

	switch (init) {
	case CONSOLE_UNINITIALIZED:
		console_init_early();
		/* fall through */

	case CONSOLE_INITIALIZED_BUFFER:
		kfifo_putc(console_output_fifo, c);
		PUTC_LL(c);
		return;

	case CONSOLE_INIT_FULL:
		for_each_console(cdev) {
			if (cdev->f_active & ch) {
				if (c == '\n')
					cdev->putc(cdev, '\r');
				cdev->putc(cdev, c);
			}
		}
		return;
	default:
		/* If we have problems inititalizing our data
		 * get them early
		 */
		hang();
	}
}
Esempio n. 2
0
int console_register(struct console_device *newcdev)
{
	struct device_d *dev = &newcdev->class_dev;
	int activate = 0;

	if (initialized == CONSOLE_UNINITIALIZED)
		console_init_early();

	dev->id = DEVICE_ID_DYNAMIC;
	strcpy(dev->name, "cs");
	if (newcdev->dev)
		dev->parent = newcdev->dev;
	platform_device_register(dev);

	if (newcdev->setbrg) {
		newcdev->baudrate = CONFIG_BAUDRATE;
		dev_add_param_int(dev, "baudrate", console_baudrate_set,
			NULL, &newcdev->baudrate, "%u", newcdev);
	}

	dev_add_param(dev, "active", console_std_set, NULL, 0);

	if (IS_ENABLED(CONFIG_CONSOLE_ACTIVATE_FIRST)) {
		if (list_empty(&console_list))
			activate = 1;
	} else if (IS_ENABLED(CONFIG_CONSOLE_ACTIVATE_ALL)) {
		activate = 1;
	}

	if (newcdev->dev && of_device_is_stdout_path(newcdev->dev)) {
		activate = 1;
		console_set_stdoutpath(newcdev);
	}

	list_add_tail(&newcdev->list, &console_list);

	if (activate) {
		if (IS_ENABLED(CONFIG_PARAMETER))
			dev_set_param(dev, "active", "ioe");
		else
			console_std_set(dev, NULL, "ioe");
	}

	return 0;
}
Esempio n. 3
0
int console_register(struct console_device *newcdev)
{
	struct device_d *dev = &newcdev->class_dev;
	int first = 0;
	char ch;

	if (initialized == CONSOLE_UNINITIALIZED)
		console_init_early();

	dev->id = DEVICE_ID_DYNAMIC;
	strcpy(dev->name, "cs");
	if (newcdev->dev)
		dev_add_child(newcdev->dev, dev);
	register_device(dev);

	if (newcdev->setbrg) {
		dev_add_param(dev, "baudrate", console_baudrate_set, NULL, 0);
		dev_set_param(dev, "baudrate", __stringify(CONFIG_BAUDRATE));
	}

	dev_add_param(dev, "active", console_std_set, NULL, 0);

	initialized = CONSOLE_INIT_FULL;
#ifdef CONFIG_CONSOLE_ACTIVATE_ALL
	dev_set_param(dev, "active", "ioe");
#endif
#ifdef CONFIG_CONSOLE_ACTIVATE_FIRST
	if (list_empty(&console_list)) {
		first = 1;
		dev_set_param(dev, "active", "ioe");
	}
#endif

	list_add_tail(&newcdev->list, &console_list);

	while (kfifo_getc(console_output_fifo, &ch) == 0)
		console_putc(CONSOLE_STDOUT, ch);
	if (first)
		barebox_banner();

	return 0;
}