// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heathgps.cpp
// Function: set_dac_voltage(double, int)
void set_dac_voltage(DATA_SIZE volts, int why)
{
int val;
int i,j;

   if(read_only) return;
   if(luxor) return;

   if(rcvr_type == CS_RCVR) {
      set_cs_remote(1);
      sprintf(out, ":ROSC:CONT %f", volts);
      queue_cs_cmd(out, SCPI_EFC_MSG);
      restore_cs_remote();
      queue_cs_cmd(":ROSC:CONT?", SCPI_EFC_MSG);
   }
   else if(rcvr_type == PRS_RCVR) {
      val = (int) volts;
      i = val / 4096;
      j = val % 4096;
      sprintf(out, "FC%d,%d", i,j);
      queue_prs_cmd(out, PRS_FC_MSG);
      queue_prs_cmd("FC?", PRS_FC_MSG);
   }
   else if(rcvr_type == TSIP_RCVR) {
      if(ACU_GG) return;
      if(ACU_360) return;
      if(ACUTIME) return;
      if(PALISADE) return;
      if(SV6_FAMILY) return;
      send_tsip_start(0x8E);
      send_byte(0xA0);
      send_byte(0x00);
      send_single((float) volts);
      send_tsip_end();
   }
   else if(rcvr_type == UCCM_RCVR) {
      val = (int) volts;  // this is DAC setting, not volts
      sprintf(out, "DIAG:ROSC:EFC:DATA %x", val);
      queue_uccm_cmd(out, UCCM_SETDAC_MSG);
      queue_uccm_cmd("DIAG:ROSC:EFC:DATA?", UCCM_EFC_MSG);
      discipline_mode = DIS_MODE_MANUAL_HOLD;  // manual control
//sprintf(plot_title, "Set dac to %f   why:%d", volts,why);
if(debug_file) fprintf(debug_file, "Set dac to %f   why:%d\n", volts,why);
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
leaq 0x2bd371(%rip), %rax    # 0x32101a
leaq 0x1c528e(%rip), %rcx    # 0x228f3e
movb (%rcx), %cl
orb (%rax), %cl
jne 0x63e19
leaq 0x19ec0f(%rip), %rax    # 0x2028d0
movq (%rax), %rax
cmpq $0x1, %rax
je 0x63dfe
cmpq $0x8, %rax
je 0x63d39
cmpq $0x1000000, %rax        # imm = 0x1000000
je 0x63db0
cmpq $0x20000, %rax          # imm = 0x20000
jne 0x63e19
pushq $0x1
popq %rdi
movsd %xmm0, -0x18(%rbp)
callq 0x5be9f
leaq 0x2c2520(%rip), %rbx    # 0x326220
leaq 0xa7585(%rip), %rsi     # 0x10b28c
movq %rbx, %rdi
movsd -0x18(%rbp), %xmm0
movb $0x1, %al
callq 0x9060
pushq $0xb
popq %r14
movq %rbx, %rdi
movl %r14d, %esi
callq 0x576d4
callq 0x5be85
leaq 0xa7569(%rip), %rdi     # 0x10b29a
movl %r14d, %esi
jmp 0x63df1
movl %edi, %ebx
cvttsd2si %xmm0, %edx
leaq 0x2c24da(%rip), %r14    # 0x326220
leaq 0xa7561(%rip), %rsi     # 0x10b2ae
movq %r14, %rdi
xorl %eax, %eax
movsd %xmm0, -0x18(%rbp)
callq 0x9060
pushq $0x68
popq %rsi
movq %r14, %rdi
callq 0x576d4
leaq 0xa7556(%rip), %rdi     # 0x10b2c4
pushq $0x67
popq %rsi
callq 0x576d4
movsd -0x18(%rbp), %xmm0
leaq 0x293715(%rip), %rax    # 0x2f7497
movb $0x3, (%rax)
leaq 0x1c4604(%rip), %rax    # 0x228390
movq (%rax), %rdi
testq %rdi, %rdi
je 0x63e19
leaq 0xa7539(%rip), %rsi     # 0x10b2d8
movl %ebx, %edx
movb $0x1, %al
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
jmp 0x9560
cvttsd2si %xmm0, %eax
movl $0x1000, %ecx           # imm = 0x1000
cltd
idivl %ecx
movl %edx, %ecx
leaq 0x2c245b(%rip), %rbx    # 0x326220
leaq 0xa74da(%rip), %rsi     # 0x10b2a6
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0x9060
movq %rbx, %rdi
movl $0x1fc, %esi            # imm = 0x1FC
callq 0x576d4
leaq 0xab530(%rip), %rdi     # 0x10f31c
movl $0x1fc, %esi            # imm = 0x1FC
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
jmp 0x576d4
leaq 0x1a11cf(%rip), %rax    # 0x204fd4
movl (%rax), %eax
addl $-0x33, %eax
cmpl $0x1d, %eax
ja 0x63e22
movl $0x20004009, %ecx       # imm = 0x20004009
btl %eax, %ecx
jae 0x63e22
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
movl $0x8e, %edi
movsd %xmm0, -0x18(%rbp)
callq 0x5707f
movl $0xa0, %edi
callq 0x523f2
xorl %edi, %edi
callq 0x523f2
cvtsd2ss -0x18(%rbp), %xmm0
callq 0x52673
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
jmp 0x570f8