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:
|
* Description:
|
||||||
* The MCPS-DATA.request primitive requests the transfer of a data SPDU
|
* 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
|
* Confirmation is returned via the
|
||||||
* struct ieee802154_maccb_s->conf_data callback.
|
* 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
|
* Name: mac802154_req_purge
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* The MCPS-PURGE.request primitive allows the next higher layer to purge an
|
* The MCPS-PURGE.request primitive allows the next higher layer to purge
|
||||||
* MSDU from the transaction queue. Confirmation is returned via
|
* an MSDU from the transaction queue. Confirmation is returned via
|
||||||
* the struct ieee802154_maccb_s->conf_purge callback.
|
* 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
|
* Name: mac802154_req_associate
|
||||||
*
|
*
|
||||||
* Description:
|
* 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
|
* association with a coordinator. Confirmation is returned via the
|
||||||
* struct ieee802154_maccb_s->conf_associate callback.
|
* struct ieee802154_maccb_s->conf_associate callback.
|
||||||
*
|
*
|
||||||
@@ -139,9 +139,11 @@ int mac802154_req_associate(MACHANDLE mac,
|
|||||||
* Name: mac802154_req_disassociate
|
* Name: mac802154_req_disassociate
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* The MLME-DISASSOCIATE.request primitive is used by an associated device to
|
* The MLME-DISASSOCIATE.request primitive is used by an associated device
|
||||||
* notify the coordinator of its intent to leave the PAN. It is also used by
|
* to notify the coordinator of its intent to leave the PAN. It is also
|
||||||
* the coordinator to instruct an associated device to leave the PAN.
|
* used by the coordinator to instruct an associated device to leave the
|
||||||
|
* PAN.
|
||||||
|
*
|
||||||
* Confirmation is returned via the
|
* Confirmation is returned via the
|
||||||
* struct ieee802154_maccb_s->conf_disassociate callback.
|
* 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
|
* Name: mac802154_req_gts
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* The MLME-GTS.request primitive allows a device to send a request to the PAN
|
* The MLME-GTS.request primitive allows a device to send a request to the
|
||||||
* coordinator to allocate a new GTS or to deallocate an existing GTS.
|
* PAN coordinator to allocate a new GTS or to deallocate an existing GTS.
|
||||||
* Confirmation is returned via the
|
* Confirmation is returned via the
|
||||||
* struct ieee802154_maccb_s->conf_gts callback.
|
* 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
|
* Name: mac802154_req_scan
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* The MLME-SCAN.request primitive is used to initiate a channel scan over a
|
* The MLME-SCAN.request primitive is used to initiate a channel scan over
|
||||||
* given list of channels. A device can use a channel scan to measure the
|
* a given list of channels. A device can use a channel scan to measure
|
||||||
* energy on the channel, search for the coordinator with which it associated,
|
* the energy on the channel, search for the coordinator with which it
|
||||||
* or search for all coordinators transmitting beacon frames within the POS of
|
* associated, or search for all coordinators transmitting beacon frames
|
||||||
* the scanning device. Scan results are returned
|
* within the POS of the scanning device. Scan results are returned
|
||||||
* via MULTIPLE calls to the struct ieee802154_maccb_s->conf_scan callback.
|
* via MULTIPLE calls to the struct ieee802154_maccb_s->conf_scan
|
||||||
* This is a difference with the official 802.15.4 specification, implemented
|
* callback. This is a difference with the official 802.15.4
|
||||||
* here to save memory.
|
* 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
|
* Name: mac802154_req_start
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* The MLME-START.request primitive makes a request for the device to start
|
* The MLME-START.request primitive makes a request for the device to
|
||||||
* using a new superframe configuration. Confirmation is returned
|
* start using a new superframe configuration. Confirmation is returned
|
||||||
* via the struct ieee802154_maccb_s->conf_start callback.
|
* 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
|
* Name: mac802154_req_poll
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* The MLME-POLL.request primitive prompts the device to request data from the
|
* The MLME-POLL.request primitive prompts the device to request data from
|
||||||
* coordinator. Confirmation is returned via the
|
* the coordinator. Confirmation is returned via the
|
||||||
* struct ieee802154_maccb_s->conf_poll callback, followed by a
|
* struct ieee802154_maccb_s->conf_poll callback, followed by a
|
||||||
* struct ieee802154_maccb_s->ind_data callback.
|
* 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
|
* Name: mac802154_rsp_associate
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* The MLME-ASSOCIATE.response primitive is used to initiate a response to an
|
* The MLME-ASSOCIATE.response primitive is used to initiate a response to
|
||||||
* MLME-ASSOCIATE.indication primitive.
|
* an MLME-ASSOCIATE.indication primitive.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
|||||||
@@ -83,12 +83,11 @@ struct mac802154_devwrapper_s
|
|||||||
|
|
||||||
struct mac802154dev_notify_s md_mcps_notify;
|
struct mac802154dev_notify_s md_mcps_notify;
|
||||||
pid_t md_mcps_pid;
|
pid_t md_mcps_pid;
|
||||||
|
|
||||||
/* MLME Service notification information */
|
/* MLME Service notification information */
|
||||||
|
|
||||||
struct mac802154dev_notify_s md_mlme_notify;
|
struct mac802154dev_notify_s md_mlme_notify;
|
||||||
pid_t md_mlme_pid;
|
pid_t md_mlme_pid;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -228,7 +227,7 @@ static int mac802154dev_open(FAR struct file *filep)
|
|||||||
ret = -ENOMEM;
|
ret = -ENOMEM;
|
||||||
goto errout_with_sem;
|
goto errout_with_sem;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Attach the open struct to the device */
|
/* Attach the open struct to the device */
|
||||||
|
|
||||||
opriv->md_flink = dev->md_open;
|
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);
|
wlerr("ERROR: buffer too small: %lu\n", (unsigned long)len);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
DEBUGASSERT(buffer != NULL);
|
DEBUGASSERT(buffer != NULL);
|
||||||
frame = (FAR struct ieee802154_frame_s *)buffer;
|
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);
|
mac802154dev_givesem(&dev->md_exclsem);
|
||||||
|
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
wlerr("ERROR: req_data failed %d\n", ret);
|
wlerr("ERROR: req_data failed %d\n", ret);
|
||||||
return 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 */
|
/* 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 */
|
/* 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_notify.mn_signo = notify->mn_signo;
|
||||||
dev->md_mlme_pid = getpid();
|
dev->md_mlme_pid = getpid();
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MAC802154IOC_MCPS_REGISTER:
|
case MAC802154IOC_MCPS_REGISTER:
|
||||||
{
|
{
|
||||||
FAR struct mac802154dev_notify_s *notify =
|
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_notify.mn_signo = notify->mn_signo;
|
||||||
dev->md_mcps_pid = getpid();
|
dev->md_mcps_pid = getpid();
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
case MAC802154IOC_MLME_ASSOC_REQUEST:
|
case MAC802154IOC_MLME_ASSOC_REQUEST:
|
||||||
{
|
{
|
||||||
FAR struct ieee802154_assoc_req_s *req =
|
FAR struct ieee802154_assoc_req_s *req =
|
||||||
(FAR struct ieee802154_assoc_req_s *)((uintptr_t)arg);
|
(FAR struct ieee802154_assoc_req_s *)((uintptr_t)arg);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
wlerr("ERROR: Unrecognized command %ld\n", cmd);
|
wlerr("ERROR: Unrecognized command %ld\n", cmd);
|
||||||
ret = -EINVAL;
|
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
|
/* 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) != OK);
|
while(mac802154dev_takesem(&dev->md_exclsem) != OK);
|
||||||
|
|
||||||
/* Search to see if there is a dwait pending for this transaction */
|
/* 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;
|
for (prev = NULL, curr = dev->md_dwait;
|
||||||
curr && curr->mw_handle != conf->msdu_handle;
|
curr && curr->mw_handle != conf->msdu_handle;
|
||||||
prev = curr, curr = curr->mw_flink);
|
prev = curr, curr = curr->mw_flink);
|
||||||
|
|
||||||
/* If a dwait is found */
|
/* If a dwait is found */
|
||||||
|
|
||||||
if (curr)
|
if (curr)
|
||||||
{
|
{
|
||||||
/* Unlink the structure from the list. The struct should be allocated on
|
/* 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
|
* the calling write's stack, so we don't need to worry about deallocating
|
||||||
* here */
|
* here */
|
||||||
|
|
||||||
if (prev)
|
if (prev)
|
||||||
{
|
{
|
||||||
prev->mw_flink = curr->mw_flink;
|
prev->mw_flink = curr->mw_flink;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dev->md_dwait = curr->mw_flink;
|
dev->md_dwait = curr->mw_flink;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Copy the transmission status into the dwait struct */
|
|
||||||
|
|
||||||
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
|
#ifndef CONFIG_DISABLE_SIGNALS
|
||||||
/* Send a signal to the registered application */
|
/* 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,
|
(void)sigqueue(dev->md_mcps_pid, dev->md_mcps_notify.mn_signo,
|
||||||
value.sival_ptr);
|
value.sival_ptr);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -261,7 +261,7 @@ static ssize_t radio802154dev_read(FAR struct file *filep, FAR char *buffer, siz
|
|||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* if no packet is received, this will produce -EAGAIN
|
/* if no packet is received, this will produce -EAGAIN
|
||||||
* The user is responsible for sleeping until sth arrives
|
* The user is responsible for sleeping until sth arrives
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user