Lines Matching full:alloc
191 static status_t mcux_flexcan_mb_start(const struct device *dev, int alloc) in mcux_flexcan_mb_start() argument
198 __ASSERT_NO_MSG(alloc >= 0 && alloc < ARRAY_SIZE(data->rx_cbs)); in mcux_flexcan_mb_start()
200 xfer.mbIdx = ALLOC_IDX_TO_RXMB_IDX(alloc); in mcux_flexcan_mb_start()
204 xfer.framefd = &data->rx_cbs[alloc].frame.fd; in mcux_flexcan_mb_start()
205 FLEXCAN_SetFDRxMbConfig(config->base, ALLOC_IDX_TO_RXMB_IDX(alloc), in mcux_flexcan_mb_start()
206 &data->rx_cbs[alloc].mb_config, true); in mcux_flexcan_mb_start()
210 xfer.frame = &data->rx_cbs[alloc].frame.classic; in mcux_flexcan_mb_start()
211 FLEXCAN_SetRxMbConfig(config->base, ALLOC_IDX_TO_RXMB_IDX(alloc), in mcux_flexcan_mb_start()
212 &data->rx_cbs[alloc].mb_config, true); in mcux_flexcan_mb_start()
221 static void mcux_flexcan_mb_stop(const struct device *dev, int alloc) in mcux_flexcan_mb_stop() argument
226 __ASSERT_NO_MSG(alloc >= 0 && alloc < ARRAY_SIZE(data->rx_cbs)); in mcux_flexcan_mb_stop()
231 ALLOC_IDX_TO_RXMB_IDX(alloc)); in mcux_flexcan_mb_stop()
232 FLEXCAN_SetFDRxMbConfig(config->base, ALLOC_IDX_TO_RXMB_IDX(alloc), in mcux_flexcan_mb_stop()
237 ALLOC_IDX_TO_RXMB_IDX(alloc)); in mcux_flexcan_mb_stop()
238 FLEXCAN_SetRxMbConfig(config->base, ALLOC_IDX_TO_RXMB_IDX(alloc), in mcux_flexcan_mb_stop()
270 int alloc; in mcux_flexcan_start() local
276 for (alloc = RX_START_IDX; alloc < MCUX_FLEXCAN_MAX_RX; alloc++) { in mcux_flexcan_start()
277 if (atomic_test_bit(data->rx_allocs, alloc)) { in mcux_flexcan_start()
278 status = mcux_flexcan_mb_start(dev, alloc); in mcux_flexcan_start()
281 alloc, status); in mcux_flexcan_start()
328 int alloc; in mcux_flexcan_stop() local
338 for (alloc = 0; alloc < MCUX_FLEXCAN_MAX_TX; alloc++) { in mcux_flexcan_stop()
339 function = data->tx_cbs[alloc].function; in mcux_flexcan_stop()
340 arg = data->tx_cbs[alloc].arg; in mcux_flexcan_stop()
342 if (atomic_test_and_clear_bit(data->tx_allocs, alloc)) { in mcux_flexcan_stop()
346 ALLOC_IDX_TO_TXMB_IDX(alloc)); in mcux_flexcan_stop()
350 ALLOC_IDX_TO_TXMB_IDX(alloc)); in mcux_flexcan_stop()
369 for (alloc = RX_START_IDX; alloc < MCUX_FLEXCAN_MAX_RX; alloc++) { in mcux_flexcan_stop()
370 if (atomic_test_bit(data->rx_allocs, alloc)) { in mcux_flexcan_stop()
371 mcux_flexcan_mb_stop(dev, alloc); in mcux_flexcan_stop()
678 int alloc; in mcux_flexcan_send() local
717 for (alloc = 0; alloc < MCUX_FLEXCAN_MAX_TX; alloc++) { in mcux_flexcan_send()
718 if (!atomic_test_and_set_bit(data->tx_allocs, alloc)) { in mcux_flexcan_send()
723 data->tx_cbs[alloc].function = callback; in mcux_flexcan_send()
724 data->tx_cbs[alloc].arg = user_data; in mcux_flexcan_send()
725 xfer.mbIdx = ALLOC_IDX_TO_TXMB_IDX(alloc); in mcux_flexcan_send()
776 int alloc = -ENOSPC; in mcux_flexcan_add_rx_filter() local
789 alloc = i; in mcux_flexcan_add_rx_filter()
794 if (alloc == -ENOSPC) { in mcux_flexcan_add_rx_filter()
798 mcux_flexcan_can_filter_to_mbconfig(filter, &data->rx_cbs[alloc].mb_config, in mcux_flexcan_add_rx_filter()
801 data->rx_cbs[alloc].arg = user_data; in mcux_flexcan_add_rx_filter()
802 data->rx_cbs[alloc].function = callback; in mcux_flexcan_add_rx_filter()
806 config->base->RXIMR[ALLOC_IDX_TO_RXMB_IDX(alloc)] = mask; in mcux_flexcan_add_rx_filter()
816 status = mcux_flexcan_mb_start(dev, alloc); in mcux_flexcan_add_rx_filter()
819 alloc, status); in mcux_flexcan_add_rx_filter()
820 alloc = -ENOSPC; in mcux_flexcan_add_rx_filter()
829 return alloc; in mcux_flexcan_add_rx_filter()
927 int alloc; in mcux_flexcan_transfer_error_status() local
966 for (alloc = 0; alloc < MCUX_FLEXCAN_MAX_TX; alloc++) { in mcux_flexcan_transfer_error_status()
968 function = data->tx_cbs[alloc].function; in mcux_flexcan_transfer_error_status()
969 arg = data->tx_cbs[alloc].arg; in mcux_flexcan_transfer_error_status()
971 if (atomic_test_and_clear_bit(data->tx_allocs, alloc)) { in mcux_flexcan_transfer_error_status()
975 ALLOC_IDX_TO_TXMB_IDX(alloc)); in mcux_flexcan_transfer_error_status()
979 ALLOC_IDX_TO_TXMB_IDX(alloc)); in mcux_flexcan_transfer_error_status()
997 int alloc; in mcux_flexcan_transfer_tx_idle() local
999 alloc = TX_MBIDX_TO_ALLOC_IDX(mb); in mcux_flexcan_transfer_tx_idle()
1002 function = data->tx_cbs[alloc].function; in mcux_flexcan_transfer_tx_idle()
1003 arg = data->tx_cbs[alloc].arg; in mcux_flexcan_transfer_tx_idle()
1005 if (atomic_test_and_clear_bit(data->tx_allocs, alloc)) { in mcux_flexcan_transfer_tx_idle()
1021 int alloc; in mcux_flexcan_transfer_rx_idle() local
1023 alloc = RX_MBIDX_TO_ALLOC_IDX(mb); in mcux_flexcan_transfer_rx_idle()
1024 function = data->rx_cbs[alloc].function; in mcux_flexcan_transfer_rx_idle()
1025 arg = data->rx_cbs[alloc].arg; in mcux_flexcan_transfer_rx_idle()
1027 if (atomic_test_bit(data->rx_allocs, alloc)) { in mcux_flexcan_transfer_rx_idle()
1030 mcux_flexcan_fd_to_can_frame(&data->rx_cbs[alloc].frame.fd, &frame); in mcux_flexcan_transfer_rx_idle()
1033 mcux_flexcan_to_can_frame(&data->rx_cbs[alloc].frame.classic, &frame); in mcux_flexcan_transfer_rx_idle()
1043 xfer.framefd = &data->rx_cbs[alloc].frame.fd; in mcux_flexcan_transfer_rx_idle()
1049 xfer.frame = &data->rx_cbs[alloc].frame.classic; in mcux_flexcan_transfer_rx_idle()
1059 "(err = %d)", alloc, status); in mcux_flexcan_transfer_rx_idle()