Lines Matching +full:port +full:- +full:irqs
4 * SPDX-License-Identifier: Apache-2.0
28 struct netc_eth_data *data = dev->data; in netc_eth_rx()
38 result = EP_GetRxFrameSize(&data->handle, 0, &length); in netc_eth_rx()
40 ret = -ENOBUFS; in netc_eth_rx()
46 ret = -EIO; in netc_eth_rx()
51 result = EP_ReceiveFrameCopy(&data->handle, 0, data->rx_frame, length, NULL); in netc_eth_rx()
54 ret = -EIO; in netc_eth_rx()
59 pkt = net_pkt_rx_alloc_with_buffer(data->iface, length, AF_UNSPEC, 0, NETC_TIMEOUT); in netc_eth_rx()
61 eth_stats_update_errors_rx(data->iface); in netc_eth_rx()
62 ret = -ENOBUFS; in netc_eth_rx()
66 ret = net_pkt_write(pkt, data->rx_frame, length); in netc_eth_rx()
68 eth_stats_update_errors_rx(data->iface); in netc_eth_rx()
74 ret = net_recv_data(data->iface, pkt); in netc_eth_rx()
76 eth_stats_update_errors_rx(data->iface); in netc_eth_rx()
88 struct netc_eth_data *data = dev->data; in netc_eth_rx_thread()
96 ret = k_sem_take(&data->rx_sem, K_FOREVER); in netc_eth_rx_thread()
103 while (netc_eth_rx(dev) != -ENOBUFS) { in netc_eth_rx_thread()
115 uint32_t irqs = NETC_MSGINTR->MSI[NETC_MSGINTR_CHANNEL].MSIR; in msgintr_isr() local
126 config = dev->config; in msgintr_isr()
127 data = dev->data; in msgintr_isr()
129 if (irqs & (1 << config->tx_intr_msg_data)) { in msgintr_isr()
130 EP_CleanTxIntrFlags(&data->handle, 1, 0); in msgintr_isr()
131 data->tx_done = true; in msgintr_isr()
134 if (irqs & (1 << config->rx_intr_msg_data)) { in msgintr_isr()
135 EP_CleanRxIntrFlags(&data->handle, 1); in msgintr_isr()
136 k_sem_give(&data->rx_sem); in msgintr_isr()
148 data->tx_info = *frameInfo; in netc_eth_reclaim_callback()
154 const struct netc_eth_config *config = dev->config; in netc_eth_init_common()
155 struct netc_eth_data *data = dev->data; in netc_eth_init_common()
164 config->bdr_init(&bdr_config, &rx_bdr_config, &tx_bdr_config); in netc_eth_init_common()
170 msix_entry[NETC_TX_MSIX_ENTRY_IDX].msgData = config->tx_intr_msg_data; in netc_eth_init_common()
174 msix_entry[NETC_RX_MSIX_ENTRY_IDX].msgData = config->rx_intr_msg_data; in netc_eth_init_common()
183 ep_config.si = config->si_idx; in netc_eth_init_common()
190 ep_config.port.ethMac.miiMode = kNETC_RmiiMode; in netc_eth_init_common()
191 ep_config.port.ethMac.miiSpeed = kNETC_MiiSpeed100M; in netc_eth_init_common()
192 ep_config.port.ethMac.miiDuplex = kNETC_MiiFullDuplex; in netc_eth_init_common()
196 config->generate_mac(&data->mac_addr[0]); in netc_eth_init_common()
198 result = EP_Init(&data->handle, &data->mac_addr[0], &ep_config, &bdr_config); in netc_eth_init_common()
200 return -ENOBUFS; in netc_eth_init_common()
211 EP_MsixSetEntryMask(&data->handle, NETC_TX_MSIX_ENTRY_IDX, false); in netc_eth_init_common()
212 EP_MsixSetEntryMask(&data->handle, NETC_RX_MSIX_ENTRY_IDX, false); in netc_eth_init_common()
214 k_mutex_init(&data->tx_mutex); in netc_eth_init_common()
216 k_sem_init(&data->rx_sem, 0, 1); in netc_eth_init_common()
217 k_thread_create(&data->rx_thread, data->rx_thread_stack, in netc_eth_init_common()
218 K_KERNEL_STACK_SIZEOF(data->rx_thread_stack), netc_eth_rx_thread, in netc_eth_init_common()
221 k_thread_name_set(&data->rx_thread, "netc_eth_rx"); in netc_eth_init_common()
228 struct netc_eth_data *data = dev->data; in netc_eth_tx()
229 netc_buffer_struct_t buff = {.buffer = data->tx_buff, .length = sizeof(data->tx_buff)}; in netc_eth_tx()
237 k_mutex_lock(&data->tx_mutex, K_FOREVER); in netc_eth_tx()
244 ret = -ENOBUFS; in netc_eth_tx()
249 data->tx_done = false; in netc_eth_tx()
250 result = EP_SendFrame(&data->handle, 0, &frame, NULL, NULL); in netc_eth_tx()
253 ret = -EIO; in netc_eth_tx()
257 while (!data->tx_done) { in netc_eth_tx()
260 EP_ReclaimTxDescriptor(&data->handle, 0); in netc_eth_tx()
261 if (data->tx_info.status != kNETC_EPTxSuccess) { in netc_eth_tx()
263 ret = -EIO; in netc_eth_tx()
268 k_mutex_unlock(&data->tx_mutex); in netc_eth_tx()
271 eth_stats_update_errors_tx(data->iface); in netc_eth_tx()
294 struct netc_eth_data *data = dev->data; in netc_eth_set_config()
295 const struct netc_eth_config *cfg = dev->config; in netc_eth_set_config()
302 memcpy(data->mac_addr, config->mac_address.addr, sizeof(data->mac_addr)); in netc_eth_set_config()
303 result = EP_SetPrimaryMacAddr(&data->handle, (uint8_t *)data->mac_addr); in netc_eth_set_config()
305 LOG_ERR("PHY device (%p) is not ready, cannot init iface", cfg->phy_dev); in netc_eth_set_config()
306 ret = -ENOTSUP; in netc_eth_set_config()
309 net_if_set_link_addr(data->iface, data->mac_addr, sizeof(data->mac_addr), in netc_eth_set_config()
311 LOG_INF("SI%d MAC set to: %02x:%02x:%02x:%02x:%02x:%02x", getSiIdx(cfg->si_idx), in netc_eth_set_config()
312 data->mac_addr[0], data->mac_addr[1], data->mac_addr[2], data->mac_addr[3], in netc_eth_set_config()
313 data->mac_addr[4], data->mac_addr[5]); in netc_eth_set_config()
316 ret = -ENOTSUP; in netc_eth_set_config()