mirror of
https://github.com/apache/nuttx.git
synced 2026-05-27 11:26:12 +08:00
c89: move variable declaration out from the for loop
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
This commit is contained in:
committed by
Tiago Medicci Serrano
parent
aa3eeaa62a
commit
1651bb476c
+3
-1
@@ -281,13 +281,15 @@ static void slip_transmit(FAR struct slip_driver_s *self)
|
|||||||
|
|
||||||
if (self->txlen > 0)
|
if (self->txlen > 0)
|
||||||
{
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
/* Transmission of previous packet is still pending. This might happen
|
/* Transmission of previous packet is still pending. This might happen
|
||||||
* in the 'slip_receive' -> 'slip_reply' -> 'slip_transmit' case. Try
|
* in the 'slip_receive' -> 'slip_reply' -> 'slip_transmit' case. Try
|
||||||
* to forward pending packet into UART's transmit buffer. Timeout on
|
* to forward pending packet into UART's transmit buffer. Timeout on
|
||||||
* packet if not forwarded within a second.
|
* packet if not forwarded within a second.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
for (int i = 0; (i < 10) && (self->txsent != self->txlen); )
|
for (i = 0; (i < 10) && (self->txsent != self->txlen); )
|
||||||
{
|
{
|
||||||
ssz = file_write(&self->tty,
|
ssz = file_write(&self->tty,
|
||||||
&self->txbuf[self->txsent],
|
&self->txbuf[self->txsent],
|
||||||
|
|||||||
+126
-132
File diff suppressed because it is too large
Load Diff
@@ -306,20 +306,20 @@ struct ieee802154_privmac_s
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int mac802154_txdesc_alloc(FAR struct ieee802154_privmac_s *priv,
|
int mac802154_txdesc_alloc(FAR struct ieee802154_privmac_s *priv,
|
||||||
FAR struct ieee802154_txdesc_s **txdesc);
|
FAR struct ieee802154_txdesc_s **txdesc);
|
||||||
|
|
||||||
void mac802154_setupindirect(FAR struct ieee802154_privmac_s *priv,
|
void mac802154_setupindirect(FAR struct ieee802154_privmac_s *priv,
|
||||||
FAR struct ieee802154_txdesc_s *txdesc);
|
FAR struct ieee802154_txdesc_s *txdesc);
|
||||||
|
|
||||||
void mac802154_createdatareq(FAR struct ieee802154_privmac_s *priv,
|
void mac802154_createdatareq(FAR struct ieee802154_privmac_s *priv,
|
||||||
FAR struct ieee802154_addr_s *coordaddr,
|
FAR struct ieee802154_addr_s *coordaddr,
|
||||||
enum ieee802154_addrmode_e srcmode,
|
enum ieee802154_addrmode_e srcmode,
|
||||||
FAR struct ieee802154_txdesc_s *txdesc);
|
FAR struct ieee802154_txdesc_s *txdesc);
|
||||||
|
|
||||||
void mac802154_updatebeacon(FAR struct ieee802154_privmac_s *priv);
|
void mac802154_updatebeacon(FAR struct ieee802154_privmac_s *priv);
|
||||||
|
|
||||||
void mac802154_notify(FAR struct ieee802154_privmac_s *priv,
|
void mac802154_notify(FAR struct ieee802154_privmac_s *priv,
|
||||||
FAR struct ieee802154_primitive_s *primitive);
|
FAR struct ieee802154_primitive_s *primitive);
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Helper Macros/Inline Functions
|
* Helper Macros/Inline Functions
|
||||||
@@ -349,7 +349,8 @@ void mac802154_notify(FAR struct ieee802154_privmac_s *priv,
|
|||||||
#define mac802154_puteaddr(iob, eaddr) \
|
#define mac802154_puteaddr(iob, eaddr) \
|
||||||
do \
|
do \
|
||||||
{ \
|
{ \
|
||||||
for (int index = IEEE802154_EADDRSIZE - 1; index >= 0; index--) \
|
int index; \
|
||||||
|
for (index = IEEE802154_EADDRSIZE - 1; index >= 0; index--) \
|
||||||
{ \
|
{ \
|
||||||
iob->io_data[iob->io_len++] = eaddr[index]; \
|
iob->io_data[iob->io_len++] = eaddr[index]; \
|
||||||
} \
|
} \
|
||||||
@@ -380,7 +381,8 @@ void mac802154_notify(FAR struct ieee802154_privmac_s *priv,
|
|||||||
#define mac802154_takeeaddr(iob, eaddr) \
|
#define mac802154_takeeaddr(iob, eaddr) \
|
||||||
do \
|
do \
|
||||||
{ \
|
{ \
|
||||||
for (int index = IEEE802154_EADDRSIZE - 1; index >= 0; index--) \
|
int index; \
|
||||||
|
for (index = IEEE802154_EADDRSIZE - 1; index >= 0; index--) \
|
||||||
{ \
|
{ \
|
||||||
eaddr[index] = iob->io_data[iob->io_offset++]; \
|
eaddr[index] = iob->io_data[iob->io_offset++]; \
|
||||||
} \
|
} \
|
||||||
@@ -542,7 +544,7 @@ mac802154_symtoticks(FAR struct ieee802154_privmac_s *priv, uint32_t symbols)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
priv->radio->getattr(priv->radio, IEEE802154_ATTR_PHY_SYMBOL_DURATION,
|
priv->radio->getattr(priv->radio, IEEE802154_ATTR_PHY_SYMBOL_DURATION,
|
||||||
&attrval);
|
&attrval);
|
||||||
|
|
||||||
/* After this step, ret represents microseconds */
|
/* After this step, ret represents microseconds */
|
||||||
|
|
||||||
@@ -555,11 +557,11 @@ mac802154_symtoticks(FAR struct ieee802154_privmac_s *priv, uint32_t symbols)
|
|||||||
|
|
||||||
if (ret % USEC_PER_TICK == 0)
|
if (ret % USEC_PER_TICK == 0)
|
||||||
{
|
{
|
||||||
ret = ret / USEC_PER_TICK;
|
ret /= USEC_PER_TICK;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ret = ret / USEC_PER_TICK;
|
ret /= USEC_PER_TICK;
|
||||||
ret++;
|
ret++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -645,7 +647,7 @@ mac802154_setchannel(FAR struct ieee802154_privmac_s *priv,
|
|||||||
uint8_t channel)
|
uint8_t channel)
|
||||||
{
|
{
|
||||||
priv->radio->setattr(priv->radio, IEEE802154_ATTR_PHY_CHAN,
|
priv->radio->setattr(priv->radio, IEEE802154_ATTR_PHY_CHAN,
|
||||||
(FAR const union ieee802154_attr_u *)&channel);
|
(FAR const union ieee802154_attr_u *)&channel);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
@@ -653,7 +655,7 @@ mac802154_setchpage(FAR struct ieee802154_privmac_s *priv,
|
|||||||
uint8_t chpage)
|
uint8_t chpage)
|
||||||
{
|
{
|
||||||
priv->radio->setattr(priv->radio, IEEE802154_ATTR_PHY_CURRENT_PAGE,
|
priv->radio->setattr(priv->radio, IEEE802154_ATTR_PHY_CURRENT_PAGE,
|
||||||
(FAR const union ieee802154_attr_u *)&chpage);
|
(FAR const union ieee802154_attr_u *)&chpage);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
@@ -662,7 +664,7 @@ mac802154_setpanid(FAR struct ieee802154_privmac_s *priv,
|
|||||||
{
|
{
|
||||||
IEEE802154_PANIDCOPY(priv->addr.panid, panid);
|
IEEE802154_PANIDCOPY(priv->addr.panid, panid);
|
||||||
priv->radio->setattr(priv->radio, IEEE802154_ATTR_MAC_PANID,
|
priv->radio->setattr(priv->radio, IEEE802154_ATTR_MAC_PANID,
|
||||||
(FAR const union ieee802154_attr_u *)panid);
|
(FAR const union ieee802154_attr_u *)panid);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
@@ -671,7 +673,7 @@ mac802154_setsaddr(FAR struct ieee802154_privmac_s *priv,
|
|||||||
{
|
{
|
||||||
IEEE802154_SADDRCOPY(priv->addr.saddr, saddr);
|
IEEE802154_SADDRCOPY(priv->addr.saddr, saddr);
|
||||||
priv->radio->setattr(priv->radio, IEEE802154_ATTR_MAC_SADDR,
|
priv->radio->setattr(priv->radio, IEEE802154_ATTR_MAC_SADDR,
|
||||||
(FAR const union ieee802154_attr_u *)saddr);
|
(FAR const union ieee802154_attr_u *)saddr);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
@@ -680,7 +682,7 @@ mac802154_setcoordsaddr(FAR struct ieee802154_privmac_s *priv,
|
|||||||
{
|
{
|
||||||
IEEE802154_SADDRCOPY(priv->pandesc.coordaddr.saddr, saddr);
|
IEEE802154_SADDRCOPY(priv->pandesc.coordaddr.saddr, saddr);
|
||||||
priv->radio->setattr(priv->radio, IEEE802154_ATTR_MAC_COORD_SADDR,
|
priv->radio->setattr(priv->radio, IEEE802154_ATTR_MAC_COORD_SADDR,
|
||||||
(FAR const union ieee802154_attr_u *)saddr);
|
(FAR const union ieee802154_attr_u *)saddr);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
@@ -689,7 +691,7 @@ mac802154_setcoordeaddr(FAR struct ieee802154_privmac_s *priv,
|
|||||||
{
|
{
|
||||||
IEEE802154_EADDRCOPY(priv->pandesc.coordaddr.eaddr, eaddr);
|
IEEE802154_EADDRCOPY(priv->pandesc.coordaddr.eaddr, eaddr);
|
||||||
priv->radio->setattr(priv->radio, IEEE802154_ATTR_MAC_COORD_EADDR,
|
priv->radio->setattr(priv->radio, IEEE802154_ATTR_MAC_COORD_EADDR,
|
||||||
(FAR const union ieee802154_attr_u *)eaddr);
|
(FAR const union ieee802154_attr_u *)eaddr);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
@@ -698,9 +700,9 @@ mac802154_setcoordaddr(FAR struct ieee802154_privmac_s *priv,
|
|||||||
{
|
{
|
||||||
memcpy(&priv->pandesc.coordaddr, addr, sizeof(struct ieee802154_addr_s));
|
memcpy(&priv->pandesc.coordaddr, addr, sizeof(struct ieee802154_addr_s));
|
||||||
priv->radio->setattr(priv->radio, IEEE802154_ATTR_MAC_COORD_EADDR,
|
priv->radio->setattr(priv->radio, IEEE802154_ATTR_MAC_COORD_EADDR,
|
||||||
(FAR const union ieee802154_attr_u *)addr->eaddr);
|
(FAR const union ieee802154_attr_u *)addr->eaddr);
|
||||||
priv->radio->setattr(priv->radio, IEEE802154_ATTR_MAC_COORD_SADDR,
|
priv->radio->setattr(priv->radio, IEEE802154_ATTR_MAC_COORD_SADDR,
|
||||||
(FAR const union ieee802154_attr_u *)addr->saddr);
|
(FAR const union ieee802154_attr_u *)addr->saddr);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
@@ -717,7 +719,7 @@ mac802154_setrxonidle(FAR struct ieee802154_privmac_s *priv, bool rxonidle)
|
|||||||
}
|
}
|
||||||
|
|
||||||
priv->radio->setattr(priv->radio, IEEE802154_ATTR_MAC_RX_ON_WHEN_IDLE,
|
priv->radio->setattr(priv->radio, IEEE802154_ATTR_MAC_RX_ON_WHEN_IDLE,
|
||||||
(FAR const union ieee802154_attr_u *)&rxonidle);
|
(FAR const union ieee802154_attr_u *)&rxonidle);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
@@ -725,7 +727,7 @@ mac802154_setdevmode(FAR struct ieee802154_privmac_s *priv, uint8_t mode)
|
|||||||
{
|
{
|
||||||
priv->devmode = mode;
|
priv->devmode = mode;
|
||||||
priv->radio->setattr(priv->radio, IEEE802154_ATTR_MAC_DEVMODE,
|
priv->radio->setattr(priv->radio, IEEE802154_ATTR_MAC_DEVMODE,
|
||||||
(FAR const union ieee802154_attr_u *)&mode);
|
(FAR const union ieee802154_attr_u *)&mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* __WIRELESS_IEEE802154__MAC802154_INTERNAL_H */
|
#endif /* __WIRELESS_IEEE802154__MAC802154_INTERNAL_H */
|
||||||
|
|||||||
Reference in New Issue
Block a user