コード例 #1
0
/**
 * @brief  Enables or disables the SSPx/I2Sx DMA interface.
 * @param  SSPx: where x can be
 *   - SSP0, SSP1 
 * @param  SSP_DMAReq: specifies the SSP DMA transfer request to be enabled or disabled. 
 *   This parameter can be any combination of the following values:
 *     @arg SSP_DMAReq_Tx: Tx buffer DMA transfer request
 *     @arg SSP_DMAReq_Rx: Rx buffer DMA transfer request
 * @param  NewState: new state of the selected SSP DMA transfer request.
 *   This parameter can be: ENABLE or DISABLE.
 * @retval None
 */
void SSP_DMACmd(SSP_TypeDef* SSPx, uint32_t SSP_DMAReq, FunctionalState NewState)
{
    /* Check the parameters */
    assert_param(IS_SSP_ALL_PERIPH(SSPx));
    assert_param(IS_FUNCTIONAL_STATE(NewState));
    assert_param(IS_SSP_DMAREQ(SSP_DMAReq));
    if (NewState != DISABLE)
    {
        /* Enable the selected SSP DMA requests */
        SSPx->DMACR |= SSP_DMAReq;
    }
    else
    {
        /* Disable the selected SSP/I2S DMA requests */
        SSPx->DMACR &= ~SSP_DMAReq;
    }
}
コード例 #2
0
/**
  * @brief  Enables or disables the SSP’s DMA interface.
  * @param  SSPx: Select the SSP peripheral.
  *         This parameter can be one of the following values:
  *         SSP1, SSP2.
  * @param  SSP_DMAReq: specifies the DMA request.
  *         This parameter can be any combination of the following values:
  *           @arg SSP_DMA_RXE: SSP DMA receive request
  *           @arg SSP_DMA_TXE: SSP DMA transmit request
  * @param  NewState: new state of the DMA Request sources.
  *         This parameter can be: ENABLE or DISABLE.
  * @note The DMA mode is not available for SSP5.
  * @retval None
  */
void SSP_DMACmd(MDR_SSP_TypeDef* SSPx, uint32_t SSP_DMAReq, FunctionalState NewState)
{
  /* Check the parameters */
  assert_param(IS_SSP_ALL_PERIPH(SSPx));
  assert_param(IS_SSP_DMAREQ(SSP_DMAReq));
  assert_param(IS_FUNCTIONAL_STATE(NewState));

  if (NewState != DISABLE)
  {
    /* Enable the DMA transfer for selected requests in the SSP DMACR register */
    SSPx->DMACR |= SSP_DMAReq;
  }
  else
  {
    /* Disable the DMA transfer for selected requests in the SSP DMACR register */
    SSPx->DMACR &= (uint16_t)~SSP_DMAReq;
  }
}