wireless: ieee802154: nxstyle fixes
various nxstyle fixes to fix the CI complains. Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
This commit is contained in:
parent
de11caffba
commit
43ee4ae184
@ -205,11 +205,15 @@ int mac802154_req_associate(MACHANDLE mac,
|
||||
mac802154_puteaddr(iob, priv->pandesc.coordaddr.eaddr);
|
||||
}
|
||||
|
||||
/* The Source PAN Identifier field shall contain the broadcast PAN identifier. */
|
||||
/* The Source PAN Identifier field shall contain the broadcast PAN
|
||||
* identifier.
|
||||
*/
|
||||
|
||||
mac802154_putsaddr(iob, &IEEE802154_SADDR_BCAST);
|
||||
|
||||
/* The Source Address field shall contain the value of macExtendedAddress. */
|
||||
/* The Source Address field shall contain the value of
|
||||
* macExtendedAddress.
|
||||
*/
|
||||
|
||||
mac802154_puteaddr(iob, priv->addr.eaddr);
|
||||
|
||||
@ -259,7 +263,9 @@ int mac802154_req_associate(MACHANDLE mac,
|
||||
|
||||
for (i = 0; i < priv->npandesc; i++)
|
||||
{
|
||||
/* Check to make sure the beacon is from the same channel as the request */
|
||||
/* Check to make sure the beacon is from the same channel as the
|
||||
* request
|
||||
*/
|
||||
|
||||
if (req->chan != priv->pandescs[i].chan)
|
||||
{
|
||||
@ -380,11 +386,13 @@ int mac802154_resp_associate(MACHANDLE mac,
|
||||
|
||||
mac802154_puteaddr(iob, resp->devaddr);
|
||||
|
||||
/* The Source Address field shall contain the value of macExtendedAddress. */
|
||||
/* The Source Address field shall contain the value of
|
||||
* macExtendedAddress.
|
||||
*/
|
||||
|
||||
mac802154_puteaddr(iob, priv->addr.eaddr);
|
||||
|
||||
/* Copy in the Command Frame Identifier */
|
||||
/* Copy in the Command Frame Identifier */
|
||||
|
||||
iob->io_data[iob->io_len++] = IEEE802154_CMD_ASSOC_RESP;
|
||||
|
||||
@ -405,12 +413,12 @@ int mac802154_resp_associate(MACHANDLE mac,
|
||||
|
||||
/* Get exclusive access to the MAC */
|
||||
|
||||
ret = mac802154_lock(priv, true);
|
||||
if (ret < 0)
|
||||
{
|
||||
iob_free(iob, IOBUSER_WIRELESS_MAC802154);
|
||||
return ret;
|
||||
}
|
||||
ret = mac802154_lock(priv, true);
|
||||
if (ret < 0)
|
||||
{
|
||||
iob_free(iob, IOBUSER_WIRELESS_MAC802154);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Allocate the txdesc, waiting if necessary */
|
||||
|
||||
@ -553,8 +561,8 @@ void mac802154_txdone_assocreq(FAR struct ieee802154_privmac_s *priv,
|
||||
DEBUGASSERT(priv->pandesc.coordaddr.mode !=
|
||||
IEEE802154_ADDRMODE_NONE);
|
||||
|
||||
/* Off-load extracting the Association Response to the work queue to
|
||||
* avoid locking up the calling thread.
|
||||
/* Off-load extracting the Association Response to the work queue
|
||||
* to avoid locking up the calling thread.
|
||||
*/
|
||||
|
||||
DEBUGASSERT(work_available(&priv->macop_work));
|
||||
@ -655,7 +663,6 @@ void mac802154_txdone_datareq_assoc(FAR struct ieee802154_privmac_s *priv,
|
||||
|
||||
if (priv->sfspec.beaconorder == 15)
|
||||
{
|
||||
|
||||
/* Start a timer, if we receive the data frame, we will cancel
|
||||
* the timer, otherwise it will expire and we will notify the
|
||||
* next highest layer of the failure.
|
||||
@ -664,7 +671,6 @@ void mac802154_txdone_datareq_assoc(FAR struct ieee802154_privmac_s *priv,
|
||||
wlinfo("Starting timeout timer\n");
|
||||
mac802154_timerstart(priv, priv->max_frame_waittime,
|
||||
mac802154_assoctimeout);
|
||||
|
||||
}
|
||||
|
||||
/* Deallocate the data conf notification as it is no longer needed. */
|
||||
@ -837,7 +843,7 @@ void mac802154_rx_assocresp(FAR struct ieee802154_privmac_s *priv,
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Private Function
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
@ -857,8 +863,8 @@ static void mac802154_assoctimeout(FAR void *arg)
|
||||
FAR struct ieee802154_primitive_s *primitive;
|
||||
|
||||
/* If there is work scheduled for the rxframe_worker, we want to reschedule
|
||||
* this work, so that we make sure if the frame we were waiting for was just
|
||||
* received, we don't timeout
|
||||
* this work, so that we make sure if the frame we were waiting for was
|
||||
* just received, we don't timeout
|
||||
*/
|
||||
|
||||
if (!work_available(&priv->rx_work))
|
||||
@ -903,8 +909,8 @@ static void mac802154_assoctimeout(FAR void *arg)
|
||||
* Name: mac802154_extract_assocrespj
|
||||
*
|
||||
* Description:
|
||||
* Create and send a Data request command to extract the Association response
|
||||
* from the Coordinator.
|
||||
* Create and send a Data request command to extract the Association
|
||||
* response from the Coordinator.
|
||||
*
|
||||
* Assumptions:
|
||||
* Called with the MAC unlocked.
|
||||
|
@ -57,7 +57,7 @@
|
||||
#include <nuttx/wireless/ieee802154/ieee802154_mac.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Public MAC Functions
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
@ -108,7 +108,8 @@ int mac802154_req_data(MACHANDLE mac,
|
||||
* sublayer will set the Frame Version to one. [1] pg. 118.
|
||||
*/
|
||||
|
||||
if ((frame->io_len - frame->io_offset) > IEEE802154_MAX_SAFE_MAC_PAYLOAD_SIZE)
|
||||
if ((frame->io_len - frame->io_offset) >
|
||||
IEEE802154_MAX_SAFE_MAC_PAYLOAD_SIZE)
|
||||
{
|
||||
*frame_ctrl |= (1 << IEEE802154_FRAMECTRL_SHIFT_VERSION);
|
||||
}
|
||||
@ -131,16 +132,18 @@ int mac802154_req_data(MACHANDLE mac,
|
||||
|
||||
if (meta->destaddr.mode == IEEE802154_ADDRMODE_SHORT)
|
||||
{
|
||||
IEEE802154_SADDRCOPY(&frame->io_data[mhr_len], meta->destaddr.saddr);
|
||||
IEEE802154_SADDRCOPY(&frame->io_data[mhr_len],
|
||||
meta->destaddr.saddr);
|
||||
mhr_len += IEEE802154_SADDRSIZE;
|
||||
}
|
||||
else if (meta->destaddr.mode == IEEE802154_ADDRMODE_EXTENDED)
|
||||
{
|
||||
int index;
|
||||
|
||||
/* The IEEE 802.15.4 Standard is confusing with regards to byte-order
|
||||
* for * extended address. More research discovers that the extended
|
||||
* address should be sent in reverse-canonical form.
|
||||
/* The IEEE 802.15.4 Standard is confusing with regards to
|
||||
* byte-order for * extended address. More research discovers
|
||||
* that the extended address should be sent in reverse-canonical
|
||||
* form.
|
||||
*/
|
||||
|
||||
for (index = IEEE802154_EADDRSIZE - 1; index >= 0; index--)
|
||||
@ -165,8 +168,8 @@ int mac802154_req_data(MACHANDLE mac,
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* If both destination and source addressing information is present, the MAC
|
||||
* sublayer shall compare the destination and source PAN identifiers.
|
||||
/* If both destination and source addressing information is present, the
|
||||
* MAC sublayer shall compare the destination and source PAN identifiers.
|
||||
* [1] pg. 41.
|
||||
*/
|
||||
|
||||
@ -206,9 +209,10 @@ int mac802154_req_data(MACHANDLE mac,
|
||||
{
|
||||
int index;
|
||||
|
||||
/* The IEEE 802.15.4 Standard is confusing with regards to byte-order
|
||||
* for * extended address. More research discovers that the extended
|
||||
* address should be sent in reverse-canonical form.
|
||||
/* The IEEE 802.15.4 Standard is confusing with regards to
|
||||
* byte-order for * extended address. More research discovers
|
||||
* that the extended address should be sent in reverse-canonical
|
||||
* form.
|
||||
*/
|
||||
|
||||
for (index = IEEE802154_EADDRSIZE - 1; index >= 0; index--)
|
||||
@ -263,11 +267,11 @@ int mac802154_req_data(MACHANDLE mac,
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Set the offset to 0 to include the header ( we do not want to
|
||||
* modify the frame until AFTER the last place that -EINTR could
|
||||
* be returned and could generate a retry. Subsequent error returns
|
||||
* are fatal and no retry should occur.
|
||||
*/
|
||||
/* Set the offset to 0 to include the header ( we do not want to
|
||||
* modify the frame until AFTER the last place that -EINTR could
|
||||
* be returned and could generate a retry. Subsequent error returns
|
||||
* are fatal and no retry should occur.
|
||||
*/
|
||||
|
||||
frame->io_offset = 0;
|
||||
|
||||
@ -278,25 +282,26 @@ int mac802154_req_data(MACHANDLE mac,
|
||||
txdesc->frametype = IEEE802154_FRAME_DATA;
|
||||
txdesc->ackreq = meta->flags.ackreq;
|
||||
|
||||
/* If the TxOptions parameter specifies that a GTS transmission is required,
|
||||
* the MAC sublayer will determine whether it has a valid GTS as described
|
||||
* 5.1.7.3. If a valid GTS could not be found, the MAC sublayer will discard
|
||||
* the MSDU. If a valid GTS was found, the MAC sublayer will defer, if
|
||||
* necessary, until the GTS. If the TxOptions parameter specifies that a GTS
|
||||
* transmission is not required, the MAC sublayer will transmit the MSDU using
|
||||
* either slotted CSMA-CA in the CAP for a beacon-enabled PAN or unslotted
|
||||
* CSMA-CA for a nonbeacon-enabled PAN. Specifying a GTS transmission in the
|
||||
* TxOptions parameter overrides an indirect transmission request.
|
||||
* [1] pg. 118.
|
||||
/* If the TxOptions parameter specifies that a GTS transmission is
|
||||
* required, the MAC sublayer will determine whether it has a valid GTS as
|
||||
* described 5.1.7.3. If a valid GTS could not be found, the MAC sublayer
|
||||
* will discard the MSDU. If a valid GTS was found, the MAC sublayer will
|
||||
* defer, if necessary, until the GTS. If the TxOptions parameter specifies
|
||||
* that a GTS transmission is not required, the MAC sublayer will transmit
|
||||
* the MSDU using either slotted CSMA-CA in the CAP for a beacon-enabled
|
||||
* PAN or unslotted CSMA-CA for a nonbeacon-enabled PAN. Specifying a GTS
|
||||
* transmission in the TxOptions parameter overrides an indirect
|
||||
* transmission request. [1] pg. 118.
|
||||
*/
|
||||
|
||||
if (meta->flags.usegts)
|
||||
{
|
||||
/* TODO: Support GTS transmission. This should just change where we link
|
||||
/* TODO:
|
||||
* Support GTS transmission. This should just change where we link
|
||||
* the transaction. Instead of going in the CSMA transaction list, it
|
||||
* should be linked to the GTS' transaction list. We'll need to check if
|
||||
* the GTS is valid, and then find the GTS, before linking. Note, we also
|
||||
* don't have to try and kick-off any transmission here.
|
||||
* should be linked to the GTS' transaction list. We'll need to check
|
||||
* if the GTS is valid, and then find the GTS, before linking.
|
||||
* Note, we also don't have to try and kick-off any transmission here.
|
||||
*/
|
||||
|
||||
ret = -ENOTSUP;
|
||||
@ -304,19 +309,20 @@ int mac802154_req_data(MACHANDLE mac,
|
||||
}
|
||||
else
|
||||
{
|
||||
/* If the TxOptions parameter specifies that an indirect transmission is
|
||||
* required and this primitive is received by the MAC sublayer of a
|
||||
/* If the TxOptions parameter specifies that an indirect transmission
|
||||
* is required and this primitive is received by the MAC sublayer of a
|
||||
* coordinator, the data frame is sent using indirect transmission, as
|
||||
* described in 5.1.5 and 5.1.6.3. [1]
|
||||
*/
|
||||
|
||||
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
|
||||
* coordinator, the destination address is not present, or the
|
||||
* TxOptions parameter also specifies a GTS transmission, the indirect
|
||||
* transmission option will be ignored. [1]
|
||||
/* If the TxOptions parameter specifies that an indirect
|
||||
* transmission is required and if the device receiving this
|
||||
* primitive is not a coordinator, the destination address is not
|
||||
* present, or the TxOptions parameter also specifies a
|
||||
* GTS transmission, the indirect transmission option will be
|
||||
* ignored. [1]
|
||||
*
|
||||
* NOTE: We don't just ignore the parameter. Instead, we throw an
|
||||
* error, since this really shouldn't be happening.
|
||||
@ -359,6 +365,7 @@ int mac802154_req_data(MACHANDLE mac,
|
||||
return OK;
|
||||
|
||||
errout_with_txdesc:
|
||||
|
||||
/* Free TX the descriptor, but preserve the IOB. */
|
||||
|
||||
txdesc->frame = NULL;
|
||||
|
@ -53,10 +53,6 @@
|
||||
#include <nuttx/wireless/ieee802154/ieee802154_mac.h>
|
||||
#include <nuttx/wireless/ieee802154/ieee802154_radio.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Private Types
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Function Prototypes
|
||||
****************************************************************************/
|
||||
|
@ -87,8 +87,10 @@ struct mac802154dev_callback_s
|
||||
{
|
||||
/* This holds the information visible to the MAC layer */
|
||||
|
||||
struct mac802154_maccb_s mc_cb; /* Interface understood by the MAC layer */
|
||||
FAR struct mac802154_chardevice_s *mc_priv; /* Our priv data */
|
||||
struct mac802154_maccb_s mc_cb; /* Interface understood by
|
||||
* the MAC layer
|
||||
*/
|
||||
FAR struct mac802154_chardevice_s *mc_priv; /* Our priv data */
|
||||
};
|
||||
|
||||
struct mac802154_chardevice_s
|
||||
@ -128,7 +130,7 @@ struct mac802154_chardevice_s
|
||||
* Private Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
/* Semaphore helpers */
|
||||
/* Semaphore helpers */
|
||||
|
||||
static inline int mac802154dev_takesem(sem_t *sem);
|
||||
#define mac802154dev_givesem(s) nxsem_post(s);
|
||||
@ -333,13 +335,15 @@ static int mac802154dev_close(FAR struct file *filep)
|
||||
FAR struct ieee802154_primitive_s *primitive;
|
||||
|
||||
primitive =
|
||||
(FAR struct ieee802154_primitive_s *)sq_remfirst(&dev->primitive_queue);
|
||||
(FAR struct ieee802154_primitive_s *)
|
||||
sq_remfirst(&dev->primitive_queue);
|
||||
|
||||
while (primitive)
|
||||
{
|
||||
ieee802154_primitive_free(primitive);
|
||||
primitive =
|
||||
(FAR struct ieee802154_primitive_s *)sq_remfirst(&dev->primitive_queue);
|
||||
(FAR struct ieee802154_primitive_s *)
|
||||
sq_remfirst(&dev->primitive_queue);
|
||||
}
|
||||
}
|
||||
|
||||
@ -398,9 +402,12 @@ static ssize_t mac802154dev_read(FAR struct file *filep, FAR char *buffer,
|
||||
|
||||
/* Try popping a data indication off the list */
|
||||
|
||||
ind = (FAR struct ieee802154_data_ind_s *)sq_remfirst(&dev->dataind_queue);
|
||||
ind = (FAR struct ieee802154_data_ind_s *)
|
||||
sq_remfirst(&dev->dataind_queue);
|
||||
|
||||
/* If the indication is not null, we can exit the loop and copy the data */
|
||||
/* If the indication is not null, we can exit the loop and copy the
|
||||
* data
|
||||
*/
|
||||
|
||||
if (ind != NULL)
|
||||
{
|
||||
@ -408,11 +415,12 @@ static ssize_t mac802154dev_read(FAR struct file *filep, FAR char *buffer,
|
||||
break;
|
||||
}
|
||||
|
||||
/* If this is a non-blocking call, or if there is another read operation
|
||||
* already pending, don't block. This driver returns EAGAIN even when
|
||||
* configured as non-blocking if another read operation is already pending
|
||||
* This situation should be rare. It will only occur when there are 2 calls
|
||||
* to read from separate threads and there was no data in the rx list.
|
||||
/* If this is a non-blocking call, or if there is another read
|
||||
* operation already pending, don't block. This driver returns EAGAIN
|
||||
* even when configured as non-blocking if another read operation is
|
||||
* already pending. This situation should be rare.
|
||||
* It will only occur when there are 2 calls to read from separate
|
||||
* threads and there was no data in the rx list.
|
||||
*/
|
||||
|
||||
if ((filep->f_oflags & O_NONBLOCK) || dev->readpending)
|
||||
@ -433,8 +441,8 @@ static ssize_t mac802154dev_read(FAR struct file *filep, FAR char *buffer,
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Let the loop wrap back around, we will then pop a indication and this
|
||||
* time, it should have a data indication
|
||||
/* Let the loop wrap back around, we will then pop a indication and
|
||||
* this time, it should have a data indication
|
||||
*/
|
||||
}
|
||||
|
||||
@ -475,22 +483,22 @@ static ssize_t mac802154dev_read(FAR struct file *filep, FAR char *buffer,
|
||||
rx->length);
|
||||
}
|
||||
|
||||
memcpy(&rx->meta, ind, sizeof(struct ieee802154_data_ind_s));
|
||||
memcpy(&rx->meta, ind, sizeof(struct ieee802154_data_ind_s));
|
||||
|
||||
/* Zero out the forward link and IOB reference */
|
||||
/* Zero out the forward link and IOB reference */
|
||||
|
||||
rx->meta.flink = NULL;
|
||||
rx->meta.frame = NULL;
|
||||
rx->meta.flink = NULL;
|
||||
rx->meta.frame = NULL;
|
||||
|
||||
/* Free the IOB */
|
||||
/* Free the IOB */
|
||||
|
||||
iob_free(ind->frame, IOBUSER_WIRELESS_MAC802154_CHARDEV);
|
||||
iob_free(ind->frame, IOBUSER_WIRELESS_MAC802154_CHARDEV);
|
||||
|
||||
/* Deallocate the data indication */
|
||||
/* Deallocate the data indication */
|
||||
|
||||
ieee802154_primitive_free((FAR struct ieee802154_primitive_s *)ind);
|
||||
ieee802154_primitive_free((FAR struct ieee802154_primitive_s *)ind);
|
||||
|
||||
return OK;
|
||||
return OK;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
@ -632,13 +640,15 @@ static int mac802154dev_ioctl(FAR struct file *filep, int cmd,
|
||||
primitive = (FAR struct ieee802154_primitive_s *)
|
||||
sq_remfirst(&dev->primitive_queue);
|
||||
|
||||
/* If there was an event to pop off, copy it into the user data and
|
||||
* free it from the MAC layer's memory.
|
||||
/* If there was an event to pop off, copy it into the user data
|
||||
* and free it from the MAC layer's memory.
|
||||
*/
|
||||
|
||||
if (primitive != NULL)
|
||||
{
|
||||
memcpy(&macarg->primitive, primitive, sizeof(struct ieee802154_primitive_s));
|
||||
memcpy(&macarg->primitive,
|
||||
primitive,
|
||||
sizeof(struct ieee802154_primitive_s));
|
||||
|
||||
/* Free the notification */
|
||||
|
||||
@ -647,12 +657,13 @@ static int mac802154dev_ioctl(FAR struct file *filep, int cmd,
|
||||
break;
|
||||
}
|
||||
|
||||
/* If this is a non-blocking call, or if there is another getevent
|
||||
* operation already pending, don't block. This driver returns
|
||||
* EAGAIN even when configured as non-blocking if another getevent
|
||||
* operation is already pending This situation should be rare.
|
||||
* It will only occur when there are 2 calls from separate threads
|
||||
* and there was no events in the queue.
|
||||
/* If this is a non-blocking call, or if there is another
|
||||
* getevent operation already pending, don't block. This driver
|
||||
* returns EAGAIN even when configured as non-blocking if
|
||||
* another getevent operation is already pending This situation
|
||||
* should be rare.
|
||||
* It will only occur when there are 2 calls from separate
|
||||
* threads and there was no events in the queue.
|
||||
*/
|
||||
|
||||
if ((filep->f_oflags & O_NONBLOCK) || dev->geteventpending)
|
||||
@ -673,8 +684,8 @@ static int mac802154dev_ioctl(FAR struct file *filep, int cmd,
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Get exclusive access again, then loop back around and try and
|
||||
* pop an event off the queue
|
||||
/* Get exclusive access again, then loop back around and try
|
||||
* and pop an event off the queue
|
||||
*/
|
||||
|
||||
ret = mac802154dev_takesem(&dev->md_exclsem);
|
||||
@ -724,22 +735,24 @@ static int mac802154dev_notify(FAR struct mac802154_maccb_s *maccb,
|
||||
return mac802154dev_rxframe(dev, &primitive->u.dataind);
|
||||
}
|
||||
|
||||
/* If there is a registered notification receiver, queue the event and signal
|
||||
* the receiver. Events should be popped from the queue from the application
|
||||
* at a reasonable rate in order for the MAC layer to be able to allocate new
|
||||
* notifications.
|
||||
/* If there is a registered notification receiver, queue the event and
|
||||
* signal the receiver. Events should be popped from the queue from the
|
||||
* application at a reasonable rate in order for the MAC layer to be able
|
||||
* to allocate new notifications.
|
||||
*/
|
||||
|
||||
if (dev->enableevents && (dev->md_open != NULL || dev->md_notify_registered))
|
||||
if (dev->enableevents &&
|
||||
(dev->md_open != NULL || dev->md_notify_registered))
|
||||
{
|
||||
/* Get exclusive access to the driver structure. We don't care about any
|
||||
* signals so if we see one, just go back to trying to get access again */
|
||||
/* Get exclusive access to the driver structure. We don't care about
|
||||
* any signals so if we see one, just go back to trying to get access
|
||||
* again
|
||||
*/
|
||||
|
||||
while (mac802154dev_takesem(&dev->md_exclsem) != 0);
|
||||
|
||||
sq_addlast((FAR sq_entry_t *)primitive, &dev->primitive_queue);
|
||||
|
||||
|
||||
/* Check if there is a read waiting for data */
|
||||
|
||||
if (dev->geteventpending)
|
||||
@ -761,8 +774,8 @@ static int mac802154dev_notify(FAR struct mac802154_maccb_s *maccb,
|
||||
return OK;
|
||||
}
|
||||
|
||||
/* By returning a negative value, we let the MAC know that we don't want the
|
||||
* primitive and it will free it for us
|
||||
/* By returning a negative value, we let the MAC know that we don't want
|
||||
* the primitive and it will free it for us
|
||||
*/
|
||||
|
||||
return -1;
|
||||
@ -784,7 +797,8 @@ static int mac802154dev_rxframe(FAR struct mac802154_chardevice_s *dev,
|
||||
FAR struct ieee802154_data_ind_s *ind)
|
||||
{
|
||||
/* Get exclusive access to the driver structure. We don't care about any
|
||||
* signals so if we see one, just go back to trying to get access again */
|
||||
* signals so if we see one, just go back to trying to get access again
|
||||
*/
|
||||
|
||||
while (mac802154dev_takesem(&dev->md_exclsem) != 0);
|
||||
|
||||
@ -882,6 +896,7 @@ int mac802154dev_register(MACHANDLE mac, int minor)
|
||||
nerr("ERROR: Failed to bind the MAC callbacks: %d\n", ret);
|
||||
|
||||
/* Free memory and return the error */
|
||||
|
||||
kmm_free(dev);
|
||||
return ret;
|
||||
}
|
||||
|
@ -55,16 +55,17 @@
|
||||
#include <nuttx/wireless/ieee802154/ieee802154_mac.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Public MAC Functions
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: mac802154_req_disassociate
|
||||
*
|
||||
* Description:
|
||||
* The MLME-DISASSOCIATE.request primitive is used by an associated device to
|
||||
* notify the coordinator of its intent to leave the PAN. It is also used by
|
||||
* the coordinator to instruct an associated device to leave the PAN.
|
||||
* The MLME-DISASSOCIATE.request primitive is used by an associated device
|
||||
* to notify the coordinator of its intent to leave the PAN. It is also
|
||||
* used by the coordinator to instruct an associated device to leave the
|
||||
* PAN.
|
||||
* Confirmation is returned via the
|
||||
* struct mac802154_maccb_s->conf_disassociate callback.
|
||||
*
|
||||
|
@ -56,7 +56,7 @@
|
||||
#include <nuttx/wireless/ieee802154/ieee802154_mac.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Public MAC Functions
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
@ -67,10 +67,10 @@
|
||||
* attribute.
|
||||
*
|
||||
* NOTE: The standard specifies that the attribute value should be returned
|
||||
* via the asynchronous MLME-GET.confirm primitive. However, in our
|
||||
* implementation, we synchronously return the value immediately.Therefore, we
|
||||
* merge the functionality of the MLME-GET.request and MLME-GET.confirm
|
||||
* primitives together.
|
||||
* via the asynchronous MLME-GET.confirm primitive.
|
||||
* However, in our implementation, we synchronously return the value
|
||||
* immediately. Therefore, we merge the functionality of the
|
||||
* MLME-GET.request and MLME-GET.confirm primitives together.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
@ -103,13 +103,15 @@ int mac802154_req_get(MACHANDLE mac, enum ieee802154_attr_e attr,
|
||||
|
||||
case IEEE802154_ATTR_MAC_COORD_SADDR:
|
||||
{
|
||||
IEEE802154_SADDRCOPY(attrval->mac.coordsaddr, priv->pandesc.coordaddr.saddr);
|
||||
IEEE802154_SADDRCOPY(attrval->mac.coordsaddr,
|
||||
priv->pandesc.coordaddr.saddr);
|
||||
}
|
||||
break;
|
||||
|
||||
case IEEE802154_ATTR_MAC_COORD_EADDR:
|
||||
{
|
||||
IEEE802154_EADDRCOPY(attrval->mac.coordeaddr, priv->pandesc.coordaddr.eaddr);
|
||||
IEEE802154_EADDRCOPY(attrval->mac.coordeaddr,
|
||||
priv->pandesc.coordaddr.eaddr);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -165,10 +167,10 @@ int mac802154_req_get(MACHANDLE mac, enum ieee802154_attr_e attr,
|
||||
* indicated MAC PIB attribute.
|
||||
*
|
||||
* NOTE: The standard specifies that confirmation should be indicated via
|
||||
* the asynchronous MLME-SET.confirm primitive. However, in our implementation
|
||||
* we synchronously return the status from the request. Therefore, we do merge
|
||||
* the functionality of the MLME-SET.request and MLME-SET.confirm primitives
|
||||
* together.
|
||||
* the asynchronous MLME-SET.confirm primitive.
|
||||
* However, in our implementation we synchronously return the status from
|
||||
* the request. Therefore, we do merge the functionality of the
|
||||
* MLME-SET.request and MLME-SET.confirm primitives together.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
@ -248,5 +250,6 @@ int mac802154_req_set(MACHANDLE mac, enum ieee802154_attr_e attr,
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -50,15 +50,15 @@
|
||||
#include <nuttx/wireless/ieee802154/ieee802154_mac.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Public MAC Functions
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: mac802154_req_gts
|
||||
*
|
||||
* Description:
|
||||
* The MLME-GTS.request primitive allows a device to send a request to the PAN
|
||||
* coordinator to allocate a new GTS or to deallocate an existing GTS.
|
||||
* The MLME-GTS.request primitive allows a device to send a request to the
|
||||
* PAN coordinator to allocate a new GTS or to deallocate an existing GTS.
|
||||
* Confirmation is returned via the
|
||||
* struct mac802154_maccb_s->conf_gts callback.
|
||||
*
|
||||
|
@ -53,7 +53,7 @@
|
||||
#include <nuttx/wireless/ieee802154/ieee802154_mac.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Public MAC Functions
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
@ -162,5 +162,6 @@ int mac802154_ioctl(MACHANDLE mac, int cmd, unsigned long arg)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -100,7 +100,9 @@
|
||||
# define LO_FRAMELEN IEEE802154_MAX_PHY_PACKET_SIZE
|
||||
#endif
|
||||
|
||||
/* TX poll delay = 1 seconds. CLK_TCK is the number of clock ticks per second */
|
||||
/* TX poll delay = 1 seconds.
|
||||
* CLK_TCK is the number of clock ticks per second
|
||||
*/
|
||||
|
||||
#define LO_WDDELAY (1*CLK_TCK)
|
||||
|
||||
@ -205,8 +207,10 @@ static int lo_properties(FAR struct radio_driver_s *netdev,
|
||||
*
|
||||
* 128 112 96 80 64 48 32 16
|
||||
* ---- ---- ---- ---- ---- ---- ---- ----
|
||||
* fe80 0000 0000 0000 0000 00ff fe00 xxxx 2-byte short address IEEE 48-bit MAC
|
||||
* fe80 0000 0000 0000 xxxx xxxx xxxx xxxx 8-byte extended address IEEE EUI-64
|
||||
* fe80 0000 0000 0000 0000 00ff fe00 xxxx 2-byte
|
||||
* short address IEEE 48-bit MAC
|
||||
* fe80 0000 0000 0000 xxxx xxxx xxxx xxxx 8-byte
|
||||
* extended address IEEE EUI-64
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
@ -225,10 +229,14 @@ static void lo_addr2ip(FAR struct net_driver_s *dev)
|
||||
dev->d_ipv6addr[1] = 0;
|
||||
dev->d_ipv6addr[2] = 0;
|
||||
dev->d_ipv6addr[3] = 0;
|
||||
dev->d_ipv6addr[4] = HTONS((uint16_t)g_eaddr[0] << 8 | (uint16_t)g_eaddr[1]);
|
||||
dev->d_ipv6addr[5] = HTONS((uint16_t)g_eaddr[2] << 8 | (uint16_t)g_eaddr[3]);
|
||||
dev->d_ipv6addr[6] = HTONS((uint16_t)g_eaddr[4] << 8 | (uint16_t)g_eaddr[5]);
|
||||
dev->d_ipv6addr[7] = HTONS((uint16_t)g_eaddr[6] << 8 | (uint16_t)g_eaddr[7]);
|
||||
dev->d_ipv6addr[4] = HTONS((uint16_t)g_eaddr[0] << 8 |
|
||||
(uint16_t)g_eaddr[1]);
|
||||
dev->d_ipv6addr[5] = HTONS((uint16_t)g_eaddr[2] << 8 |
|
||||
(uint16_t)g_eaddr[3]);
|
||||
dev->d_ipv6addr[6] = HTONS((uint16_t)g_eaddr[4] << 8 |
|
||||
(uint16_t)g_eaddr[5]);
|
||||
dev->d_ipv6addr[7] = HTONS((uint16_t)g_eaddr[6] << 8 |
|
||||
(uint16_t)g_eaddr[7]);
|
||||
|
||||
/* Invert the U/L bit */
|
||||
|
||||
@ -253,7 +261,8 @@ static void lo_addr2ip(FAR struct net_driver_s *dev)
|
||||
dev->d_ipv6addr[4] = 0;
|
||||
dev->d_ipv6addr[5] = HTONS(0x00ff);
|
||||
dev->d_ipv6addr[6] = HTONS(0xfe00);
|
||||
dev->d_ipv6addr[7] = HTONS((uint16_t)g_saddr[0] << 8 | (uint16_t)g_saddr[1]);
|
||||
dev->d_ipv6addr[7] = HTONS((uint16_t)g_saddr[0] << 8 |
|
||||
(uint16_t)g_saddr[1]);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
@ -267,8 +276,10 @@ static void lo_addr2ip(FAR struct net_driver_s *dev)
|
||||
*
|
||||
* 128 112 96 80 64 48 32 16
|
||||
* ---- ---- ---- ---- ---- ---- ---- ----
|
||||
* fe80 0000 0000 0000 0000 00ff fe00 xxxx 2-byte short address IEEE 48-bit MAC
|
||||
* fe80 0000 0000 0000 xxxx xxxx xxxx xxxx 8-byte extended address IEEE EUI-64
|
||||
* fe80 0000 0000 0000 0000 00ff fe00 xxxx 2-byte
|
||||
* short address IEEE 48-bit MAC
|
||||
* fe80 0000 0000 0000 xxxx xxxx xxxx xxxx 8-byte
|
||||
* extended address IEEE EUI-64
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
@ -547,7 +558,7 @@ static int lo_ifup(FAR struct net_driver_s *dev)
|
||||
dev->d_ipv6addr[3], dev->d_ipv6addr[4], dev->d_ipv6addr[5],
|
||||
dev->d_ipv6addr[6], dev->d_ipv6addr[7]);
|
||||
#ifdef CONFIG_NET_6LOWPAN_EXTENDEDADDR
|
||||
ninfo(" Node: %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x PANID=%02x:%02x\n",
|
||||
ninfo("Node: %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x PANID=%02x:%02x\n",
|
||||
dev->d_mac.radio.nv_addr[0], dev->d_mac.radio.nv_addr[1],
|
||||
dev->d_mac.radio.nv_addr[2], dev->d_mac.radio.nv_addr[3],
|
||||
dev->d_mac.radio.nv_addr[4], dev->d_mac.radio.nv_addr[5],
|
||||
@ -561,11 +572,12 @@ static int lo_ifup(FAR struct net_driver_s *dev)
|
||||
#else
|
||||
if (dev->d_mac.radio.nv_addrlen == 8)
|
||||
{
|
||||
ninfo("Bringing up: Node: %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x PANID=%02x:%02x\n",
|
||||
ninfo("Bringing up: Node: %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x",
|
||||
dev->d_mac.radio.nv_addr[0], dev->d_mac.radio.nv_addr[1],
|
||||
dev->d_mac.radio.nv_addr[2], dev->d_mac.radio.nv_addr[3],
|
||||
dev->d_mac.radio.nv_addr[4], dev->d_mac.radio.nv_addr[5],
|
||||
dev->d_mac.radio.nv_addr[6], dev->d_mac.radio.nv_addr[7],
|
||||
dev->d_mac.radio.nv_addr[6], dev->d_mac.radio.nv_addr[7]);
|
||||
ninfo(" PANID=%02x:%02x\n",
|
||||
priv->lo_panid[0], priv->lo_panid[1]);
|
||||
}
|
||||
else if (dev->d_mac.radio.nv_addrlen == 2)
|
||||
@ -748,8 +760,8 @@ static int lo_addmac(FAR struct net_driver_s *dev, FAR const uint8_t *mac)
|
||||
* Name: lo_rmmac
|
||||
*
|
||||
* Description:
|
||||
* NuttX Callback: Remove the specified MAC address from the hardware multicast
|
||||
* address filtering
|
||||
* NuttX Callback: Remove the specified MAC address from the hardware
|
||||
* multicast address filtering
|
||||
*
|
||||
* Input Parameters:
|
||||
* dev - Reference to the NuttX driver state structure
|
||||
@ -959,7 +971,9 @@ static int lo_req_data(FAR struct radio_driver_s *netdev,
|
||||
DEBUGASSERT(iob->io_offset == MAC_HDRLEN);
|
||||
memset(iob->io_data, 0, MAC_HDRLEN);
|
||||
|
||||
/* Add the IOB to the tail of the queue of framelist to be looped back */
|
||||
/* Add the IOB to the tail of the queue of framelist to be looped
|
||||
* back
|
||||
*/
|
||||
|
||||
if (priv->lo_tail == NULL)
|
||||
{
|
||||
@ -1033,7 +1047,7 @@ static int lo_properties(FAR struct radio_driver_s *netdev,
|
||||
memset(properties->sp_mcast.nv_addr, 0xff, RADIO_MAX_ADDRLEN);
|
||||
|
||||
#ifdef CONFIG_NET_STARPOINT
|
||||
/* Star hub node address -- Not supported*/
|
||||
/* Star hub node address -- Not supported */
|
||||
|
||||
#endif
|
||||
|
||||
@ -1106,9 +1120,10 @@ int ieee8021514_loopback(void)
|
||||
priv->lo_polldog = wd_create(); /* Create periodic poll timer */
|
||||
|
||||
#ifdef CONFIG_NET_6LOWPAN
|
||||
/* Make sure the our single packet buffer is attached. We must do this before
|
||||
* registering the device since, once the device is registered, a packet may
|
||||
* be attempted to be forwarded and require the buffer.
|
||||
/* Make sure the our single packet buffer is attached.
|
||||
* We must do this before registering the device since, once the device
|
||||
* is registered, a packet may be attempted to be forwarded and require
|
||||
* the buffer.
|
||||
*/
|
||||
|
||||
priv->lo_radio.r_dev.d_buf = g_iobuffer.rb_buf;
|
||||
|
@ -90,8 +90,8 @@
|
||||
|
||||
#define WPANWORK LPWORK
|
||||
|
||||
/* CONFIG_IEEE802154_NETDEV_NINTERFACES determines the number of physical interfaces
|
||||
* that will be supported.
|
||||
/* CONFIG_IEEE802154_NETDEV_NINTERFACES determines the number of physical
|
||||
* interfaces that will be supported.
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_IEEE802154_NETDEV_NINTERFACES
|
||||
@ -119,7 +119,9 @@
|
||||
"CONFIG_IOB_NBUFFERS to avoid waiting on req_data"
|
||||
#endif
|
||||
|
||||
/* TX poll delay = 1 seconds. CLK_TCK is the number of clock ticks per second */
|
||||
/* TX poll delay = 1 seconds.
|
||||
* CLK_TCK is the number of clock ticks per second
|
||||
*/
|
||||
|
||||
#define TXPOLL_WDDELAY (1*CLK_TCK)
|
||||
|
||||
@ -277,7 +279,8 @@ static int macnet_update_nvaddr(FAR struct net_driver_s *dev)
|
||||
}
|
||||
else
|
||||
{
|
||||
IEEE802154_EADDRCOPY(dev->d_mac.radio.nv_addr, arg.getreq.attrval.mac.eaddr);
|
||||
IEEE802154_EADDRCOPY(dev->d_mac.radio.nv_addr,
|
||||
arg.getreq.attrval.mac.eaddr);
|
||||
dev->d_mac.radio.nv_addrlen = IEEE802154_EADDRSIZE;
|
||||
return OK;
|
||||
}
|
||||
@ -321,8 +324,10 @@ static int macnet_update_nvaddr(FAR struct net_driver_s *dev)
|
||||
*
|
||||
* 128 112 96 80 64 48 32 16
|
||||
* ---- ---- ---- ---- ---- ---- ---- ----
|
||||
* fe80 0000 0000 0000 0000 00ff fe00 xxxx 2-byte short address IEEE 48-bit MAC
|
||||
* fe80 0000 0000 0000 xxxx xxxx xxxx xxxx 8-byte extended address IEEE EUI-64
|
||||
* fe80 0000 0000 0000 0000 00ff fe00 xxxx 2-byte
|
||||
* short address IEEE 48-bit MAC
|
||||
* fe80 0000 0000 0000 xxxx xxxx xxxx xxxx 8-byte
|
||||
* extended address IEEE EUI-64
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
@ -369,16 +374,17 @@ static int macnet_notify(FAR struct mac802154_maccb_s *maccb,
|
||||
return macnet_rxframe(priv, &primitive->u.dataind);
|
||||
}
|
||||
|
||||
/* If there is a registered notification receiver, queue the event and signal
|
||||
* the receiver. Events should be popped from the queue from the application
|
||||
* at a reasonable rate in order for the MAC layer to be able to allocate new
|
||||
* notifications.
|
||||
/* If there is a registered notification receiver, queue the event and
|
||||
* signal the receiver. Events should be popped from the queue from the
|
||||
* application at a reasonable rate in order for the MAC layer to be able
|
||||
* to allocate new notifications.
|
||||
*/
|
||||
|
||||
if (priv->md_enableevents)
|
||||
{
|
||||
/* Get exclusive access to the driver structure. We don't care about any
|
||||
* signals so if we see one, just go back to trying to get access again
|
||||
/* Get exclusive access to the driver structure.
|
||||
* We don't care about any signals so if we see one, just go
|
||||
* back to trying to get access again
|
||||
*/
|
||||
|
||||
while (nxsem_wait(&priv->md_exclsem) < 0);
|
||||
@ -406,8 +412,8 @@ static int macnet_notify(FAR struct mac802154_maccb_s *maccb,
|
||||
return OK;
|
||||
}
|
||||
|
||||
/* By returning a negative value, we let the MAC know that we don't want the
|
||||
* primitive and it will free it for us
|
||||
/* By returning a negative value, we let the MAC know that we don't want
|
||||
* the primitive and it will free it for us
|
||||
*/
|
||||
|
||||
return -1;
|
||||
@ -536,8 +542,8 @@ static int macnet_rxframe(FAR struct macnet_driver_s *priv,
|
||||
|
||||
static int macnet_txpoll_callback(FAR struct net_driver_s *dev)
|
||||
{
|
||||
/* If zero is returned, the polling will continue until all connections have
|
||||
* been examined.
|
||||
/* If zero is returned, the polling will continue until all connections
|
||||
* have been examined.
|
||||
*/
|
||||
|
||||
return 0;
|
||||
@ -699,8 +705,10 @@ static int macnet_coord_saddr(FAR struct radio_driver_s *radio,
|
||||
*
|
||||
* 128 112 96 80 64 48 32 16
|
||||
* ---- ---- ---- ---- ---- ---- ---- ----
|
||||
* fe80 0000 0000 0000 0000 00ff fe00 xxxx 2-byte short address IEEE 48-bit MAC
|
||||
* fe80 0000 0000 0000 xxxx xxxx xxxx xxxx 8-byte extended address IEEE EUI-64
|
||||
* fe80 0000 0000 0000 0000 00ff fe00 xxxx 2-byte
|
||||
* short address IEEE 48-bit MAC
|
||||
* fe80 0000 0000 0000 xxxx xxxx xxxx xxxx 8-byte
|
||||
* extended address IEEE EUI-64
|
||||
*
|
||||
* Input Parameters:
|
||||
* dev - Reference to the NuttX driver state structure
|
||||
@ -731,10 +739,14 @@ static int macnet_ifup(FAR struct net_driver_s *dev)
|
||||
dev->d_ipv6addr[3] = HTONS(CONFIG_IEEE802154_NETDEV_DEFAULT_PREFIX_3);
|
||||
|
||||
#ifdef CONFIG_NET_6LOWPAN_EXTENDEDADDR
|
||||
dev->d_ipv6addr[4] = HTONS((uint16_t)nvaddr[0] << 8 | (uint16_t)nvaddr[1]);
|
||||
dev->d_ipv6addr[5] = HTONS((uint16_t)nvaddr[2] << 8 | (uint16_t)nvaddr[3]);
|
||||
dev->d_ipv6addr[6] = HTONS((uint16_t)nvaddr[4] << 8 | (uint16_t)nvaddr[5]);
|
||||
dev->d_ipv6addr[7] = HTONS((uint16_t)nvaddr[6] << 8 | (uint16_t)nvaddr[7]);
|
||||
dev->d_ipv6addr[4] = HTONS((uint16_t)nvaddr[0] << 8 |
|
||||
(uint16_t)nvaddr[1]);
|
||||
dev->d_ipv6addr[5] = HTONS((uint16_t)nvaddr[2] << 8 |
|
||||
(uint16_t)nvaddr[3]);
|
||||
dev->d_ipv6addr[6] = HTONS((uint16_t)nvaddr[4] << 8 |
|
||||
(uint16_t)nvaddr[5]);
|
||||
dev->d_ipv6addr[7] = HTONS((uint16_t)nvaddr[6] << 8 |
|
||||
(uint16_t)nvaddr[7]);
|
||||
|
||||
/* Invert the U/L bit */
|
||||
|
||||
@ -744,7 +756,8 @@ static int macnet_ifup(FAR struct net_driver_s *dev)
|
||||
dev->d_ipv6addr[4] = 0;
|
||||
dev->d_ipv6addr[5] = HTONS(0x00ff);
|
||||
dev->d_ipv6addr[6] = HTONS(0xfe00);
|
||||
dev->d_ipv6addr[7] = HTONS((uint16_t)nvaddr[0] << 8 | (uint16_t)nvaddr[1]);
|
||||
dev->d_ipv6addr[7] = HTONS((uint16_t)nvaddr[0] << 8 |
|
||||
(uint16_t)nvaddr[1]);
|
||||
#endif
|
||||
|
||||
wlinfo("Bringing up: %04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x\n",
|
||||
@ -795,7 +808,8 @@ static int macnet_ifup(FAR struct net_driver_s *dev)
|
||||
|
||||
static int macnet_ifdown(FAR struct net_driver_s *dev)
|
||||
{
|
||||
FAR struct macnet_driver_s *priv = (FAR struct macnet_driver_s *)dev->d_private;
|
||||
FAR struct macnet_driver_s *priv = (FAR struct macnet_driver_s *)
|
||||
dev->d_private;
|
||||
irqstate_t flags;
|
||||
|
||||
/* Disable interruption */
|
||||
@ -888,7 +902,8 @@ static void macnet_txavail_work(FAR void *arg)
|
||||
|
||||
static int macnet_txavail(FAR struct net_driver_s *dev)
|
||||
{
|
||||
FAR struct macnet_driver_s *priv = (FAR struct macnet_driver_s *)dev->d_private;
|
||||
FAR struct macnet_driver_s *priv = (FAR struct macnet_driver_s *)
|
||||
dev->d_private;
|
||||
|
||||
wlinfo("Available=%u\n", work_available(&priv->md_pollwork));
|
||||
|
||||
@ -926,12 +941,13 @@ static int macnet_txavail(FAR struct net_driver_s *dev)
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_NET_MCASTGROUP
|
||||
static int macnet_addmac(FAR struct net_driver_s *dev, FAR const uint8_t *mac)
|
||||
static int macnet_addmac(FAR struct net_driver_s *dev,
|
||||
FAR const uint8_t *mac)
|
||||
{
|
||||
FAR struct macnet_driver_s *priv = (FAR struct macnet_driver_s *)dev->d_private;
|
||||
|
||||
/* Add the MAC address to the hardware multicast routing table. Not used
|
||||
* with IEEE 802.15.4 radios.
|
||||
FAR struct macnet_driver_s *priv = (FAR struct macnet_driver_s *)
|
||||
dev->d_private;
|
||||
/* Add the MAC address to the hardware multicast routing table.
|
||||
* Not used with IEEE 802.15.4 radios.
|
||||
*/
|
||||
|
||||
return -ENOSYS;
|
||||
@ -942,8 +958,8 @@ static int macnet_addmac(FAR struct net_driver_s *dev, FAR const uint8_t *mac)
|
||||
* Name: macnet_rmmac
|
||||
*
|
||||
* Description:
|
||||
* NuttX Callback: Remove the specified MAC address from the hardware multicast
|
||||
* address filtering
|
||||
* NuttX Callback: Remove the specified MAC address from the hardware
|
||||
* multicast address filtering
|
||||
*
|
||||
* Input Parameters:
|
||||
* dev - Reference to the NuttX driver state structure
|
||||
@ -959,10 +975,10 @@ static int macnet_addmac(FAR struct net_driver_s *dev, FAR const uint8_t *mac)
|
||||
#ifdef CONFIG_NET_MCASTGROUP
|
||||
static int macnet_rmmac(FAR struct net_driver_s *dev, FAR const uint8_t *mac)
|
||||
{
|
||||
FAR struct macnet_driver_s *priv = (FAR struct macnet_driver_s *)dev->d_private;
|
||||
|
||||
/* Remove the MAC address from the hardware multicast routing table Not used
|
||||
* with IEEE 802.15.4 radios.
|
||||
FAR struct macnet_driver_s *priv = (FAR struct macnet_driver_s *)
|
||||
dev->d_private;
|
||||
/* Remove the MAC address from the hardware multicast routing table
|
||||
* Not used with IEEE 802.15.4 radios.
|
||||
*/
|
||||
|
||||
return -ENOSYS;
|
||||
@ -991,7 +1007,8 @@ static int macnet_rmmac(FAR struct net_driver_s *dev, FAR const uint8_t *mac)
|
||||
static int macnet_ioctl(FAR struct net_driver_s *dev, int cmd,
|
||||
unsigned long arg)
|
||||
{
|
||||
FAR struct macnet_driver_s *priv = (FAR struct macnet_driver_s *)dev->d_private;
|
||||
FAR struct macnet_driver_s *priv = (FAR struct macnet_driver_s *)
|
||||
dev->d_private;
|
||||
int ret = -EINVAL;
|
||||
|
||||
ret = nxsem_wait(&priv->md_exclsem);
|
||||
@ -1015,12 +1032,13 @@ static int macnet_ioctl(FAR struct net_driver_s *dev, int cmd,
|
||||
switch (cmd)
|
||||
{
|
||||
/* Command: MAC802154IOC_NOTIFY_REGISTER
|
||||
* Description: Register to receive a signal whenever there is a
|
||||
* event primitive sent from the MAC layer.
|
||||
* Description: Register to receive a signal whenever there is
|
||||
* a event primitive sent from the MAC layer.
|
||||
* Argument: A read-only pointer to an instance of struct
|
||||
* macnet_notify_s
|
||||
* Return: Zero (OK) on success. Minus one will be returned on
|
||||
* failure with the errno value set appropriately.
|
||||
* Return: Zero (OK) on success.
|
||||
* Minus one will be returned on failure with the
|
||||
* errno value set appropriately.
|
||||
*/
|
||||
|
||||
case MAC802154IOC_NOTIFY_REGISTER:
|
||||
@ -1045,8 +1063,8 @@ static int macnet_ioctl(FAR struct net_driver_s *dev, int cmd,
|
||||
primitive = (FAR struct ieee802154_primitive_s *)
|
||||
sq_remfirst(&priv->primitive_queue);
|
||||
|
||||
/* If there was an event to pop off, copy it into the user
|
||||
* data and free it from the MAC layer's memory.
|
||||
/* If there was an event to pop off, copy it into the
|
||||
* user data and free it from the MAC layer's memory.
|
||||
*/
|
||||
|
||||
if (primitive != NULL)
|
||||
@ -1081,8 +1099,8 @@ static int macnet_ioctl(FAR struct net_driver_s *dev, int cmd,
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Get exclusive access again, then loop back around and try and
|
||||
* pop an event off the queue
|
||||
/* Get exclusive access again, then loop back around
|
||||
* and try and pop an event off the queue
|
||||
*/
|
||||
|
||||
ret = nxsem_wait(&priv->md_exclsem);
|
||||
@ -1412,8 +1430,9 @@ int mac802154netdev_register(MACHANDLE mac)
|
||||
}
|
||||
|
||||
#ifdef CONFIG_NET_6LOWPAN
|
||||
/* Make sure the our single packet buffer is attached. We must do this before
|
||||
* registering the device since, once the device is registered, a packet may
|
||||
/* Make sure the our single packet buffer is attached.
|
||||
* We must do this before registering the device since,
|
||||
* once the device is registered, a packet may
|
||||
* be attempted to be forwarded and require the buffer.
|
||||
*/
|
||||
|
||||
@ -1424,7 +1443,9 @@ int mac802154netdev_register(MACHANDLE mac)
|
||||
|
||||
netdev_register(&priv->md_dev.r_dev, NET_LL_IEEE802154);
|
||||
|
||||
/* Put the network in the DOWN state, let the user decide when to bring it up */
|
||||
/* Put the network in the DOWN state, let the user decide when to bring
|
||||
* it up
|
||||
*/
|
||||
|
||||
dev->d_flags = IFF_DOWN;
|
||||
return macnet_ifdown(&priv->md_dev.r_dev);
|
||||
|
@ -50,7 +50,7 @@
|
||||
#include <nuttx/wireless/ieee802154/ieee802154_mac.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Public MAC Functions
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -63,7 +63,7 @@
|
||||
static void mac802154_polltimeout(FAR void *arg);
|
||||
|
||||
/****************************************************************************
|
||||
* Public MAC Functions
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
@ -84,18 +84,18 @@ int mac802154_req_poll(MACHANDLE mac, FAR struct ieee802154_poll_req_s *req)
|
||||
FAR struct ieee802154_txdesc_s *txdesc;
|
||||
int ret;
|
||||
|
||||
/* On receipt of the MLME-POLL.request primitive, the MLME requests data from
|
||||
* the coordinator, as described in 5.1.6.3. If the poll is directed to the
|
||||
* PAN coordinator, the data request command may be generated without any
|
||||
* destination address information present. Otherwise, the data request
|
||||
* command is always generated with the destination address information in the
|
||||
* CoordPANId and CoordAddress parameters.
|
||||
/* On receipt of the MLME-POLL.request primitive, the MLME requests data
|
||||
* from the coordinator, as described in 5.1.6.3. If the poll is directed
|
||||
* to the PAN coordinator, the data request command may be generated
|
||||
* without any destination address information present. Otherwise, the data
|
||||
* request command is always generated with the destination address
|
||||
* information in the CoordPANId and CoordAddress parameters.
|
||||
*/
|
||||
|
||||
/* Get exclusive access to the operation semaphore. This must happen before
|
||||
* getting exclusive access to the MAC struct or else there could be a lockup
|
||||
* condition. This would occur if another thread is using the cmdtrans but
|
||||
* needs access to the MAC in order to unlock it.
|
||||
* getting exclusive access to the MAC struct or else there could be a
|
||||
* lockup condition. This would occur if another thread is using the
|
||||
* cmdtrans but needs access to the MAC in order to unlock it.
|
||||
*/
|
||||
|
||||
ret = mac802154_takesem(&priv->opsem, true);
|
||||
@ -106,12 +106,12 @@ int mac802154_req_poll(MACHANDLE mac, FAR struct ieee802154_poll_req_s *req)
|
||||
|
||||
/* Get exclusive access to the MAC */
|
||||
|
||||
ret = mac802154_lock(priv, true);
|
||||
if (ret < 0)
|
||||
{
|
||||
mac802154_givesem(&priv->opsem);
|
||||
return ret;
|
||||
}
|
||||
ret = mac802154_lock(priv, true);
|
||||
if (ret < 0)
|
||||
{
|
||||
mac802154_givesem(&priv->opsem);
|
||||
return ret;
|
||||
}
|
||||
|
||||
priv->curr_op = MAC802154_OP_POLL;
|
||||
priv->curr_cmd = IEEE802154_CMD_DATA_REQ;
|
||||
@ -127,26 +127,34 @@ int mac802154_req_poll(MACHANDLE mac, FAR struct ieee802154_poll_req_s *req)
|
||||
}
|
||||
|
||||
/* The Source Addressing Mode field shall be set according to the value of
|
||||
* macShortAddress. If macShortAddress is less than 0xfffe, short addressing
|
||||
* shall be used. Extended addressing shall be used otherwise.
|
||||
* macShortAddress.
|
||||
* If macShortAddress is less than 0xfffe, short addressing shall be used.
|
||||
* Extended addressing shall be used otherwise.
|
||||
*/
|
||||
|
||||
if (priv->addr.saddr[0] >= 0xfe && priv->addr.saddr[1] == 0xff)
|
||||
{
|
||||
mac802154_createdatareq(priv, &req->coordaddr, IEEE802154_ADDRMODE_EXTENDED,
|
||||
mac802154_createdatareq(priv,
|
||||
&req->coordaddr,
|
||||
IEEE802154_ADDRMODE_EXTENDED,
|
||||
txdesc);
|
||||
}
|
||||
else
|
||||
{
|
||||
mac802154_createdatareq(priv, &req->coordaddr, IEEE802154_ADDRMODE_SHORT,
|
||||
mac802154_createdatareq(priv,
|
||||
&req->coordaddr,
|
||||
IEEE802154_ADDRMODE_SHORT,
|
||||
txdesc);
|
||||
}
|
||||
|
||||
/* Save a copy of the destination addressing information into the tx descriptor.
|
||||
* We only do this for commands to help with handling their progession.
|
||||
/* Save a copy of the destination addressing information into the tx
|
||||
* descriptor. We only do this for commands to help with handling their
|
||||
* progession.
|
||||
*/
|
||||
|
||||
memcpy(&txdesc->destaddr, &req->coordaddr, sizeof(struct ieee802154_addr_s));
|
||||
memcpy(&txdesc->destaddr,
|
||||
&req->coordaddr,
|
||||
sizeof(struct ieee802154_addr_s));
|
||||
|
||||
/* Save a reference of the tx descriptor */
|
||||
|
||||
@ -252,19 +260,20 @@ void mac802154_txdone_datareq_poll(FAR struct ieee802154_privmac_s *priv,
|
||||
* Name: mac802154_polltimeout
|
||||
*
|
||||
* Description:
|
||||
* Function registered with MAC timer that gets called via the work queue to
|
||||
* handle a timeout for extracting a response from the Coordinator.
|
||||
* Function registered with MAC timer that gets called via the work queue
|
||||
* to handle a timeout for extracting a response from the Coordinator.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void mac802154_polltimeout(FAR void *arg)
|
||||
{
|
||||
FAR struct ieee802154_privmac_s *priv = (FAR struct ieee802154_privmac_s *)arg;
|
||||
FAR struct ieee802154_privmac_s *priv =
|
||||
(FAR struct ieee802154_privmac_s *)arg;
|
||||
FAR struct ieee802154_primitive_s *primitive;
|
||||
|
||||
/* If there is work scheduled for the rxframe_worker, we want to reschedule
|
||||
* this work, so that we make sure if the frame we were waiting for was just
|
||||
* received, we don't timeout
|
||||
* this work, so that we make sure if the frame we were waiting for was
|
||||
* just received, we don't timeout
|
||||
*/
|
||||
|
||||
if (!work_available(&priv->rx_work))
|
||||
@ -282,6 +291,7 @@ void mac802154_polltimeout(FAR void *arg)
|
||||
mac802154_lock(priv, false);
|
||||
|
||||
/* We are no longer performing the association operation */
|
||||
|
||||
priv->curr_op = MAC802154_OP_NONE;
|
||||
priv->cmd_desc = NULL;
|
||||
mac802154_givesem(&priv->opsem);
|
||||
|
@ -55,7 +55,7 @@
|
||||
#include <nuttx/wireless/ieee802154/ieee802154_mac.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Public MAC Functions
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -56,7 +56,7 @@
|
||||
#include <nuttx/wireless/ieee802154/ieee802154_mac.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Public MAC Functions
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
@ -68,13 +68,13 @@
|
||||
*
|
||||
* NOTE: The standard specifies that confirmation should be provided via
|
||||
* via the asynchronous MLME-RESET.confirm primitive. However, in our
|
||||
* implementation we synchronously return the value immediately. Therefore,
|
||||
* we merge the functionality of the MLME-RESET.request and MLME-RESET.confirm
|
||||
* primitives together.
|
||||
* implementation we synchronously return the value immediately.
|
||||
* Therefore, we merge the functionality of the MLME-RESET.request and
|
||||
* MLME-RESET.confirm primitives together.
|
||||
*
|
||||
* Input Parameters:
|
||||
* mac - Handle to the MAC layer instance
|
||||
* resetattr - Whether or not to reset the MAC PIB attributes to defaults
|
||||
* mac - Handle to the MAC layer instance
|
||||
* resetattr - Whether or not to reset the MAC PIB attributes to defaults
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
@ -113,11 +113,12 @@ int mac802154_req_reset(MACHANDLE mac, bool resetattr)
|
||||
priv->sec_enabled = false; /* Security disabled by default */
|
||||
priv->tx_totaldur = 0; /* 0 transmit duration */
|
||||
|
||||
priv->trans_persisttime = 0x01F4;
|
||||
priv->trans_persisttime = 0x01f4;
|
||||
|
||||
/* Reset the short address and PAN ID. The extended address does not
|
||||
* get reset. It is a read-only attribute and the radio driver should
|
||||
* be in charge of managing it. We pull a local copy for us to use below.
|
||||
* be in charge of managing it. We pull a local copy for us to use
|
||||
* below.
|
||||
*/
|
||||
|
||||
priv->addr.mode = IEEE802154_ADDRMODE_EXTENDED;
|
||||
@ -135,11 +136,14 @@ int mac802154_req_reset(MACHANDLE mac, bool resetattr)
|
||||
* reset.
|
||||
*/
|
||||
|
||||
priv->radio->getattr(priv->radio, IEEE802154_ATTR_MAC_EADDR, &attr);
|
||||
IEEE802154_EADDRCOPY(priv->addr.eaddr, attr.mac.eaddr);
|
||||
priv->radio->getattr(priv->radio,
|
||||
IEEE802154_ATTR_MAC_EADDR, &attr);
|
||||
IEEE802154_EADDRCOPY(priv->addr.eaddr,
|
||||
attr.mac.eaddr);
|
||||
|
||||
priv->radio->getattr(priv->radio, IEEE802154_ATTR_MAC_MAX_FRAME_WAITTIME,
|
||||
&attr);
|
||||
priv->radio->getattr(priv->radio,
|
||||
IEEE802154_ATTR_MAC_MAX_FRAME_WAITTIME,
|
||||
&attr);
|
||||
priv->max_frame_waittime = attr.mac.max_frame_waittime;
|
||||
}
|
||||
|
||||
|
@ -69,8 +69,8 @@ static void mac802154_rxenabletimeout(FAR void *arg);
|
||||
* Name: mac802154_rxenabletimeout
|
||||
*
|
||||
* Description:
|
||||
* Function registered with MAC timer that gets called via the work queue to
|
||||
* handle a timeout for extracting the Association Response from the
|
||||
* Function registered with MAC timer that gets called via the work queue
|
||||
* to handle a timeout for extracting the Association Response from the
|
||||
* Coordinator.
|
||||
*
|
||||
****************************************************************************/
|
||||
@ -162,7 +162,7 @@ int mac802154_req_rxenable(MACHANDLE mac,
|
||||
|
||||
mac802154_rxenable(priv);
|
||||
|
||||
if (req->rxon_dur != 0xFFFFFFFF)
|
||||
if (req->rxon_dur != 0xffffffff)
|
||||
{
|
||||
mac802154_timerstart(priv, req->rxon_dur,
|
||||
mac802154_rxenabletimeout);
|
||||
|
@ -70,14 +70,14 @@ static void mac802154_scantimeout(FAR void *arg);
|
||||
* Name: mac802154_req_scan
|
||||
*
|
||||
* Description:
|
||||
* The MLME-SCAN.request primitive is used to initiate a channel scan over a
|
||||
* given list of channels. A device can use a channel scan to measure the
|
||||
* energy on the channel, search for the coordinator with which it associated,
|
||||
* or search for all coordinators transmitting beacon frames within the POS of
|
||||
* the scanning device. Scan results are returned
|
||||
* The MLME-SCAN.request primitive is used to initiate a channel scan over
|
||||
* a given list of channels. A device can use a channel scan to measure the
|
||||
* energy on the channel, search for the coordinator with which it
|
||||
* associated, or search for all coordinators transmitting beacon frames
|
||||
* within the POS of the scanning device. Scan results are returned
|
||||
* via MULTIPLE calls to the struct mac802154_maccb_s->conf_scan callback.
|
||||
* This is a difference with the official 802.15.4 specification, implemented
|
||||
* here to save memory.
|
||||
* This is a difference with the official 802.15.4 specification,
|
||||
* implemented here to save memory.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
@ -95,8 +95,8 @@ int mac802154_req_scan(MACHANDLE mac, FAR struct ieee802154_scan_req_s *req)
|
||||
|
||||
wlinfo("MLME: SCAN.request received\n");
|
||||
|
||||
/* Need to get access to the ops semaphore since operations are serial. This
|
||||
* must be done before locking the MAC so that we don't hold the MAC
|
||||
/* Need to get access to the ops semaphore since operations are serial.
|
||||
* This must be done before locking the MAC so that we don't hold the MAC
|
||||
*/
|
||||
|
||||
ret = mac802154_takesem(&priv->opsem, true);
|
||||
@ -122,7 +122,8 @@ int mac802154_req_scan(MACHANDLE mac, FAR struct ieee802154_scan_req_s *req)
|
||||
priv->scanindex = 0;
|
||||
priv->npandesc = 0;
|
||||
|
||||
priv->scansymdur = IEEE802154_BASE_SUPERFRAME_DURATION * ((1 << req->duration) + 1);
|
||||
priv->scansymdur = IEEE802154_BASE_SUPERFRAME_DURATION *
|
||||
((1 << req->duration) + 1);
|
||||
|
||||
switch (req->type)
|
||||
{
|
||||
@ -135,17 +136,18 @@ int mac802154_req_scan(MACHANDLE mac, FAR struct ieee802154_scan_req_s *req)
|
||||
mac802154_setchannel(priv, req->channels[priv->scanindex]);
|
||||
mac802154_setchpage(priv, req->chpage);
|
||||
|
||||
/* Before commencing an active or passive scan, the MAC sublayer shall
|
||||
* store the value of macPANId and then set it to 0xffff for the
|
||||
* duration of the scan. This enables the receive filter to accept all
|
||||
* beacons rather than just the beacons from its current PAN, as
|
||||
* described in 5.1.6.2. On completion of the scan, the MAC sublayer
|
||||
* shall restore the value of macPANId to the value stored before the
|
||||
* scan began. [1] pg. 24
|
||||
/* Before commencing an active or passive scan, the MAC sublayer
|
||||
* shall store the value of macPANId and then set it to 0xffff for
|
||||
* the duration of the scan. This enables the receive filter to
|
||||
* accept all beacons rather than just the beacons from its current
|
||||
* PAN, as described in 5.1.6.2. On completion of the scan, the MAC
|
||||
* sublayer shall restore the value of macPANId to the value stored
|
||||
* before the scan began. [1] pg. 24
|
||||
*/
|
||||
|
||||
IEEE802154_PANIDCOPY(priv->panidbeforescan, priv->addr.panid);
|
||||
mac802154_setpanid(priv, (const uint8_t *)&IEEE802154_PANID_UNSPEC);
|
||||
mac802154_setpanid(priv,
|
||||
(const uint8_t *) & IEEE802154_PANID_UNSPEC);
|
||||
|
||||
/* ...after switching to the channel for a passive scan, the device
|
||||
* shall enable its receiver for at most
|
||||
@ -154,7 +156,9 @@ int mac802154_req_scan(MACHANDLE mac, FAR struct ieee802154_scan_req_s *req)
|
||||
*/
|
||||
|
||||
mac802154_rxenable(priv);
|
||||
mac802154_timerstart(priv, priv->scansymdur, mac802154_scantimeout);
|
||||
mac802154_timerstart(priv,
|
||||
priv->scansymdur,
|
||||
mac802154_scantimeout);
|
||||
}
|
||||
break;
|
||||
case IEEE802154_SCANTYPE_ACTIVE:
|
||||
@ -191,7 +195,8 @@ int mac802154_req_scan(MACHANDLE mac, FAR struct ieee802154_scan_req_s *req)
|
||||
}
|
||||
|
||||
mac802154_unlock(priv)
|
||||
return OK;
|
||||
|
||||
return OK;
|
||||
|
||||
errout_with_sem:
|
||||
mac802154_unlock(priv)
|
||||
@ -219,47 +224,52 @@ void mac802154_scanfinish(FAR struct ieee802154_privmac_s *priv,
|
||||
|
||||
if (priv->currscan.type == IEEE802154_SCANTYPE_ED)
|
||||
{
|
||||
/* "The list of energy measurements, one for each channel searched during an
|
||||
* ED scan. This parameter is null for active, passive, and orphan scans." [1]
|
||||
/* "The list of energy measurements, one for each channel searched
|
||||
* during an ED scan. This parameter is null for active, passive,
|
||||
* and orphan scans." [1]
|
||||
*/
|
||||
|
||||
memcpy(scanconf->edlist, priv->edlist, sizeof(scanconf->edlist));
|
||||
memcpy(scanconf->chlist, priv->currscan.channels, sizeof(scanconf->chlist));
|
||||
memcpy(scanconf->edlist,
|
||||
priv->edlist,
|
||||
sizeof(scanconf->edlist));
|
||||
memcpy(scanconf->chlist,
|
||||
priv->currscan.channels,
|
||||
sizeof(scanconf->chlist));
|
||||
scanconf->numresults = priv->currscan.numchan;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
/* "A list of the channels given in the request which were not scanned. This
|
||||
* parameter is not valid for ED scans." [1]
|
||||
*/
|
||||
/* "A list of the channels given in the request which were not
|
||||
* scanned. This parameter is not valid for ED scans." [1]
|
||||
*/
|
||||
|
||||
scanconf->numunscanned = priv->currscan.numchan - priv->scanindex;
|
||||
if (scanconf->numunscanned)
|
||||
scanconf->numunscanned = priv->currscan.numchan - priv->scanindex;
|
||||
if (scanconf->numunscanned)
|
||||
{
|
||||
memcpy(scanconf->chlist, &priv->currscan.channels[priv->scanindex],
|
||||
scanconf->numunscanned);
|
||||
}
|
||||
|
||||
/* "The list of PAN descriptors, one for each beacon found during an active or
|
||||
* passive scan if macAutoRequest is set to TRUE. This parameter is null for
|
||||
* ED and orphan scans or when macAutoRequest is set to FALSE during an
|
||||
* active or passive scan." [1]
|
||||
*/
|
||||
/* "The list of PAN descriptors, one for each beacon found during an
|
||||
* active or passive scan if macAutoRequest is set to TRUE. This
|
||||
* parameter is null for ED and orphan scans or when macAutoRequest
|
||||
* is set to FALSE during an active or passive scan." [1]
|
||||
*/
|
||||
|
||||
if (priv->currscan.type != IEEE802154_SCANTYPE_ORPHAN && priv->autoreq)
|
||||
{
|
||||
memcpy(scanconf->pandescs, priv->pandescs,
|
||||
sizeof(struct ieee802154_pandesc_s) * priv->npandesc);
|
||||
scanconf->numresults = priv->npandesc;
|
||||
}
|
||||
if (priv->currscan.type != IEEE802154_SCANTYPE_ORPHAN && priv->autoreq)
|
||||
{
|
||||
memcpy(scanconf->pandescs, priv->pandescs,
|
||||
sizeof(struct ieee802154_pandesc_s) * priv->npandesc);
|
||||
scanconf->numresults = priv->npandesc;
|
||||
}
|
||||
|
||||
if (priv->currscan.type == IEEE802154_SCANTYPE_PASSIVE)
|
||||
{
|
||||
/* Reset the PAN ID to the setting before the scan started */
|
||||
if (priv->currscan.type == IEEE802154_SCANTYPE_PASSIVE)
|
||||
{
|
||||
/* Reset the PAN ID to the setting before the scan started */
|
||||
|
||||
mac802154_setpanid(priv, priv->panidbeforescan);
|
||||
}
|
||||
mac802154_setpanid(priv, priv->panidbeforescan);
|
||||
}
|
||||
}
|
||||
|
||||
scanconf->status = status;
|
||||
@ -274,15 +284,16 @@ void mac802154_scanfinish(FAR struct ieee802154_privmac_s *priv,
|
||||
* Name: mac802154_edscan_onresult
|
||||
*
|
||||
* Description:
|
||||
* Function indirectly called from the radio layer via the radiocb edresult()
|
||||
* call.
|
||||
* Function indirectly called from the radio layer via the radiocb
|
||||
* edresult() call.
|
||||
*
|
||||
* Assumptions:
|
||||
* Called with the priv mac struct locked
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void mac802154_edscan_onresult(FAR struct ieee802154_privmac_s *priv, uint8_t edval)
|
||||
void mac802154_edscan_onresult(FAR struct ieee802154_privmac_s *priv,
|
||||
uint8_t edval)
|
||||
{
|
||||
DEBUGASSERT(priv->curr_op == MAC802154_OP_SCAN &&
|
||||
priv->currscan.type == IEEE802154_SCANTYPE_ED);
|
||||
@ -324,14 +335,15 @@ void mac802154_edscan_onresult(FAR struct ieee802154_privmac_s *priv, uint8_t ed
|
||||
* Name: mac802154_scantimeout
|
||||
*
|
||||
* Description:
|
||||
* Function registered with MAC timer that gets called via the work queue to
|
||||
* handle a timeout for performing a scan operation.
|
||||
* Function registered with MAC timer that gets called via the work queue
|
||||
* to handle a timeout for performing a scan operation.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void mac802154_scantimeout(FAR void *arg)
|
||||
{
|
||||
FAR struct ieee802154_privmac_s *priv = (FAR struct ieee802154_privmac_s *)arg;
|
||||
FAR struct ieee802154_privmac_s *priv =
|
||||
(FAR struct ieee802154_privmac_s *)arg;
|
||||
DEBUGASSERT(priv->curr_op == MAC802154_OP_SCAN);
|
||||
|
||||
mac802154_lock(priv, false);
|
||||
@ -353,6 +365,7 @@ static void mac802154_scantimeout(FAR void *arg)
|
||||
{
|
||||
mac802154_scanfinish(priv, IEEE802154_STATUS_NO_BEACON);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -60,7 +60,8 @@
|
||||
|
||||
struct ieee802154_privmac_s; /* Forward Reference */
|
||||
|
||||
void mac802154_edscan_onresult(FAR struct ieee802154_privmac_s *priv, uint8_t edval);
|
||||
void mac802154_edscan_onresult(FAR struct ieee802154_privmac_s *priv,
|
||||
uint8_t edval);
|
||||
|
||||
void mac802154_scanfinish(FAR struct ieee802154_privmac_s *priv,
|
||||
enum ieee802154_status_e status);
|
||||
|
@ -51,7 +51,7 @@
|
||||
#include <nuttx/wireless/ieee802154/ieee802154_mac.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Public MAC Functions
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
@ -64,7 +64,8 @@
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int mac802154_req_start(MACHANDLE mac, FAR struct ieee802154_start_req_s *req)
|
||||
int mac802154_req_start(MACHANDLE mac,
|
||||
FAR struct ieee802154_start_req_s *req)
|
||||
{
|
||||
FAR struct ieee802154_privmac_s *priv =
|
||||
(FAR struct ieee802154_privmac_s *)mac;
|
||||
@ -79,14 +80,14 @@ int mac802154_req_start(MACHANDLE mac, FAR struct ieee802154_start_req_s *req)
|
||||
}
|
||||
|
||||
/* When the CoordRealignment parameter is set to TRUE, the coordinator
|
||||
* attempts to transmit a coordinator realignment command frame as described
|
||||
* in 5.1.2.3.2. If the transmission of the coordinator realignment command
|
||||
* fails due to a channel access failure, the MLME will not make any changes
|
||||
* to the superframe configuration. (i.e., no PIB attributes will be
|
||||
* changed). If the coordinator realignment command is successfully
|
||||
* transmitted, the MLME updates the PIB attributes BeaconOrder,
|
||||
* SuperframeOrder, PANId, ChannelPage, and ChannelNumber parameters.
|
||||
* [1] pg. 106
|
||||
* attempts to transmit a coordinator realignment command frame as
|
||||
* described in 5.1.2.3.2. If the transmission of the coordinator
|
||||
* realignment command fails due to a channel access failure, the MLME
|
||||
* will not make any changes to the superframe configuration. (i.e., no
|
||||
* PIB attributes will be changed). If the coordinator realignment
|
||||
* command is successfully transmitted, the MLME updates the PIB
|
||||
* attributes BeaconOrder, SuperframeOrder, PANId, ChannelPage, and
|
||||
* ChannelNumber parameters. [1] pg. 106
|
||||
*/
|
||||
|
||||
if (req->coordrealign)
|
||||
@ -102,10 +103,12 @@ int mac802154_req_start(MACHANDLE mac, FAR struct ieee802154_start_req_s *req)
|
||||
|
||||
/* Tell the radio layer to set the channel number and channel page */
|
||||
|
||||
priv->radio->setattr(priv->radio, IEEE802154_ATTR_PHY_CHAN,
|
||||
(FAR const union ieee802154_attr_u *)&req->chan);
|
||||
priv->radio->setattr(priv->radio, IEEE802154_ATTR_PHY_CURRENT_PAGE,
|
||||
(FAR const union ieee802154_attr_u *)&req->chpage);
|
||||
priv->radio->setattr(priv->radio,
|
||||
IEEE802154_ATTR_PHY_CHAN,
|
||||
(FAR const union ieee802154_attr_u *)&req->chan);
|
||||
priv->radio->setattr(priv->radio,
|
||||
IEEE802154_ATTR_PHY_CURRENT_PAGE,
|
||||
(FAR const union ieee802154_attr_u *)&req->chpage);
|
||||
|
||||
/* The address used in the Source Address field of the beacon frame shall
|
||||
* contain the value of macExtendedAddress if macShortAddress is equal to
|
||||
@ -131,7 +134,9 @@ int mac802154_req_start(MACHANDLE mac, FAR struct ieee802154_start_req_s *req)
|
||||
|
||||
priv->sfspec.beaconorder = req->beaconorder;
|
||||
|
||||
/* The value of macSuperframeOrder shall be ignored if macBeaconOrder = 15. pg. 19 */
|
||||
/* The value of macSuperframeOrder shall be ignored if
|
||||
* macBeaconOrder = 15. pg. 19
|
||||
*/
|
||||
|
||||
if (priv->sfspec.beaconorder < 15)
|
||||
{
|
||||
@ -171,8 +176,8 @@ int mac802154_req_start(MACHANDLE mac, FAR struct ieee802154_start_req_s *req)
|
||||
|
||||
priv->sfspec.final_capslot = 15;
|
||||
|
||||
/* If the PAN coordinator parameter is set to TRUE, the MLME ignores the
|
||||
* StartTime parameter and begins beacon transmissions immediately.
|
||||
/* If the PAN coordinator parameter is set to TRUE, the MLME ignores
|
||||
* the StartTime parameter and begins beacon transmissions immediately.
|
||||
*/
|
||||
|
||||
if (req->pancoord)
|
||||
|
@ -55,7 +55,7 @@
|
||||
#include <nuttx/wireless/ieee802154/ieee802154_mac.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Public MAC Functions
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
|
Loading…
x
Reference in New Issue
Block a user