/**
  * @brief  Enables or disables the specified SSP interrupts.
  * @param  SSPx: Select the SSP peripheral.
  *         This parameter can be one of the following values:
  *         SSP1, SSP2.
  * @param  SSP_IT: specifies the SSP interrupt sources to be enabled or disabled.
  *         This parameter can be one of the following values:
  *           @arg SSP_IT_TX
  *           @arg SSP_IT_RX
  *           @arg SSP_IT_RT
  *           @arg SSP_IT_ROR
  * @param  NewState: new state of the specified SSPx interrupts.
  *         This parameter can be: ENABLE or DISABLE.
  * @retval None
  */
void SSP_ITConfig(MDR_SSP_TypeDef* SSPx, uint32_t SSP_IT, FunctionalState NewState)
{
  /* Check the parameters */
  assert_param(IS_SSP_ALL_PERIPH(SSPx));
  assert_param(IS_SSP_CONFIG_IT(SSP_IT));
  assert_param(IS_FUNCTIONAL_STATE(NewState));

  if (NewState != DISABLE)
  {
    SSPx->IMSC |= SSP_IT;
  }
  else
  {
    SSPx->IMSC &= ~SSP_IT;
  }
}
/**
  * @brief  Checks whether the specified SSP interrupt (masked) has occurred or not.
  * @param  SSPx: Select the SSP peripheral.
  *         This parameter can be one of the following values:
  *         SSP1, SSP2.
  * @param  SSP_IT: specifies the SSP interrupt source to check.
  *         This parameter can be one of the following values:
  *           @arg SSP_IT_TX
  *           @arg SSP_IT_RX
  *           @arg SSP_IT_RT
  *           @arg SSP_IT_ROR
 * @retval The new state of SSP_IT (SET or RESET).
  */
ITStatus SSP_GetITStatusMasked(MDR_SSP_TypeDef* SSPx, uint32_t SSP_IT)
{
  ITStatus bitstatus;

  /* Check the parameters */
  assert_param(IS_SSP_ALL_PERIPH(SSPx));
  assert_param(IS_SSP_CONFIG_IT(SSP_IT));

  if (SSPx->MIS & SSP_IT)
  {
    bitstatus = SET;
  }
  else
  {
    bitstatus = RESET;
  }

  return (bitstatus);
}
/**
 * @brief  Enables or disables the specified SSP/I2S interrupts.
 * @param  SSPx: where x can be
 *   - SSP0, SSP1 
 * @param  SSP_IT: specifies the SSP interrupt source to be enabled or disabled. 
 *   This parameter can be one of the following values:
 *     @arg SSP_IT_TXIM: Tx FIFO interrupt mask
 *     @arg SSP_IT_RXIM: Rx FIFO interrupt mask
 *     @arg SSP_IT_RTIM: RX Timeout interrupt mask
 *     @arg SSP_IT_RORIM: RX overrun interrupt mask
 * @param  NewState: new state of the specified SSP/I2S interrupt.
 *   This parameter can be: ENABLE or DISABLE.
 * @retval None
 */
void SSP_ITConfig(SSP_TypeDef* SSPx, uint32_t SSP_IT, FunctionalState NewState)
{
    /* Check the parameters */
    assert_param(IS_SSP_ALL_PERIPH(SSPx));
    assert_param(IS_FUNCTIONAL_STATE(NewState));
    assert_param(IS_SSP_CONFIG_IT(SSP_IT));


    if (NewState != DISABLE)
    {
        /* Enable the selected SSP/I2S interrupt */
        SSPx->IMSC |= SSP_IT;
    }
    else
    {
        /* Disable the selected SSP/I2S interrupt */
        SSPx->IMSC &= SSP_IT;
    }
}