// File: /workspace/github_cpp_makefile_star2_O3/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 0x2d2701(%rip), %rax    # 0x33701a
leaq 0x2d2700(%rip), %rcx    # 0x337020
movb (%rcx), %cl
orb (%rax), %cl
je 0x64931
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0x2a88b1(%rip), %rax    # 0x30d1e9
movb $0x0, (%rax)
leaq 0x2a889e(%rip), %rax    # 0x30d1e0
movl $0x0, (%rax)
leaq 0x2a8889(%rip), %rax    # 0x30d1d8
andb $0x7f, (%rax)
xorps %xmm0, %xmm0
callq 0x63ce2
leaq 0x1da5dd(%rip), %rax    # 0x23ef3e
cmpb $0x0, (%rax)
je 0x64975
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x64443
leaq 0x1b3f54(%rip), %rbx    # 0x2188d0
movq (%rbx), %rax
cmpq $0x7fff, %rax           # imm = 0x7FFF
jle 0x649d4
cmpq $0x3fffff, %rax         # imm = 0x3FFFFF
jle 0x64b62
cmpq $0x1fffffff, %rax       # imm = 0x1FFFFFFF
jg 0x64be7
cmpq $0x400000, %rax         # imm = 0x400000
je 0x64e60
cmpq $0x1000000, %rax        # imm = 0x1000000
je 0x64f23
cmpq $0x8000000, %rax        # imm = 0x8000000
jne 0x64926
leaq 0xbbda2(%rip), %rdi     # 0x12076c
movl $0x323, %esi            # imm = 0x323
jmp 0x65015
cmpq $0x7f, %rax
jg 0x64ba8
cmpq $0x3, %rax
jle 0x64c7f
cmpq $0x4, %rax
je 0x64d5c
cmpq $0x20, %rax
je 0x64ea5
cmpq $0x40, %rax
jne 0x64926
leaq 0x1b6613(%rip), %rax    # 0x21b020
cmpl $0x0, (%rax)
je 0x64926
movl $0x0, (%rax)
movl $0x81, %edi
movl $0x18, %esi
callq 0x5fa1f
movl $0x2, %edi
callq 0x590f7
movl $0x1, %edi
callq 0x590f7
movl $0x1, %edi
callq 0x590f7
xorl %r14d, %r14d
xorl %edi, %edi
callq 0x590f7
movl $0x1, %edi
callq 0x590f7
movl $0x1, %edi
callq 0x590f7
movl $0x1, %edi
callq 0x590f7
movl $0x5, %edi
callq 0x590f7
movl $0x1, %edi
callq 0x590f7
movl $0x1, %edi
callq 0x590f7
movl $0x1, %edi
callq 0x590f7
xorl %edi, %edi
callq 0x590f7
movl $0x1, %edi
callq 0x590f7
xorl %edi, %edi
callq 0x590f7
movl $0x1, %edi
callq 0x590f7
xorl %edi, %edi
callq 0x590f7
movl $0x1, %edi
callq 0x590f7
xorl %edi, %edi
callq 0x590f7
movl $0x1, %edi
callq 0x590f7
xorl %edi, %edi
callq 0x590f7
movl $0x1, %edi
callq 0x590f7
leaq 0x2a97eb(%rip), %rax    # 0x30e2e0
movzwl 0x159d0(%rax), %eax
movw %ax, -0x1a(%rbp)
leaq 0x1b3ccd(%rip), %r15    # 0x2187d4
xorl %eax, %eax
cmpb $0x0, (%r15)
sete %al
movzbl -0x1a(%rbp,%rax), %edi
callq 0x590f7
xorl %eax, %eax
cmpb $0x0, (%r15)
setne %al
movzbl -0x1a(%rbp,%rax), %edi
callq 0x590f7
callq 0x5fac3
movl $0xfa0, %edi            # imm = 0xFA0
callq 0xafe8
leaq 0x2d3713(%rip), %rax    # 0x338256
movw %r14w, (%rax)
leaq 0x2d3704(%rip), %rax    # 0x338252
movw %r14w, (%rax)
leaq 0x2d36fb(%rip), %rax    # 0x338254
movw %r14w, (%rax)
jmp 0x64ff1
cmpq $0x3ffff, %rax          # imm = 0x3FFFF
jle 0x64c28
cmpq $0x40000, %rax          # imm = 0x40000
je 0x64d35
cmpq $0x100000, %rax         # imm = 0x100000
je 0x64d46
cmpq $0x200000, %rax         # imm = 0x200000
jne 0x64926
leaq 0xbbbd2(%rip), %rdi     # 0x12076b
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x5f228
cmpq $0x7ff, %rax            # imm = 0x7FF
jle 0x64cb8
cmpq $0x800, %rax            # imm = 0x800
je 0x64df8
cmpq $0x1000, %rax           # imm = 0x1000
je 0x64f07
cmpq $0x4000, %rax           # imm = 0x4000
jne 0x64926
movl $0x68, 0x30804e(%rip)   # 0x36cc30
jmp 0x64926
cmpq $0x20000000, %rax       # imm = 0x20000000
je 0x64e6f
movl $0x80000000, %ecx       # imm = 0x80000000
cmpq %rcx, %rax
je 0x64f34
movabsq $0x100000000, %rcx      # imm = 0x100000000
cmpq %rcx, %rax
jne 0x64926
movl $0x2, %edi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x63e8c
cmpq $0x8000, %rax           # imm = 0x8000
je 0x64e85
cmpq $0x20000, %rax          # imm = 0x20000
jne 0x64926
movl $0x1, %edi
callq 0x63e3b
leaq 0xbbab6(%rip), %rdi     # 0x120707
movl $0x14d, %esi            # imm = 0x14D
callq 0x5edda
leaq 0x1b5d8a(%rip), %rax    # 0x21a9ec
cmpl $0x0, (%rax)
jne 0x64c6e
xorl %edi, %edi
callq 0x63e3b
leaq 0xbbaa2(%rip), %rdi     # 0x120717
movl $0x14d, %esi            # imm = 0x14D
jmp 0x65015
cmpq $0x1, %rax
je 0x64f89
cmpq $0x2, %rax
jne 0x64926
leaq 0x1b6386(%rip), %rax    # 0x21b020
cmpl $0x0, (%rax)
je 0x64926
movl $0x0, (%rax)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x61c31
cmpq $0x80, %rax
je 0x64fa7
cmpq $0x100, %rax            # imm = 0x100
jne 0x64926
movl $0x517, %edi            # imm = 0x517
movl $0x8, %esi
xorl %edx, %edx
callq 0x646e6
callq 0x64869
movw $0x1, -0x1c(%rbp)
leaq 0x1b3ae1(%rip), %rbx    # 0x2187d4
xorl %eax, %eax
cmpb $0x0, (%rbx)
sete %al
movzbl -0x1c(%rbp,%rax), %edi
callq 0x590f7
xorl %eax, %eax
cmpb $0x0, (%rbx)
setne %al
movzbl -0x1c(%rbp,%rax), %edi
callq 0x590f7
callq 0x648ab
movl $0x1388, %edi           # imm = 0x1388
callq 0xafe8
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x6156d
leaq 0xbb9c0(%rip), %rdi     # 0x1206fc
movl $0x1a4, %esi            # imm = 0x1A4
jmp 0x65015
leaq 0xbba90(%rip), %rdi     # 0x1207dd
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x5f0e5
xorl %edi, %edi
xorl %esi, %esi
movl $0x41f, %edx            # imm = 0x41F
callq 0x619b5
movl $0x0, 0x307d1c(%rip)    # 0x36ca90
leaq 0x1b62a5(%rip), %r14    # 0x21b020
cmpl $0x0, (%r14)
je 0x64dd7
movl $0x1f4, %edi            # imm = 0x1F4
callq 0xafe8
movq $0x2, (%rbx)
leaq 0x2a9547(%rip), %rax    # 0x30e2e0
movl 0x159d0(%rax), %edx
leaq 0x2d747a(%rip), %rbx    # 0x33c220
leaq 0xbba16(%rip), %rsi     # 0x1207c3
movq %rbx, %rdi
xorl %eax, %eax
callq 0x9060
movq %rbx, %rdi
callq 0x5f0e5
movl $0x1f4, %edi            # imm = 0x1F4
callq 0xafe8
movl $0x0, (%r14)
xorl %edi, %edi
callq 0x61d0d
movl $0x15, %edi
movl $0x1, %esi
callq 0x616de
leaq 0x1b623b(%rip), %rax    # 0x21b028
movl $0x2, (%rax)
jmp 0x64926
movl $0x1, %edi
callq 0x5e6be
xorl %edi, %edi
callq 0x590f7
movl $0x1, %edi
callq 0x590f7
movl $0x21, %edi
callq 0x590f7
movl $0x1, %edi
callq 0x590f7
xorl %edi, %edi
callq 0x590f7
movl $0x1, %edi
callq 0x590f7
callq 0x5e7c0
movl $0x1388, %edi           # imm = 0x1388
callq 0xafe8
movl $0x154e, %edi           # imm = 0x154E
movl $0x1, %esi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x616de
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x644f4
leaq 0xbb935(%rip), %rdi     # 0x1207ab
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x5eff8
leaq 0xbb933(%rip), %rdi     # 0x1207bf
callq 0xa3914
movl $0x1, %edi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0xa39a0
callq 0x63bac
leaq 0x1b616f(%rip), %rax    # 0x21b020
cmpl $0x0, (%rax)
je 0x64926
movl $0x0, (%rax)
leaq 0xbb736(%rip), %rdi     # 0x1205fd
callq 0x6160d
callq 0x61688
movl $0x3e8, %edi            # imm = 0x3E8
callq 0xafe8
leaq 0x2d3374(%rip), %rax    # 0x338256
xorl %ecx, %ecx
movw %cx, (%rax)
leaq 0x2d3364(%rip), %rax    # 0x338252
movw %cx, (%rax)
leaq 0x2d335c(%rip), %rax    # 0x338254
movw %cx, (%rax)
movq $0x1, (%rbx)
jmp 0x64ff8
leaq 0x1b60da(%rip), %rax    # 0x21afe8
cmpl $0x4f, (%rax)
jne 0x65009
leaq 0xbb830(%rip), %rdi     # 0x12074e
jmp 0x65010
leaq 0xbb81a(%rip), %rdi     # 0x120744
movl $0x1f5, %esi            # imm = 0x1F5
jmp 0x65015
leaq 0x1b60e5(%rip), %rax    # 0x21b020
cmpl $0x0, (%rax)
je 0x65024
movl $0x0, (%rax)
leaq 0xbb832(%rip), %rdi     # 0x120783
callq 0x5ee9b
movl $0x1388, %edi           # imm = 0x1388
callq 0xafe8
leaq 0x2d32ef(%rip), %rax    # 0x338256
xorl %ecx, %ecx
movw %cx, (%rax)
leaq 0x2d32df(%rip), %rax    # 0x338252
movw %cx, (%rax)
leaq 0x2d32d7(%rip), %rax    # 0x338254
movw %cx, (%rax)
movq $0x20, (%rbx)
jmp 0x64ff8
movl $0x25, %edi
callq 0x5e6be
callq 0x5e73c
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x614df
leaq 0x1b6072(%rip), %rax    # 0x21b020
cmpl $0x0, (%rax)
je 0x6503a
movl $0x0, (%rax)
movl $0x1, %edi
callq 0x6504e
movl $0x3e8, %edi            # imm = 0x3E8
callq 0xafe8
leaq 0x2d327e(%rip), %rax    # 0x338256
xorl %ecx, %ecx
movw %cx, (%rax)
leaq 0x2d326e(%rip), %rax    # 0x338252
movw %cx, (%rax)
leaq 0x2d3266(%rip), %rax    # 0x338254
movw %cx, (%rax)
movq $0x2, (%rbx)
xorl %edi, %edi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x61d0d
leaq 0xbb7a3(%rip), %rdi     # 0x1207b3
movl $0xfb, %esi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x5edda
leaq 0xbb76b(%rip), %rdi     # 0x120796
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x5ee9b
movl $0x2, %edi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x61a29