Lines Matching +full:random +full:- +full:mac +full:- +full:address

4  * SPDX-License-Identifier: Apache-2.0
24 #include <zephyr/random/random.h>
32 #define DEST_ADDR_OFFSET 5 /* Destination offset address*/
33 #define DEST_ADDR_TYPE_OFFSET 1 /* Destination address type */
35 #define DEST_ADDR_TYPE_MASK 0x0c /* Mask for destination address type */
37 #define DEST_ADDR_TYPE_SHORT 0x08 /* Short destination address type */
38 #define DEST_ADDR_TYPE_EXTENDED 0x0c /* Extended destination address type */
41 #define SHORT_ADDRESS_SIZE 2 /* Size of Short Mac Address */
42 #define EXTENDED_ADDRESS_SIZE 8 /* Size of Extended Mac Address */
44 /* Broadcast Short Address */
48 static uint8_t dev_short_addr[SHORT_ADDRESS_SIZE]; /* Device Short Address */
49 static uint8_t dev_ext_addr[EXTENDED_ADDRESS_SIZE]; /* Device Extended Address */
58 struct upipe_context *upipe = upipe_dev->data; in received_dest_addr_matched()
68 /* Check destination address */ in received_dest_addr_matched()
72 /* If not broadcast, check if length and address matches */ in received_dest_addr_matched()
76 (net_if_get_link_addr(upipe->iface)->len != in received_dest_addr_matched()
86 /* If not broadcast, check if length and address matches */ in received_dest_addr_matched()
87 if (net_if_get_link_addr(upipe->iface)->len != in received_dest_addr_matched()
113 upipe = upipe_dev->data; in upipe_rx()
114 if (!upipe->rx && *buf == UART_PIPE_RADIO_15_4_FRAME_TYPE) { in upipe_rx()
115 upipe->rx = true; in upipe_rx()
119 if (!upipe->rx_len) { in upipe_rx()
124 upipe->rx_len = *buf; in upipe_rx()
128 upipe->rx_buf[upipe->rx_off++] = *buf; in upipe_rx()
130 if (upipe->rx_len == upipe->rx_off) { in upipe_rx()
131 pkt = net_pkt_rx_alloc_with_buffer(upipe->iface, upipe->rx_len, in upipe_rx()
138 if (net_pkt_write(pkt, upipe->rx_buf, upipe->rx_len)) { in upipe_rx()
144 if (received_dest_addr_matched(pkt->buffer->data) == false) { in upipe_rx()
150 if (ieee802154_handle_ack(upipe->iface, pkt) == NET_OK) { in upipe_rx()
155 LOG_DBG("Caught a packet (%u)", upipe->rx_len); in upipe_rx()
156 if (net_recv_data(upipe->iface, pkt) < 0) { in upipe_rx()
165 upipe->rx = false; in upipe_rx()
166 upipe->rx_len = 0U; in upipe_rx()
167 upipe->rx_off = 0U; in upipe_rx()
182 struct upipe_context *upipe = dev->data; in upipe_cca()
184 if (upipe->stopped) { in upipe_cca()
185 return -EIO; in upipe_cca()
241 return -ENOTSUP; in upipe_filter()
245 return upipe_set_ieee_addr(dev, filter->ieee_addr); in upipe_filter()
247 return upipe_set_short_addr(dev, filter->short_addr); in upipe_filter()
249 return upipe_set_pan_id(dev, filter->pan_id); in upipe_filter()
252 return -ENOTSUP; in upipe_filter()
268 struct upipe_context *upipe = dev->data; in upipe_tx()
269 uint8_t *pkt_buf = frag->data; in upipe_tx()
270 uint8_t len = frag->len; in upipe_tx()
275 return -ENOTSUP; in upipe_tx()
280 if (upipe->stopped) { in upipe_tx()
281 return -EIO; in upipe_tx()
299 struct upipe_context *upipe = dev->data; in upipe_start()
301 if (!upipe->stopped) { in upipe_start()
302 return -EALREADY; in upipe_start()
305 upipe->stopped = false; in upipe_start()
312 struct upipe_context *upipe = dev->data; in upipe_stop()
314 if (upipe->stopped) { in upipe_stop()
315 return -EALREADY; in upipe_stop()
318 upipe->stopped = true; in upipe_stop()
323 /* driver-allocated attribute memory - constant across all driver instances */
339 struct upipe_context *upipe = dev->data; in upipe_init()
343 uart_pipe_register(upipe->uart_pipe_buf, 1, upipe_rx); in upipe_init()
352 struct upipe_context *upipe = dev->data; in get_mac()
354 upipe->mac_addr[0] = 0x00; in get_mac()
355 upipe->mac_addr[1] = 0x10; in get_mac()
356 upipe->mac_addr[2] = 0x20; in get_mac()
357 upipe->mac_addr[3] = 0x30; in get_mac()
360 sys_rand_get(&upipe->mac_addr[4], 4U); in get_mac()
362 upipe->mac_addr[4] = CONFIG_IEEE802154_UPIPE_MAC4; in get_mac()
363 upipe->mac_addr[5] = CONFIG_IEEE802154_UPIPE_MAC5; in get_mac()
364 upipe->mac_addr[6] = CONFIG_IEEE802154_UPIPE_MAC6; in get_mac()
365 upipe->mac_addr[7] = CONFIG_IEEE802154_UPIPE_MAC7; in get_mac()
368 return upipe->mac_addr; in get_mac()
374 struct upipe_context *upipe = dev->data; in upipe_iface_init()
375 uint8_t *mac = get_mac(dev); in upipe_iface_init() local
377 net_if_set_link_addr(iface, mac, 8, NET_LINK_IEEE802154); in upipe_iface_init()
380 upipe->iface = iface; in upipe_iface_init()