# MRC Service - [API reference](https://docs.qualcomm.com/doc/80-41102-2/topic/_doxygen_rst_file__doxygen_sources_taf_mrc_interface_h.html#file-taf-mrc-interface-h) The MRC (Memory Robustness Criteria) service provides APIs to communicate with the MRC daemon (MRCD). MRCD runs in the background to support EFS2 backup/restore, system mirroring, flash scrubbing, eCall suspend, and flash access arbitration. ## IPC interfaces binding The functions of this API are provided by the **tafMRCSvc** service. bindings: { clientExe.clientComponent.taf_mrc -> tafMRCSvc.taf_mrc } Copy to clipboard ## OTA operations Use these APIs to notify MRCD about OTA lifecycle events and A/B synchronization. - [taf\_mrc\_SendOtaStartMsg()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00593_1a05a9393288ef88732c61e353cf14846d.html#Documentationa00593_1a05a9393288ef88732c61e353cf14846d) — Notifies MRCD that OTA is starting. - [taf\_mrc\_SendOtaResumeMsg()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00593_1a7f5b0162fbb6afb4e9d114972e99c2b6.html#Documentationa00593_1a7f5b0162fbb6afb4e9d114972e99c2b6) — Notifies MRCD that a paused OTA is resuming. - [taf\_mrc\_SendOtaEndMsg()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00593_1a9527b023aadc189c315fc640d6bb6c58.html#Documentationa00593_1a9527b023aadc189c315fc640d6bb6c58) — Notifies MRCD that OTA has finished. - [taf\_mrc\_SendOtaAbsyncMsg()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00593_1a14df52b13be3b706e4c1839f249917a1.html#Documentationa00593_1a14df52b13be3b706e4c1839f249917a1) — Requests MRCD to perform A/B synchronization. - [taf\_mrc\_SendSyncStatusMsg()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00593_1ac5baf44658a8e65aeb00ebb1f13f4eef.html#Documentationa00593_1ac5baf44658a8e65aeb00ebb1f13f4eef) — Reports A/B synchronization progress to MRCD. le_result_t res; // When OTA is about to start. res = taf_mrc_SendOtaStartMsg(); if (res != LE_OK) { LE_ERROR("taf_mrc_SendOtaStartMsg failed: %d", res); return; } // Perform OTA with recovery client or flash access. // When OTA is ended. res = taf_mrc_SendOtaEndMsg(TAF_MRC_OTA_OP_STATUS_SUCCESS); if (res != LE_OK) { LE_ERROR("taf_mrc_SendOtaEndMsg failed: %d", res); return; } // A/B synchronization. res = taf_mrc_SendOtaAbsyncMsg(); if (res != LE_OK) { LE_ERROR("taf_mrc_SendOtaAbsyncMsg failed: %d", res); return; } // Notify synchronization state changes. res = taf_mrc_SendSyncStatusMsg(TAF_MRC_SYNC_STATUS_INIT); if (res != LE_OK) { LE_ERROR("taf_mrc_SendSyncStatusMsg(init) failed: %d", res); return; } res = taf_mrc_SendSyncStatusMsg(TAF_MRC_SYNC_STATUS_SUCCESS); if (res != LE_OK) { LE_ERROR("taf_mrc_SendSyncStatusMsg(success) failed: %d", res); return; } Copy to clipboard ## EFS metrics operations Use these APIs to measure EFS flash health metrics. Call [taf\_mrc\_MeasureEfsMetrics()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00593_1ab26def5454af00366ca8ac4de9dccbc3.html#Documentationa00593_1ab26def5454af00366ca8ac4de9dccbc3) to get a metrics reference, use the getter APIs to read individual values, then call [taf\_mrc\_DeleteEfsMetrics()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00593_1a6833bd435c4f3c7f82a23fbcee64c9f5.html#Documentationa00593_1a6833bd435c4f3c7f82a23fbcee64c9f5) to release the reference. - [taf\_mrc\_MeasureEfsMetrics()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00593_1ab26def5454af00366ca8ac4de9dccbc3.html#Documentationa00593_1ab26def5454af00366ca8ac4de9dccbc3) — Collects EFS metrics and return a reference. - [taf\_mrc\_DeleteEfsMetrics()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00593_1a6833bd435c4f3c7f82a23fbcee64c9f5.html#Documentationa00593_1a6833bd435c4f3c7f82a23fbcee64c9f5) — Releases a metrics reference. - [taf\_mrc\_GetEfsMaxPECount()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00593_1a1d5b994cf4066c98702fc1a96a9aa6b5.html#Documentationa00593_1a1d5b994cf4066c98702fc1a96a9aa6b5) — Gets the maximum Program/Erase count. - [taf\_mrc\_GetEfsMinPECount()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00593_1afc510e820f4dbfa137b40c827060a702.html#Documentationa00593_1afc510e820f4dbfa137b40c827060a702) — Gets the minimum Program/Erase count. - [taf\_mrc\_GetEfsAvgPECount()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00593_1a3098aca3326330a39c678895a6cf28aa.html#Documentationa00593_1a3098aca3326330a39c678895a6cf28aa) — Gets the average Program/Erase count. - [taf\_mrc\_GetEfsPEStandardDeviation()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00593_1a17725e9943975a422ce9c3ddf707ecfb.html#Documentationa00593_1a17725e9943975a422ce9c3ddf707ecfb) — Gets the standard deviation of Program/Erase counts. - [taf\_mrc\_GetEfsBadBlocks()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00593_1a76ecb3713c153b7ea59ce3a4ad42b3dd.html#Documentationa00593_1a76ecb3713c153b7ea59ce3a4ad42b3dd) — Gets the bad block count. - [taf\_mrc\_GetEfsBlocksInPECountRange()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00593_1aab6a0744003b6ba5866b699c2815a7cb.html#Documentationa00593_1aab6a0744003b6ba5866b699c2815a7cb) — Gets the number of blocks in a P/E count range. - [taf\_mrc\_SetEfsBackupPeriod()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00593_1aee978f644e238f02245af7d81affaec5.html#Documentationa00593_1aee978f644e238f02245af7d81affaec5) — Sets the EFS backup timer period (in seconds). taf_mrc_MetricsRef_t metricsRef = NULL; uint32_t count = 0; uint32_t sd = 0; le_result_t res; // Measure EFS metrics. res = taf_mrc_MeasureEfsMetrics(&metricsRef); if (res != LE_OK) { LE_ERROR("taf_mrc_MeasureEfsMetrics failed: %d", res); return; } // Get the maximum program and erase count in EFS. res = taf_mrc_GetEfsMaxPECount(metricsRef, &count); if (res != LE_OK) { LE_ERROR("taf_mrc_GetEfsMaxPECount failed: %d", res); goto cleanup; } LE_INFO("Max PE count: %u", count); // Get the minimum program and erase count in EFS. res = taf_mrc_GetEfsMinPECount(metricsRef, &count); if (res != LE_OK) { LE_ERROR("taf_mrc_GetEfsMinPECount failed: %d", res); goto cleanup; } LE_INFO("Min PE count: %u", count); // Get the average program and erase count in EFS. res = taf_mrc_GetEfsAvgPECount(metricsRef, &count); if (res != LE_OK) { LE_ERROR("taf_mrc_GetEfsAvgPECount failed: %d", res); goto cleanup; } LE_INFO("Avg PE count: %u", count); // Get the standard deviation of program and erase count in EFS. res = taf_mrc_GetEfsPEStandardDeviation(metricsRef, &sd); if (res != LE_OK) { LE_ERROR("taf_mrc_GetEfsPEStandardDeviation failed: %d", res); goto cleanup; } LE_INFO("Standard deviation: %u", sd); // Get the bad block count in EFS. res = taf_mrc_GetEfsBadBlocks(metricsRef, &count); if (res != LE_OK) { LE_ERROR("taf_mrc_GetEfsBadBlocks failed: %d", res); goto cleanup; } LE_INFO("Bad block count: %u", count); // Get the number of blocks whose P/E count is within 20K-40K. res = taf_mrc_GetEfsBlocksInPECountRange(metricsRef, 20000, 40000, &count); if (res != LE_OK) { LE_ERROR("taf_mrc_GetEfsBlocksInPECountRange failed: %d", res); goto cleanup; } LE_INFO("Blocks in [20K, 40K): %u", count); // Set the period of EFS backup. res = taf_mrc_SetEfsBackupPeriod(3600); if (res != LE_OK) { LE_ERROR("taf_mrc_SetEfsBackupPeriod failed: %d", res); } *cleanup: if (metricsRef != NULL) { res = taf_mrc_DeleteEfsMetrics(metricsRef); if (res != LE_OK) { LE_ERROR("taf_mrc_DeleteEfsMetrics failed: %d", res); } } Copy to clipboard ## Toggle notification operations MRCD can request a bank toggle asynchronously. The clients subscribe to the ToggleBank operation request event, handle the request in the callback, then acknowledge the result with [taf\_mrc\_SetGpioToggleStatus()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00593_1aec208450c71e9036d001ed76a883518d.html#Documentationa00593_1aec208450c71e9036d001ed76a883518d). - [taf\_mrc\_AddToggleBankHandler()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00593_1addb9e9081608a20ff3e7967b72cb922a.html#Documentationa00593_1addb9e9081608a20ff3e7967b72cb922a) — Subscribes to bank toggle request or status from MRCD. - [taf\_mrc\_SetGpioToggleStatus()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00593_1aec208450c71e9036d001ed76a883518d.html#Documentationa00593_1aec208450c71e9036d001ed76a883518d) — Acknowledges the GPIO toggle result to MRCD. static void MyToggleBankHandler ( taf_mrc_ToggleStatus_t status, taf_mrc_Bank_t bank, taf_mrc_Error_t error, void* contextPtr ) { le_result_t res; LE_UNUSED(bank); LE_UNUSED(error); LE_UNUSED(contextPtr); if (status != TAF_MRC_TOGGLE_STATUS_REQUESTED) { return; } // Perform board-specific bank toggle handling here. res = taf_mrc_SetGpioToggleStatus(TAF_MRC_TOGGLE_STATUS_SUCCEEDED); if (res != LE_OK) { LE_ERROR("taf_mrc_SetGpioToggleStatus failed: %d", res); } } static taf_mrc_ToggleBankHandlerRef_t handlerRef = NULL; le_result_t res; handlerRef = taf_mrc_AddToggleBankHandler(MyToggleBankHandler, NULL); if (handlerRef == NULL) { LE_ERROR("taf_mrc_AddToggleBankHandler failed"); return; } // Later, when a toggle request is no longer expected, acknowledge failures explicitly. res = taf_mrc_SetGpioToggleStatus(TAF_MRC_TOGGLE_STATUS_FAILED); if (res != LE_OK) { LE_ERROR("taf_mrc_SetGpioToggleStatus(failed) returned %d", res); } Copy to clipboard Last Published: Jul 29, 2026 [Previous Topic Positioning Control](https://docs.qualcomm.com/bundle/publicresource/80-41102-2/topics/page_c_taflocPosCtrl.md) [Next Topic Network Service](https://docs.qualcomm.com/bundle/publicresource/80-41102-2/topics/page_c_tafNetwork.md)