// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heathgps.cpp
// Function: parse_scpi_hardware()
void parse_scpi_hardware()
{
int status;

   log_packet_id("scpi hardware");

   msg_col = 0;
   if(get_msg_field()) {
      status = atoi(nmea_msg);
if(debug_file) fprintf(debug_file, "### hardware status:%04X\n", status);
      if(scpi_type == NORTEL_TYPE) {
        // 0x0001 - self test fail
        // 0x0002 - power fail
        // 0x0004 - GPS 1PPS fail
        // 0x0008 - OCXO fail
        // 0x0010 - EFC fail
        // 0x0020 - PLL fail
        // 0x0040 - EEPROM fail
        // 0x0080 - RAM fail
        // 0x0100 - FPGA fail
        // 0x0200 - antenna RF signal too high
        // 0x0400 - antenna RF signal too low
        // 0x0800 - GPS fail (TRAIM failure)
        // 0x1000 - PDOP fail
        if(status & 0x0002) critical_alarms |= CRIT_PWR;      // power
        else                critical_alarms &= (~CRIT_PWR);
        if(status & 0x0008) critical_alarms |= CRIT_OCXO;     // ocxo
        else                critical_alarms &= (~CRIT_OCXO);
        if(status & 0x0080) critical_alarms |= CRIT_RAM;      // RAM
        else                critical_alarms &= (CRIT_RAM);
        if(status & 0x01A5) critical_alarms |= CRIT_FPGA;     // various hardware
        else                critical_alarms &= (~CRIT_FPGA);
        if(!have_critical_alarms) need_redraw = 7701;
        have_critical_alarms = 555;

        if(status & 0x0010) minor_alarms |= MINOR_OSC_AGE;    // EFC limit
        else                minor_alarms &= (~MINOR_OSC_AGE);
        have_osc_age = 1;

        if(status & 0x0040) minor_alarms |= MINOR_EEPROM;    // eeprom
        else                minor_alarms &= (~MINOR_EEPROM);
        have_eeprom = 1;
      }
      else {
         critical_alarms = 0x0000;
         if(status & 0x003E) critical_alarms |= CRIT_PWR;       // power
         if(status & 0x0300) critical_alarms |= CRIT_GPS;       // GPS
         if(status & 0x1000) critical_alarms |= CRIT_OCXO;      // ref failure

         if(status & 0x00C0) minor_alarms |= MINOR_OSC_AGE;     // EFC limit
         else                minor_alarms &= (~MINOR_OSC_AGE);  // EFC limit

         if(status & 0x0800) minor_alarms |= MINOR_EEPROM;      // EEPROM fault
         else                minor_alarms &= (~MINOR_EEPROM) ;  // EEPROM ok
         have_eeprom = 1;

         if(!have_critical_alarms) need_redraw = 7708;
         have_critical_alarms = 8;
      }
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
leaq 0x86350(%rip), %rdi     # 0x12513d
callq 0x58dc2
leaq 0x29ce4b(%rip), %rax    # 0x33bc44
movl $0x0, (%rax)
callq 0x810b1
testl %eax, %eax
je 0x9ef56
leaq 0x29ca1d(%rip), %rdi    # 0x33b830
callq 0x95e0
movl %eax, %ebx
leaq 0x19f56f(%rip), %rax    # 0x23e390
movq (%rax), %rdi
testq %rdi, %rdi
je 0x9ee39
leaq 0x8631b(%rip), %rsi     # 0x12514b
movl %ebx, %edx
xorl %eax, %eax
callq 0x9560
leaq 0x17c1a0(%rip), %rax    # 0x21afe0
cmpl $0x4e, (%rax)
jne 0x9eed4
leaq 0x26e380(%rip), %rax    # 0x30d1d0
movl (%rax), %ecx
movl %ecx, %edx
andl $-0x1f, %edx
andl $0x2, %ecx
movl %ebx, %esi
andl $0xa, %esi
testb %bl, %bl
leal 0x2(%rdx,%rsi,2), %edx
cmovnsl %ecx, %edx
xorl %ecx, %ecx
testl $0x1a5, %ebx            # imm = 0x1A5
setne %cl
leal (%rdx,%rcx,8), %ecx
movl %ecx, (%rax)
leaq 0x26e429(%rip), %rax    # 0x30d2a8
cmpl $0x0, (%rax)
jne 0x9ee91
leaq 0x1799b9(%rip), %rcx    # 0x218844
movl $0x1e15, (%rcx)         # imm = 0x1E15
movl $0x22b, (%rax)          # imm = 0x22B
leaq 0x26e33a(%rip), %rax    # 0x30d1d8
movl $0xfffffbfe, %ecx       # imm = 0xFFFFFBFE
andl (%rax), %ecx
movl %ebx, %edx
shrl $0x4, %edx
movl $0x1, %esi
andl %esi, %edx
orl %ecx, %edx
leaq 0x26e376(%rip), %rcx    # 0x30d230
movl %esi, (%rcx)
andl $0x40, %ebx
shll $0x4, %ebx
orl %edx, %ebx
movl %ebx, (%rax)
leaq 0x26e3df(%rip), %rax    # 0x30d2ac
movl %esi, (%rax)
jmp 0x9ef56
xorl %eax, %eax
testb $0x3e, %bl
setne %al
leal (,%rax,4), %ecx
testl $0x300, %ebx            # imm = 0x300
leal 0x8(,%rax,4), %eax
cmovel %ecx, %eax
movl %ebx, %ecx
shrl $0x8, %ecx
andl $0x10, %ecx
orl %eax, %ecx
leaq 0x26e2cc(%rip), %rax    # 0x30d1d0
movl %ecx, (%rax)
xorl %eax, %eax
testb $-0x40, %bl
setne %al
leaq 0x26e2c3(%rip), %rcx    # 0x30d1d8
movl $0xfffffbfe, %edx       # imm = 0xFFFFFBFE
andl (%rcx), %edx
shrl %ebx
andl $0x400, %ebx            # imm = 0x400
orl %eax, %ebx
orl %edx, %ebx
movl %ebx, (%rcx)
leaq 0x26e37b(%rip), %rax    # 0x30d2ac
movl $0x1, (%rax)
leaq 0x26e36a(%rip), %rax    # 0x30d2a8
cmpl $0x0, (%rax)
jne 0x9ef50
leaq 0x1798fa(%rip), %rcx    # 0x218844
movl $0x1e1c, (%rcx)         # imm = 0x1E1C
movl $0x8, (%rax)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq