@@ -35,9 +35,6 @@ static uint8_t m_init_packet[64]; /**< Init packet
35
35
static uint8_t m_init_packet_length ; /**< Length of init packet received. */
36
36
static uint16_t m_image_crc ; /**< Calculated CRC of the image received. */
37
37
38
- APP_TIMER_DEF (m_dfu_timer_id ); /**< Application timer id. */
39
- static bool m_dfu_timed_out = false; /**< Boolean flag value for tracking DFU timer timeout state. */
40
-
41
38
static pstorage_handle_t m_storage_handle_app ; /**< Pstorage handle for the application area (bank 0). Bank used when updating a SoftDevice w/wo bootloader. Handle also used when swapping received application from bank 1 to bank 0. */
42
39
static pstorage_handle_t * mp_storage_handle_active ; /**< Pointer to the pstorage handle for the active bank for receiving of data packets. */
43
40
@@ -83,47 +80,6 @@ static void pstorage_callback_handler(pstorage_handle_t * p_handle,
83
80
APP_ERROR_CHECK (result );
84
81
}
85
82
86
-
87
- /**@brief Function for handling the DFU timeout.
88
- *
89
- * @param[in] p_context The timeout context.
90
- */
91
- static void dfu_timeout_handler (void * p_context )
92
- {
93
- UNUSED_PARAMETER (p_context );
94
- dfu_update_status_t update_status ;
95
-
96
- m_dfu_timed_out = true;
97
- update_status .status_code = DFU_TIMEOUT ;
98
-
99
- bootloader_dfu_update_process (update_status );
100
- }
101
-
102
-
103
- /**@brief Function for restarting the DFU Timer.
104
- *
105
- * @details This function will stop and restart the DFU timer. This function will be called by the
106
- * functions handling any DFU packet received from the peer that is transferring a firmware
107
- * image.
108
- */
109
- static uint32_t dfu_timer_restart (void )
110
- {
111
- if (m_dfu_timed_out )
112
- {
113
- // The DFU timer had already timed out.
114
- return NRF_ERROR_INVALID_STATE ;
115
- }
116
-
117
- uint32_t err_code = app_timer_stop (m_dfu_timer_id );
118
- APP_ERROR_CHECK (err_code );
119
-
120
- err_code = app_timer_start (m_dfu_timer_id , DFU_TIMEOUT_INTERVAL , NULL );
121
- APP_ERROR_CHECK (err_code );
122
-
123
- return err_code ;
124
- }
125
-
126
-
127
83
/**@brief Function for preparing of flash before receiving SoftDevice image.
128
84
*
129
85
* @details This function will erase current application area to ensure sufficient amount of
@@ -289,16 +245,6 @@ uint32_t dfu_init(void)
289
245
290
246
m_storage_handle_app .block_id = DFU_BANK_0_REGION_START ;
291
247
292
- // Create the timer to monitor the activity by the peer doing the firmware update.
293
- err_code = app_timer_create (& m_dfu_timer_id ,
294
- APP_TIMER_MODE_SINGLE_SHOT ,
295
- dfu_timeout_handler );
296
- APP_ERROR_CHECK (err_code );
297
-
298
- // Start the DFU timer.
299
- err_code = app_timer_start (m_dfu_timer_id , DFU_TIMEOUT_INTERVAL , NULL );
300
- APP_ERROR_CHECK (err_code );
301
-
302
248
m_data_received = 0 ;
303
249
m_dfu_state = DFU_STATE_IDLE ;
304
250
@@ -370,11 +316,7 @@ uint32_t dfu_start_pkt_handle(dfu_update_packet_t * p_packet)
370
316
switch (m_dfu_state )
371
317
{
372
318
case DFU_STATE_IDLE :
373
- // Valid peer activity detected. Hence restart the DFU timer.
374
- err_code = dfu_timer_restart ();
375
- VERIFY_SUCCESS (err_code );
376
319
m_functions .prepare (m_image_size );
377
-
378
320
break ;
379
321
380
322
default :
@@ -422,10 +364,6 @@ uint32_t dfu_data_pkt_handle(dfu_update_packet_t * p_packet)
422
364
return NRF_ERROR_DATA_SIZE ;
423
365
}
424
366
425
- // Valid peer activity detected. Hence restart the DFU timer.
426
- err_code = dfu_timer_restart ();
427
- VERIFY_SUCCESS (err_code );
428
-
429
367
p_data = (uint32_t * )p_packet -> params .data_packet .p_data_packet ;
430
368
431
369
if ( is_ota () )
@@ -511,10 +449,6 @@ uint32_t dfu_init_pkt_handle(dfu_update_packet_t * p_packet)
511
449
return NRF_ERROR_INVALID_STATE ;
512
450
}
513
451
514
- // Valid peer activity detected. Hence restart the DFU timer.
515
- err_code = dfu_timer_restart ();
516
- VERIFY_SUCCESS (err_code );
517
-
518
452
length = p_packet -> params .data_packet .packet_length * sizeof (uint32_t );
519
453
if ((m_init_packet_length + length ) > sizeof (m_init_packet ))
520
454
{
@@ -555,16 +489,9 @@ uint32_t dfu_image_validate()
555
489
{
556
490
m_dfu_state = DFU_STATE_VALIDATE ;
557
491
558
- // Valid peer activity detected. Hence restart the DFU timer.
559
- err_code = dfu_timer_restart ();
560
- if (err_code == NRF_SUCCESS )
561
- {
562
- err_code = dfu_init_postvalidate ((uint8_t * )mp_storage_handle_active -> block_id ,
563
- m_image_size );
564
- VERIFY_SUCCESS (err_code );
565
-
566
- m_dfu_state = DFU_STATE_WAIT_4_ACTIVATE ;
567
- }
492
+ err_code = dfu_init_postvalidate ((uint8_t * )mp_storage_handle_active -> block_id , m_image_size );
493
+ VERIFY_SUCCESS (err_code );
494
+ m_dfu_state = DFU_STATE_WAIT_4_ACTIVATE ;
568
495
}
569
496
break ;
570
497
@@ -584,11 +511,6 @@ uint32_t dfu_image_activate()
584
511
switch (m_dfu_state )
585
512
{
586
513
case DFU_STATE_WAIT_4_ACTIVATE :
587
-
588
- // Stop the DFU Timer because the peer activity need not be monitored any longer.
589
- err_code = app_timer_stop (m_dfu_timer_id );
590
- APP_ERROR_CHECK (err_code );
591
-
592
514
err_code = m_functions .activate ();
593
515
break ;
594
516
0 commit comments