/* ===================================================================*/ LDD_TError SMasterLdd1_ReceiveBlock(LDD_TDeviceData *DeviceDataPtr, LDD_TData *BufferPtr, uint16_t Size) { if (((SMasterLdd1_TDeviceDataPtr)DeviceDataPtr)->InpDataNumReq != 0x00U) { /* Is the previous receive operation pending? */ return ERR_BUSY; /* If yes then error */ } /* {Default RTOS Adapter} Critical section begin, general PE function is used */ EnterCritical(); ((SMasterLdd1_TDeviceDataPtr)DeviceDataPtr)->InpDataPtr = (uint8_t*)BufferPtr; /* Store a pointer to the input data. */ ((SMasterLdd1_TDeviceDataPtr)DeviceDataPtr)->InpDataNumReq = Size; /* Store a number of characters to be received. */ ((SMasterLdd1_TDeviceDataPtr)DeviceDataPtr)->InpRecvDataNum = 0x00U; /* Set number of received characters to zero. */ if ((SPI_PDD_ReadStatusReg(SPI1_BASE_PTR) & SPI_PDD_RX_BUFFER_FULL) != 0U) { (void)SPI_PDD_ReadData8bit(SPI1_BASE_PTR); /* Dummy read of the data register */ } SPI_PDD_EnableInterruptMask(SPI1_BASE_PTR, SPI_PDD_RX_BUFFER_FULL_OR_FAULT); /* Enable Rx buffer full interrupt */ /* {Default RTOS Adapter} Critical section end, general PE function is used */ ExitCritical(); return ERR_OK; /* OK */ }
/* ===================================================================*/ LDD_TError SMasterLdd2_ReceiveBlock(LDD_TDeviceData *DeviceDataPtr, LDD_TData *BufferPtr, uint16_t Size) { if (((SMasterLdd2_TDeviceDataPtr)DeviceDataPtr)->InpDataNumReq != 0x00U) { /* Is the previous receive operation pending? */ return ERR_BUSY; /* If yes then error */ } /* {FreeRTOS RTOS Adapter} Critical section begin (RTOS function call is defined by FreeRTOS RTOS Adapter property) */ taskENTER_CRITICAL(); ((SMasterLdd2_TDeviceDataPtr)DeviceDataPtr)->InpDataPtr = (uint8_t*)BufferPtr; /* Store a pointer to the input data. */ ((SMasterLdd2_TDeviceDataPtr)DeviceDataPtr)->InpDataNumReq = Size; /* Store a number of characters to be received. */ ((SMasterLdd2_TDeviceDataPtr)DeviceDataPtr)->InpRecvDataNum = 0x00U; /* Set number of received characters to zero. */ if ((SPI_PDD_ReadStatusReg(SPI0_BASE_PTR) & SPI_PDD_RX_BUFFER_FULL) != 0U) { (void)SPI_PDD_ReadData8bit(SPI0_BASE_PTR); /* Dummy read of the data register */ } SPI_PDD_EnableInterruptMask(SPI0_BASE_PTR, SPI_PDD_RX_BUFFER_FULL_OR_FAULT); /* Enable Rx buffer full interrupt */ /* {FreeRTOS RTOS Adapter} Critical section ends (RTOS function call is defined by FreeRTOS RTOS Adapter property) */ taskEXIT_CRITICAL(); return ERR_OK; /* OK */ }