Merged in merlin17/nuttx/beacon802154 (pull request #435)

ieee802154:  Minor updates

Approved-by: Gregory Nutt <gnutt@nuttx.org>
This commit is contained in:
Anthony Merlino 2017-07-17 07:42:25 +00:00 committed by Gregory Nutt
commit c80e0d9d8d
10 changed files with 47 additions and 47 deletions

View File

@ -413,8 +413,6 @@ void mrf24j40_setup_fifo(FAR struct mrf24j40_radio_s *dev, FAR const uint8_t *bu
}
}
/****************************************************************************
* Public Functions
****************************************************************************/

View File

@ -388,6 +388,7 @@ void mrf24j40_irqworker(FAR void *arg)
mrf24j40_setreg(dev->spi, MRF24J40_BEACON_FIFO + 4, dev->bsn++);
mrf24j40_beacon_trigger(dev);
wlinfo("Beacon triggered. BSN: 0x%02X\n", dev->bsn-1);
}
}

View File

@ -141,13 +141,15 @@ static void mrf24j40_setorder(FAR struct mrf24j40_radio_s *dev, uint8_t bo,
{
if (dev->devmode == IEEE802154_DEVMODE_ENDPOINT)
{
wlinfo("Configuring sleep for inactive period\n");
maincnt = (bi - sfduration) / dev->slpclkper;
remcnt = ((bi - sfduration) - (maincnt * dev->slpclkper)) / 50;
}
else
{
wlinfo("Configuring sleep for beacon interval\n");
maincnt = bi / dev->slpclkper;
remcnt = bi - (maincnt * dev->slpclkper) / 50;
remcnt = (bi - (maincnt * dev->slpclkper)) / 50;
}
wlinfo("MAINCNT: %lu, REMCNT: %lu\n", maincnt, remcnt);

View File

@ -632,7 +632,7 @@ union ieee802154_macattr_u
bool sec_enabled;
bool timestamp_support;
uint32_t ack_wait_dur;
uint32_t ack_waitdur;
uint8_t batt_life_ext_periods;
uint8_t max_csma_backoffs : 3;
uint8_t max_be : 4;
@ -697,17 +697,17 @@ enum ieee802154_scantype_e
struct ieee802154_frame_meta_s
{
enum ieee802154_addrmode_e srcaddr_mode; /* Source Address Mode */
struct ieee802154_addr_s destaddr; /* Destination Address */
enum ieee802154_addrmode_e srcmode; /* Source Address Mode */
struct ieee802154_addr_s destaddr; /* Destination Address */
uint8_t msdu_handle; /* Handle assoc. with MSDU */
uint8_t handle; /* User-specified handle identifier */
struct
{
uint8_t ack_tx : 1; /* Acknowledge TX? */
uint8_t gts_tx : 1; /* 1=GTS used for TX, 0=CAP used for TX */
uint8_t indirect_tx : 1; /* Should indirect transmission be used? */
} msdu_flags;
uint8_t ackreq : 1;
uint8_t usegts : 1;
uint8_t indirect : 1;
} flags;
#ifdef CONFIG_IEEE802154_SECURITY
/* Security information if enabled */
@ -718,7 +718,7 @@ struct ieee802154_frame_meta_s
#ifdef CONFIG_IEEE802154_UWB
/* The UWB Pulse Repetition Frequency to be used for the transmission */
enum ieee802154_uwbprf_e uwb_prf;
enum ieee802154_uwbprf_e uwbprf;
/* The UWB preamble symbol repititions
* Should be one of:
@ -729,7 +729,7 @@ struct ieee802154_frame_meta_s
/* The UWB Data Rate to be used for the transmission */
enum ieee802154_uwb_datarate_e data_rate;
enum ieee802154_uwb_datarate_e datarate;
#endif
enum ieee802154_ranging_e ranging;

View File

@ -80,11 +80,15 @@ struct ieee802154_txdesc_s
FAR struct ieee802154_data_conf_s *conf;
enum ieee802154_frametype_e frametype; /* Frame type. Used by MAC layer to
* control how tx done is handled */
bool framepending; /* Did the ACK have the frame pending bit
* bit set */
uint32_t purgetime; /* Time to purge transaction */
/* Frame type. Used by MAC layer to control how tx done is handled */
enum ieee802154_frametype_e frametype;
bool framepending; /* Did the ACK have the frame pending bit set */
uint32_t purgetime; /* Time to purge transaction */
uint8_t retrycount; /* Number of remaining retries. Set to macMaxFrameRetries
* when txdescriptor is allocated
*/
/* TODO: Add slotting information for GTS transactions */
};

View File

@ -163,9 +163,9 @@ int sixlowpan_meta_data(FAR struct ieee802154_driver_s *ieee,
/* Source address mode */
meta->srcaddr_mode = pktmeta->sextended != 0?
IEEE802154_ADDRMODE_EXTENDED :
IEEE802154_ADDRMODE_SHORT;
meta->srcmode = pktmeta->sextended != 0?
IEEE802154_ADDRMODE_EXTENDED :
IEEE802154_ADDRMODE_SHORT;
/* Check for a broadcast destination address (all zero) */
@ -184,7 +184,7 @@ int sixlowpan_meta_data(FAR struct ieee802154_driver_s *ieee,
if (rcvrnull)
{
meta->msdu_flags.ack_tx = TRUE;
meta->flags.ackreq = TRUE;
}
/* Destination address */
@ -223,7 +223,7 @@ int sixlowpan_meta_data(FAR struct ieee802154_driver_s *ieee,
* fragment of a disassembled packet.
*/
meta->msdu_handle = ieee->i_msdu_handle++;
meta->handle = ieee->i_msdu_handle++;
#ifdef CONFIG_IEEE802154_SECURITY
# warning CONFIG_IEEE802154_SECURITY not yet supported

View File

@ -1110,7 +1110,7 @@ static void mac802154_rxframe_worker(FAR void *arg)
case IEEE802154_FRAME_BEACON:
{
wlinfo("Beacon frame received\n");
wlinfo("Beacon frame received. BSN: 0x%02X\n", ind->dsn);
mac802154_rxbeaconframe(priv, ind);
ieee802154_ind_free(ind);
}
@ -1850,6 +1850,10 @@ static void mac802154_rxbeaconframe(FAR struct ieee802154_privmac_s *priv,
{
priv->curr_cmd = IEEE802154_CMD_DATA_REQ;
}
else if (priv->curr_op == MAC802154_OP_ASSOC)
{
priv->curr_cmd = IEEE802154_CMD_DATA_REQ;
}
else if (priv->curr_op == MAC802154_OP_NONE)
{
DEBUGASSERT(priv->opsem.semcount == 1);

View File

@ -118,7 +118,7 @@ int mac802154_req_data(MACHANDLE mac,
* 5.1.6.4 [1] pg. 118.
*/
*frame_ctrl |= (meta->msdu_flags.ack_tx << IEEE802154_FRAMECTRL_SHIFT_ACKREQ);
*frame_ctrl |= (meta->flags.ackreq << IEEE802154_FRAMECTRL_SHIFT_ACKREQ);
/* If the destination address is present, copy the PAN ID and one of the
* addresses, depending on mode, into the MHR.
@ -161,7 +161,7 @@ int mac802154_req_data(MACHANDLE mac,
* [1] pg. 41.
*/
if (meta->srcaddr_mode != IEEE802154_ADDRMODE_NONE &&
if (meta->srcmode != IEEE802154_ADDRMODE_NONE &&
meta->destaddr.mode != IEEE802154_ADDRMODE_NONE)
{
/* If the PAN identifiers are identical, the PAN ID Compression field
@ -175,7 +175,7 @@ int mac802154_req_data(MACHANDLE mac,
}
}
if (meta->srcaddr_mode != IEEE802154_ADDRMODE_NONE)
if (meta->srcmode != IEEE802154_ADDRMODE_NONE)
{
/* If the destination address is not included, or if PAN ID Compression
* is off, we need to include the Source PAN ID.
@ -188,12 +188,12 @@ int mac802154_req_data(MACHANDLE mac,
mhr_len += 2;
}
if (meta->srcaddr_mode == IEEE802154_ADDRMODE_SHORT)
if (meta->srcmode == IEEE802154_ADDRMODE_SHORT)
{
IEEE802154_SADDRCOPY(&frame->io_data[mhr_len], priv->addr.saddr);
mhr_len += 2;
}
else if (meta->srcaddr_mode == IEEE802154_ADDRMODE_EXTENDED)
else if (meta->srcmode == IEEE802154_ADDRMODE_EXTENDED)
{
IEEE802154_EADDRCOPY(&frame->io_data[mhr_len], priv->addr.eaddr);
mhr_len += IEEE802154_EADDRSIZE;
@ -214,7 +214,7 @@ int mac802154_req_data(MACHANDLE mac,
/* Set the source addr mode inside the frame control field */
*frame_ctrl |= (meta->srcaddr_mode << IEEE802154_FRAMECTRL_SHIFT_SADDR);
*frame_ctrl |= (meta->srcmode << IEEE802154_FRAMECTRL_SHIFT_SADDR);
/* Each time a data or a MAC command frame is generated, the MAC sublayer
* shall copy the value of macDSN into the Sequence Number field of the MHR
@ -255,7 +255,7 @@ int mac802154_req_data(MACHANDLE mac,
/* Then initialize the TX descriptor */
txdesc->conf->handle = meta->msdu_handle;
txdesc->conf->handle = meta->handle;
txdesc->frame = frame;
txdesc->frametype = IEEE802154_FRAME_DATA;
@ -271,7 +271,7 @@ int mac802154_req_data(MACHANDLE mac,
* [1] pg. 118.
*/
if (meta->msdu_flags.gts_tx)
if (meta->flags.usegts)
{
/* TODO: Support GTS transmission. This should just change where we link
* the transaction. Instead of going in the CSMA transaction list, it
@ -291,7 +291,7 @@ int mac802154_req_data(MACHANDLE mac,
* described in 5.1.5 and 5.1.6.3. [1]
*/
if (meta->msdu_flags.indirect_tx)
if (meta->flags.indirect)
{
/* If the TxOptions parameter specifies that an indirect transmission
* is required and if the device receiving this primitive is not a

View File

@ -76,14 +76,14 @@ int mac802154_get_mhrlen(MACHANDLE mac,
* to NONE */
if (meta->destaddr.mode == IEEE802154_ADDRMODE_NONE &&
meta->srcaddr_mode == IEEE802154_ADDRMODE_NONE)
meta->srcmode == IEEE802154_ADDRMODE_NONE)
{
return -EINVAL;
}
/* The source address can only be set to NONE if the device is the PAN coord */
if (meta->srcaddr_mode == IEEE802154_ADDRMODE_NONE &&
if (meta->srcmode == IEEE802154_ADDRMODE_NONE &&
priv->devmode != IEEE802154_DEVMODE_PANCOORD)
{
return -EINVAL;
@ -95,14 +95,14 @@ int mac802154_get_mhrlen(MACHANDLE mac,
/* Add the source address length */
ret += mac802154_addr_length[ meta->srcaddr_mode];
ret += mac802154_addr_length[ meta->srcmode];
/* If both destination and source addressing information is present, the MAC
* sublayer shall compare the destination and source PAN identifiers.
* [1] pg. 41.
*/
if (meta->srcaddr_mode != IEEE802154_ADDRMODE_NONE &&
if (meta->srcmode != IEEE802154_ADDRMODE_NONE &&
meta->destaddr.mode != IEEE802154_ADDRMODE_NONE)
{
/* If the PAN identifiers are identical, the PAN ID Compression field
@ -121,7 +121,7 @@ int mac802154_get_mhrlen(MACHANDLE mac,
* PAN ID if the respective address is included
*/
if (meta->srcaddr_mode != IEEE802154_ADDRMODE_NONE)
if (meta->srcmode != IEEE802154_ADDRMODE_NONE)
{
ret += 2; /* 2 bytes for source PAN ID */
}

View File

@ -256,15 +256,6 @@ struct ieee802154_privmac_s
/****************** Uncategorized MAC PIB attributes ***********************/
/* The maximum number of symbols to wait for an acknowledgement frame to
* arrive following a transmitted data frame. [1] pg. 126
*
* NOTE: This may be able to be a 16-bit or even an 8-bit number. I wasn't
* sure at the time what the range of reasonable values was.
*/
uint32_t ack_waitdur;
/* The maximum time to wait either for a frame intended as a response to a
* data request frame or for a broadcast frame following a beacon with the
* Frame Pending field set to one. [1] pg. 127