Exemplo n.º 1
0
/*
** ===================================================================
**     Method      :  HWEnDi (component SPISlave_LDD)
**
**     Description :
**         Enables or disables the peripheral(s) associated with the 
**         component. The method is called automatically as a part of the 
**         Enable and Disable methods and several internal methods.
**         This method is internal. It is used by Processor Expert only.
** ===================================================================
*/
static void HWEnDi(LDD_TDeviceData *DeviceDataPtr)
{
  SS_SPI1_TDeviceData* DeviceDataPrv = (SS_SPI1_TDeviceData*)DeviceDataPtr;

  if (DeviceDataPrv->EnUser) {         /* Enable device? */
    SPI_PDD_EnableDevice(SPI1_BASE_PTR,PDD_ENABLE); /* Enable device */
  } else {
    SPI_PDD_EnableDevice(SPI1_BASE_PTR,PDD_DISABLE); /* Disable device */
  }
}
Exemplo n.º 2
0
/*
** ===================================================================
**     Method      :  HWEnDi (component SPIMaster_LDD)
**
**     Description :
**         Enables or disables the peripheral(s) associated with the 
**         component. The method is called automatically as a part of the 
**         Enable and Disable methods and several internal methods.
**         This method is internal. It is used by Processor Expert only.
** ===================================================================
*/
static void HWEnDi(LDD_TDeviceData *DeviceDataPtr)
{
  if (((SPI_SD_TDeviceDataPtr)DeviceDataPtr)->EnMode) { /* Enable device? */
    ((SPI_SD_TDeviceDataPtr)DeviceDataPtr)->OutDataNumReq = 0x00U; /* Clear the counter of requested outgoing characters. */
    ((SPI_SD_TDeviceDataPtr)DeviceDataPtr)->OutSentDataNum = 0x00U; /* Clear the counter of sent characters. */
    ((SPI_SD_TDeviceDataPtr)DeviceDataPtr)->InpDataNumReq = 0x00U; /* Clear the counter of requested incoming characters. */
    ((SPI_SD_TDeviceDataPtr)DeviceDataPtr)->InpRecvDataNum = 0x00U; /* Clear the counter of received characters. */
    SPI_PDD_EnableDevice(SPI1_BASE_PTR,PDD_ENABLE); /* Enable device */
    SPI_PDD_ClearTxFIFO(SPI1_BASE_PTR); /* Clear Tx FIFO */
    SPI_PDD_ClearRxFIFO(SPI1_BASE_PTR); /* Clear Rx FIFO */
    SPI_PDD_ClearInterruptFlags(SPI1_BASE_PTR,SPI_PDD_ALL_INT); /* Clear all HW flags */
    SPI_PDD_EnableHaltMode(SPI1_BASE_PTR,PDD_DISABLE); /* Leave the STOPPED mode */
  }
  else {
    SPI_PDD_EnableHaltMode(SPI1_BASE_PTR,PDD_ENABLE); /* Enter to STOPPED mode */
    SPI_PDD_EnableDevice(SPI1_BASE_PTR,PDD_DISABLE); /* Disable device */
  }
}