コード例 #1
0
ファイル: console.c プロジェクト: Reggi3/mini210s-barebox
static int console_baudrate_set(struct device_d *dev, struct param_d *param,
		const char *val)
{
	struct console_device *cdev = to_console_dev(dev);
	int baudrate;
	char baudstr[16];
	unsigned char c;

	if (!val)
		dev_param_set_generic(dev, param, NULL);

	baudrate = simple_strtoul(val, NULL, 10);

	if (cdev->f_active) {
		printf("## Switch baudrate to %d bps and press ENTER ...\n",
			baudrate);
		mdelay(50);
		cdev->setbrg(cdev, baudrate);
		mdelay(50);
		do {
			c = getc();
		} while (c != '\r' && c != '\n');
	} else
		cdev->setbrg(cdev, baudrate);

	sprintf(baudstr, "%d", baudrate);
	dev_param_set_generic(dev, param, baudstr);

	return 0;
}
コード例 #2
0
ファイル: console.c プロジェクト: caicry/mini2440-barebox
static int console_std_set(struct device_d *dev, struct param_d *param,
		const char *val)
{
	struct console_device *cdev = to_console_dev(dev);
	char active[4];
	unsigned int flag = 0, i = 0;

	if (!val)
		dev_param_set_generic(dev, param, NULL);

	if (strchr(val, 'i') && cdev->f_caps & CONSOLE_STDIN) {
		active[i++] = 'i';
		flag |= CONSOLE_STDIN;
	}

	if (strchr(val, 'o') && cdev->f_caps & CONSOLE_STDOUT) {
		active[i++] = 'o';
		flag |= CONSOLE_STDOUT;
	}

	if (strchr(val, 'e') && cdev->f_caps & CONSOLE_STDERR) {
		active[i++] = 'e';
		flag |= CONSOLE_STDERR;
	}

	active[i] = 0;
	cdev->f_active = flag;

	dev_param_set_generic(dev, param, active);

	return 0;
}
コード例 #3
0
ファイル: console.c プロジェクト: bluecmd/barebox
static int console_std_set(struct device_d *dev, struct param_d *param,
		const char *val)
{
	struct console_device *cdev = to_console_dev(dev);
	char active[4];
	unsigned int flag = 0, i = 0;

	if (val) {
		if (strchr(val, 'i') && cdev->getc) {
			active[i++] = 'i';
			flag |= CONSOLE_STDIN;
		}

		if (cdev->putc) {
			if (strchr(val, 'o')) {
				active[i++] = 'o';
				flag |= CONSOLE_STDOUT;
			}

			if (strchr(val, 'e')) {
				active[i++] = 'e';
				flag |= CONSOLE_STDERR;
			}
		}
	}

	if (flag && !cdev->f_active) {
		/* The device is being activated, set its baudrate */
		if (cdev->setbrg)
			cdev->setbrg(cdev, cdev->baudrate);
	}

	active[i] = 0;
	cdev->f_active = flag;

	dev_param_set_generic(dev, param, active);

	if (initialized < CONSOLE_INIT_FULL) {
		char ch;
		initialized = CONSOLE_INIT_FULL;
		puts_ll("Switch to console [");
		puts_ll(dev_name(dev));
		puts_ll("]\n");
		barebox_banner();
		while (kfifo_getc(console_output_fifo, &ch) == 0)
			console_putc(CONSOLE_STDOUT, ch);
	}

	return 0;
}
コード例 #4
0
ファイル: console.c プロジェクト: Reggi3/mini210s-barebox
static int console_std_set(struct device_d *dev, struct param_d *param,
		const char *val)
{
	struct console_device *cdev = to_console_dev(dev);
	char active[4];
	unsigned int flag = 0, i = 0;

	if (!val)
		dev_param_set_generic(dev, param, NULL);

	if (strchr(val, 'i') && cdev->f_caps & CONSOLE_STDIN) {
		active[i++] = 'i';
		flag |= CONSOLE_STDIN;
	}

	if (strchr(val, 'o') && cdev->f_caps & CONSOLE_STDOUT) {
		active[i++] = 'o';
		flag |= CONSOLE_STDOUT;
	}

	if (strchr(val, 'e') && cdev->f_caps & CONSOLE_STDERR) {
		active[i++] = 'e';
		flag |= CONSOLE_STDERR;
	}

	active[i] = 0;
	cdev->f_active = flag;

	dev_param_set_generic(dev, param, active);

	if (initialized < CONSOLE_INIT_FULL) {
		char ch;
		initialized = CONSOLE_INIT_FULL;
		PUTS_LL("Switch to console [");
		PUTS_LL(dev_name(dev));
		PUTS_LL("]\n");
		barebox_banner();
		while (kfifo_getc(console_output_fifo, &ch) == 0)
			console_putc(CONSOLE_STDOUT, ch);
	}

	return 0;
}