// File: /workspace/github_cpp_makefile_star2_O1/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 %r14
pushq %rbx
leaq 0x2d28e8(%rip), %rax    # 0x33701a
leaq 0x2d28e7(%rip), %rcx    # 0x337020
movb (%rcx), %cl
orb (%rax), %cl
je 0x64744
popq %rbx
popq %r14
popq %rbp
retq
leaq 0x2a8a9e(%rip), %rax    # 0x30d1e9
movb $0x0, (%rax)
leaq 0x2a8a8b(%rip), %rax    # 0x30d1e0
movl $0x0, (%rax)
leaq 0x2a8a76(%rip), %rax    # 0x30d1d8
andb $0x7f, (%rax)
xorps %xmm0, %xmm0
callq 0x63c5c
leaq 0x1da7ca(%rip), %rax    # 0x23ef3e
cmpb $0x0, (%rax)
je 0x64782
popq %rbx
popq %r14
popq %rbp
jmp 0x64349
leaq 0x1b4147(%rip), %rbx    # 0x2188d0
movq (%rbx), %rax
cmpq $0x7fff, %rax           # imm = 0x7FFF
jle 0x647e1
cmpq $0x3fffff, %rax         # imm = 0x3FFFFF
jle 0x64943
cmpq $0x1fffffff, %rax       # imm = 0x1FFFFFFF
jg 0x649c2
cmpq $0x400000, %rax         # imm = 0x400000
je 0x64bfd
cmpq $0x1000000, %rax        # imm = 0x1000000
je 0x64cae
cmpq $0x8000000, %rax        # imm = 0x8000000
jne 0x6473f
leaq 0xbbeb5(%rip), %rdi     # 0x12068c
movl $0x323, %esi            # imm = 0x323
jmp 0x64d90
cmpq $0x7f, %rax
jg 0x64983
cmpq $0x3, %rax
jle 0x64a54
cmpq $0x4, %rax
je 0x64aff
cmpq $0x20, %rax
je 0x64c30
cmpq $0x40, %rax
jne 0x6473f
leaq 0x1b6806(%rip), %rax    # 0x21b020
cmpl $0x0, (%rax)
je 0x6473f
movl $0x0, (%rax)
movl $0x81, %edi
movl $0x18, %esi
callq 0x5fa97
movl $0x2, %edi
callq 0x591af
movl $0x1, %edi
callq 0x591af
movl $0x1, %edi
callq 0x591af
xorl %r14d, %r14d
xorl %edi, %edi
callq 0x591af
movl $0x1, %edi
callq 0x591af
movl $0x1, %edi
callq 0x591af
movl $0x1, %edi
callq 0x591af
movl $0x5, %edi
callq 0x591af
movl $0x1, %edi
callq 0x591af
movl $0x1, %edi
callq 0x591af
movl $0x1, %edi
callq 0x591af
xorl %edi, %edi
callq 0x591af
movl $0x1, %edi
callq 0x591af
xorl %edi, %edi
callq 0x591af
movl $0x1, %edi
callq 0x591af
xorl %edi, %edi
callq 0x591af
movl $0x1, %edi
callq 0x591af
xorl %edi, %edi
callq 0x591af
movl $0x1, %edi
callq 0x591af
xorl %edi, %edi
callq 0x591af
movl $0x1, %edi
callq 0x591af
leaq 0x2a99de(%rip), %rax    # 0x30e2e0
movzwl 0x159d0(%rax), %edi
callq 0x5936c
callq 0x5fb3b
movl $0xfa0, %edi            # imm = 0xFA0
callq 0xaff7
leaq 0x2d3932(%rip), %rax    # 0x338256
movw %r14w, (%rax)
leaq 0x2d3923(%rip), %rax    # 0x338252
movw %r14w, (%rax)
leaq 0x2d391a(%rip), %rax    # 0x338254
movw %r14w, (%rax)
jmp 0x64d72
cmpq $0x3ffff, %rax          # imm = 0x3FFFF
jle 0x649fd
cmpq $0x40000, %rax          # imm = 0x40000
je 0x64ade
cmpq $0x100000, %rax         # imm = 0x100000
je 0x64aef
cmpq $0x200000, %rax         # imm = 0x200000
jne 0x6473f
leaq 0xbbd11(%rip), %rdi     # 0x12068b
popq %rbx
popq %r14
popq %rbp
jmp 0x5f2a0
cmpq $0x7ff, %rax            # imm = 0x7FF
jle 0x64a87
cmpq $0x800, %rax            # imm = 0x800
je 0x64b9b
cmpq $0x1000, %rax           # imm = 0x1000
je 0x64c92
cmpq $0x4000, %rax           # imm = 0x4000
jne 0x6473f
movl $0x68, 0x308273(%rip)   # 0x36cc30
jmp 0x6473f
cmpq $0x20000000, %rax       # imm = 0x20000000
je 0x64c06
movl $0x80000000, %ecx       # imm = 0x80000000
cmpq %rcx, %rax
je 0x64cbf
movabsq $0x100000000, %rcx      # imm = 0x100000000
cmpq %rcx, %rax
jne 0x6473f
movl $0x2, %edi
popq %rbx
popq %r14
popq %rbp
jmp 0x63e06
cmpq $0x8000, %rax           # imm = 0x8000
je 0x64c16
cmpq $0x20000, %rax          # imm = 0x20000
jne 0x6473f
movl $0x1, %edi
callq 0x63db5
leaq 0xbbc01(%rip), %rdi     # 0x120627
movl $0x14d, %esi            # imm = 0x14D
callq 0x5ee52
leaq 0x1b5fb5(%rip), %rax    # 0x21a9ec
cmpl $0x0, (%rax)
jne 0x64a43
xorl %edi, %edi
callq 0x63db5
leaq 0xbbbed(%rip), %rdi     # 0x120637
movl $0x14d, %esi            # imm = 0x14D
jmp 0x64d90
cmpq $0x1, %rax
je 0x64d14
cmpq $0x2, %rax
jne 0x6473f
leaq 0x1b65b1(%rip), %rax    # 0x21b020
cmpl $0x0, (%rax)
je 0x6473f
movl $0x0, (%rax)
popq %rbx
popq %r14
popq %rbp
jmp 0x61c33
cmpq $0x80, %rax
je 0x64d2c
cmpq $0x100, %rax            # imm = 0x100
jne 0x6473f
movl $0x517, %edi            # imm = 0x517
movl $0x8, %esi
xorl %edx, %edx
callq 0x645ec
movzwl 0x308079(%rip), %edi    # 0x36cb30
callq 0x5936c
movl $0x1, %edi
callq 0x5936c
callq 0x646c7
movl $0x1388, %edi           # imm = 0x1388
callq 0xaff7
popq %rbx
popq %r14
popq %rbp
jmp 0x615f4
leaq 0xbbb37(%rip), %rdi     # 0x12061c
movl $0x1a4, %esi            # imm = 0x1A4
jmp 0x64d90
leaq 0xbbc07(%rip), %rdi     # 0x1206fd
popq %rbx
popq %r14
popq %rbp
jmp 0x5f15d
xorl %edi, %edi
xorl %esi, %esi
movl $0x41f, %edx            # imm = 0x41F
callq 0x61a3f
movl $0x0, 0x307f79(%rip)    # 0x36ca90
leaq 0x1b6502(%rip), %r14    # 0x21b020
cmpl $0x0, (%r14)
je 0x64b7a
movl $0x1f4, %edi            # imm = 0x1F4
callq 0xaff7
movq $0x2, (%rbx)
leaq 0x2a97a4(%rip), %rax    # 0x30e2e0
movl 0x159d0(%rax), %edx
leaq 0x2d76d7(%rip), %rbx    # 0x33c220
leaq 0xbbb93(%rip), %rsi     # 0x1206e3
movq %rbx, %rdi
xorl %eax, %eax
callq 0x9060
movq %rbx, %rdi
callq 0x5f15d
movl $0x1f4, %edi            # imm = 0x1F4
callq 0xaff7
movl $0x0, (%r14)
xorl %edi, %edi
callq 0x61d0f
movl $0x15, %edi
movl $0x1, %esi
callq 0x61765
leaq 0x1b6498(%rip), %rax    # 0x21b028
movl $0x2, (%rax)
jmp 0x6473f
movl $0x1, %edi
callq 0x5e740
xorl %edi, %edi
callq 0x591af
movl $0x1, %edi
callq 0x591af
movl $0x21, %edi
callq 0x591af
movl $0x1, %edi
callq 0x591af
xorl %edi, %edi
callq 0x591af
movl $0x1, %edi
callq 0x591af
callq 0x5e844
movl $0x1388, %edi           # imm = 0x1388
callq 0xaff7
movl $0x154e, %edi           # imm = 0x154E
movl $0x1, %esi
popq %rbx
popq %r14
popq %rbp
jmp 0x61765
popq %rbx
popq %r14
popq %rbp
jmp 0x643fa
leaq 0xbbabe(%rip), %rdi     # 0x1206cb
popq %rbx
popq %r14
popq %rbp
jmp 0x5f070
leaq 0xbbac2(%rip), %rdi     # 0x1206df
callq 0xa36fd
movl $0x1, %edi
popq %rbx
popq %r14
popq %rbp
jmp 0xa3789
callq 0x63b26
leaq 0x1b63e4(%rip), %rax    # 0x21b020
cmpl $0x0, (%rax)
je 0x6473f
movl $0x0, (%rax)
leaq 0xbb8cb(%rip), %rdi     # 0x12051d
callq 0x61694
callq 0x6170f
movl $0x3e8, %edi            # imm = 0x3E8
callq 0xaff7
leaq 0x2d35e9(%rip), %rax    # 0x338256
xorl %ecx, %ecx
movw %cx, (%rax)
leaq 0x2d35d9(%rip), %rax    # 0x338252
movw %cx, (%rax)
leaq 0x2d35d1(%rip), %rax    # 0x338254
movw %cx, (%rax)
movq $0x1, (%rbx)
jmp 0x64d79
leaq 0x1b634f(%rip), %rax    # 0x21afe8
cmpl $0x4f, (%rax)
jne 0x64d84
leaq 0xbb9c5(%rip), %rdi     # 0x12066e
jmp 0x64d8b
leaq 0xbb9af(%rip), %rdi     # 0x120664
movl $0x1f5, %esi            # imm = 0x1F5
jmp 0x64d90
leaq 0x1b635a(%rip), %rax    # 0x21b020
cmpl $0x0, (%rax)
je 0x64d99
movl $0x0, (%rax)
leaq 0xbb9c7(%rip), %rdi     # 0x1206a3
callq 0x5ef13
movl $0x1388, %edi           # imm = 0x1388
callq 0xaff7
leaq 0x2d3564(%rip), %rax    # 0x338256
xorl %ecx, %ecx
movw %cx, (%rax)
leaq 0x2d3554(%rip), %rax    # 0x338252
movw %cx, (%rax)
leaq 0x2d354c(%rip), %rax    # 0x338254
movw %cx, (%rax)
movq $0x20, (%rbx)
jmp 0x64d79
movl $0x25, %edi
callq 0x5e740
callq 0x5e7c0
popq %rbx
popq %r14
popq %rbp
jmp 0x61566
leaq 0x1b62ed(%rip), %rax    # 0x21b020
cmpl $0x0, (%rax)
je 0x64da9
movl $0x0, (%rax)
movl $0x1, %edi
callq 0x64db7
movl $0x3e8, %edi            # imm = 0x3E8
callq 0xaff7
leaq 0x2d34fd(%rip), %rax    # 0x338256
xorl %ecx, %ecx
movw %cx, (%rax)
leaq 0x2d34ed(%rip), %rax    # 0x338252
movw %cx, (%rax)
leaq 0x2d34e5(%rip), %rax    # 0x338254
movw %cx, (%rax)
movq $0x2, (%rbx)
xorl %edi, %edi
popq %rbx
popq %r14
popq %rbp
jmp 0x61d0f
leaq 0xbb948(%rip), %rdi     # 0x1206d3
movl $0xfb, %esi
popq %rbx
popq %r14
popq %rbp
jmp 0x5ee52
leaq 0xbb916(%rip), %rdi     # 0x1206b6
popq %rbx
popq %r14
popq %rbp
jmp 0x5ef13
movl $0x2, %edi
popq %rbx
popq %r14
popq %rbp
jmp 0x61ab3