// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heathgps.cpp
// Function: set_ticc_config(unsigned int, char*)
void set_ticc_config(unsigned port, char *s)
{
unsigned i;
int old_ticc_mode;
#define TICC_CHAR_WAIT 0    // 60  - possible delay needed after each char sent
#define TICC_MSG_WAIT  300  // 200 - delay needed after a param change command sent (min val that worked was 150)
#define TICC_MENU_WAIT 600  // 1000 - delay after entering menu mode (min val that worked was 300)
#define TICC_EE_WAIT   300  // 200 ok 2000  - delay after sending an EEPROM write command (min value that worked was 100)
                            // warm_reset() and factory_reset() commands have longer delays in them

   // send a config command to the TICC   // aaaaahhhhh
   // if (s == 0) get the TICC configuration from the menu
   if(read_only) return;
   if(ticc_sim_file) return;  //lfs LARS_TICC

   if(port >= NUM_COM_PORTS) return;
   old_ticc_mode = ticc_mode;

   sendout(port, '#', ADD_CHAR);  // break TICC out of the processing loop and get to the menu
   sendout(port, 0, FLUSH_COM);
   Sleep(TICC_MSG_WAIT);     // allow TICC to process the data
   reset_com_timer(port);

   get_ticc_info(port);      // process the ticc menu config header

   sendout(port, '#', ADD_CHAR);  // get to the TICC config menu
   sendout(port, 0, FLUSH_COM);
   Sleep(TICC_MENU_WAIT);
reset_com_timer(port);

   if(s) {   // send the command to the TICC
      for(i=0; i<strlen(s); i++) {  // send command string to the TICC
         sendout(port, s[i], ADD_CHAR);
         if(TICC_CHAR_WAIT) Sleep(TICC_CHAR_WAIT);
      }
      sendout(port, 0x0D, ADD_CHAR);
      sendout(port, 0, FLUSH_COM);
      Sleep(TICC_MSG_WAIT);    // wait for TICC to resend the menu

      sendout(port, 'W', ADD_CHAR); // W)rite changes to TICC EEPROM and exit menu
      sendout(port, 0, FLUSH_COM);
      Sleep(TICC_EE_WAIT);     // we must rate limit EEPROM commands
   }
   else {    // we were just getting the config
      sendout(port, 'Z', ADD_CHAR); // Exit menu without writing to TICC EEPROM
      sendout(port, 0, FLUSH_COM);
      Sleep(TICC_MSG_WAIT);
   }

reset_com_timer(RCVR_PORT);
   drain_port(port);  // flush TICC output
reset_com_timer(RCVR_PORT);

if(s == 0) ; 
else if(dont_reset_queues) ; 
   else {
      ticc_packets = 0;  // causes queues to flush after 10 packets
      new_queue(RESET_ALL_QUEUES, 102);
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
cmpl $0x12, %edi
ja 0x646ca
leaq 0x2d2aaf(%rip), %rax    # 0x33701a
cmpb $0x0, (%rax)
jne 0x646ca
leaq 0x1d9e1d(%rip), %rax    # 0x23e398
cmpq $0x0, (%rax)
jne 0x646ca
movq %rsi, %rbx
movl %edi, %r14d
movl $0x23, %esi
xorl %edx, %edx
callq 0xbcaa
movl %r14d, %edi
xorl %esi, %esi
movl $0x2, %edx
callq 0xbcaa
movl $0x12c, %edi            # imm = 0x12C
callq 0xafe8
movl %r14d, %edi
callq 0x1ea0b
movl %r14d, %edi
callq 0xad101
movl %r14d, %edi
movl $0x23, %esi
xorl %edx, %edx
callq 0xbcaa
movl %r14d, %edi
xorl %esi, %esi
movl $0x2, %edx
callq 0xbcaa
movl $0x258, %edi            # imm = 0x258
callq 0xafe8
movl %r14d, %edi
callq 0x1ea0b
testq %rbx, %rbx
je 0x64651
cmpb $0x0, (%rbx)
je 0x64625
movl $0x1, %r15d
xorl %r12d, %r12d
movzbl (%rbx,%r12), %esi
movl %r14d, %edi
xorl %edx, %edx
callq 0xbcaa
movl %r15d, %r12d
movq %rbx, %rdi
callq 0x9120
incl %r15d
cmpq %r12, %rax
ja 0x64603
movl %r14d, %edi
movl $0xd, %esi
xorl %edx, %edx
callq 0xbcaa
movl %r14d, %edi
xorl %esi, %esi
movl $0x2, %edx
callq 0xbcaa
movl $0x12c, %edi            # imm = 0x12C
callq 0xafe8
movb $0x57, %al
jmp 0x64653
movb $0x5a, %al
movzbl %al, %esi
movl %r14d, %edi
xorl %edx, %edx
callq 0xbcaa
movl %r14d, %edi
xorl %esi, %esi
movl $0x2, %edx
callq 0xbcaa
movl $0x12c, %edi            # imm = 0x12C
callq 0xafe8
movl $0xa, %edi
callq 0x1ea0b
movl %r14d, %edi
callq 0x5802f
movl $0xa, %edi
callq 0x1ea0b
testq %rbx, %rbx
je 0x646ca
leaq 0x10c5bf(%rip), %rax    # 0x170c60
cmpl $0x0, (%rax)
jne 0x646ca
leaq 0x1da8cf(%rip), %rax    # 0x23ef7c
movl $0x0, (%rax)
movl $0x7, %edi
movl $0x66, %esi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x1118c
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq