55#define LOG_MODULE "IPC MAC"
56#define LOG_LEVEL LOG_LEVEL_INFO
60static uint32_t rx_drop_count;
65#define ACK_FRAME_LEN 3
66#define FCF_ACK_REQUEST_BIT 0x20
67#define FRAME802154_ACKFRAME 0x02
91 if((frame[0] & 0x07) == FRAME802154_ACKFRAME) {
96 if(!(frame[0] & FCF_ACK_REQUEST_BIT)) {
101 ack[0] = FRAME802154_ACKFRAME;
137 const uint8_t *frame;
157 if(len ==
ACK_FRAME_LEN && (frame[0] & 0x07) == FRAME802154_ACKFRAME) {
159 if(!shm->
rx_ack.pending) {
172 if(shm->
rx.pending) {
174 if((rx_drop_count % 100) == 1) {
175 LOG_WARN(
"RX drop (app core busy), total drops: %" PRIu32
"\n",
182 memcpy((
void *)shm->
rx.data, frame, len);
183 shm->
rx.rssi = (int8_t)packetbuf_attr(PACKETBUF_ATTR_RSSI);
184 shm->
rx.lqi = (uint8_t)packetbuf_attr(PACKETBUF_ATTR_LINK_QUALITY);
196 return NETSTACK_RADIO.on();
202 return NETSTACK_RADIO.off();
#define NRF_IPC_MAX_FRAME_LEN
Maximum 802.15.4 frame size carried over IPC.
void nrf_ipc_signal(void)
Send an IPC signal to the other core.
#define NRF_IPC_SHARED_MEM
Get a pointer to the shared memory structure.
void * packetbuf_dataptr(void)
Get a pointer to the data in the packetbuf.
uint16_t packetbuf_datalen(void)
Get the length of the data in the packetbuf.
#define RADIO_TX_MODE_SEND_ON_CCA
Radio TX mode control / retrieval.
int radio_value_t
Each radio has a set of parameters that designate the current configuration and state of the radio.
@ RADIO_RESULT_OK
The parameter was set/read successfully.
@ RADIO_PARAM_TX_MODE
Radio transmission mode determines if the radio has send on CCA (RADIO_TX_MODE_SEND_ON_CCA) enabled o...
static void send_packet(void)
This function is called by the 6lowpan code to send out a packet.
Header file for the logging system.
Include file for the Contiki low-layer network stack (NETSTACK)
#define ACK_FRAME_LEN
802.15.4 ACK frame constants.
static void packet_input(void)
Called by the radio driver process when a frame has been received.
static void send_ack_if_needed(const uint8_t *frame, int len)
Send a software ACK for a received frame if the ACK request bit is set.
IPC protocol definitions for nRF5340 dual-core communication.
Header file for the Packet buffer (packetbuf) management.
The structure of a MAC protocol driver in Contiki.
int(* on)(void)
Turn the MAC layer on.
int(* max_payload)(void)
Read out estimated max payload size based on payload in packetbuf.
int(* off)(void)
Turn the MAC layer off.
void(* init)(void)
Initialize the MAC driver.
Shared memory layout between the application core and the network core.
volatile uint32_t heartbeat
Heartbeat counter (used as IPC MAC RX frame counter).
struct nrf_ipc_shared_mem::@7 rx
Received data frame (net -> app, asynchronous).
struct nrf_ipc_shared_mem::@8 rx_ack
Received ACK frame (net -> app, asynchronous).