MCPcopy Create free account
hub / github.com/ARMmbed/DAPLink / main_task

Function main_task

source/daplink/interface/main_interface.c:264–546  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

262extern void cdc_process_event(void);
263
264void 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();

Callers

nothing calls this directly

Calls 15

config_initFunction · 0.85
DAP_SetupFunction · 0.85
info_initFunction · 0.85
usbd_initFunction · 0.85
vfs_mngr_fs_enableFunction · 0.85
usbd_connectFunction · 0.85
cdc_process_eventFunction · 0.85
vfs_mngr_periodicFunction · 0.85
usbd_configuredFunction · 0.85

Tested by

no test coverage detected