| 262 | extern void cdc_process_event(void); |
| 263 | |
| 264 | void main_task(void * arg) |
| 265 | { |
| 266 | // State processing |
| 267 | uint16_t flags = 0; |
| 268 | // LED |
| 269 | gpio_led_state_t hid_led_value = HID_LED_DEF; |
| 270 | gpio_led_state_t cdc_led_value = CDC_LED_DEF; |
| 271 | gpio_led_state_t msc_led_value = MSC_LED_DEF; |
| 272 | // USB |
| 273 | uint32_t usb_state_count = USB_CONNECT_DELAY; |
| 274 | uint32_t usb_no_config_count = USB_CONFIGURE_TIMEOUT; |
| 275 | #ifdef PBON_BUTTON |
| 276 | uint8_t power_on = 1; |
| 277 | #endif |
| 278 | |
| 279 | // Initialize settings - required for asserts to work |
| 280 | config_init(); |
| 281 | |
| 282 | #ifdef USE_LEGACY_CMSIS_RTOS |
| 283 | // Get a reference to this task |
| 284 | main_task_id = osThreadGetId(); |
| 285 | #endif |
| 286 | // leds |
| 287 | gpio_init(); |
| 288 | // Turn to LED default settings |
| 289 | gpio_set_hid_led(hid_led_value); |
| 290 | gpio_set_cdc_led(cdc_led_value); |
| 291 | gpio_set_msc_led(msc_led_value); |
| 292 | // Initialize the DAP |
| 293 | DAP_Setup(); |
| 294 | |
| 295 | // make sure we have a valid board info structure. |
| 296 | util_assert(g_board_info.info_version == kBoardInfoVersion); |
| 297 | |
| 298 | // do some init with the target before USB and files are configured |
| 299 | if (g_board_info.prerun_board_config) { |
| 300 | g_board_info.prerun_board_config(); |
| 301 | } |
| 302 | |
| 303 | //initialize the family |
| 304 | init_family(); |
| 305 | |
| 306 | if (g_target_family && g_target_family->prerun_target_config) { |
| 307 | g_target_family->prerun_target_config(); |
| 308 | } |
| 309 | |
| 310 | //setup some flags |
| 311 | if (g_board_info.flags & kEnableUnderResetConnect) { |
| 312 | swd_set_reset_connect(CONNECT_UNDER_RESET); |
| 313 | } |
| 314 | if (g_board_info.flags & kEnablePageErase) { |
| 315 | #ifdef DRAG_N_DROP_SUPPORT |
| 316 | flash_manager_set_page_erase(true); |
| 317 | #endif |
| 318 | } |
| 319 | |
| 320 | // Update versions and IDs |
| 321 | info_init(); |
nothing calls this directly
no test coverage detected