/* Examines transmit buffer allocation in message RAM and returns ID of buffer, which is free. */
static int fdcan_get_free_txbuf(uint32_t canport)
/* Examines transmit buffer allocation in message RAM and returns ID of buffer, which is free. */
static int fdcan_get_free_txbuf(uint32_t canport)
{
	if ((FDCAN_TXBRP(canport) & FDCAN_TXBRP_TRP0) == 0) {
		return 0;
	} else if ((FDCAN_TXBRP(canport) & FDCAN_TXBRP_TRP1) == 0) {
		return 1;
	} else if ((FDCAN_TXBRP(canport) & FDCAN_TXBRP_TRP2) == 0) {
		return 2;
	}
	return FDCAN_E_BUSY;
}