void
newtmgr_ble_pkg_init(void)
{
    int rc;

    /* Ensure this function only gets called by sysinit. */
    SYSINIT_ASSERT_ACTIVE();

    rc = nmgr_ble_gatt_svr_init();
    SYSINIT_PANIC_ASSERT(rc == 0);
}
Beispiel #2
0
void
split_app_init(void)
{
    int rc;

    /* Ensure this function only gets called by sysinit. */
    SYSINIT_ASSERT_ACTIVE();

    rc = split_conf_init();
    assert(rc == 0);
}
int
console_init(console_rx_cb rx_cb)
{
    struct console_tty *ct = &console_tty;
    struct uart_conf uc = {
        .uc_speed = MYNEWT_VAL(CONSOLE_BAUD),
        .uc_databits = 8,
        .uc_stopbits = 1,
        .uc_parity = UART_PARITY_NONE,
        .uc_flow_ctl = MYNEWT_VAL(CONSOLE_FLOW_CONTROL),
        .uc_tx_char = console_tx_char,
        .uc_rx_char = console_rx_char,
        .uc_cb_arg = ct
    };

    ct->ct_rx_cb = rx_cb;
    if (!ct->ct_dev) {
        ct->ct_tx.cr_size = MYNEWT_VAL(CONSOLE_TX_BUF_SIZE);
        ct->ct_tx.cr_buf = ct->ct_tx_buf;
        ct->ct_rx.cr_size = MYNEWT_VAL(CONSOLE_RX_BUF_SIZE);
        ct->ct_rx.cr_buf = ct->ct_rx_buf;
        ct->ct_write_char = console_queue_char;

        ct->ct_dev = (struct uart_dev *)os_dev_open(CONSOLE_UART,
          OS_TIMEOUT_NEVER, &uc);
        if (!ct->ct_dev) {
            return -1;
        }
        ct->ct_echo_off = ! MYNEWT_VAL(CONSOLE_ECHO);
    }

    /* must be a power of 2 */
    assert(is_power_of_two(MYNEWT_VAL(CONSOLE_RX_BUF_SIZE)));

#if MYNEWT_VAL(CONSOLE_HIST_ENABLE)
    console_hist_init();
#endif

    return 0;
}

void
console_pkg_init(void)
{
    int rc;

    /* Ensure this function only gets called by sysinit. */
    SYSINIT_ASSERT_ACTIVE();

    rc = console_init(NULL);
    SYSINIT_PANIC_ASSERT(rc == 0);
}
void
ble_svc_gap_init(void)
{
    int rc;

    /* Ensure this function only gets called by sysinit. */
    SYSINIT_ASSERT_ACTIVE();

    rc = ble_gatts_count_cfg(ble_svc_gap_defs);
    SYSINIT_PANIC_ASSERT(rc == 0);

    rc = ble_gatts_add_svcs(ble_svc_gap_defs);
    SYSINIT_PANIC_ASSERT(rc == 0);
}
Beispiel #5
0
void
id_init(void)
{
    int rc;

    /* Ensure this function only gets called by sysinit. */
    SYSINIT_ASSERT_ACTIVE();

    rc = conf_register(&id_conf);
    SYSINIT_PANIC_ASSERT(rc == 0);

    /* Attempt to read the manufacturing image hash from the meta region. */
    id_read_mfghash();
}
void
nmgr_shell_pkg_init(void)
{
    int rc;

    /* Ensure this function only gets called by sysinit. */
    SYSINIT_ASSERT_ACTIVE();

    rc = nmgr_transport_init(&nmgr_shell_transport, nmgr_shell_out,
      nmgr_shell_get_mtu);
    assert(rc == 0);

    rc = shell_nlip_input_register(nmgr_shell_in, &nmgr_shell_transport);
    assert(rc == 0);
}