/* Get remain size of specified Key Store memory.  */
uint32_t KS_GetRemainSize(KS_MEM_Type mem)
/* Get remain size of specified Key Store memory.  */
uint32_t KS_GetRemainSize(KS_MEM_Type mem)
{
    uint32_t u32Reg;
    uint32_t u32SramRemain, u32FlashRemain;
    u32Reg = KS->REMAIN;
    u32SramRemain = (u32Reg & KS_REMAIN_RRMNG_Msk) >> KS_REMAIN_RRMNG_Pos;
    u32FlashRemain = (u32Reg & KS_REMAIN_FRMNG_Msk) >> KS_REMAIN_FRMNG_Pos;
    if(mem == KS_SRAM)
        return u32SramRemain;
    else
        return u32FlashRemain;
}