static void do_output_vgs (void) { size_t i; CLEANUP_FREE_LVM_VG_LIST struct guestfs_lvm_vg_list *vgs = guestfs_vgs_full (g); if (vgs == NULL) exit (EXIT_FAILURE); for (i = 0; i < vgs->len; ++i) { CLEANUP_FREE char *name = NULL; char uuid[33]; CLEANUP_FREE_STRING_LIST char **parents = NULL; if (asprintf (&name, "/dev/%s", vgs->val[i].vg_name) == -1) { perror ("asprintf"); exit (EXIT_FAILURE); } memcpy (uuid, vgs->val[i].vg_uuid, 32); uuid[32] = '\0'; parents = parents_of_vg (vgs->val[i].vg_name); write_row (name, "vg", NULL, NULL, -1, (int64_t) vgs->val[i].vg_size, parents, uuid); } }
static void do_output_blockdevs (void) { size_t i; CLEANUP_FREE_STRING_LIST char **devices = guestfs_list_devices (g); if (devices == NULL) exit (EXIT_FAILURE); for (i = 0; devices[i] != NULL; ++i) { int64_t size = -1; CLEANUP_FREE_STRING_LIST char **parents = NULL; CLEANUP_FREE char *dev; dev = guestfs_canonical_device_name (g, devices[i]); if (!dev) exit (EXIT_FAILURE); if ((columns & COLUMN_SIZE)) { size = guestfs_blockdev_getsize64 (g, devices[i]); if (size == -1) exit (EXIT_FAILURE); } if (is_md (devices[i])) parents = parents_of_md (devices[i]); else parents = no_parents (); write_row (dev, "device", NULL, NULL, -1, size, parents, NULL); } }
void board_60GHz_TX::set_gain(uint16_t tx_gain) { if (tx_gain>13) tx_gain=13; write_row(7,15+16*(13-tx_gain)); };
/* * write_sheet: * * @output: the stream * @sheet: the gnumeric sheet * * set up a table and call write_row for each row */ static void write_sheet (GsfOutput *output, Sheet *sheet, html_version_t version, GOFileSaveScope save_scope) { GnmRange total_range; gint row; switch (version) { case HTML40: case HTML40F: case XHTML: gsf_output_puts (output, "<p></p><table cellspacing=\"0\" cellpadding=\"3\">\n"); break; default: gsf_output_puts (output, "<p><table border=\"1\">\n"); break; } if (save_scope != GO_FILE_SAVE_RANGE) { gsf_output_puts (output, "<caption>"); html_print_encoded (output, sheet->name_unquoted); gsf_output_puts (output, "</caption>\n"); } total_range = sheet_get_extent (sheet, TRUE, TRUE); for (row = total_range.start.row; row <= total_range.end.row; row++) { gsf_output_puts (output, "<tr>\n"); write_row (output, sheet, row, &total_range, version); gsf_output_puts (output, "</tr>\n"); } gsf_output_puts (output, "</table>\n"); }
void save_matrix_market_format_vector(const std::string datafile, const vec & output, bool issparse, std::string comment) { MM_typecode matcode; mm_initialize_typecode(&matcode); mm_set_matrix(&matcode); mm_set_coordinate(&matcode); if (issparse) mm_set_sparse(&matcode); else mm_set_dense(&matcode); set_typecode<vec>(matcode); FILE * f = fopen(datafile.c_str(),"w"); if (f == NULL) logstream(LOG_FATAL)<<"Failed to open file: " << datafile << " for writing. " << std::endl; mm_write_banner(f, matcode); if (comment.size() > 0) // add a comment to the matrix market header fprintf(f, "%c%s\n", '%', comment.c_str()); if (issparse) mm_write_mtx_crd_size(f, output.size(), 1, output.size()); else mm_write_mtx_array_size(f, output.size(), 1); for (int j=0; j<(int)output.size(); j++){ write_row(j+1, 1, output[j], f, issparse); if (!issparse) fprintf(f, "\n"); } fclose(f); }
void board_60GHz_RX::set_gain(uint16_t rx_gain) { if (rx_gain>15) rx_gain=15; int if_att=15-rx_gain; write_row(5,15+16*if_att); // Normal operation };
/** * Writes a matrix to a generic stream */ void write_matrix(const Matrix *m, FILE *f) { write_magic(f); write_dims(f, m->rows, m->columns); int i; for (i = 0; i < m->rows; ++i) { write_row(f, m->data[i], m->columns); } }
/* * write_sheet: * * @output: the stream * @sheet: the gnumeric sheet * * set up a table and call write_row for each row */ static void write_sheet (GsfOutput *output, Sheet *sheet, GOFileSaveScope save_scope) { GnmRange total_range; gint row; total_range = sheet_get_extent (sheet, FALSE, TRUE); for (row = total_range.start.row; row <= total_range.end.row; row++) { write_row (output, sheet, row, &total_range); } gsf_output_puts (output, "---\n"); }
static void do_output_partitions (void) { size_t i; CLEANUP_FREE_STRING_LIST char **parts = guestfs_list_partitions (g); if (parts == NULL) exit (EXIT_FAILURE); for (i = 0; parts[i] != NULL; ++i) { CLEANUP_FREE char *dev = NULL, *parent_name = NULL, *canonical_name = NULL; const char *parents[2]; int64_t size = -1; int mbr_id = -1; dev = guestfs_canonical_device_name (g, parts[i]); if (!dev) exit (EXIT_FAILURE); if ((columns & COLUMN_SIZE)) { size = guestfs_blockdev_getsize64 (g, parts[i]); if (size == -1) exit (EXIT_FAILURE); } if ((columns & COLUMN_PARENTS)) { parent_name = guestfs_part_to_dev (g, parts[i]); if (parent_name == NULL) exit (EXIT_FAILURE); if ((columns & COLUMN_MBR)) mbr_id = get_mbr_id (parts[i], parent_name); canonical_name = guestfs_canonical_device_name (g, parent_name); if (!canonical_name) exit (EXIT_FAILURE); parents[0] = canonical_name; parents[1] = NULL; } write_row (dev, "partition", NULL, NULL, mbr_id, size, (char **) parents, NULL); } }
void generate(FILE *f, const int rows, const int cols) { write_magic(f); write_dims(f, rows, cols); int i; int j; DataType row[cols]; for (i = 0; i < rows; ++i) { for (j = 0; j < cols; ++j) { /* row[j] = ((int) random()) % kValueLimit; */ #ifdef MATRIX_OF_DOUBLES row[j] = random() / ((DataType) RAND_MAX); #else row[j] = ((int) random()) % kValueLimit; #endif } write_row(f, row, cols); } }
static void do_output_lvs (void) { size_t i; CLEANUP_FREE_STRING_LIST char **lvs = guestfs_lvs (g); if (lvs == NULL) exit (EXIT_FAILURE); for (i = 0; lvs[i] != NULL; ++i) { CLEANUP_FREE char *uuid = NULL, *parent_name = NULL; const char *parents[2]; int64_t size = -1; if ((columns & COLUMN_SIZE)) { size = guestfs_blockdev_getsize64 (g, lvs[i]); if (size == -1) exit (EXIT_FAILURE); } if ((columns & COLUMN_UUID)) { uuid = guestfs_lvuuid (g, lvs[i]); if (uuid == NULL) exit (EXIT_FAILURE); } if ((columns & COLUMN_PARENTS)) { parent_name = strdup (lvs[i]); if (parent_name == NULL) { perror ("strdup"); exit (EXIT_FAILURE); } char *p = strrchr (parent_name, '/'); if (p) *p = '\0'; parents[0] = parent_name; parents[1] = NULL; } write_row (lvs[i], "lv", NULL, NULL, -1, size, (char **) parents, uuid); } }
static int print_800frames(const char *frame, size_t offset, const char *end, const struct rdf_info *file_info) { static unsigned n = 0; unsigned sec, i; int ret = 0; const unsigned w = 1200, h = 800; time_t time = 0; char time_str[64], sec_str[16]; char img_fname[256]; gdImagePtr im; im = gdImageCreateTrueColor(w, h); gdImageFilledRectangle(im, 0, 0, w-1, h-1, 0x0); sec = offset / (40000*400); printf("Save picture #%u: begin at %lu (%lu frame, %u sec)\n", n++, offset, offset / 40000, sec); for(i = 0; i < h; i++){ write_row(im, i, frame, w/8); frame += FRAME_SIZE; if(frame > end){ printf("End of file\n"); ret++; break; } } snprintf(img_fname, sizeof(img_fname), "%s_%04d.png", file_info->name, sec); print_string(im, w, 10, file_info->exper); print_string(im, w, 30, file_info->station); time = file_info->time0 + sec; ctime_r(&time, time_str); time_str[strlen(time_str)-1] = 0; print_string(im, w, 50, time_str); sprintf(sec_str, "%02d:%02d", sec/60, sec%60); print_string(im, w, 70, sec_str); save_png(im, img_fname); gdImageDestroy(im); return ret; }
static void do_output_pvs (void) { size_t i; struct guestfs_lvm_pv_list *pvs = get_pvs (); for (i = 0; i < pvs->len; ++i) { char uuid[33]; const char *parents[1] = { NULL }; CLEANUP_FREE char *dev = guestfs_canonical_device_name (g, pvs->val[i].pv_name); if (!dev) exit (EXIT_FAILURE); memcpy (uuid, pvs->val[i].pv_uuid, 32); uuid[32] = '\0'; write_row (dev, "pv", NULL, NULL, -1, (int64_t) pvs->val[i].pv_size, (char **) parents, uuid); } }
board_60GHz_RX::board_60GHz_RX(uhd::usrp::dboard_iface::sptr db_iface) : board_60GHz_base(db_iface,uhd::usrp::dboard_iface::UNIT_TX, ENABLE_HMC, DATA_IN_HMC, CLK_HMC, DATA_OUT_HMC, RESET_HMC,1+2+4) { write_row(0,128); // Everthing on except ASK mod. int bb_gain1=0; // 0-3 int bb_gain2=0; // 0-3 int bb_att1=3-bb_gain1; int bb_att2=3-bb_gain2; write_row(1,bb_att2+4*bb_att1); // Power on + gain control int bb_gain_fineI=0; // 0-5 int bb_gain_fineQ=0; // 0-5 int bb_att_fineI=5-bb_gain_fineI; int bb_att_fineQ=5-bb_gain_fineQ; write_row(2,4*bb_att_fineQ+32*bb_att_fineI); // Normal operation int bb_low_pass_corner=3; // 0=>1.4GHz, 1=>500MHz, 2=> 300MHz, 3=>200MHz. int bb_high_pass_corner=2; // 0=>30kHz, 1=>300kHz, 2=>1.5MHz. write_row(3,3+16*bb_high_pass_corner+64*bb_low_pass_corner); // Normal operation write_row(4,158); // Normal operation int if_gain=15; // 0-15 int if_att=15-if_gain; write_row(5,15+16*if_att); // Normal operation write_row(6,191); // Normal operation write_row(7,109); // Normal operation write_row(8,128); // Normal operation write_row(9,0); // Normal operation write_row(10,240); // 240+DIVRATIO<4> write_row(11,16*(1+2+4)+2*3+1); // 16*DIVRATIO<3:0>+2*BAND+1 write_row(12,95); // Normal operation write_row(13,128); // Normal operation write_row(14,118); // Normal operation #if 0 for (int i1=0;i1<15;i1++) { std::cout << "reg=" << i1 << " value=" << read_row(i1) << "\n"; }; #endif std::cout << "Waiting for PLL lock \n"; int lock=read_row(15)>> 6; while (lock!=1) { std::cout << "."; usleep(1e6); lock=read_row(15)>> 6; }; std::cout << "PLL has locked! \n"; }
/* A specification for the LP file format can be found in the * ILOG CPLEX 7.0 Reference Manual page 527. * ILOG CPLEX 8.0 Reference Manual page 595. * The "Lazy Constraints" section seems to be undocumented. */ void lpf_write( const Lps* lp, FILE* fp, LpFormat format, const char* text) { const Var* var; Con* con; Con** contab; Bool have_integer = FALSE; Bool have_separate = FALSE; Bool have_checkonly = FALSE; int cnt; int i; int k; int name_size; char* name; assert(lp != NULL); assert(fp != NULL); /* Store constraint pointers and permute them * (add 1 in case lp->cons == 0) */ contab = calloc((size_t)lp->cons + 1, sizeof(*contab)); assert(contab != NULL); k = 0; for(con = lp->con_root; con != NULL; con = con->next) contab[k++] = con; assert(k == lp->cons); if (format == LP_FORM_RLP) permute(lp->cons, (void**)contab); name_size = lps_getnamesize(lp, LP_FORM_LPF); name = malloc((size_t)name_size); assert(name != NULL); if (text != NULL) fprintf(fp, "%s", text); fprintf(fp, "\\Problem name: %s\n", lp->name); fprintf(fp, "%s\n", (lp->direct == LP_MIN) ? "Minimize" : "Maximize"); fprintf(fp, " %s: ", lp->objname == NULL ? "Objective" : lp->objname); for(var = lp->var_root, cnt = 0; var != NULL; var = var->next) { /* If cost is zero, do not include in objective function */ if (mpq_equal(var->cost, const_zero)) continue; lps_makename(name, name_size, var->name, format == LP_FORM_HUM ? -1 : var->number); if (mpq_equal(var->cost, const_one)) fprintf(fp, " + %s", name); else if (mpq_equal(var->cost, const_minus_one)) fprintf(fp, " - %s", name); else { fprintf(fp, " "); write_val(fp, format, TRUE, var->cost); fprintf(fp, " %s", name); } if (++cnt % 6 == 0) fprintf(fp, "\n "); } /* ---------------------------------------------------------------------- */ /* First loop run for normal constraints, second one for * user cuts, thrid one for lazy constraints, if any. */ for(i = 0; i < 3; i++) { if (i == 0) fprintf(fp, "\nSubject to\n"); else if (i == 1) { if (!have_separate) continue; else fprintf(fp, "\nUser Cuts\n"); } else if (i == 2) { if (!have_checkonly) continue; else fprintf(fp, "\nLazy Constraints\n"); } for(k = 0; k < lp->cons; k++) { con = contab[k]; if (con->size == 0 && con->qme_first == NULL && con->term == NULL) continue; if (i == 0 && ((con->flags & (LP_FLAG_CON_SEPAR | LP_FLAG_CON_CHECK)) != 0)) { if ((con->flags & LP_FLAG_CON_SEPAR) == LP_FLAG_CON_SEPAR) have_separate = TRUE; if ((con->flags & LP_FLAG_CON_CHECK) == LP_FLAG_CON_CHECK) have_checkonly = TRUE; continue; } if (i == 1 && (con->flags & LP_FLAG_CON_SEPAR) != LP_FLAG_CON_SEPAR) continue; if (i == 2 && (con->flags & LP_FLAG_CON_CHECK) != LP_FLAG_CON_CHECK) continue; if (con->type == CON_RANGE) { if (format == LP_FORM_HUM) { lps_makename(name, name_size, con->name, -1); fprintf(fp, " %s:\n ", name); write_lhs(fp, format, con, CON_RANGE); write_row(fp, format, con, name, name_size); write_rhs(fp, format, con, CON_RANGE); } else { /* Split ranges, because LP format can't handle them. */ lps_makename(name, name_size, con->name, con->number); fprintf(fp, " %sR:\n ", name); write_row(fp, format, con, name, name_size); /* changes name */ write_rhs(fp, format, con, CON_RHS); lps_makename(name, name_size, con->name, con->number); fprintf(fp, " %sL:\n ", name); write_row(fp, format, con, name, name_size); /* changes name */ write_rhs(fp, format, con, CON_LHS); } } else { lps_makename(name, name_size, con->name, format == LP_FORM_HUM ? -1 : con->number); if (i == 0) fprintf(fp, " %s:\n ", name); else if (i == 1) fprintf(fp, " %sU:\n ", name); else if (i == 2) fprintf(fp, " %sZ:\n ", name); if (con->ind_var != NULL) { lps_makename(name, name_size, con->ind_var->name, format == LP_FORM_HUM ? -1 : con->ind_var->number); fprintf(fp, "%s = %d -> ", name, con->ind_dir ? 1 : 0); } write_row(fp, format, con, name, name_size); write_rhs(fp, format, con, con->type); } } } /* ---------------------------------------------------------------------- */ fprintf(fp, "Bounds\n"); for(var = lp->var_root; var != NULL; var = var->next) { /* A variable without any entries in the matrix * or the objective function can be ignored. * (also not part of an SOS or quadratic constraint) */ if (var->size == 0 && mpq_equal(var->cost, const_zero) && !var->is_used) continue; lps_makename(name, name_size, var->name, format == LP_FORM_HUM ? -1 : var->number); if (var->type == VAR_FIXED) { fprintf(fp, " %s = ", name); write_val(fp, format, FALSE, var->lower); fprintf(fp, "\n"); } else { /* Check if we have integer variables */ if (var->vclass == VAR_INT) have_integer = TRUE; fprintf(fp, " "); if (var->type == VAR_LOWER || var->type == VAR_BOXED) write_val(fp, format, FALSE, var->lower); else fprintf(fp, "-inf"); fprintf(fp, " <= %s <= ", name); if (var->type == VAR_UPPER || var->type == VAR_BOXED) { write_val(fp, format, FALSE, var->upper); fprintf(fp, "\n"); } else fprintf(fp, "+inf\n"); } } /* ---------------------------------------------------------------------- */ if (have_integer) { fprintf(fp, "General\n"); for(var = lp->var_root; var != NULL; var = var->next) { if (var->vclass != VAR_INT) continue; if (var->size == 0 && mpq_equal(var->cost, const_zero) && !var->is_used) continue; lps_makename(name, name_size, var->name, format == LP_FORM_HUM ? -1 : var->number); fprintf(fp, " %s\n", name); } } /* ---------------------------------------------------------------------- */ if (lps_has_sos(lp)) { const Sos* sos; const Sse* sse; fprintf(fp, "SOS\n"); for(sos = lp->sos_root; sos != NULL; sos = sos->next) { cnt = 0; fprintf(fp, " %s:S%d:: ", sos->name, sos->type == SOS_TYPE1 ? 1 : 2); for(sse = sos->first; sse != NULL; sse = sse->next) { lps_makename(name, name_size, sse->var->name, format == LP_FORM_HUM ? -1 : sse->var->number); fprintf(fp, " %s:", name); write_val(fp, format, FALSE, sse->weight); if (++cnt % 6 == 0) fputc('\n', fp); } if (cnt % 6 != 0) fputc('\n', fp); } } fprintf(fp, "End\n"); free(name); free(contab); }
static void do_output_filesystems (void) { size_t i; CLEANUP_FREE_STRING_LIST char **fses = guestfs_list_filesystems (g); if (fses == NULL) exit (EXIT_FAILURE); for (i = 0; fses[i] != NULL; i += 2) { CLEANUP_FREE char *dev = NULL, *vfs_label = NULL, *vfs_uuid = NULL; CLEANUP_FREE_STRING_LIST char **parents = NULL; int64_t size = -1; /* Skip swap and unknown, unless --extra flag was given. */ if (!(output & OUTPUT_FILESYSTEMS_EXTRA) && (STREQ (fses[i+1], "swap") || STREQ (fses[i+1], "unknown"))) continue; dev = guestfs_canonical_device_name (g, fses[i]); if (dev == NULL) exit (EXIT_FAILURE); /* Only bother to look these up if we will be displaying them, * otherwise pass them as NULL. */ if ((columns & COLUMN_VFS_LABEL)) { guestfs_push_error_handler (g, NULL, NULL); vfs_label = guestfs_vfs_label (g, fses[i]); guestfs_pop_error_handler (g); if (vfs_label == NULL) { vfs_label = strdup (""); if (!vfs_label) { perror ("strdup"); exit (EXIT_FAILURE); } } } if ((columns & COLUMN_UUID)) { guestfs_push_error_handler (g, NULL, NULL); vfs_uuid = guestfs_vfs_uuid (g, fses[i]); guestfs_pop_error_handler (g); if (vfs_uuid == NULL) { vfs_uuid = strdup (""); if (!vfs_uuid) { perror ("strdup"); exit (EXIT_FAILURE); } } } if ((columns & COLUMN_SIZE)) { size = guestfs_blockdev_getsize64 (g, fses[i]); if (size == -1) exit (EXIT_FAILURE); } if (is_md (fses[i])) parents = parents_of_md (fses[i]); else parents = no_parents (); write_row (dev, "filesystem", fses[i+1], vfs_label, -1, size, parents, vfs_uuid); } }
bool monomialOrderingToMatrix( const struct MonomialOrdering& mo, std::vector<int>& mat, bool& base_is_revlex, int& component_direction, // -1 is Down, +1 is Up, 0 is not present int& component_is_before_row // -1 means: at the end. 0 means before the // order. // and r means considered before row 'r' of the matrix. ) { // a false return value means an error has occurred. int nvars = rawNumberOfVariables(&mo); base_is_revlex = true; enum LastBlock { LEX, REVLEX, WEIGHTS, NONE }; LastBlock last = NONE; int nwts = 0; // local var used in MO_WEIGHTS section int nrows = 0; int firstvar = 0; component_direction = 0; component_is_before_row = -2; // what should the default value be? Probably: -1. size_t last_element = 0; // The vector 'mat' will be resized back to this // value if the last part of the order is lex or // revlex. for (int i = 0; i < mo.len; i++) { mon_part p = mo.array[i]; switch (p->type) { case MO_LEX: case MO_LEX2: case MO_LEX4: // printf("lex %d\n", p->nvars); last_element = mat.size(); for (int j = 0; j < p->nvars; j++) { write_row(mat, nvars, firstvar + j, 1); } last = LEX; firstvar += p->nvars; nrows += p->nvars; break; case MO_GREVLEX: case MO_GREVLEX2: case MO_GREVLEX4: // printf("grevlex %d %ld\n", p->nvars, p->wts); write_weights(mat, nvars, firstvar, p->wts, p->nvars); last_element = mat.size(); for (int j = p->nvars - 1; j >= 1; --j) { write_row(mat, nvars, firstvar + j, -1); } last = REVLEX; firstvar += p->nvars; nrows += p->nvars; break; case MO_GREVLEX_WTS: case MO_GREVLEX2_WTS: case MO_GREVLEX4_WTS: // printf("grevlex_wts %d %ld\n", p->nvars, p->wts); write_weights(mat, nvars, firstvar, p->wts, p->nvars); last_element = mat.size(); for (int j = p->nvars - 1; j >= 1; --j) { write_row(mat, nvars, firstvar + j, -1); } last = REVLEX; firstvar += p->nvars; nrows += p->nvars; break; case MO_REVLEX: // printf("revlex %d\n", p->nvars); last_element = mat.size(); for (int j = p->nvars - 1; j >= 0; --j) { write_row(mat, nvars, firstvar + j, -1); } last = REVLEX; firstvar += p->nvars; nrows += p->nvars; break; case MO_WEIGHTS: // printf("matsize= %d weights %d p->wts=%lu\n", mat.size(), // p->nvars, p->wts); nwts = (p->nvars > nvars ? nvars : p->nvars); write_weights(mat, nvars, 0, p->wts, nwts); nrows++; last_element = mat.size(); last = WEIGHTS; break; case MO_LAURENT: case MO_LAURENT_REVLEX: case MO_NC_LEX: return false; break; case MO_POSITION_UP: component_direction = 1; component_is_before_row = nrows; break; case MO_POSITION_DOWN: component_direction = -1; component_is_before_row = nrows; break; default: // DO nothing break; } } if (last == LEX) { // last block was lex, so use lex tie-breaker mat.resize(last_element); if (nrows == component_is_before_row) component_is_before_row = -1; base_is_revlex = false; } else if (last == REVLEX) { // last block was revlex, so use revlex tie-breaker if (nrows == component_is_before_row) component_is_before_row = -1; mat.resize(last_element); } else { // last block is a weight vector, so use revlex as the tie-breaker. // nothing to change here. } return true; }
board_60GHz_TX::board_60GHz_TX(uhd::usrp::dboard_iface::sptr db_iface) : board_60GHz_base(db_iface,uhd::usrp::dboard_iface::UNIT_TX, ENABLE_HMC, DATA_IN_HMC, CLK_HMC, DATA_OUT_HMC, RESET_HMC,2+4) { write_row(0,0); // Power on everything write_row(1,0); // Power on and highest Q of filter. write_row(2,240); // Taken from PC app. write_row(3,31); // Taken from PC app. write_row(4,63); // Normal operation write_row(5,244); // Normal operation write_row(6,143); // int l_tx_gain=13; // 0:13. Increasing gain. write_row(7,15+16*(13-l_tx_gain)); // Highest gain + normal operation write_row(8,191); // normal operation write_row(9,111); // normal operation // Table 10. 285.7143MHz Reference // Frequency(GHz) DIVRATIO BAND /* 57 00001 000 57.5 00010 000 58 00011 001 58.5 00100 001 59 00101 010 59.5 00110 010 60 00111 011 60.5 01000 011 61 01001 100 61.5 01010 100 62 01011 101 62.5 01100 101 63 01101 110 63.5 01110 110 64 01111 111 */ write_row(10,240); // 240+DIVRATIO<4> write_row(11,16*(1+2+4)+2*3+1); // 16*DIVRATIO<3:0>+2*BAND+1 write_row(12,95); // Syntesizer parameters (lock window) write_row(13,128); // normal operation (synths on) write_row(14,118); // normal operation #if 0 for (int i1=0;i1<15;i1++) { std::cout << "reg=" << i1 << " value=" << read_row(i1) << "\n"; }; #endif std::cout << "Waiting for PLL lock \n"; int lock=read_row(15)>> 6; while (lock!=1) { std::cout << "."; usleep(1e6); lock=read_row(15)>> 6; }; std::cout << "PLL has locked! \n"; }