/* param base XRDC2 peripheral base address. param mem Which memory region descriptor to set. param valid True to set valid, false to set invalid.  */
void XRDC2_SetMemAccessValid(XRDC2_Type *base, xrdc2_mem_t mem, bool valid)
/* param base XRDC2 peripheral base address. param mem Which memory region descriptor to set. param valid True to set valid, false to set invalid.  */
void XRDC2_SetMemAccessValid(XRDC2_Type *base, xrdc2_mem_t mem, bool valid)
{
    uint32_t mrc  = XRDC2_GET_MRC((uint32_t)mem);
    uint32_t mrgd = XRDC2_GET_MRGD((uint32_t)mem);
    uint32_t reg  = base->MRCI_MRGDJ[mrc][mrgd].MRC_MRGD_W6 & ~XRDC2_EAL_MASK;
    if (valid)
    {
        base->MRCI_MRGDJ[mrc][mrgd].MRC_MRGD_W6 = (reg | XRDC2_MRC_MRGD_W6_VLD_MASK);
    }
    else
    {
        base->MRCI_MRGDJ[mrc][mrgd].MRC_MRGD_W6 = (reg & ~XRDC2_MRC_MRGD_W6_VLD_MASK);
    }
}