Changeset 6673 for branches/rel10_ifa/psModules/src/astrom/pmFPAConstruct.c
- Timestamp:
- Mar 22, 2006, 5:09:57 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/rel10_ifa/psModules/src/astrom/pmFPAConstruct.c
r6663 r6673 9 9 #include "pmFPAConstruct.h" 10 10 #include "pmFPAview.h" 11 #include "pmFPAUtils.h" 11 12 12 13 ////////////////////////////////////////////////////////////////////////////////////////////////////////////// … … 32 33 33 34 return cellData; 34 }35 36 // Find a chip by name; return the index37 static int findChip(pmFPA *fpa, // FPA in which to find the chip38 const char *name // Name of the chip39 )40 {41 psArray *chips = fpa->chips; // Array of chips42 for (int i = 0; i < chips->n; i++) {43 pmChip *chip = chips->data[i]; // The chip of interest44 psString testName = psMetadataLookupStr(NULL, chip->concepts, "CHIP.NAME"); // Name of this chip45 if (strcmp(name, testName) == 0) {46 return i;47 }48 }49 50 psError(PS_ERR_IO, true, "Unable to find chip %s\n", name);51 return -1;52 }53 54 // Find a cell by name; return the index55 static int findCell(pmChip *chip, // Chip in which to find the cell56 const char *name // Name of the cell57 )58 {59 psArray *cells = chip->cells; // Array of cells60 for (int i = 0; i < cells->n; i++) {61 pmCell *cell = cells->data[i]; // The cell of interest62 psString testName = psMetadataLookupStr(NULL, cell->concepts, "CELL.NAME"); // Name of this cell63 if (strcmp(name, testName) == 0) {64 return i;65 }66 }67 68 psError(PS_ERR_IO, true, "Unable to find cell %s\n", name);69 return -1;70 35 } 71 36 … … 232 197 // Get the chip 233 198 phuChipName = phuNameFromHeader("CHIP.NAME", formatSpec, phu); // Name of the chip 234 int chipNum = findChip(fpa, phuChipName); // Chip number199 int chipNum = pmFPAFindChip(fpa, phuChipName); // Chip number 235 200 if (chipNum == -1) { 236 201 psError(PS_ERR_IO, true, "Unable to find chip %s in FPA.\n", phuChipName); … … 257 222 // Added this for possible future plans which might allow PHU=CELL 258 223 phuCellName = phuNameFromHeader("CELL.NAME", formatSpec, phu); // Name of the cell 259 int cellNum = findCell(chip, phuCellName); // Cell number224 int cellNum = pmChipFindCell(chip, phuCellName); // Cell number 260 225 if (cellNum == -1) { 261 226 psError(PS_ERR_IO, true, "Unable to find cell %s in chip %s.\n", phuCellName, phuChipName); … … 330 295 "(%s) --- there may be problems when reading!\n", chipName, phuChipName); 331 296 // Find the other chip 332 int chipNum = findChip(fpa, chipName); // The chip we're looking for297 int chipNum = pmFPAFindChip(fpa, chipName); // The chip we're looking for 333 298 if (chipNum == -1) { 334 299 psLogMsg(__func__, PS_LOG_WARN, "Unable to find chip %s in fpa --- ignored.\n", chipName); … … 338 303 } 339 304 psString cellName = values->data[i]; // The name of the cell specified 340 int cellNum = findCell(chip, cellName); // The cell we're looking for305 int cellNum = pmChipFindCell(chip, cellName); // The cell we're looking for 341 306 if (cellNum == -1) { 342 307 psLogMsg(__func__, PS_LOG_WARN, "Unable to find cell %s in chip %s --- ignored.\n", … … 388 353 psString chipName = names->data[i]; // The name of the chip 389 354 psString cellName = values->data[i]; // The name of the cell 390 int chipNum = findChip(fpa, chipName); // The chip we're looking for355 int chipNum = pmFPAFindChip(fpa, chipName); // The chip we're looking for 391 356 if (chipNum == -1) { 392 357 psLogMsg(__func__, PS_LOG_WARN, "Unable to find chip %s in FPA --- ignored.\n", chipName); … … 394 359 } 395 360 chip = fpa->chips->data[chipNum]; 396 int cellNum = findCell(chip, cellName); // The cell we're looking for361 int cellNum = pmChipFindCell(chip, cellName); // The cell we're looking for 397 362 if (cellNum == -1) { 398 363 psLogMsg(__func__, PS_LOG_WARN, "Unable to find cell %s in chip %s --- ignored\n", … … 429 394 // Need to look up the name of the chip 430 395 chipName = phuNameFromHeader("CHIP.NAME", formatSpec, phu); 431 int chipNum = findChip(fpa, chipName);396 int chipNum = pmFPAFindChip(fpa, chipName); 432 397 if (chipNum == -1) { 433 398 psLogMsg(__func__, PS_LOG_WARN, "Unable to find chip %s in FPA --- ignored.\n", chipName); … … 444 409 chipName = names->data[i]; 445 410 cellName = cellType; 446 int chipNum = findChip(fpa, chipName); // The chip we're looking for411 int chipNum = pmFPAFindChip(fpa, chipName); // The chip we're looking for 447 412 if (chipNum == -1) { 448 413 psLogMsg(__func__, PS_LOG_WARN, "Unable to find chip %s in FPA --- ignored.\n", … … 455 420 cellName = names->data[i]; 456 421 } 457 int cellNum = findCell(chip, cellName); // The cell we're looking for422 int cellNum = pmChipFindCell(chip, cellName); // The cell we're looking for 458 423 if (cellNum == -1) { 459 424 psLogMsg(__func__, PS_LOG_WARN, "Unable to find cell %s in chip %s --- ignored.\n",
Note:
See TracChangeset
for help on using the changeset viewer.
