int onlp_sfpi_presence_bitmap_get(onlp_sfp_bitmap_t* dst) { uint32_t presence_all[2] = {0}; int port, ret, index; for (port = 0, index = 0; port < NUM_OF_SFP_PORT; port++) { if (port == 32) { index = 1; } ret = onlp_sfpi_is_present(port); if (ret == 1) { presence_all[index] |= (1<<port); } else if (ret == 0) { presence_all[index] &= ~(1<<port); } else { AIM_LOG_ERROR("Unable to read present status of port(%d).", port); } } /* Populate bitmap */ for(port = 0, index = 0; port < NUM_OF_SFP_PORT; port++) { if (port == 32) { index = 1; } AIM_BITMAP_MOD(dst, port, (presence_all[index] & 1)); presence_all[index] >>= 1; } return ONLP_STATUS_OK; }
int onlp_sfpi_presence_bitmap_get(onlp_sfp_bitmap_t* dst) { int p = 1; int rc = 0; for (p = 1; p <= QSFP_NUM; p++) { rc = onlp_sfpi_is_present(p); AIM_BITMAP_MOD(dst, p, (1 == rc) ? 1 : 0); } return ONLP_STATUS_OK; }
int onlp_sfpi_presence_bitmap_get(onlp_sfp_bitmap_t* dst) { int ii = 1; int rc = 0; for (;ii <= NUM_OF_SFP_PORT; ii++) { rc = onlp_sfpi_is_present(ii); AIM_BITMAP_MOD(dst, ii, (1 == rc) ? 1 : 0); } return ONLP_STATUS_OK; }