mirror of
https://github.com/apache/nuttx.git
synced 2026-06-05 15:58:59 +08:00
Costmetic change from review of last PR
This commit is contained in:
+111
-80
File diff suppressed because it is too large
Load Diff
@@ -102,7 +102,7 @@ int mac802154_ioctl(MACHANDLE mac, int cmd, unsigned long arg);
|
||||
*
|
||||
* Description:
|
||||
* The MCPS-DATA.request primitive requests the transfer of a data SPDU
|
||||
* (i.e., MSDU) from a local SSCS entity to a single peer SSCS entity.
|
||||
* (i.e., MSDU) from a local SSCS entity to a single peer SSCS entity.
|
||||
* Confirmation is returned via the
|
||||
* struct ieee802154_maccb_s->conf_data callback.
|
||||
*
|
||||
@@ -114,8 +114,8 @@ int mac802154_req_data(MACHANDLE mac, FAR struct ieee802154_data_req_s *req);
|
||||
* Name: mac802154_req_purge
|
||||
*
|
||||
* Description:
|
||||
* The MCPS-PURGE.request primitive allows the next higher layer to purge an
|
||||
* MSDU from the transaction queue. Confirmation is returned via
|
||||
* The MCPS-PURGE.request primitive allows the next higher layer to purge
|
||||
* an MSDU from the transaction queue. Confirmation is returned via
|
||||
* the struct ieee802154_maccb_s->conf_purge callback.
|
||||
*
|
||||
****************************************************************************/
|
||||
@@ -126,7 +126,7 @@ int mac802154_req_purge(MACHANDLE mac, uint8_t handle);
|
||||
* Name: mac802154_req_associate
|
||||
*
|
||||
* Description:
|
||||
* The MLME-ASSOCIATE.request primitive allows a device to request an
|
||||
* The MLME-ASSOCIATE.request primitive allows a device to request an
|
||||
* association with a coordinator. Confirmation is returned via the
|
||||
* struct ieee802154_maccb_s->conf_associate callback.
|
||||
*
|
||||
@@ -139,9 +139,11 @@ int mac802154_req_associate(MACHANDLE mac,
|
||||
* 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 ieee802154_maccb_s->conf_disassociate callback.
|
||||
*
|
||||
@@ -166,8 +168,8 @@ int mac802154_req_get(MACHANDLE mac, enum ieee802154_pib_attr_e attr);
|
||||
* 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 ieee802154_maccb_s->conf_gts callback.
|
||||
*
|
||||
@@ -205,14 +207,14 @@ int mac802154_req_rxenable(MACHANDLE mac, bool deferrable, int ontime,
|
||||
* 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
|
||||
* via MULTIPLE calls to the struct ieee802154_maccb_s->conf_scan callback.
|
||||
* This is a difference with the official 802.15.4 specification, implemented
|
||||
* here to save memory.
|
||||
* 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 ieee802154_maccb_s->conf_scan
|
||||
* callback. This is a difference with the official 802.15.4
|
||||
* specification, implemented here to save memory.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
@@ -236,8 +238,8 @@ int mac802154_req_set(MACHANDLE mac, int attribute, FAR uint8_t *value,
|
||||
* Name: mac802154_req_start
|
||||
*
|
||||
* Description:
|
||||
* The MLME-START.request primitive makes a request for the device to start
|
||||
* using a new superframe configuration. Confirmation is returned
|
||||
* The MLME-START.request primitive makes a request for the device to
|
||||
* start using a new superframe configuration. Confirmation is returned
|
||||
* via the struct ieee802154_maccb_s->conf_start callback.
|
||||
*
|
||||
****************************************************************************/
|
||||
@@ -263,8 +265,8 @@ int mac802154_req_sync(MACHANDLE mac, int channel, bool track);
|
||||
* Name: mac802154_req_poll
|
||||
*
|
||||
* Description:
|
||||
* The MLME-POLL.request primitive prompts the device to request data from the
|
||||
* coordinator. Confirmation is returned via the
|
||||
* The MLME-POLL.request primitive prompts the device to request data from
|
||||
* the coordinator. Confirmation is returned via the
|
||||
* struct ieee802154_maccb_s->conf_poll callback, followed by a
|
||||
* struct ieee802154_maccb_s->ind_data callback.
|
||||
*
|
||||
@@ -276,8 +278,8 @@ int mac802154_req_poll(MACHANDLE mac, FAR uint8_t *coordaddr);
|
||||
* Name: mac802154_rsp_associate
|
||||
*
|
||||
* Description:
|
||||
* The MLME-ASSOCIATE.response primitive is used to initiate a response to an
|
||||
* MLME-ASSOCIATE.indication primitive.
|
||||
* The MLME-ASSOCIATE.response primitive is used to initiate a response to
|
||||
* an MLME-ASSOCIATE.indication primitive.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
|
||||
@@ -83,12 +83,11 @@ struct mac802154_devwrapper_s
|
||||
|
||||
struct mac802154dev_notify_s md_mcps_notify;
|
||||
pid_t md_mcps_pid;
|
||||
|
||||
|
||||
/* MLME Service notification information */
|
||||
|
||||
struct mac802154dev_notify_s md_mlme_notify;
|
||||
pid_t md_mlme_pid;
|
||||
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -228,7 +227,7 @@ static int mac802154dev_open(FAR struct file *filep)
|
||||
ret = -ENOMEM;
|
||||
goto errout_with_sem;
|
||||
}
|
||||
|
||||
|
||||
/* Attach the open struct to the device */
|
||||
|
||||
opriv->md_flink = dev->md_open;
|
||||
@@ -413,7 +412,7 @@ static ssize_t mac802154dev_write(FAR struct file *filep,
|
||||
wlerr("ERROR: buffer too small: %lu\n", (unsigned long)len);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
||||
DEBUGASSERT(buffer != NULL);
|
||||
frame = (FAR struct ieee802154_frame_s *)buffer;
|
||||
|
||||
@@ -441,7 +440,7 @@ static ssize_t mac802154dev_write(FAR struct file *filep,
|
||||
|
||||
mac802154dev_givesem(&dev->md_exclsem);
|
||||
|
||||
if (ret < 0)
|
||||
if (ret < 0)
|
||||
{
|
||||
wlerr("ERROR: req_data failed %d\n", ret);
|
||||
return ret;
|
||||
@@ -449,7 +448,7 @@ static ssize_t mac802154dev_write(FAR struct file *filep,
|
||||
|
||||
/* Wait for the DATA.confirm callback to be called for our handle */
|
||||
|
||||
if(sem_wait(dwait.mw_sem) < 0)
|
||||
if (sem_wait(dwait.mw_sem) < 0)
|
||||
{
|
||||
/* This should only happen if the wait was canceled by an signal */
|
||||
|
||||
@@ -522,10 +521,11 @@ static int mac802154dev_ioctl(FAR struct file *filep, int cmd,
|
||||
dev->md_mlme_notify.mn_signo = notify->mn_signo;
|
||||
dev->md_mlme_pid = getpid();
|
||||
|
||||
return OK;
|
||||
return OK;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case MAC802154IOC_MCPS_REGISTER:
|
||||
{
|
||||
FAR struct mac802154dev_notify_s *notify =
|
||||
@@ -538,19 +538,19 @@ static int mac802154dev_ioctl(FAR struct file *filep, int cmd,
|
||||
dev->md_mcps_notify.mn_signo = notify->mn_signo;
|
||||
dev->md_mcps_pid = getpid();
|
||||
|
||||
return OK;
|
||||
return OK;
|
||||
}
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
||||
case MAC802154IOC_MLME_ASSOC_REQUEST:
|
||||
{
|
||||
FAR struct ieee802154_assoc_req_s *req =
|
||||
(FAR struct ieee802154_assoc_req_s *)((uintptr_t)arg);
|
||||
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
wlerr("ERROR: Unrecognized command %ld\n", cmd);
|
||||
ret = -EINVAL;
|
||||
@@ -578,7 +578,7 @@ void mac802154dev_conf_data(MACHANDLE mac,
|
||||
|
||||
/* 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) != OK);
|
||||
|
||||
/* Search to see if there is a dwait pending for this transaction */
|
||||
@@ -586,37 +586,36 @@ void mac802154dev_conf_data(MACHANDLE mac,
|
||||
for (prev = NULL, curr = dev->md_dwait;
|
||||
curr && curr->mw_handle != conf->msdu_handle;
|
||||
prev = curr, curr = curr->mw_flink);
|
||||
|
||||
|
||||
/* If a dwait is found */
|
||||
|
||||
if (curr)
|
||||
{
|
||||
/* Unlink the structure from the list. The struct should be allocated on
|
||||
* the calling write's stack, so we don't need to worry about deallocating
|
||||
* here */
|
||||
{
|
||||
/* Unlink the structure from the list. The struct should be allocated on
|
||||
* the calling write's stack, so we don't need to worry about deallocating
|
||||
* here */
|
||||
|
||||
if (prev)
|
||||
{
|
||||
prev->mw_flink = curr->mw_flink;
|
||||
}
|
||||
else
|
||||
{
|
||||
dev->md_dwait = curr->mw_flink;
|
||||
}
|
||||
|
||||
/* Copy the transmission status into the dwait struct */
|
||||
if (prev)
|
||||
{
|
||||
prev->mw_flink = curr->mw_flink;
|
||||
}
|
||||
else
|
||||
{
|
||||
dev->md_dwait = curr->mw_flink;
|
||||
}
|
||||
|
||||
curr->mw_status = conf->msdu_handle;
|
||||
/* Copy the transmission status into the dwait struct */
|
||||
|
||||
/* Wake the thread waiting for the data transmission */
|
||||
curr->mw_status = conf->msdu_handle;
|
||||
|
||||
sem_post(&curr->mw_sem);
|
||||
/* Wake the thread waiting for the data transmission */
|
||||
|
||||
/* Release the driver */
|
||||
sem_post(&curr->mw_sem);
|
||||
|
||||
mac802154dev_givesem(&dev->md_exclsem);
|
||||
}
|
||||
/* Release the driver */
|
||||
|
||||
mac802154dev_givesem(&dev->md_exclsem);
|
||||
}
|
||||
|
||||
#ifndef CONFIG_DISABLE_SIGNALS
|
||||
/* Send a signal to the registered application */
|
||||
@@ -631,7 +630,6 @@ void mac802154dev_conf_data(MACHANDLE mac,
|
||||
(void)sigqueue(dev->md_mcps_pid, dev->md_mcps_notify.mn_signo,
|
||||
value.sival_ptr);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -261,7 +261,7 @@ static ssize_t radio802154dev_read(FAR struct file *filep, FAR char *buffer, siz
|
||||
goto done;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/* if no packet is received, this will produce -EAGAIN
|
||||
* The user is responsible for sleeping until sth arrives
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user