/* Get remain key count of specified Key Store memory.  */
uint32_t KS_GetRemainKeyCount(KS_MEM_Type mem)
/* Get remain key count of specified Key Store memory.  */
uint32_t KS_GetRemainKeyCount(KS_MEM_Type mem)
{
    uint32_t u32Reg;
    uint32_t u32SramRemain, u32FlashRemain;
    u32Reg = KS->REMKCNT;
    u32SramRemain = (u32Reg & KS_REMKCNT_RRMKCNT_Msk) >> KS_REMKCNT_RRMKCNT_Pos;
    u32FlashRemain = (u32Reg & KS_REMKCNT_FRMKCNT_Msk) >> KS_REMKCNT_FRMKCNT_Pos;
    if(mem == KS_SRAM)
        return u32SramRemain;
    else
        return u32FlashRemain;
}