// File: /workspace/github_cpp_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
leaq 0x2c48ae(%rip), %rax    # 0x32101a
leaq 0x2c48ad(%rip), %rcx    # 0x321020
movb (%rcx), %cl
orb (%rax), %cl
je 0x5c784
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0x29aa5e(%rip), %rax    # 0x2f71e9
movb $0x0, (%rax)
leaq 0x29aa4b(%rip), %rax    # 0x2f71e0
andl $0x0, (%rax)
leaq 0x29aa39(%rip), %rax    # 0x2f71d8
andb $0x7f, (%rax)
xorps %xmm0, %xmm0
callq 0x5bd83
leaq 0x1cc78d(%rip), %rax    # 0x228f3e
cmpb $0x0, (%rax)
je 0x5c7c5
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x5c3ab
leaq 0x1a6104(%rip), %r14    # 0x2028d0
movq (%r14), %rax
cmpq $0x1, %rax
je 0x5cb98
cmpq $0x2, %rax
je 0x5cb65
cmpq $0x4, %rax
je 0x5cc90
cmpq $0x20, %rax
je 0x5cbdf
cmpq $0x40, %rax
je 0x5ca5e
cmpq $0x80, %rax
je 0x5c8d9
cmpq $0x100, %rax            # imm = 0x100
je 0x5c9f8
cmpq $0x800, %rax            # imm = 0x800
je 0x5c8fe
cmpq $0x1000, %rax           # imm = 0x1000
je 0x5cbb4
movabsq $0x100000000, %rcx      # imm = 0x100000000
cmpq %rcx, %rax
je 0x5c97f
cmpq $0x8000, %rax           # imm = 0x8000
je 0x5c958
cmpq $0x20000, %rax          # imm = 0x20000
je 0x5cc4b
cmpq $0x40000, %rax          # imm = 0x40000
je 0x5c991
cmpq $0x100000, %rax         # imm = 0x100000
je 0x5cc7a
cmpq $0x200000, %rax         # imm = 0x200000
je 0x5ca48
cmpq $0x400000, %rax         # imm = 0x400000
je 0x5cbd0
cmpq $0x1000000, %rax        # imm = 0x1000000
je 0x5cb87
cmpq $0x8000000, %rax        # imm = 0x8000000
je 0x5c96e
cmpq $0x20000000, %rax       # imm = 0x20000000
je 0x5ca32
movl $0x80000000, %ecx       # imm = 0x80000000
cmpq %rcx, %rax
je 0x5c9a2
cmpq $0x4000, %rax           # imm = 0x4000
jne 0x5c779
movl $0x68, 0x2fa35c(%rip)   # 0x356c30
jmp 0x5c779
leaq 0x1a8740(%rip), %rax    # 0x205020
cmpl $0x0, (%rax)
je 0x5cd3d
andl $0x0, (%rax)
pushq $0x1
popq %rdi
callq 0x5cd65
movl $0x3e8, %edi            # imm = 0x3E8
jmp 0x5cb33
pushq $0x1
popq %rbx
movl %ebx, %edi
callq 0x5707f
xorl %edi, %edi
callq 0x523f2
movl %ebx, %edi
callq 0x523f2
pushq $0x21
popq %rdi
callq 0x523f2
movl %ebx, %edi
callq 0x523f2
xorl %edi, %edi
callq 0x523f2
movl %ebx, %edi
callq 0x523f2
callq 0x57171
movl $0x1388, %edi           # imm = 0x1388
callq 0xae83
movl $0x154e, %edi           # imm = 0x154E
movl %ebx, %esi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x59afe
leaq 0xadda8(%rip), %rdi     # 0x10a707
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x5c473
leaq 0xadd3f(%rip), %rdi     # 0x10a6b4
movl $0x323, %esi            # imm = 0x323
jmp 0x5cd2e
pushq $0x2
popq %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x5bef0
leaq 0xadcac(%rip), %rdi     # 0x10a644
movl $0x1a4, %esi            # imm = 0x1A4
jmp 0x5cd2e
leaq 0x1a8677(%rip), %rax    # 0x205020
cmpl $0x0, (%rax)
je 0x5cd4f
andl $0x0, (%rax)
leaq 0xadd0f(%rip), %rdi     # 0x10a6cb
callq 0x57791
movl $0x1388, %edi           # imm = 0x1388
callq 0xae83
leaq 0x2c5884(%rip), %rax    # 0x322256
andw $0x0, (%rax)
leaq 0x2c5875(%rip), %rax    # 0x322252
andw $0x0, (%rax)
leaq 0x2c586c(%rip), %rax    # 0x322254
andw $0x0, (%rax)
movq $0x20, (%r14)
jmp 0x5cc3a
pushq $0x8
popq %rsi
movl $0x517, %edi            # imm = 0x517
xorl %edx, %edx
callq 0x5c619
callq 0x5c6ed
pushq $0x1
popq %rdi
callq 0x52599
callq 0x5c6fe
movl $0x1388, %edi           # imm = 0x1388
callq 0xae83
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x5998f
leaq 0xadcba(%rip), %rdi     # 0x10a6f3
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x578d5
leaq 0xadc64(%rip), %rdi     # 0x10a6b3
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x57acc
leaq 0x1a85bb(%rip), %rax    # 0x205020
cmpl $0x0, (%rax)
je 0x5c779
andl $0x0, (%rax)
pushq $0x18
popq %rsi
movl $0x81, %edi
callq 0x581a8
pushq $0x2
popq %rdi
callq 0x523f2
pushq $0x1
popq %rbx
movl %ebx, %edi
callq 0x523f2
movl %ebx, %edi
callq 0x523f2
xorl %edi, %edi
callq 0x523f2
movl %ebx, %edi
callq 0x523f2
movl %ebx, %edi
callq 0x523f2
movl %ebx, %edi
callq 0x523f2
pushq $0x5
popq %rdi
callq 0x523f2
movl %ebx, %edi
callq 0x523f2
movl %ebx, %edi
callq 0x523f2
movl %ebx, %edi
callq 0x523f2
xorl %edi, %edi
callq 0x523f2
movl %ebx, %edi
callq 0x523f2
xorl %edi, %edi
callq 0x523f2
movl %ebx, %edi
callq 0x523f2
xorl %edi, %edi
callq 0x523f2
movl %ebx, %edi
callq 0x523f2
xorl %edi, %edi
callq 0x523f2
movl %ebx, %edi
callq 0x523f2
xorl %edi, %edi
callq 0x523f2
movl %ebx, %edi
callq 0x523f2
leaq 0x29b7c3(%rip), %rax    # 0x2f82e0
movzwl 0x159d0(%rax), %edi
callq 0x52599
callq 0x5824a
movl $0xfa0, %edi            # imm = 0xFA0
callq 0xae83
leaq 0x2c5717(%rip), %rax    # 0x322256
andw $0x0, (%rax)
leaq 0x2c5708(%rip), %rax    # 0x322252
andw $0x0, (%rax)
leaq 0x2c56ff(%rip), %rax    # 0x322254
andw $0x0, (%rax)
movq $0x2, (%r14)
jmp 0x5cc3a
leaq 0x1a84b4(%rip), %rax    # 0x205020
cmpl $0x0, (%rax)
je 0x5c779
andl $0x0, (%rax)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x59fa9
leaq 0xadafe(%rip), %rdi     # 0x10a68c
movl $0x1f5, %esi            # imm = 0x1F5
jmp 0x5cd2e
pushq $0x25
popq %rdi
callq 0x5707f
callq 0x570f8
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x59901
leaq 0x1a842d(%rip), %rax    # 0x204fe8
cmpl $0x4f, (%rax)
jne 0x5cd22
leaq 0xadacb(%rip), %rdi     # 0x10a696
jmp 0x5cd29
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x5c446
callq 0x5bc5e
leaq 0x1a8435(%rip), %rax    # 0x205020
cmpl $0x0, (%rax)
je 0x5c779
andl $0x0, (%rax)
leaq 0xad947(%rip), %rdi     # 0x10a545
callq 0x59a28
callq 0x59aab
movl $0x3e8, %edi            # imm = 0x3E8
callq 0xae83
leaq 0x2c563d(%rip), %rax    # 0x322256
andw $0x0, (%rax)
leaq 0x2c562e(%rip), %rax    # 0x322252
andw $0x0, (%rax)
leaq 0x2c5625(%rip), %rax    # 0x322254
andw $0x0, (%rax)
movq $0x1, (%r14)
xorl %edi, %edi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x5a086
pushq $0x1
popq %rdi
callq 0x5be9f
leaq 0xad9f5(%rip), %rdi     # 0x10a64f
movl $0x14d, %esi            # imm = 0x14D
callq 0x576d4
callq 0x5be85
leaq 0xad9ef(%rip), %rdi     # 0x10a65f
movl $0x14d, %esi            # imm = 0x14D
jmp 0x5cd2e
leaq 0xadaa4(%rip), %rdi     # 0x10a725
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x579af
xorl %edi, %edi
xorl %esi, %esi
movl $0x41f, %edx            # imm = 0x41F
callq 0x59dc8
andl $0x0, 0x2f9deb(%rip)    # 0x356a90
leaq 0x1a8374(%rip), %r15    # 0x205020
cmpl $0x0, (%r15)
je 0x5cd05
movl $0x1f4, %edi            # imm = 0x1F4
callq 0xae83
movq $0x2, (%r14)
leaq 0x29b616(%rip), %rax    # 0x2f82e0
movl 0x159d0(%rax), %edx
leaq 0x2c9549(%rip), %rbx    # 0x326220
leaq 0xada2d(%rip), %rsi     # 0x10a70b
movq %rbx, %rdi
xorl %eax, %eax
callq 0x9060
movq %rbx, %rdi
callq 0x579af
movl $0x1f4, %edi            # imm = 0x1F4
callq 0xae83
andl $0x0, (%r15)
xorl %edi, %edi
callq 0x5a086
pushq $0x15
popq %rdi
pushq $0x1
popq %rsi
callq 0x59afe
leaq 0x1a8311(%rip), %rax    # 0x205028
movl $0x2, (%rax)
jmp 0x5c779
leaq 0xad9d2(%rip), %rdi     # 0x10a6fb
movl $0xfb, %esi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x576d4
pushq $0x2
popq %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x59e3a
leaq 0xad988(%rip), %rdi     # 0x10a6de
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x57791