apache / apache/mynewt-nimble

Func "nimble_port_init" has a err.

Open
#1,294 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
893
Forks
512
Avg merge
13d 31m
Merged PRs (30d)
7

Description

```c
void
nimble_port_init(void)
{
/* Initialize default event queue */
ble_npl_eventq_init(&g_eventq_dflt);
/* Initialize the global memory pool */
os_mempool_module_init();
os_msys_init();
/* Initialize transport */
ble_transport_init();
/* Initialize the host */
ble_transport_hs_init();

#if NIMBLE_CFG_CONTROLLER
#ifndef RIOT_VERSION
hal_timer_init(5, NULL);
os_cputime_init(32768);
#endif
ble_transport_ll_init();
#endif
}
```
In "ble_transport_ll_init", "ble_transport_hs_init" should swap places with "ble_transport_ll_init".
"NIMBLE_CFG_CONTROLLER" could be placed by MYNEWT_VAL(BLE_CONTROLLER), and add MYNEWT_VAL(BLE_HOST). ==>
```c
void
nimble_port_init(void)
{
/* Initialize default event queue */
ble_npl_eventq_init(&g_eventq_dflt);
/* Initialize the global memory pool */
os_mempool_module_init();
os_msys_init();
/* Initialize transport */
ble_transport_init();
/* Initialize the host */
#if MYNEWT_VAL(BLE_HOST)
ble_transport_ll_init();
#endif

#if MYNEWT_VAL(BLE_CONTROLLER)
#ifndef RIOT_VERSION
hal_timer_init(5, NULL);
os_cputime_init(32768);
#endif
ble_transport_hs_init();
#endif
}
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at the nimble_port_init function shown in the issue and inspect the existing ble_transport_ll_init and ble_transport_hs_init calls. Verify the requested initialization order and MYNEWT_VAL(BLE_HOST)/MYNEWT_VAL(BLE_CONTROLLER) guards against the surrounding transport code. Done means the function reflects the requested guards and ordering.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
embedded-iot, networking
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.