This is an automated email from the ASF dual-hosted git repository. andk pushed a commit to branch freertos-port in repository https://gitbox.apache.org/repos/asf/mynewt-nimble.git
The following commit(s) were added to refs/heads/freertos-port by this push: new c37b551 [wip] fix initialization stuff c37b551 is described below commit c37b551debf2b7c3258e29f593b84a67a92e0143 Author: Andrzej Kaczmarek <andrzej.kaczma...@codecoup.pl> AuthorDate: Wed Jan 3 17:23:39 2018 +0100 [wip] fix initialization stuff --- porting/common/include/nimble_port.h | 4 +- porting/common/src/nimble_port.c | 15 +------ porting/freertos_nrf5_sdk/config/FreeRTOSConfig.h | 4 +- porting/freertos_nrf5_sdk/src/ble_task.c | 55 ++++++++++++++--------- 4 files changed, 38 insertions(+), 40 deletions(-) diff --git a/porting/common/include/nimble_port.h b/porting/common/include/nimble_port.h index 6d5e214..b6b65b0 100755 --- a/porting/common/include/nimble_port.h +++ b/porting/common/include/nimble_port.h @@ -24,9 +24,7 @@ extern "C" { #endif -void nimble_init(void); - -void nimble_run(void); +void nimble_port_sysinit(void); #ifdef __cplusplus } diff --git a/porting/common/src/nimble_port.c b/porting/common/src/nimble_port.c index 8f8daa9..5db88f1 100644 --- a/porting/common/src/nimble_port.c +++ b/porting/common/src/nimble_port.c @@ -30,7 +30,7 @@ #include "controller/ble_ll.h" void -nimble_init(void) +nimble_port_sysinit(void) { void os_msys_init(void); void ble_hci_ram_pkg_init(void); @@ -50,16 +50,3 @@ nimble_init(void) ble_store_ram_init(); sysinit_end(); } - -void -nimble_run(void) -{ - while (1) { - struct os_event *ev; - - ev = os_eventq_get(os_eventq_dflt_get()); - assert(ev->ev_cb != NULL); - - ev->ev_cb(ev); - } -} diff --git a/porting/freertos_nrf5_sdk/config/FreeRTOSConfig.h b/porting/freertos_nrf5_sdk/config/FreeRTOSConfig.h index 7569484..0ca590a 100644 --- a/porting/freertos_nrf5_sdk/config/FreeRTOSConfig.h +++ b/porting/freertos_nrf5_sdk/config/FreeRTOSConfig.h @@ -97,7 +97,7 @@ #define configUSE_TICKLESS_IDLE_SIMPLE_DEBUG 1 /* See into vPortSuppressTicksAndSleep source code for explanation */ #define configCPU_CLOCK_HZ ( SystemCoreClock ) #define configTICK_RATE_HZ 1000 -#define configMAX_PRIORITIES ( 3 ) +#define configMAX_PRIORITIES ( 4 ) #define configMINIMAL_STACK_SIZE ( 60 ) #define configTOTAL_HEAP_SIZE ( 6144 ) #define configMAX_TASK_NAME_LEN ( 4 ) @@ -130,7 +130,7 @@ /* Software timer definitions. */ #define configUSE_TIMERS 1 -#define configTIMER_TASK_PRIORITY ( 2 ) +#define configTIMER_TASK_PRIORITY ( 3 ) #define configTIMER_QUEUE_LENGTH 32 #define configTIMER_TASK_STACK_DEPTH ( 80 ) diff --git a/porting/freertos_nrf5_sdk/src/ble_task.c b/porting/freertos_nrf5_sdk/src/ble_task.c index 43b1754..8dfb94b 100644 --- a/porting/freertos_nrf5_sdk/src/ble_task.c +++ b/porting/freertos_nrf5_sdk/src/ble_task.c @@ -132,10 +132,31 @@ on_sync_cb(void) } static void -task_func(void *param) +dftl_task(void *param) +{ + while (1) { + os_eventq_run(os_eventq_dflt_get()); + } +} + +static void led_tmr_func(void *param) +{ + bsp_board_led_invert(BSP_BOARD_LED_0); + bsp_board_led_invert(BSP_BOARD_LED_1); + bsp_board_led_invert(BSP_BOARD_LED_2); + bsp_board_led_invert(BSP_BOARD_LED_3); +} + +void start_nimble(void) { int rc; + void ble_ll_task(void *arg); + + /* + * XXX initialize some stuff required by controller; we need to move this + * somewhere later + */ rc = hal_timer_init(0, NULL); assert(rc == 0); rc = hal_timer_init(5, NULL); @@ -143,33 +164,25 @@ task_func(void *param) rc = os_cputime_init(MYNEWT_VAL(OS_CPUTIME_FREQ)); assert(rc == 0); - nimble_init(); + /* Execute sysinit port */ + nimble_port_sysinit(); + /* Configure Nimble host */ ble_hs_cfg.sync_cb = on_sync_cb; ble_svc_gap_device_name_set(gap_name); ble_svc_ias_set_cb(ias_event_cb); - nimble_run(); -} + /* Create task which handles default event queue */ + xTaskCreate(dftl_task, "dflt", configMINIMAL_STACK_SIZE + 400, + NULL, 1, &task_h); -static void led_tmr_func(void *param) -{ - bsp_board_led_invert(BSP_BOARD_LED_0); - bsp_board_led_invert(BSP_BOARD_LED_1); - bsp_board_led_invert(BSP_BOARD_LED_2); - bsp_board_led_invert(BSP_BOARD_LED_3); -} - -void start_nimble(void) -{ - void ble_ll_task(void *arg); - - led_tmr_h = xTimerCreate("led", 500, pdTRUE, NULL, led_tmr_func); - - xTaskCreate(task_func, "nimble", configMINIMAL_STACK_SIZE + 400, + /* + * XXX create LL task; in Mynewt this is done in sysinit but for now this + * is commented out there due to missing porting layer for task creation + */ + xTaskCreate(ble_ll_task, "ll", configMINIMAL_STACK_SIZE + 100, NULL, 2, &task_h); - xTaskCreate(ble_ll_task, "ll", configMINIMAL_STACK_SIZE + 100, - NULL, 0, &task_h); + led_tmr_h = xTimerCreate("led", 500, pdTRUE, NULL, led_tmr_func); } -- To stop receiving notification emails like this one, please contact ['"commits@mynewt.apache.org" <commits@mynewt.apache.org>'].