Ejemplo n.º 1
0
static int
log_console_append(struct log *log, void *buf, int len)
{
    struct log_entry_hdr *hdr;

    if (!console_is_init()) {
        return (0);
    }

    if (!console_is_midline) {
        hdr = (struct log_entry_hdr *) buf;
        console_printf("[ts=%lussb, mod=%u level=%u] ",
                (unsigned long) hdr->ue_ts, hdr->ue_module,
                hdr->ue_level);
    }

    console_write((char *) buf + LOG_ENTRY_HDR_SIZE, len - LOG_ENTRY_HDR_SIZE);

    return (0);
}
Ejemplo n.º 2
0
/**
 * init_tasks
 *
 * Called by main.c after os_init(). This function performs initializations
 * that are required before tasks are running.
 *
 * @return int 0 success; error otherwise.
 */
int
init_tasks(void)
{
    os_task_init(&a_task, "Task A", a_task_handler, NULL,
            A_TASK_PRIO, OS_WAIT_FOREVER, a_stack, A_STACK_SIZE);
    os_task_init(&b_task, "Task B", b_task_handler, NULL,
            B_TASK_PRIO, OS_WAIT_FOREVER, b_stack, B_STACK_SIZE);
    os_task_init(&timer_task, "timer", timer_task_handler, NULL,
            TIMER_TASK_PRIO, OS_WAIT_FOREVER, timer_stack, TIMER_STACK_SIZE);
   
    /* Shell/Console */
    shell_task_init(SHELL_TASK_PRIO, shell_stack, SHELL_TASK_STACK_SIZE,
                         SHELL_MAX_INPUT_LEN);
    console_init(shell_console_rx_cb);
    assert(console_is_init());

    tasks_initialized = 1;

    return 0;
}