Пример #1
0
void shell_init(const char *str, const struct shell_cmd *cmds)
{
	nano_fifo_init(&cmds_queue);
	nano_fifo_init(&avail_queue);

	commands = cmds;

	line_queue_init();

	prompt = str ? str : "";

	task_fiber_start(stack, STACKSIZE, shell, 0, 0, 7, 0);

	/* Register serial console handler */
	uart_register_input(&avail_queue, &cmds_queue, completion);
}
Пример #2
0
void zephyr_getline_init(void)
{
  int i;

  nano_fifo_init(&used_queue);
  nano_fifo_init(&free_queue);
  for (i = 0; i < sizeof(line_bufs) / sizeof(*line_bufs); i++)
  {
    nano_fifo_put(&free_queue, &line_bufs[i]);
  }

  /* Zephyr UART handler takes an empty buffer from free_queue,
     stores UART input in it until EOL, and then puts it into
     used_queue. */
  uart_register_input(&free_queue, &used_queue, NULL);
}
Пример #3
0
void shell_init(const char *str)
{
	k_fifo_init(&cmds_queue);
	k_fifo_init(&avail_queue);

	line_queue_init();

	prompt = str ? str : "";

	k_thread_create(&shell_thread, stack, STACKSIZE, shell, NULL, NULL,
			NULL, K_PRIO_COOP(7), 0, K_NO_WAIT);

	/* Register serial console handler */
#ifdef CONFIG_UART_CONSOLE
	uart_register_input(&avail_queue, &cmds_queue, completion);
#endif
#ifdef CONFIG_TELNET_CONSOLE
	telnet_register_input(&avail_queue, &cmds_queue, completion);
#endif
}