// File: 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
subq $0x10, %rsp
leaq 0xb0802(%rip), %rdi     # 0x188431
callq 0x7add0
leaq 0x2c31e9(%rip), %rax    # 0x39ae24
movl $0x0, (%rax)
callq 0xb0bd0
cmpl $0x0, %eax
je 0xd7f4d
leaq 0x2c2dba(%rip), %rdi    # 0x39aa10
callq 0x95c0
movl %eax, -0x4(%rbp)
leaq 0x1c590b(%rip), %rax    # 0x29d570
cmpq $0x0, (%rax)
je 0xd7c86
leaq 0x1c58fe(%rip), %rax    # 0x29d570
movq (%rax), %rdi
movl -0x4(%rbp), %edx
leaq 0xb07c0(%rip), %rsi     # 0x18843f
movb $0x0, %al
callq 0x9550
leaq 0x1a2533(%rip), %rax    # 0x27a1c0
cmpl $0x4e, (%rax)
jne 0xd7e2f
movl -0x4(%rbp), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0xd7cb8
leaq 0x294708(%rip), %rax    # 0x36c3b0
movl (%rax), %ecx
orl $0x4, %ecx
leaq 0x2946fc(%rip), %rax    # 0x36c3b0
movl %ecx, (%rax)
jmp 0xd7ccd
leaq 0x2946f1(%rip), %rax    # 0x36c3b0
movl (%rax), %ecx
andl $-0x5, %ecx
leaq 0x2946e5(%rip), %rax    # 0x36c3b0
movl %ecx, (%rax)
movl -0x4(%rbp), %eax
andl $0x8, %eax
cmpl $0x0, %eax
je 0xd7cef
leaq 0x2946d1(%rip), %rax    # 0x36c3b0
movl (%rax), %ecx
orl $0x10, %ecx
leaq 0x2946c5(%rip), %rax    # 0x36c3b0
movl %ecx, (%rax)
jmp 0xd7d04
leaq 0x2946ba(%rip), %rax    # 0x36c3b0
movl (%rax), %ecx
andl $-0x11, %ecx
leaq 0x2946ae(%rip), %rax    # 0x36c3b0
movl %ecx, (%rax)
movl -0x4(%rbp), %eax
andl $0x80, %eax
cmpl $0x0, %eax
je 0xd7d28
leaq 0x294698(%rip), %rax    # 0x36c3b0
movl (%rax), %ecx
orl $0x2, %ecx
leaq 0x29468c(%rip), %rax    # 0x36c3b0
movl %ecx, (%rax)
jmp 0xd7d3d
leaq 0x294681(%rip), %rax    # 0x36c3b0
movl (%rax), %ecx
andl $0x2, %ecx
leaq 0x294675(%rip), %rax    # 0x36c3b0
movl %ecx, (%rax)
movl -0x4(%rbp), %eax
andl $0x1a5, %eax            # imm = 0x1A5
cmpl $0x0, %eax
je 0xd7d61
leaq 0x29465f(%rip), %rax    # 0x36c3b0
movl (%rax), %ecx
orl $0x8, %ecx
leaq 0x294653(%rip), %rax    # 0x36c3b0
movl %ecx, (%rax)
jmp 0xd7d76
leaq 0x294648(%rip), %rax    # 0x36c3b0
movl (%rax), %ecx
andl $-0x9, %ecx
leaq 0x29463c(%rip), %rax    # 0x36c3b0
movl %ecx, (%rax)
leaq 0x29470b(%rip), %rax    # 0x36c488
cmpl $0x0, (%rax)
jne 0xd7d8f
leaq 0x19fc9b(%rip), %rax    # 0x277a24
movl $0x1e15, (%rax)         # imm = 0x1E15
leaq 0x2946f2(%rip), %rax    # 0x36c488
movl $0x22b, (%rax)          # imm = 0x22B
movl -0x4(%rbp), %eax
andl $0x10, %eax
cmpl $0x0, %eax
je 0xd7dbe
leaq 0x29460a(%rip), %rax    # 0x36c3b8
movl (%rax), %ecx
orl $0x1, %ecx
leaq 0x2945fe(%rip), %rax    # 0x36c3b8
movl %ecx, (%rax)
jmp 0xd7dd3
leaq 0x2945f3(%rip), %rax    # 0x36c3b8
movl (%rax), %ecx
andl $-0x2, %ecx
leaq 0x2945e7(%rip), %rax    # 0x36c3b8
movl %ecx, (%rax)
leaq 0x294636(%rip), %rax    # 0x36c410
movl $0x1, (%rax)
movl -0x4(%rbp), %eax
andl $0x40, %eax
cmpl $0x0, %eax
je 0xd7e05
leaq 0x2945c6(%rip), %rax    # 0x36c3b8
movl (%rax), %ecx
orl $0x400, %ecx            # imm = 0x400
leaq 0x2945b7(%rip), %rax    # 0x36c3b8
movl %ecx, (%rax)
jmp 0xd7e1d
leaq 0x2945ac(%rip), %rax    # 0x36c3b8
movl (%rax), %ecx
andl $0xfffffbff, %ecx       # imm = 0xFFFFFBFF
leaq 0x29459d(%rip), %rax    # 0x36c3b8
movl %ecx, (%rax)
leaq 0x294668(%rip), %rax    # 0x36c48c
movl $0x1, (%rax)
jmp 0xd7f4b
leaq 0x29457a(%rip), %rax    # 0x36c3b0
movl $0x0, (%rax)
movl -0x4(%rbp), %eax
andl $0x3e, %eax
cmpl $0x0, %eax
je 0xd7e5c
leaq 0x294562(%rip), %rax    # 0x36c3b0
movl (%rax), %ecx
orl $0x4, %ecx
leaq 0x294556(%rip), %rax    # 0x36c3b0
movl %ecx, (%rax)
movl -0x4(%rbp), %eax
andl $0x300, %eax            # imm = 0x300
cmpl $0x0, %eax
je 0xd7e7e
leaq 0x294540(%rip), %rax    # 0x36c3b0
movl (%rax), %ecx
orl $0x8, %ecx
leaq 0x294534(%rip), %rax    # 0x36c3b0
movl %ecx, (%rax)
movl -0x4(%rbp), %eax
andl $0x1000, %eax           # imm = 0x1000
cmpl $0x0, %eax
je 0xd7ea0
leaq 0x29451e(%rip), %rax    # 0x36c3b0
movl (%rax), %ecx
orl $0x10, %ecx
leaq 0x294512(%rip), %rax    # 0x36c3b0
movl %ecx, (%rax)
movl -0x4(%rbp), %eax
andl $0xc0, %eax
cmpl $0x0, %eax
je 0xd7ec4
leaq 0x294504(%rip), %rax    # 0x36c3b8
movl (%rax), %ecx
orl $0x1, %ecx
leaq 0x2944f8(%rip), %rax    # 0x36c3b8
movl %ecx, (%rax)
jmp 0xd7ed9
leaq 0x2944ed(%rip), %rax    # 0x36c3b8
movl (%rax), %ecx
andl $-0x2, %ecx
leaq 0x2944e1(%rip), %rax    # 0x36c3b8
movl %ecx, (%rax)
movl -0x4(%rbp), %eax
andl $0x800, %eax            # imm = 0x800
cmpl $0x0, %eax
je 0xd7f00
leaq 0x2944cb(%rip), %rax    # 0x36c3b8
movl (%rax), %ecx
orl $0x400, %ecx            # imm = 0x400
leaq 0x2944bc(%rip), %rax    # 0x36c3b8
movl %ecx, (%rax)
jmp 0xd7f18
leaq 0x2944b1(%rip), %rax    # 0x36c3b8
movl (%rax), %ecx
andl $0xfffffbff, %ecx       # imm = 0xFFFFFBFF
leaq 0x2944a2(%rip), %rax    # 0x36c3b8
movl %ecx, (%rax)
leaq 0x29456d(%rip), %rax    # 0x36c48c
movl $0x1, (%rax)
leaq 0x29455c(%rip), %rax    # 0x36c488
cmpl $0x0, (%rax)
jne 0xd7f3e
leaq 0x19faec(%rip), %rax    # 0x277a24
movl $0x1e1c, (%rax)         # imm = 0x1E1C
leaq 0x294543(%rip), %rax    # 0x36c488
movl $0x8, (%rax)
jmp 0xd7f4d
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)