FreeCalypso > hg > fc-rfcal-tools
comparison cmu200/vcxocal.c @ 7:948031e6de50
fc-cmu200d: vcxo-cal-setup implemented
| author | Mychaela Falconia <falcon@freecalypso.org> |
|---|---|
| date | Sun, 21 May 2017 08:03:35 +0000 |
| parents | |
| children | c873a36a16e6 |
comparison
equal
deleted
inserted
replaced
| 6:d8cbc7a383eb | 7:948031e6de50 |
|---|---|
| 1 /* | |
| 2 * This module implements the VCXO calibration support functionality. | |
| 3 */ | |
| 4 | |
| 5 #include <stdio.h> | |
| 6 #include <stdlib.h> | |
| 7 #include <string.h> | |
| 8 #include <strings.h> | |
| 9 #include "mode.h" | |
| 10 #include "band.h" | |
| 11 | |
| 12 extern char *client_cmd_fields[]; | |
| 13 extern int client_cmd_nfields; | |
| 14 | |
| 15 extern int current_mode; | |
| 16 extern struct band *current_band; | |
| 17 | |
| 18 cmd_vcxo_cal_setup() | |
| 19 { | |
| 20 int rc; | |
| 21 unsigned arfcn; | |
| 22 char cmdstr[32]; | |
| 23 | |
| 24 if (client_cmd_nfields != 3) { | |
| 25 send_socket_response("-Wrong number of arguments\n"); | |
| 26 return(0); | |
| 27 } | |
| 28 stop_signal_gen(); | |
| 29 current_mode = OP_MODE_UNDEF; | |
| 30 rc = find_named_band(client_cmd_fields[1]); | |
| 31 if (rc < 0) { | |
| 32 send_socket_response("-Invalid band argument\n"); | |
| 33 return(0); | |
| 34 } | |
| 35 arfcn = atoi(client_cmd_fields[2]); | |
| 36 if (verify_arfcn(arfcn, 0, 0) < 0) { | |
| 37 send_socket_response("-Invalid ARFCN\n"); | |
| 38 return(0); | |
| 39 } | |
| 40 sprintf(cmdstr, "*SEC %d\n", current_band->secaddr); | |
| 41 send_scpi_cmd(cmdstr); | |
| 42 sprintf(cmdstr, "RFAN:CHAN %uCH\n", arfcn); | |
| 43 send_scpi_cmd(cmdstr); | |
| 44 send_scpi_cmd("RFAN:TSEQ GSM5\n"); | |
| 45 current_mode = OP_MODE_VCXO_CAL; | |
| 46 send_socket_response("+OK\n"); | |
| 47 return(0); | |
| 48 } |
