/* This function will mask oldest entry in FIFO as released making space for another received frame. This function can be used if fdcan_receive was called using release = false. If used in other case, then messages can get lost. */
void fdcan_release_fifo(uint32_t canport, uint8_t fifo_id)
/* This function will mask oldest entry in FIFO as released making space for another received frame. This function can be used if fdcan_receive was called using release = false. If used in other case, then messages can get lost. */
void fdcan_release_fifo(uint32_t canport, uint8_t fifo_id)
{
	unsigned pending_frames, get_index;
	get_index = (FDCAN_RXFIS(canport, fifo_id) >> FDCAN_RXFIFO_GI_SHIFT)
		& FDCAN_RXFIFO_GI_SHIFT;
	pending_frames = (FDCAN_RXFIS(canport, fifo_id) >> FDCAN_RXFIFO_FL_SHIFT)
		& FDCAN_RXFIFO_FL_SHIFT;
	if (pending_frames) {
		FDCAN_RXFIA(canport, fifo_id) |= get_index << FDCAN_RXFIFO_AI_SHIFT;
	}
}