// File: jkingan[P]ladyheather/heathgps.cpp
// Function: parse_ubx_gnss()
void parse_ubx_gnss()
{
int hw_chans;
int use_chans;
int blocks;
int id;
int min_chans;
int max_chans;
u32 flags;

   log_packet_id("UBX_GNSS");

   tsip_byte();  // msg version
   hw_chans = tsip_byte();
   use_chans = tsip_byte();
   blocks = tsip_byte();
//sprintf(debug_text2, "GNSS info hw_chans:%d  use:%d  blocks:%d", hw_chans,use_chans,blocks);

   if(blocks == 0) return;

   gnss_mask = 0x0000;
   have_gnss_mask = 1;
   while(blocks--) {
      id = tsip_byte();
      min_chans = tsip_byte();
      max_chans = tsip_byte();
      tsip_byte();  // reserved
      flags = tsip_dword();

      if(id == 0) {       // GPS
         if(flags & 0x0001) gnss_mask |= GPS;
      }
      else if(id == 1) {  // SBAS
         if(flags & 0x0001) gnss_mask |= SBAS;
      }
      else if(id == 2) {  // GALILEO
         if(flags & 0x0001) gnss_mask |= GALILEO;
      }
      else if(id == 3) {  // Beidou
         if(flags & 0x0001) gnss_mask |= BEIDOU;
      }
      else if(id == 4) {  // IMES
         if(flags & 0x0001) gnss_mask |= IMES;
      }
      else if(id == 5) {  // QZSS
         if(flags & 0x0001) gnss_mask |= QZSS;
      }
      else if(id == 6) {  // GLONASS
         if(flags & 0x0001) gnss_mask |= GLONASS;
      }

if(0 && debug_file) {
   fprintf(debug_file, "gnss blk:%d  hw:%d use:%d  id:%d min:%d max:%d flags:%08X  mask:%04X\n", 
   blocks, hw_chans, use_chans, id,min_chans,max_chans,flags, gnss_mask);
}
   }
// sprintf(debug_text2, "GNSS got mask:%04X", gnss_mask);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
leaq 0xbbec7(%rip), %rdi     # 0x187ae6
callq 0x7add0
callq 0x7a510
callq 0x7a510
movzbl %al, %eax
movl %eax, -0x4(%rbp)
callq 0x7a510
movzbl %al, %eax
movl %eax, -0x8(%rbp)
callq 0x7a510
movzbl %al, %eax
movl %eax, -0xc(%rbp)
cmpl $0x0, -0xc(%rbp)
jne 0xcbc55
jmp 0xcbdef
leaq 0x1041f8(%rip), %rax    # 0x1cfe54
movl $0x0, (%rax)
leaq 0x1041ef(%rip), %rax    # 0x1cfe58
movl $0x1, (%rax)
movl -0xc(%rbp), %eax
movl %eax, %ecx
addl $-0x1, %ecx
movl %ecx, -0xc(%rbp)
cmpl $0x0, %eax
je 0xcbdef
callq 0x7a510
movzbl %al, %eax
movl %eax, -0x10(%rbp)
callq 0x7a510
movzbl %al, %eax
movl %eax, -0x14(%rbp)
callq 0x7a510
movzbl %al, %eax
movl %eax, -0x18(%rbp)
callq 0x7a510
callq 0x7a680
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x10(%rbp)
jne 0xcbcdc
movl -0x1c(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0xcbcd7
leaq 0x10418b(%rip), %rax    # 0x1cfe54
movl (%rax), %ecx
orl $0x1, %ecx
leaq 0x10417f(%rip), %rax    # 0x1cfe54
movl %ecx, (%rax)
jmp 0xcbdea
cmpl $0x1, -0x10(%rbp)
jne 0xcbd0a
movl -0x1c(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0xcbd05
leaq 0x104160(%rip), %rax    # 0x1cfe54
movl (%rax), %ecx
orl $0x8000, %ecx           # imm = 0x8000
leaq 0x104151(%rip), %rax    # 0x1cfe54
movl %ecx, (%rax)
jmp 0xcbde8
cmpl $0x2, -0x10(%rbp)
jne 0xcbd35
movl -0x1c(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0xcbd30
leaq 0x104132(%rip), %rax    # 0x1cfe54
movl (%rax), %ecx
orl $0x4, %ecx
leaq 0x104126(%rip), %rax    # 0x1cfe54
movl %ecx, (%rax)
jmp 0xcbde6
cmpl $0x3, -0x10(%rbp)
jne 0xcbd60
movl -0x1c(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0xcbd5b
leaq 0x104107(%rip), %rax    # 0x1cfe54
movl (%rax), %ecx
orl $0x8, %ecx
leaq 0x1040fb(%rip), %rax    # 0x1cfe54
movl %ecx, (%rax)
jmp 0xcbde4
cmpl $0x4, -0x10(%rbp)
jne 0xcbd8b
movl -0x1c(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0xcbd89
leaq 0x1040dc(%rip), %rax    # 0x1cfe54
movl (%rax), %ecx
orl $0x2000, %ecx           # imm = 0x2000
leaq 0x1040cd(%rip), %rax    # 0x1cfe54
movl %ecx, (%rax)
jmp 0xcbde2
cmpl $0x5, -0x10(%rbp)
jne 0xcbdb6
movl -0x1c(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0xcbdb4
leaq 0x1040b1(%rip), %rax    # 0x1cfe54
movl (%rax), %ecx
orl $0x4000, %ecx           # imm = 0x4000
leaq 0x1040a2(%rip), %rax    # 0x1cfe54
movl %ecx, (%rax)
jmp 0xcbde0
cmpl $0x6, -0x10(%rbp)
jne 0xcbdde
movl -0x1c(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0xcbddc
leaq 0x104086(%rip), %rax    # 0x1cfe54
movl (%rax), %ecx
orl $0x2, %ecx
leaq 0x10407a(%rip), %rax    # 0x1cfe54
movl %ecx, (%rax)
jmp 0xcbdde
jmp 0xcbde0
jmp 0xcbde2
jmp 0xcbde4
jmp 0xcbde6
jmp 0xcbde8
jmp 0xcbdea
jmp 0xcbc6f
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)