// File: /workspace/github_cpp_makefile_star2_O2/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 0x7f181(%rip), %rdi     # 0x10f085
callq 0x520bf
leaq 0x295d34(%rip), %rax    # 0x325c44
andl $0x0, (%rax)
callq 0x75767
testl %eax, %eax
je 0x90066
leaq 0x295909(%rip), %rdi    # 0x325830
callq 0x95e0
movl %eax, %ebx
leaq 0x19845b(%rip), %rax    # 0x228390
movq (%rax), %rdi
testq %rdi, %rdi
je 0x8ff4d
leaq 0x7f14f(%rip), %rsi     # 0x10f093
movl %ebx, %edx
xorl %eax, %eax
callq 0x9560
leaq 0x17508c(%rip), %rax    # 0x204fe0
cmpl $0x4e, (%rax)
jne 0x8ffe5
leaq 0x26726c(%rip), %rax    # 0x2f71d0
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
testw $0x1a5, %bx             # imm = 0x1A5
setne %cl
leal (%rdx,%rcx,8), %ecx
movl %ecx, (%rax)
leaq 0x267316(%rip), %rax    # 0x2f72a8
cmpl $0x0, (%rax)
jne 0x8ffa4
leaq 0x1728a6(%rip), %rcx    # 0x202844
movl $0x1e15, (%rcx)         # imm = 0x1E15
movl $0x22b, (%rax)          # imm = 0x22B
leaq 0x267227(%rip), %rax    # 0x2f71d8
movl $0xfffffbfe, %ecx       # imm = 0xFFFFFBFE
andl (%rax), %ecx
movl %ebx, %edx
shrl $0x4, %edx
pushq $0x1
popq %rsi
andl %esi, %edx
orl %ecx, %edx
leaq 0x267265(%rip), %rcx    # 0x2f7230
movl %esi, (%rcx)
andl $0x40, %ebx
shll $0x4, %ebx
orl %edx, %ebx
movl %ebx, (%rax)
leaq 0x2672ce(%rip), %rax    # 0x2f72ac
movl %esi, (%rax)
jmp 0x90066
xorl %eax, %eax
testb $0x3e, %bl
setne %al
leal (,%rax,4), %ecx
testw $0x300, %bx             # imm = 0x300
leal 0x8(,%rax,4), %eax
cmovel %ecx, %eax
movl %ebx, %ecx
shrl $0x8, %ecx
andl $0x10, %ecx
orl %eax, %ecx
leaq 0x2671bc(%rip), %rax    # 0x2f71d0
movl %ecx, (%rax)
xorl %eax, %eax
testb $-0x40, %bl
setne %al
leaq 0x2671b3(%rip), %rcx    # 0x2f71d8
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 0x26726b(%rip), %rax    # 0x2f72ac
movl $0x1, (%rax)
leaq 0x26725a(%rip), %rax    # 0x2f72a8
cmpl $0x0, (%rax)
jne 0x90060
leaq 0x1727ea(%rip), %rcx    # 0x202844
movl $0x1e1c, (%rcx)         # imm = 0x1E1C
movl $0x8, (%rax)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq