TSCH: keep track of Rx channel as packetbuf attribute

This commit is contained in:
Simon Duquennoy 2016-06-23 18:35:16 +02:00
parent a8989f9f1c
commit 1acb69e280
3 changed files with 7 additions and 2 deletions

View file

@ -154,6 +154,9 @@ static rtimer_clock_t volatile current_slot_start;
/* Are we currently inside a slot? */
static volatile int tsch_in_slot_operation = 0;
/* If we are inside a slot, this tells the current channel */
static uint8_t current_channel;
/* Info about the link, packet and neighbor of
* the current (or next) slot */
struct tsch_link *current_link = NULL;
@ -780,6 +783,7 @@ PT_THREAD(tsch_rx_slot(struct pt *pt, struct rtimer *t))
NETSTACK_RADIO.get_value(RADIO_PARAM_LAST_RSSI, &radio_last_rssi);
current_input->rx_asn = current_asn;
current_input->rssi = (signed)radio_last_rssi;
current_input->channel = current_channel;
header_len = frame802154_parse((uint8_t *)current_input->payload, current_input->len, &frame);
frame_valid = header_len > 0 &&
frame802154_check_dest_panid(&frame) &&
@ -937,7 +941,6 @@ PT_THREAD(tsch_slot_operation(struct rtimer *t, void *ptr))
);
} else {
uint8_t current_channel;
int is_active_slot;
TSCH_DEBUG_SLOT_START();
tsch_in_slot_operation = 1;

View file

@ -89,7 +89,8 @@ struct input_packet {
uint8_t payload[TSCH_PACKET_MAX_LEN]; /* Packet payload */
struct asn_t rx_asn; /* ASN when the packet was received */
int len; /* Packet len */
uint16_t rssi; /* RSSI for this packet */
int16_t rssi; /* RSSI for this packet */
uint8_t channel; /* Channel we received the packet on */
};
/***** External Variables *****/

View file

@ -361,6 +361,7 @@ tsch_rx_process_pending()
/* Copy to packetbuf for processing */
packetbuf_copyfrom(current_input->payload, current_input->len);
packetbuf_set_attr(PACKETBUF_ATTR_RSSI, current_input->rssi);
packetbuf_set_attr(PACKETBUF_ATTR_CHANNEL, current_input->channel);
}
/* Remove input from ringbuf */