/* Enables and configures parameters related to FDCAN transmission. This function allows configuration of bitrate switching, FDCAN frame format and fast mode timing. This function can only be called if FDCAN block is in INIT mode. It is safe to call this function on previously configured block in order to enable/disable/change FDCAN mode parameters. Non-FDCAN parameters won't be affected. */
void fdcan_set_fdcan(uint32_t canport, bool brs_enable, bool fd_op_enable, uint32_t f_sjw, uint32_t f_ts1, uint32_t f_ts2, uint32_t f_br_presc)
/* Enables and configures parameters related to FDCAN transmission. This function allows configuration of bitrate switching, FDCAN frame format and fast mode timing. This function can only be called if FDCAN block is in INIT mode. It is safe to call this function on previously configured block in order to enable/disable/change FDCAN mode parameters. Non-FDCAN parameters won't be affected. */
void fdcan_set_fdcan(uint32_t canport, bool brs_enable, bool fd_op_enable, uint32_t f_sjw, uint32_t f_ts1, uint32_t f_ts2, uint32_t f_br_presc)
{
	FDCAN_DBTP(canport) = (f_sjw << FDCAN_DBTP_DSJW_SHIFT)
		| (f_ts1 << FDCAN_DBTP_DTSEG1_SHIFT)
		| (f_ts2 << FDCAN_DBTP_DTSEG2_SHIFT)
		| (f_br_presc << FDCAN_DBTP_DBRP_SHIFT);
	if (fd_op_enable) {
		FDCAN_CCCR(canport) |= FDCAN_CCCR_FDOE;
	} else {
		FDCAN_CCCR(canport) &= ~FDCAN_CCCR_FDOE;
	}
	if (brs_enable) {
		FDCAN_CCCR(canport) |= FDCAN_CCCR_BRSE;
	} else {
		FDCAN_CCCR(canport) &= ~FDCAN_CCCR_BRSE;
	}
}