// File: jkingan[P]ladyheather/heathgps.cpp
// Function: request_warm_reset()
void request_warm_reset()
{
   if(read_only) return;
   if(no_poll) return;

   reset_leap_flags();
   extend_com_timeout(0.0);

   if(luxor) {
      set_luxor_time();
   }
   else if(rcvr_type == ACRON_RCVR) {
      need_acron_sync = 'h';
   }
   else if(rcvr_type == BRANDY_RCVR) {
      queue_brandy_cmd("$PRCCG,Z,0", BRANDY_RESET_MSG);
   }
   else if(rcvr_type == CS_RCVR) {
      set_cs_remote(1);
      queue_cs_cmd("DIAG:CONT:RESET", CS_LAMP_MSG);
      restore_cs_remote();
      queue_cs_cmd("DIAG:CONT:STAT?", CS_LAMP_MSG);
   }
   else if(rcvr_type == ESIP_RCVR) {
      if(force_mode_change) {
         force_mode_change = 0;
         send_esip_cmd("PERDCFG,FORMAT,M12");
         Sleep(5000);

         tsip_sync = 0;
         tsip_wptr = 0;
         tsip_rptr = 0;
         rcvr_type = MOTO_RCVR;
         auto_detect(0);
      }
      else {
         send_esip_cmd("PERDAPI,RESTART,WARM");
      }
   }
   else if(rcvr_type == FURUNO_RCVR) {
      send_furuno_cmd("GPclr,2");
   }
   else if(rcvr_type == MOTO_RCVR) {
enable_moto_nmea();

      if(force_mode_change) {
         force_mode_change = 0;
         send_moto_start("Wb");  // set Resolution-T TEP receiver protocol to TSIP mode
         send_moto_end();
         Sleep(1000);

         tsip_sync = 0;
         tsip_wptr = 0;
         tsip_rptr = 0;
         rcvr_type = TSIP_RCVR;
auto_detect(0);
//         init_messages(70, 1);
      }
   }
   else if(rcvr_type == NMEA_RCVR) {
      if(force_mode_change) {
         force_mode_change = 0;
         enable_moto_binary();
      }
   }
   else if(rcvr_type == NVS_RCVR) {
      send_nvs_start(0x01);
      send_byte(0x00); 
      send_byte(0x01); 
      send_byte(0x21); 
      send_byte(0x01); 
      send_byte(0x00); 
      send_byte(0x01); 
      send_nvs_end();

      Sleep(5000);
      init_messages(5454, 1);
   }
   else if(rcvr_type == PRS_RCVR) {
      queue_prs_cmd("RS1", PRS_RS_MSG);
   }
   else if(rcvr_type == RFTG_RCVR) {
      request_rftg_reset('W');
   }
   else if(rcvr_type == SIRF_RCVR) {
      if(force_mode_change) {
         force_mode_change =0;
         send_sirf_start(SET_SIRF_NMEA, 23+1);  // set to NMEA protocol
         send_byte(2);    // don't change debug state
         send_byte(1); send_byte(1);  // GGA
         send_byte(0); send_byte(1);  // GLL
         send_byte(1); send_byte(1);  // GSA
         send_byte(5); send_byte(1);  // GSV
         send_byte(1); send_byte(1);  // RMC
         send_byte(0); send_byte(1);  // VTG
         send_byte(0); send_byte(1);  // MSS
         send_byte(0); send_byte(1);  // EPE
         send_byte(0); send_byte(1);  // ZDA
         send_byte(0); send_byte(1);  // rsvd
         send_word(com[RCVR_PORT].baud_rate);  // 9600 bps
         send_sirf_end();
         Sleep(4000);

         tsip_sync = 0;
         tsip_wptr = 0;
         tsip_rptr = 0;
         rcvr_type = NMEA_RCVR;
auto_detect(0);
      }
   }
   else if(rcvr_type == SRO_RCVR) {
      queue_sro_cmd("RESET", SRO_RESET_MSG);
   }
   else if(rcvr_type == STAR_RCVR) {
      if(star_type == OSA_TYPE) queue_star_cmd("RESTART;", STAR_RESTART_MSG);
      else                      queue_star_cmd("RESTART(W);", STAR_RESTART_MSG);
   }
   else if(rcvr_type == TAIP_RCVR) {
      send_taip_cmd("SRT");
   }
   else if(rcvr_type == TRUE_RCVR) {
      send_true_cmd("$RESET");   // warm reset unit
   }
   else if(rcvr_type == TSIP_RCVR) {
      send_tsip_start(0x25);
      send_tsip_end();
      restart_gpsdo();
   }
   else if(rcvr_type == UBX_RCVR) {
      update_ubx_config(0x0000, 0x0000, UBX_EE_ALL);  // load config from eeprom
      max_ubx_bytes = 0;

      if(force_mode_change) {
         Sleep(500);
         rcvr_type = NMEA_RCVR;
         sprintf(out, "PUBX,41,1,0003,0002,%d,0", com[RCVR_PORT].baud_rate);  // 9600 bps ublox NMEA output mode (port 1)
         send_nmea_cmd(out);
//       sprintf(out, "PUBX,41,2,0003,0002,%d,0", com[RCVR_PORT].baud_rate);  // 9600 bps ublox NMEA output mode (port 2)
//       send_nmea_cmd(out);
         Sleep(500);
         force_mode_change = 0;
         auto_detect(0);
      }

      init_messages(21, 1);
      rcvr_reset = 2;
   }
   else if(rcvr_type == VENUS_RCVR) {
      if(force_mode_change) {
         force_mode_change = 0;
         set_venus_mode(1);
         Sleep(1000);

         tsip_sync = 0;
         tsip_wptr = 0;
         tsip_rptr = 0;
         rcvr_type = NMEA_RCVR;
auto_detect(0);
      }
      else {
         venus_restart(2);
      }
   }
   else if(rcvr_type == Z12_RCVR) {
      init_z12(2);
   }
   else if(rcvr_type == ZODIAC_RCVR) {
      send_zod_start(ZOD_REQ_RESTART, 8, 0);
      send_zod_seq();
      send_word(0x0001);
      send_zod_end();

      Sleep(5000);
      restart_zodiac_rcvr();
   }
   else if(rcvr_type == ZYFER_RCVR) {
      send_zyfer_cmd("$RSTG,W");
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
leaq 0x30c42f(%rip), %rax    # 0x3961fa
cmpb $0x0, (%rax)
je 0x89dd5
jmp 0x8a4ce
leaq 0x30c424(%rip), %rax    # 0x396200
cmpb $0x0, (%rax)
je 0x89de6
jmp 0x8a4ce
callq 0x80300
xorps %xmm0, %xmm0
callq 0x88f10
leaq 0x214324(%rip), %rax    # 0x29e11e
cmpb $0x0, (%rax)
je 0x89e09
callq 0x898d0
jmp 0x8a4ce
leaq 0x1edca0(%rip), %rax    # 0x277ab0
cmpq $0x4000, (%rax)         # imm = 0x4000
jne 0x89e28
movl $0x68, 0x341fdd(%rip)   # 0x3cbe00
jmp 0x8a4cc
leaq 0x1edc81(%rip), %rax    # 0x277ab0
cmpq $0x40000, (%rax)        # imm = 0x40000
jne 0x89e4e
leaq 0xf9b3d(%rip), %rdi     # 0x18397c
movl $0x1a4, %esi            # imm = 0x1A4
callq 0x82fd0
jmp 0x8a4ca
leaq 0x1edc5b(%rip), %rax    # 0x277ab0
cmpq $0x20000, (%rax)        # imm = 0x20000
jne 0x89e94
movl $0x1, %edi
callq 0x89280
leaq 0xf9b18(%rip), %rdi     # 0x183987
movl $0x14d, %esi            # imm = 0x14D
callq 0x82fd0
callq 0x89260
leaq 0xf9b12(%rip), %rdi     # 0x183997
movl $0x14d, %esi            # imm = 0x14D
callq 0x82fd0
jmp 0x8a4c8
movl $0x80000000, %ecx       # imm = 0x80000000
leaq 0x1edc10(%rip), %rax    # 0x277ab0
cmpq %rcx, (%rax)
jne 0x89f20
leaq 0x1f0354(%rip), %rax    # 0x27a200
cmpl $0x0, (%rax)
je 0x89f0f
leaq 0x1f0348(%rip), %rax    # 0x27a200
movl $0x0, (%rax)
leaq 0xf9b3e(%rip), %rdi     # 0x183a03
callq 0x830d0
movl $0x1388, %edi           # imm = 0x1388
callq 0xb8b0
leaq 0x30d55b(%rip), %rax    # 0x397436
movw $0x0, (%rax)
leaq 0x30d54b(%rip), %rax    # 0x397432
movw $0x0, (%rax)
leaq 0x30d541(%rip), %rax    # 0x397434
movw $0x0, (%rax)
leaq 0x1edbb1(%rip), %rax    # 0x277ab0
movq $0x20, (%rax)
xorl %edi, %edi
callq 0x86960
jmp 0x89f1b
leaq 0xf9b00(%rip), %rdi     # 0x183a16
callq 0x830d0
jmp 0x8a4c6
leaq 0x1edb89(%rip), %rax    # 0x277ab0
cmpq $0x20000000, (%rax)     # imm = 0x20000000
jne 0x89f41
leaq 0xf9af4(%rip), %rdi     # 0x183a2b
callq 0x83270
jmp 0x8a4c4
leaq 0x1edb68(%rip), %rax    # 0x277ab0
cmpq $0x20, (%rax)
jne 0x89fc5
callq 0x88d70
leaq 0x1f02a6(%rip), %rax    # 0x27a200
cmpl $0x0, (%rax)
je 0x89fc0
leaq 0x1f029a(%rip), %rax    # 0x27a200
movl $0x0, (%rax)
leaq 0xf990a(%rip), %rdi     # 0x18387d
callq 0x86190
callq 0x86230
movl $0x3e8, %edi            # imm = 0x3E8
callq 0xb8b0
leaq 0x30d4a8(%rip), %rax    # 0x397436
movw $0x0, (%rax)
leaq 0x30d498(%rip), %rax    # 0x397432
movw $0x0, (%rax)
leaq 0x30d48e(%rip), %rax    # 0x397434
movw $0x0, (%rax)
leaq 0x1edafe(%rip), %rax    # 0x277ab0
movq $0x1, (%rax)
xorl %edi, %edi
callq 0x86960
jmp 0x8a4c2
leaq 0x1edae4(%rip), %rax    # 0x277ab0
cmpq $0x2, (%rax)
jne 0x89ff5
leaq 0x1f0227(%rip), %rax    # 0x27a200
cmpl $0x0, (%rax)
je 0x89ff0
leaq 0x1f021b(%rip), %rax    # 0x27a200
movl $0x0, (%rax)
callq 0x86850
jmp 0x8a4c0
leaq 0x1edab4(%rip), %rax    # 0x277ab0
cmpq $0x800, (%rax)          # imm = 0x800
jne 0x8a068
movl $0x1, %edi
callq 0x824f0
xorl %edi, %edi
callq 0x7b210
movl $0x1, %edi
callq 0x7b210
movl $0x21, %edi
callq 0x7b210
movl $0x1, %edi
callq 0x7b210
xorl %edi, %edi
callq 0x7b210
movl $0x1, %edi
callq 0x7b210
callq 0x82630
movl $0x1388, %edi           # imm = 0x1388
callq 0xb8b0
movl $0x154e, %edi           # imm = 0x154E
movl $0x1, %esi
callq 0x86290
jmp 0x8a4be
leaq 0x1eda41(%rip), %rax    # 0x277ab0
cmpq $0x1000000, (%rax)      # imm = 0x1000000
jne 0x8a08e
leaq 0xf9945(%rip), %rdi     # 0x1839c4
movl $0x1f5, %esi            # imm = 0x1F5
callq 0x82fd0
jmp 0x8a4bc
leaq 0x1eda1b(%rip), %rax    # 0x277ab0
cmpq $0x400000, (%rax)       # imm = 0x400000
jne 0x8a0ad
movl $0x57, %edi
callq 0x89980
jmp 0x8a4ba
leaq 0x1ed9fc(%rip), %rax    # 0x277ab0
cmpq $0x40, (%rax)
jne 0x8a20c
leaq 0x1f013b(%rip), %rax    # 0x27a200
cmpl $0x0, (%rax)
je 0x8a207
leaq 0x1f012b(%rip), %rax    # 0x27a200
movl $0x0, (%rax)
movl $0x81, %edi
movl $0x18, %esi
callq 0x83f10
movl $0x2, %edi
callq 0x7b210
movl $0x1, %edi
callq 0x7b210
movl $0x1, %edi
callq 0x7b210
xorl %edi, %edi
callq 0x7b210
movl $0x1, %edi
callq 0x7b210
movl $0x1, %edi
callq 0x7b210
movl $0x1, %edi
callq 0x7b210
movl $0x5, %edi
callq 0x7b210
movl $0x1, %edi
callq 0x7b210
movl $0x1, %edi
callq 0x7b210
movl $0x1, %edi
callq 0x7b210
xorl %edi, %edi
callq 0x7b210
movl $0x1, %edi
callq 0x7b210
xorl %edi, %edi
callq 0x7b210
movl $0x1, %edi
callq 0x7b210
xorl %edi, %edi
callq 0x7b210
movl $0x1, %edi
callq 0x7b210
xorl %edi, %edi
callq 0x7b210
movl $0x1, %edi
callq 0x7b210
xorl %edi, %edi
callq 0x7b210
movl $0x1, %edi
callq 0x7b210
leaq 0x2e330f(%rip), %rax    # 0x36d4c0
movl 0x159d0(%rax), %eax
movzwl %ax, %edi
callq 0x7b4b0
callq 0x83fe0
movl $0xfa0, %edi            # imm = 0xFA0
callq 0xb8b0
leaq 0x30d261(%rip), %rax    # 0x397436
movw $0x0, (%rax)
leaq 0x30d251(%rip), %rax    # 0x397432
movw $0x0, (%rax)
leaq 0x30d247(%rip), %rax    # 0x397434
movw $0x0, (%rax)
leaq 0x1ed8b7(%rip), %rax    # 0x277ab0
movq $0x2, (%rax)
xorl %edi, %edi
callq 0x86960
jmp 0x8a4b8
leaq 0x1ed89d(%rip), %rax    # 0x277ab0
cmpq $0x8000000, (%rax)      # imm = 0x8000000
jne 0x8a232
leaq 0xf97c9(%rip), %rdi     # 0x1839ec
movl $0x323, %esi            # imm = 0x323
callq 0x82fd0
jmp 0x8a4b6
leaq 0x1ed877(%rip), %rax    # 0x277ab0
cmpq $0x1000, (%rax)         # imm = 0x1000
jne 0x8a277
leaq 0x1eff7f(%rip), %rax    # 0x27a1c8
cmpl $0x4f, (%rax)
jne 0x8a261
leaq 0xf9779(%rip), %rdi     # 0x1839ce
movl $0xfb, %esi
callq 0x82fd0
jmp 0x8a272
leaq 0xf97cb(%rip), %rdi     # 0x183a33
movl $0xfb, %esi
callq 0x82fd0
jmp 0x8a4b4
leaq 0x1ed832(%rip), %rax    # 0x277ab0
cmpq $0x8000, (%rax)         # imm = 0x8000
jne 0x8a298
leaq 0xf97b1(%rip), %rdi     # 0x183a3f
callq 0x899c0
jmp 0x8a4b2
leaq 0x1ed811(%rip), %rax    # 0x277ab0
cmpq $0x200000, (%rax)       # imm = 0x200000
jne 0x8a2b9
leaq 0xf973c(%rip), %rdi     # 0x1839eb
callq 0x83580
jmp 0x8a4b0
leaq 0x1ed7f0(%rip), %rax    # 0x277ab0
cmpq $0x1, (%rax)
jne 0x8a2df
movl $0x25, %edi
callq 0x824f0
callq 0x82590
callq 0x86040
jmp 0x8a4ae
leaq 0x1ed7ca(%rip), %rax    # 0x277ab0
cmpq $0x4, (%rax)
jne 0x8a399
xorl %esi, %esi
movl $0x41f, %edx            # imm = 0x41F
movl %esi, %edi
callq 0x86600
movl $0x0, 0x341968(%rip)    # 0x3cbc70
leaq 0x1efef1(%rip), %rax    # 0x27a200
cmpl $0x0, (%rax)
je 0x8a378
movl $0x1f4, %edi            # imm = 0x1F4
callq 0xb8b0
leaq 0x1ed78b(%rip), %rax    # 0x277ab0
movq $0x2, (%rax)
leaq 0x2e318d(%rip), %rax    # 0x36d4c0
movl 0x159d0(%rax), %edx
leaq 0x3110c0(%rip), %rdi    # 0x39b400
leaq 0xf96fc(%rip), %rsi     # 0x183a43
movb $0x0, %al
callq 0x9060
leaq 0x3110ab(%rip), %rdi    # 0x39b400
callq 0x833e0
movl $0x1f4, %edi            # imm = 0x1F4
callq 0xb8b0
leaq 0x1efe95(%rip), %rax    # 0x27a200
movl $0x0, (%rax)
xorl %edi, %edi
callq 0x86960
movl $0x15, %edi
movl $0x1, %esi
callq 0x86290
leaq 0x1efe7a(%rip), %rax    # 0x27a208
movl $0x2, (%rax)
jmp 0x8a4ac
leaq 0x1ed710(%rip), %rax    # 0x277ab0
cmpq $0x80, (%rax)
jne 0x8a420
leaq 0x1efe50(%rip), %rax    # 0x27a200
cmpl $0x0, (%rax)
je 0x8a411
leaq 0x1efe44(%rip), %rax    # 0x27a200
movl $0x0, (%rax)
movl $0x1, %edi
callq 0x8a4d0
movl $0x3e8, %edi            # imm = 0x3E8
callq 0xb8b0
leaq 0x30d059(%rip), %rax    # 0x397436
movw $0x0, (%rax)
leaq 0x30d049(%rip), %rax    # 0x397432
movw $0x0, (%rax)
leaq 0x30d03f(%rip), %rax    # 0x397434
movw $0x0, (%rax)
leaq 0x1ed6af(%rip), %rax    # 0x277ab0
movq $0x2, (%rax)
xorl %edi, %edi
callq 0x86960
jmp 0x8a41b
movl $0x2, %edi
callq 0x86680
jmp 0x8a4aa
movabsq $0x100000000, %rcx      # imm = 0x100000000
leaq 0x1ed67f(%rip), %rax    # 0x277ab0
cmpq %rcx, (%rax)
jne 0x8a442
movl $0x2, %edi
callq 0x892f0
jmp 0x8a4a8
leaq 0x1ed667(%rip), %rax    # 0x277ab0
cmpq $0x100, (%rax)          # imm = 0x100
jne 0x8a488
movl $0x517, %edi            # imm = 0x517
movl $0x8, %esi
xorl %edx, %edx
callq 0x89bf0
callq 0x89d10
movl $0x1, %edi
callq 0x7b4b0
callq 0x89d30
movl $0x1388, %edi           # imm = 0x1388
callq 0xb8b0
callq 0x860e0
jmp 0x8a4a6
leaq 0x1ed621(%rip), %rax    # 0x277ab0
cmpq $0x100000, (%rax)       # imm = 0x100000
jne 0x8a4a4
leaq 0xf95bd(%rip), %rdi     # 0x183a5c
callq 0x85d30
jmp 0x8a4a6
jmp 0x8a4a8
jmp 0x8a4aa
jmp 0x8a4ac
jmp 0x8a4ae
jmp 0x8a4b0
jmp 0x8a4b2
jmp 0x8a4b4
jmp 0x8a4b6
jmp 0x8a4b8
jmp 0x8a4ba
jmp 0x8a4bc
jmp 0x8a4be
jmp 0x8a4c0
jmp 0x8a4c2
jmp 0x8a4c4
jmp 0x8a4c6
jmp 0x8a4c8
jmp 0x8a4ca
jmp 0x8a4cc
jmp 0x8a4ce
popq %rbp
retq