Пример #1
0
/**
 * @brief   Deactivates the SPI peripheral.
 *
 * @param[in] spip      pointer to the @p SPIDriver object
 *
 * @notapi
 */
void spi_lld_stop(SPIDriver *spip)
{
  if (spip->state != SPI_STOP) {
    spip->ssi->CR1 = 0;
    spip->ssi->CR0 = 0;
    spip->ssi->CPSR = 0;

    udmaChannelRelease(spip->dmarxnr);
    udmaChannelRelease(spip->dmatxnr);

#if TIVA_SPI_USE_SSI0
    if (&SPID1 == spip) {
      nvicDisableVector(TIVA_SSI0_NUMBER);
    }
#endif
#if TIVA_SPI_USE_SSI1
    if (&SPID2 == spip) {
      nvicDisableVector(TIVA_SSI1_NUMBER);
    }
#endif
#if TIVA_SPI_USE_SSI2
    if (&SPID3 == spip) {
      nvicDisableVector(TIVA_SSI2_NUMBER);
    }
#endif
#if TIVA_SPI_USE_SSI3
    if (&SPID4 == spip) {
      nvicDisableVector(TIVA_SSI3_NUMBER);
    }
#endif
  }
}
Пример #2
0
/**
 * @brief   Deactivates the UART peripheral.
 *
 * @param[in] uartp     pointer to the @p UARTDriver object
 *
 * @notapi
 */
void uart_lld_stop(UARTDriver *uartp) {

  if (uartp->state == UART_READY) {
    uart_stop(uartp);
    udmaChannelRelease(uartp->dmarxnr);
    udmaChannelRelease(uartp->dmatxnr);

#if TIVA_UART_USE_UART0
    if (&UARTD1 == uartp) {
      HWREG(SYSCTL_RCGCUART) &= ~(1 << 0);
      return;
    }
#endif
#if TIVA_UART_USE_UART1
    if (&UARTD2 == uartp) {
      HWREG(SYSCTL_RCGCUART) &= ~(1 << 1);
      return;
    }
#endif
#if TIVA_UART_USE_UART2
    if (&UARTD3 == uartp) {
      HWREG(SYSCTL_RCGCUART) &= ~(1 << 2);
      return;
    }
#endif
#if TIVA_UART_USE_UART3
    if (&UARTD4 == uartp) {
      HWREG(SYSCTL_RCGCUART) &= ~(1 << 3);
      return;
    }
#endif
#if TIVA_UART_USE_UART4
    if (&UARTD5 == uartp) {
      HWREG(SYSCTL_RCGCUART) &= ~(1 << 4);
      return;
    }
#endif
#if TIVA_UART_USE_UART5
    if (&UARTD6 == uartp) {
      HWREG(SYSCTL_RCGCUART) &= ~(1 << 5);
      return;
    }
#endif
#if TIVA_UART_USE_UART6
    if (&UARTD7 == uartp) {
      HWREG(SYSCTL_RCGCUART) &= ~(1 << 6);
      return;
    }
#endif
#if TIVA_UART_USE_UART7
    if (&UARTD8 == uartp) {
      HWREG(SYSCTL_RCGCUART) &= ~(1 << 7);
      return;
    }
#endif
  }
}