/* This method block the program to wait for a message transmission. It waits either until the message is acknowledged or 5 seconds. */
int32_t can_ctrl_wait_tx(struct can_ctrl_dev *dev, bool *scs)
/* This method block the program to wait for a message transmission. It waits either until the message is acknowledged or 5 seconds. */
int32_t can_ctrl_wait_tx(struct can_ctrl_dev *dev, bool *scs)
{
	int32_t ret;
	uint32_t data = 0;
	uint32_t timeout = 5000;
	*scs = true;
	do {
		ret = can_ctrl_sfr_word_read(dev, CAN_CTRL_REG_FIFOCON(dev->tx_fifo_nr),
					     &data);
		if(ret != SUCCESS)
			return ret;
		timeout--;
		mdelay(1);
	} while(((data & FIFOCON_TXREQ_MODE(WORD_MASK)) != 0) && timeout);
	if(!timeout)
		*scs = false;
	return ret;
}