misra-c: Add 'U' to unsigned variable assignments in subsys/
Add 'U' to a value when assigning it to an unsigned variable. MISRA-C rule 7.2 Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
This commit is contained in:
parent
079f55d519
commit
b97db52de7
139 changed files with 1198 additions and 1198 deletions
|
@ -159,7 +159,7 @@ static void ecb_cb(u32_t status, u8_t *cipher_be, void *context)
|
|||
struct ecb_ut_context *ecb_ut_context =
|
||||
(struct ecb_ut_context *)context;
|
||||
|
||||
ecb_ut_context->done = 1;
|
||||
ecb_ut_context->done = 1U;
|
||||
ecb_ut_context->status = status;
|
||||
if (!status) {
|
||||
mem_rcopy(ecb_ut_context->cipher_text, cipher_be,
|
||||
|
@ -175,13 +175,13 @@ u32_t ecb_ut(void)
|
|||
0x88, 0x99, 0x00, 0x11, 0x22, 0x33, 0x44,
|
||||
0x55 };
|
||||
u8_t cipher_text[16];
|
||||
u32_t status = 0;
|
||||
u32_t status = 0U;
|
||||
struct ecb ecb;
|
||||
struct ecb_ut_context context;
|
||||
|
||||
ecb_encrypt(key, clear_text, cipher_text, NULL);
|
||||
|
||||
context.done = 0;
|
||||
context.done = 0U;
|
||||
ecb.in_key_le = key;
|
||||
ecb.in_clear_text_le = clear_text;
|
||||
ecb.fp_ecb = ecb_cb;
|
||||
|
|
|
@ -149,14 +149,14 @@ void radio_pkt_configure(u8_t bits_len, u8_t max_len, u8_t flags)
|
|||
#if defined(CONFIG_SOC_SERIES_NRF51X)
|
||||
ARG_UNUSED(phy);
|
||||
|
||||
extra = 0;
|
||||
extra = 0U;
|
||||
|
||||
/* nRF51 supports only 27 byte PDU when using h/w CCM for encryption. */
|
||||
if (!IS_ENABLED(CONFIG_BT_CTLR_DATA_LENGTH_CLEAR) && dc) {
|
||||
bits_len = 5;
|
||||
bits_len = 5U;
|
||||
}
|
||||
#elif defined(CONFIG_SOC_COMPATIBLE_NRF52X)
|
||||
extra = 0;
|
||||
extra = 0U;
|
||||
|
||||
phy = (flags >> 1) & 0x07; /* phy */
|
||||
switch (phy) {
|
||||
|
@ -585,7 +585,7 @@ void radio_filter_configure(u8_t bitmask_enable, u8_t bitmask_addr_type,
|
|||
{
|
||||
u8_t index;
|
||||
|
||||
for (index = 0; index < 8; index++) {
|
||||
for (index = 0U; index < 8; index++) {
|
||||
NRF_RADIO->DAB[index] = ((u32_t)bdaddr[3] << 24) |
|
||||
((u32_t)bdaddr[2] << 16) |
|
||||
((u32_t)bdaddr[1] << 8) |
|
||||
|
@ -691,7 +691,7 @@ u32_t radio_tmr_start(u8_t trx, u32_t ticks_start, u32_t remainder)
|
|||
|
||||
#if !defined(CONFIG_BT_CTLR_TIFS_HW)
|
||||
#if defined(CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER)
|
||||
last_pdu_end_us = 0;
|
||||
last_pdu_end_us = 0U;
|
||||
|
||||
#else /* !CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER */
|
||||
nrf_timer_task_trigger(SW_SWITCH_TIMER, NRF_TIMER_TASK_CLEAR);
|
||||
|
|
|
@ -220,10 +220,10 @@ static void reset(struct net_buf *buf, struct net_buf **evt)
|
|||
}
|
||||
#if defined(CONFIG_BT_HCI_ACL_FLOW_CONTROL)
|
||||
hci_hbuf_total = 0;
|
||||
hci_hbuf_sent = 0;
|
||||
hci_hbuf_acked = 0;
|
||||
hci_hbuf_sent = 0U;
|
||||
hci_hbuf_acked = 0U;
|
||||
(void)memset(hci_hbuf_pend, 0, sizeof(hci_hbuf_pend));
|
||||
conn_count = 0;
|
||||
conn_count = 0U;
|
||||
if (buf) {
|
||||
atomic_set_bit(&hci_state_mask, HCI_STATE_BIT_RESET);
|
||||
k_poll_signal_raise(hbuf_signal, 0x0);
|
||||
|
@ -268,8 +268,8 @@ static void set_ctl_to_host_flow(struct net_buf *buf, struct net_buf **evt)
|
|||
return;
|
||||
}
|
||||
|
||||
hci_hbuf_sent = 0;
|
||||
hci_hbuf_acked = 0;
|
||||
hci_hbuf_sent = 0U;
|
||||
hci_hbuf_acked = 0U;
|
||||
(void)memset(hci_hbuf_pend, 0, sizeof(hci_hbuf_pend));
|
||||
hci_hbuf_total = -hci_hbuf_total;
|
||||
}
|
||||
|
@ -304,7 +304,7 @@ static void host_num_completed_packets(struct net_buf *buf,
|
|||
{
|
||||
struct bt_hci_cp_host_num_completed_packets *cmd = (void *)buf->data;
|
||||
struct bt_hci_evt_cc_status *ccst;
|
||||
u32_t count = 0;
|
||||
u32_t count = 0U;
|
||||
int i;
|
||||
|
||||
/* special case, no event returned except for error conditions */
|
||||
|
@ -813,7 +813,7 @@ static void le_rand(struct net_buf *buf, struct net_buf **evt)
|
|||
static void le_read_supp_states(struct net_buf *buf, struct net_buf **evt)
|
||||
{
|
||||
struct bt_hci_rp_le_read_supp_states *rp;
|
||||
u64_t states = 0;
|
||||
u64_t states = 0U;
|
||||
|
||||
rp = cmd_complete(evt, sizeof(*rp));
|
||||
rp->status = 0x00;
|
||||
|
@ -969,7 +969,7 @@ static void le_set_scan_enable(struct net_buf *buf, struct net_buf **evt)
|
|||
/* initialize duplicate filtering */
|
||||
if (cmd->enable && cmd->filter_dup) {
|
||||
dup_count = 0;
|
||||
dup_curr = 0;
|
||||
dup_curr = 0U;
|
||||
} else {
|
||||
dup_count = -1;
|
||||
}
|
||||
|
@ -1316,7 +1316,7 @@ static void le_set_phy(struct net_buf *buf, struct net_buf **evt)
|
|||
phy_opts -= 1;
|
||||
phy_opts &= 1;
|
||||
} else {
|
||||
phy_opts = 0;
|
||||
phy_opts = 0U;
|
||||
}
|
||||
|
||||
status = ll_phy_req_send(handle, cmd->tx_phys, phy_opts,
|
||||
|
@ -2133,7 +2133,7 @@ static inline bool dup_found(struct pdu_adv *adv)
|
|||
}
|
||||
|
||||
if (dup_curr == CONFIG_BT_CTLR_DUP_FILTER_LEN) {
|
||||
dup_curr = 0;
|
||||
dup_curr = 0U;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2509,7 +2509,7 @@ static void disconn_complete(struct pdu_data *pdu_data, u16_t handle,
|
|||
/* Note: This requires linear handle values starting from 0 */
|
||||
LL_ASSERT(handle < ARRAY_SIZE(hci_hbuf_pend));
|
||||
hci_hbuf_acked += hci_hbuf_pend[handle];
|
||||
hci_hbuf_pend[handle] = 0;
|
||||
hci_hbuf_pend[handle] = 0U;
|
||||
#endif /* CONFIG_BT_HCI_ACL_FLOW_CONTROL */
|
||||
conn_count--;
|
||||
}
|
||||
|
@ -2982,7 +2982,7 @@ void hci_num_cmplt_encode(struct net_buf *buf, u16_t handle, u8_t num)
|
|||
u8_t num_handles;
|
||||
u8_t len;
|
||||
|
||||
num_handles = 1;
|
||||
num_handles = 1U;
|
||||
|
||||
len = (sizeof(*ep) + (sizeof(*hc) * num_handles));
|
||||
evt_create(buf, BT_HCI_EVT_NUM_COMPLETED_PACKETS, len);
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -268,7 +268,7 @@ void ll_adv_data_set(u8_t len, u8_t const *const data)
|
|||
if (radio_adv_data->first == radio_adv_data->last) {
|
||||
last = radio_adv_data->last + 1;
|
||||
if (last == DOUBLE_BUFFER_SIZE) {
|
||||
last = 0;
|
||||
last = 0U;
|
||||
}
|
||||
} else {
|
||||
last = radio_adv_data->last;
|
||||
|
@ -277,12 +277,12 @@ void ll_adv_data_set(u8_t len, u8_t const *const data)
|
|||
/* update adv pdu fields. */
|
||||
pdu = (struct pdu_adv *)&radio_adv_data->data[last][0];
|
||||
pdu->type = prev->type;
|
||||
pdu->rfu = 0;
|
||||
pdu->rfu = 0U;
|
||||
|
||||
if (IS_ENABLED(CONFIG_BT_CTLR_CHAN_SEL_2)) {
|
||||
pdu->chan_sel = prev->chan_sel;
|
||||
} else {
|
||||
pdu->chan_sel = 0;
|
||||
pdu->chan_sel = 0U;
|
||||
}
|
||||
|
||||
pdu->tx_addr = prev->tx_addr;
|
||||
|
|
|
@ -87,7 +87,7 @@ struct k_delayed_work rpa_work;
|
|||
static void wl_clear(void)
|
||||
{
|
||||
for (int i = 0; i < WL_SIZE; i++) {
|
||||
wl[i].taken = 0;
|
||||
wl[i].taken = 0U;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -131,11 +131,11 @@ static u32_t wl_add(bt_addr_le_t *id_addr)
|
|||
j = ll_rl_find(id_addr->type, id_addr->a.val, NULL);
|
||||
if (j < ARRAY_SIZE(rl)) {
|
||||
wl[i].rl_idx = j;
|
||||
rl[j].wl = 1;
|
||||
rl[j].wl = 1U;
|
||||
} else {
|
||||
wl[i].rl_idx = FILTER_IDX_NONE;
|
||||
}
|
||||
wl[i].taken = 1;
|
||||
wl[i].taken = 1U;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -149,9 +149,9 @@ static u32_t wl_remove(bt_addr_le_t *id_addr)
|
|||
u8_t j = wl[i].rl_idx;
|
||||
|
||||
if (j < ARRAY_SIZE(rl)) {
|
||||
rl[j].wl = 0;
|
||||
rl[j].wl = 0U;
|
||||
}
|
||||
wl[i].taken = 0;
|
||||
wl[i].taken = 0U;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -162,8 +162,8 @@ static u32_t wl_remove(bt_addr_le_t *id_addr)
|
|||
|
||||
static void filter_clear(struct ll_filter *filter)
|
||||
{
|
||||
filter->enable_bitmask = 0;
|
||||
filter->addr_type_bitmask = 0;
|
||||
filter->enable_bitmask = 0U;
|
||||
filter->addr_type_bitmask = 0U;
|
||||
}
|
||||
|
||||
static void filter_insert(struct ll_filter *filter, int index, u8_t addr_type,
|
||||
|
@ -304,7 +304,7 @@ u32_t ll_wl_clear(void)
|
|||
#else
|
||||
filter_clear(&wl_filter);
|
||||
#endif /* CONFIG_BT_CTLR_PRIVACY */
|
||||
wl_anon = 0;
|
||||
wl_anon = 0U;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -316,7 +316,7 @@ u32_t ll_wl_add(bt_addr_le_t *addr)
|
|||
}
|
||||
|
||||
if (addr->type == ADDR_TYPE_ANON) {
|
||||
wl_anon = 1;
|
||||
wl_anon = 1U;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -334,7 +334,7 @@ u32_t ll_wl_remove(bt_addr_le_t *addr)
|
|||
}
|
||||
|
||||
if (addr->type == ADDR_TYPE_ANON) {
|
||||
wl_anon = 0;
|
||||
wl_anon = 0U;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -352,7 +352,7 @@ static void filter_wl_update(void)
|
|||
u8_t i;
|
||||
|
||||
/* Populate filter from wl peers */
|
||||
for (i = 0; i < WL_SIZE; i++) {
|
||||
for (i = 0U; i < WL_SIZE; i++) {
|
||||
u8_t j;
|
||||
|
||||
if (!wl[i].taken) {
|
||||
|
@ -374,7 +374,7 @@ static void filter_rl_update(void)
|
|||
u8_t i;
|
||||
|
||||
/* Populate filter from rl peers */
|
||||
for (i = 0; i < CONFIG_BT_CTLR_RL_SIZE; i++) {
|
||||
for (i = 0U; i < CONFIG_BT_CTLR_RL_SIZE; i++) {
|
||||
if (rl[i].taken) {
|
||||
filter_insert(&rl_filter, i, rl[i].id_addr_type,
|
||||
rl[i].id_addr.val);
|
||||
|
@ -430,7 +430,7 @@ u8_t ll_rl_find(u8_t id_addr_type, u8_t *id_addr, u8_t *free)
|
|||
*free = FILTER_IDX_NONE;
|
||||
}
|
||||
|
||||
for (i = 0; i < CONFIG_BT_CTLR_RL_SIZE; i++) {
|
||||
for (i = 0U; i < CONFIG_BT_CTLR_RL_SIZE; i++) {
|
||||
if (LIST_MATCH(rl, i, id_addr_type, id_addr)) {
|
||||
return i;
|
||||
} else if (free && !rl[i].taken && (*free == FILTER_IDX_NONE)) {
|
||||
|
@ -476,10 +476,10 @@ bool ctrl_rl_addr_allowed(u8_t id_addr_type, u8_t *id_addr, u8_t *rl_idx)
|
|||
return true;
|
||||
}
|
||||
|
||||
for (i = 0; i < CONFIG_BT_CTLR_RL_SIZE; i++) {
|
||||
for (i = 0U; i < CONFIG_BT_CTLR_RL_SIZE; i++) {
|
||||
if (rl[i].taken && (rl[i].id_addr_type == id_addr_type)) {
|
||||
u8_t *addr = rl[i].id_addr.val;
|
||||
for (j = 0; j < BDADDR_SIZE; j++) {
|
||||
for (j = 0U; j < BDADDR_SIZE; j++) {
|
||||
if (addr[j] != id_addr[j]) {
|
||||
break;
|
||||
}
|
||||
|
@ -527,7 +527,7 @@ void ll_rl_pdu_adv_update(u8_t idx, struct pdu_adv *pdu)
|
|||
/* AdvA */
|
||||
if (idx < ARRAY_SIZE(rl) && rl[idx].lirk) {
|
||||
LL_ASSERT(rl[idx].rpas_ready);
|
||||
pdu->tx_addr = 1;
|
||||
pdu->tx_addr = 1U;
|
||||
memcpy(adva, rl[idx].local_rpa->val, BDADDR_SIZE);
|
||||
} else {
|
||||
pdu->tx_addr = ll_adv->own_addr_type & 0x1;
|
||||
|
@ -537,7 +537,7 @@ void ll_rl_pdu_adv_update(u8_t idx, struct pdu_adv *pdu)
|
|||
/* TargetA */
|
||||
if (pdu->type == PDU_ADV_TYPE_DIRECT_IND) {
|
||||
if (idx < ARRAY_SIZE(rl) && rl[idx].pirk) {
|
||||
pdu->rx_addr = 1;
|
||||
pdu->rx_addr = 1U;
|
||||
memcpy(&pdu->direct_ind.tgt_addr[0],
|
||||
rl[idx].peer_rpa.val, BDADDR_SIZE);
|
||||
} else {
|
||||
|
@ -570,7 +570,7 @@ static void rpa_adv_refresh(void)
|
|||
if (radio_adv_data->first == radio_adv_data->last) {
|
||||
last = radio_adv_data->last + 1;
|
||||
if (last == DOUBLE_BUFFER_SIZE) {
|
||||
last = 0;
|
||||
last = 0U;
|
||||
}
|
||||
} else {
|
||||
last = radio_adv_data->last;
|
||||
|
@ -579,12 +579,12 @@ static void rpa_adv_refresh(void)
|
|||
/* update adv pdu fields. */
|
||||
pdu = (struct pdu_adv *)&radio_adv_data->data[last][0];
|
||||
pdu->type = prev->type;
|
||||
pdu->rfu = 0;
|
||||
pdu->rfu = 0U;
|
||||
|
||||
if (IS_ENABLED(CONFIG_BT_CTLR_CHAN_SEL_2)) {
|
||||
pdu->chan_sel = prev->chan_sel;
|
||||
} else {
|
||||
pdu->chan_sel = 0;
|
||||
pdu->chan_sel = 0U;
|
||||
}
|
||||
|
||||
idx = ll_rl_find(ll_adv->id_addr_type, ll_adv->id_addr, NULL);
|
||||
|
@ -603,10 +603,10 @@ static void rpa_adv_refresh(void)
|
|||
static void rl_clear(void)
|
||||
{
|
||||
for (u8_t i = 0; i < CONFIG_BT_CTLR_RL_SIZE; i++) {
|
||||
rl[i].taken = 0;
|
||||
rl[i].taken = 0U;
|
||||
}
|
||||
|
||||
peer_irk_count = 0;
|
||||
peer_irk_count = 0U;
|
||||
}
|
||||
|
||||
static int rl_access_check(bool check_ar)
|
||||
|
@ -630,7 +630,7 @@ void ll_rl_rpa_update(bool timeout)
|
|||
(now - rpa_last_ms >= rpa_timeout_ms);
|
||||
BT_DBG("");
|
||||
|
||||
for (i = 0; i < CONFIG_BT_CTLR_RL_SIZE; i++) {
|
||||
for (i = 0U; i < CONFIG_BT_CTLR_RL_SIZE; i++) {
|
||||
if ((rl[i].taken) && (all || !rl[i].rpas_ready)) {
|
||||
|
||||
if (rl[i].pirk) {
|
||||
|
@ -657,7 +657,7 @@ void ll_rl_rpa_update(bool timeout)
|
|||
rl[i].local_rpa = &local_rpas[i];
|
||||
}
|
||||
|
||||
rl[i].rpas_ready = 1;
|
||||
rl[i].rpas_ready = 1U;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -761,18 +761,18 @@ u32_t ll_rl_add(bt_addr_le_t *id_addr, const u8_t pirk[16],
|
|||
rl[i].local_rpa = NULL;
|
||||
}
|
||||
(void)memset(rl[i].curr_rpa.val, 0x00, sizeof(rl[i].curr_rpa));
|
||||
rl[i].rpas_ready = 0;
|
||||
rl[i].rpas_ready = 0U;
|
||||
/* Default to Network Privacy */
|
||||
rl[i].dev = 0;
|
||||
rl[i].dev = 0U;
|
||||
/* Add reference to a whitelist entry */
|
||||
j = wl_find(id_addr->type, id_addr->a.val, NULL);
|
||||
if (j < ARRAY_SIZE(wl)) {
|
||||
wl[j].rl_idx = i;
|
||||
rl[i].wl = 1;
|
||||
rl[i].wl = 1U;
|
||||
} else {
|
||||
rl[i].wl = 0;
|
||||
rl[i].wl = 0U;
|
||||
}
|
||||
rl[i].taken = 1;
|
||||
rl[i].taken = 1U;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -796,7 +796,7 @@ u32_t ll_rl_remove(bt_addr_le_t *id_addr)
|
|||
|
||||
if (pj && pi != pj) {
|
||||
memcpy(peer_irks[pi], peer_irks[pj], 16);
|
||||
for (k = 0;
|
||||
for (k = 0U;
|
||||
k < CONFIG_BT_CTLR_RL_SIZE;
|
||||
k++) {
|
||||
|
||||
|
@ -816,7 +816,7 @@ u32_t ll_rl_remove(bt_addr_le_t *id_addr)
|
|||
if (j < ARRAY_SIZE(wl)) {
|
||||
wl[j].rl_idx = FILTER_IDX_NONE;
|
||||
}
|
||||
rl[i].taken = 0;
|
||||
rl[i].taken = 0U;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -876,10 +876,10 @@ u32_t ll_rl_enable(u8_t enable)
|
|||
|
||||
switch (enable) {
|
||||
case BT_HCI_ADDR_RES_DISABLE:
|
||||
rl_enable = 0;
|
||||
rl_enable = 0U;
|
||||
break;
|
||||
case BT_HCI_ADDR_RES_ENABLE:
|
||||
rl_enable = 1;
|
||||
rl_enable = 1U;
|
||||
break;
|
||||
default:
|
||||
return BT_HCI_ERR_INVALID_PARAM;
|
||||
|
@ -906,10 +906,10 @@ u32_t ll_priv_mode_set(bt_addr_le_t *id_addr, u8_t mode)
|
|||
if (i < ARRAY_SIZE(rl)) {
|
||||
switch (mode) {
|
||||
case BT_HCI_LE_PRIVACY_MODE_NETWORK:
|
||||
rl[i].dev = 0;
|
||||
rl[i].dev = 0U;
|
||||
break;
|
||||
case BT_HCI_LE_PRIVACY_MODE_DEVICE:
|
||||
rl[i].dev = 1;
|
||||
rl[i].dev = 1U;
|
||||
break;
|
||||
default:
|
||||
return BT_HCI_ERR_INVALID_PARAM;
|
||||
|
@ -925,12 +925,12 @@ u32_t ll_priv_mode_set(bt_addr_le_t *id_addr, u8_t mode)
|
|||
|
||||
void ll_filter_reset(bool init)
|
||||
{
|
||||
wl_anon = 0;
|
||||
wl_anon = 0U;
|
||||
|
||||
#if defined(CONFIG_BT_CTLR_PRIVACY)
|
||||
wl_clear();
|
||||
|
||||
rl_enable = 0;
|
||||
rl_enable = 0U;
|
||||
rpa_timeout_ms = DEFAULT_RPA_TIMEOUT_MS;
|
||||
rpa_last_ms = -1;
|
||||
rl_clear();
|
||||
|
|
|
@ -22,7 +22,7 @@ u32_t ll_create_connection(u16_t scan_interval, u16_t scan_window,
|
|||
u16_t timeout)
|
||||
{
|
||||
u32_t status;
|
||||
u8_t rpa_gen = 0;
|
||||
u8_t rpa_gen = 0U;
|
||||
u8_t rl_idx = FILTER_IDX_NONE;
|
||||
|
||||
if (ll_scan_is_enabled()) {
|
||||
|
@ -50,7 +50,7 @@ u32_t ll_create_connection(u16_t scan_interval, u16_t scan_window,
|
|||
/* Generate RPAs if required */
|
||||
ll_rl_rpa_update(false);
|
||||
own_addr_type &= 0x1;
|
||||
rpa_gen = 1;
|
||||
rpa_gen = 1U;
|
||||
}
|
||||
#endif
|
||||
return radio_scan_enable(0, own_addr_type,
|
||||
|
|
|
@ -59,7 +59,7 @@ u32_t ll_scan_params_set(u8_t type, u16_t interval, u16_t window,
|
|||
|
||||
u32_t ll_scan_enable(u8_t enable)
|
||||
{
|
||||
u8_t rpa_gen = 0;
|
||||
u8_t rpa_gen = 0U;
|
||||
u32_t status;
|
||||
u32_t scan;
|
||||
|
||||
|
@ -87,7 +87,7 @@ u32_t ll_scan_enable(u8_t enable)
|
|||
ll_scan.own_addr_type == BT_ADDR_LE_RANDOM_ID)) {
|
||||
/* Generate RPAs if required */
|
||||
ll_rl_rpa_update(false);
|
||||
rpa_gen = 1;
|
||||
rpa_gen = 1U;
|
||||
}
|
||||
#endif
|
||||
status = radio_scan_enable(ll_scan.type, ll_scan.own_addr_type & 0x1,
|
||||
|
|
|
@ -127,7 +127,7 @@ static void isr_tx(void)
|
|||
|
||||
static void isr_rx(void)
|
||||
{
|
||||
u8_t crc_ok = 0;
|
||||
u8_t crc_ok = 0U;
|
||||
u8_t trx_done;
|
||||
|
||||
/* Read radio status and events */
|
||||
|
@ -176,10 +176,10 @@ static u32_t init(u8_t chan, u8_t phy, void (*isr)(void))
|
|||
/* Store value needed in Tx/Rx ISR */
|
||||
if (phy < 0x04) {
|
||||
test_phy = BIT(phy - 1);
|
||||
test_phy_flags = 1;
|
||||
test_phy_flags = 1U;
|
||||
} else {
|
||||
test_phy = BIT(2);
|
||||
test_phy_flags = 0;
|
||||
test_phy_flags = 0U;
|
||||
}
|
||||
|
||||
/* Setup Radio in Tx/Rx */
|
||||
|
@ -311,7 +311,7 @@ u32_t ll_test_end(u16_t *num_rx)
|
|||
|
||||
/* Return packets Rx-ed/Completed */
|
||||
*num_rx = test_num_rx;
|
||||
test_num_rx = 0;
|
||||
test_num_rx = 0U;
|
||||
|
||||
/* Disable Radio, if in Rx test */
|
||||
ack = tx_ack;
|
||||
|
|
|
@ -171,7 +171,7 @@ static void ticker_by_next_slot_get(struct ticker_instance *instance,
|
|||
(*ticks_current != instance->ticks_current)) {
|
||||
_ticker_id_head = instance->ticker_id_head;
|
||||
*ticks_current = instance->ticks_current;
|
||||
_ticks_to_expire = 0;
|
||||
_ticks_to_expire = 0U;
|
||||
} else {
|
||||
ticker = &node[_ticker_id_head];
|
||||
_ticker_id_head = ticker->next;
|
||||
|
@ -225,7 +225,7 @@ static u8_t ticker_enqueue(struct ticker_instance *instance, u8_t id)
|
|||
if (ticks_slot_previous > ticks_to_expire_current) {
|
||||
ticks_slot_previous -= ticks_to_expire_current;
|
||||
} else {
|
||||
ticks_slot_previous = 0;
|
||||
ticks_slot_previous = 0U;
|
||||
}
|
||||
}
|
||||
previous = current;
|
||||
|
@ -274,7 +274,7 @@ static u32_t ticker_dequeue(struct ticker_instance *instance, u8_t id)
|
|||
node = &instance->node[0];
|
||||
previous = instance->ticker_id_head;
|
||||
current = previous;
|
||||
total = 0;
|
||||
total = 0U;
|
||||
ticker_current = 0;
|
||||
while (current != TICKER_NULL) {
|
||||
|
||||
|
@ -326,14 +326,14 @@ void ticker_worker(void *param)
|
|||
u8_t ticker_id_head;
|
||||
|
||||
/* Defer worker if job running */
|
||||
instance->worker_trigger = 1;
|
||||
instance->worker_trigger = 1U;
|
||||
if (instance->job_guard) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* If no tickers to expire, do nothing */
|
||||
if (instance->ticker_id_head == TICKER_NULL) {
|
||||
instance->worker_trigger = 0;
|
||||
instance->worker_trigger = 0U;
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -343,7 +343,7 @@ void ticker_worker(void *param)
|
|||
instance->ticks_current);
|
||||
|
||||
/* initialise actual elapsed ticks being consumed */
|
||||
ticks_expired = 0;
|
||||
ticks_expired = 0U;
|
||||
|
||||
/* auto variable containing the head of tickers expiring */
|
||||
ticker_id_head = instance->ticker_id_head;
|
||||
|
@ -401,13 +401,13 @@ void ticker_worker(void *param)
|
|||
|
||||
last = instance->ticks_elapsed_last + 1;
|
||||
if (last == DOUBLE_BUFFER_SIZE) {
|
||||
last = 0;
|
||||
last = 0U;
|
||||
}
|
||||
instance->ticks_elapsed_last = last;
|
||||
}
|
||||
instance->ticks_elapsed[instance->ticks_elapsed_last] = ticks_expired;
|
||||
|
||||
instance->worker_trigger = 0;
|
||||
instance->worker_trigger = 0U;
|
||||
|
||||
instance->sched_cb(TICKER_CALL_ID_WORKER, TICKER_CALL_ID_JOB, 1,
|
||||
instance);
|
||||
|
@ -433,17 +433,17 @@ static void ticks_to_expire_prep(struct ticker_node *ticker,
|
|||
} else {
|
||||
ticks_to_expire_minus +=
|
||||
(delta_current_start - ticks_to_expire);
|
||||
ticks_to_expire = 0;
|
||||
ticks_to_expire = 0U;
|
||||
}
|
||||
}
|
||||
|
||||
/* Handle any drifts requested */
|
||||
if (ticks_to_expire > ticks_to_expire_minus) {
|
||||
ticks_to_expire -= ticks_to_expire_minus;
|
||||
ticks_to_expire_minus = 0;
|
||||
ticks_to_expire_minus = 0U;
|
||||
} else {
|
||||
ticks_to_expire_minus -= ticks_to_expire;
|
||||
ticks_to_expire = 0;
|
||||
ticks_to_expire = 0U;
|
||||
}
|
||||
|
||||
ticker->ticks_to_expire = ticks_to_expire;
|
||||
|
@ -463,7 +463,7 @@ static u8_t ticker_remainder_inc(struct ticker_node *ticker)
|
|||
|
||||
static u8_t ticker_remainder_dec(struct ticker_node *ticker)
|
||||
{
|
||||
u8_t decrement = 0;
|
||||
u8_t decrement = 0U;
|
||||
|
||||
if ((ticker->remainder_current >= BIT(31)) ||
|
||||
(ticker->remainder_current <= (30517578UL / 2))) {
|
||||
|
@ -500,7 +500,7 @@ static inline void ticker_job_node_update(struct ticker_node *ticker,
|
|||
} else {
|
||||
ticker->ticks_to_expire_minus += ticks_elapsed -
|
||||
ticks_to_expire;
|
||||
ticks_to_expire = 0;
|
||||
ticks_to_expire = 0U;
|
||||
}
|
||||
|
||||
if ((ticker->ticks_periodic != 0) &&
|
||||
|
@ -534,7 +534,7 @@ static inline void ticker_job_node_update(struct ticker_node *ticker,
|
|||
if (ticker->ticks_slot > user_op->params.update.ticks_slot_minus) {
|
||||
ticker->ticks_slot -= user_op->params.update.ticks_slot_minus;
|
||||
} else {
|
||||
ticker->ticks_slot = 0;
|
||||
ticker->ticks_slot = 0U;
|
||||
}
|
||||
|
||||
if (user_op->params.update.force != 0) {
|
||||
|
@ -569,7 +569,7 @@ static inline void ticker_job_node_manage(struct ticker_instance *instance,
|
|||
|
||||
if (instance->ticker_id_slot_previous == user_op->id) {
|
||||
instance->ticker_id_slot_previous = TICKER_NULL;
|
||||
instance->ticks_slot_previous = 0;
|
||||
instance->ticks_slot_previous = 0U;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -588,7 +588,7 @@ static inline u8_t ticker_job_list_manage(struct ticker_instance *instance,
|
|||
struct ticker_user *users;
|
||||
u8_t count_user;
|
||||
|
||||
pending = 0;
|
||||
pending = 0U;
|
||||
node = &instance->node[0];
|
||||
users = &instance->user[0];
|
||||
count_user = instance->count_user;
|
||||
|
@ -611,7 +611,7 @@ static inline u8_t ticker_job_list_manage(struct ticker_instance *instance,
|
|||
prev = user->middle;
|
||||
middle = user->middle + 1;
|
||||
if (middle == user->count_user_op) {
|
||||
middle = 0;
|
||||
middle = 0U;
|
||||
}
|
||||
user->middle = middle;
|
||||
|
||||
|
@ -662,7 +662,7 @@ static inline u8_t ticker_job_list_manage(struct ticker_instance *instance,
|
|||
*/
|
||||
user->middle = prev;
|
||||
|
||||
pending = 1;
|
||||
pending = 1U;
|
||||
|
||||
break;
|
||||
}
|
||||
|
@ -681,7 +681,7 @@ static inline void ticker_job_worker_bh(struct ticker_instance *instance,
|
|||
u32_t ticks_expired;
|
||||
|
||||
node = &instance->node[0];
|
||||
ticks_expired = 0;
|
||||
ticks_expired = 0U;
|
||||
while (instance->ticker_id_head != TICKER_NULL) {
|
||||
struct ticker_node *ticker;
|
||||
u32_t ticks_to_expire;
|
||||
|
@ -707,7 +707,7 @@ static inline void ticker_job_worker_bh(struct ticker_instance *instance,
|
|||
instance->ticks_slot_previous -= ticks_to_expire;
|
||||
} else {
|
||||
instance->ticker_id_slot_previous = TICKER_NULL;
|
||||
instance->ticks_slot_previous = 0;
|
||||
instance->ticks_slot_previous = 0U;
|
||||
}
|
||||
|
||||
/* save current ticks_slot_previous */
|
||||
|
@ -717,7 +717,7 @@ static inline void ticker_job_worker_bh(struct ticker_instance *instance,
|
|||
}
|
||||
|
||||
/* ticker expired, set ticks_to_expire zero */
|
||||
ticker->ticks_to_expire = 0;
|
||||
ticker->ticks_to_expire = 0U;
|
||||
|
||||
/* remove the expired ticker from head */
|
||||
instance->ticker_id_head = ticker->next;
|
||||
|
@ -727,7 +727,7 @@ static inline void ticker_job_worker_bh(struct ticker_instance *instance,
|
|||
u32_t count;
|
||||
|
||||
/* Prepare for next interval */
|
||||
ticks_to_expire = 0;
|
||||
ticks_to_expire = 0U;
|
||||
count = 1 + ticker->lazy_periodic;
|
||||
while (count--) {
|
||||
ticks_to_expire += ticker->ticks_periodic;
|
||||
|
@ -737,7 +737,7 @@ static inline void ticker_job_worker_bh(struct ticker_instance *instance,
|
|||
ticks_to_expire_prep(ticker, instance->ticks_current,
|
||||
(ticks_previous + ticks_expired));
|
||||
ticker->lazy_current = ticker->lazy_periodic;
|
||||
ticker->force = 0;
|
||||
ticker->force = 0U;
|
||||
|
||||
/* Add to insert list */
|
||||
ticker->next = *insert_head;
|
||||
|
@ -765,11 +765,11 @@ static inline void ticker_job_op_start(struct ticker_node *ticker,
|
|||
ticker->timeout_func = start->fp_timeout_func;
|
||||
ticker->context = start->context;
|
||||
ticker->ticks_to_expire = start->ticks_first;
|
||||
ticker->ticks_to_expire_minus = 0;
|
||||
ticker->ticks_to_expire_minus = 0U;
|
||||
ticks_to_expire_prep(ticker, ticks_current, start->ticks_at_start);
|
||||
ticker->remainder_current = 0;
|
||||
ticker->lazy_current = 0;
|
||||
ticker->force = 1;
|
||||
ticker->remainder_current = 0U;
|
||||
ticker->lazy_current = 0U;
|
||||
ticker->force = 1U;
|
||||
}
|
||||
|
||||
static inline u32_t ticker_job_insert(struct ticker_instance *instance,
|
||||
|
@ -789,7 +789,7 @@ static inline u32_t ticker_job_insert(struct ticker_instance *instance,
|
|||
skip = ticker->lazy_current -
|
||||
ticker->lazy_periodic;
|
||||
} else {
|
||||
skip = 0;
|
||||
skip = 0U;
|
||||
}
|
||||
|
||||
/* If insert collides, remove colliding or advance to next interval */
|
||||
|
@ -808,7 +808,7 @@ static inline u32_t ticker_job_insert(struct ticker_instance *instance,
|
|||
skip_collide = ticker_collide->lazy_current -
|
||||
ticker_collide->lazy_periodic;
|
||||
} else {
|
||||
skip_collide = 0;
|
||||
skip_collide = 0U;
|
||||
}
|
||||
|
||||
if (ticker_collide->ticks_periodic &&
|
||||
|
@ -844,11 +844,11 @@ static inline u32_t ticker_job_insert(struct ticker_instance *instance,
|
|||
ticker->ticks_to_expire_minus) {
|
||||
ticker->ticks_to_expire -=
|
||||
ticker->ticks_to_expire_minus;
|
||||
ticker->ticks_to_expire_minus = 0;
|
||||
ticker->ticks_to_expire_minus = 0U;
|
||||
} else {
|
||||
ticker->ticks_to_expire_minus -=
|
||||
ticker->ticks_to_expire;
|
||||
ticker->ticks_to_expire = 0;
|
||||
ticker->ticks_to_expire = 0U;
|
||||
}
|
||||
} else {
|
||||
return TICKER_STATUS_FAILURE;
|
||||
|
@ -898,7 +898,7 @@ static inline void ticker_job_list_insert(struct ticker_instance *instance,
|
|||
user_op = &user_ops[user_ops_first];
|
||||
first = user_ops_first + 1;
|
||||
if (first == user->count_user_op) {
|
||||
first = 0;
|
||||
first = 0U;
|
||||
}
|
||||
user_ops_first = first;
|
||||
|
||||
|
@ -977,7 +977,7 @@ static inline void ticker_job_list_inquire(struct ticker_instance *instance)
|
|||
|
||||
first = user->first + 1;
|
||||
if (first == user->count_user_op) {
|
||||
first = 0;
|
||||
first = 0U;
|
||||
}
|
||||
user->first = first;
|
||||
}
|
||||
|
@ -996,7 +996,7 @@ static inline void ticker_job_compare_update(struct ticker_instance *instance,
|
|||
|
||||
if (instance->ticker_id_head == TICKER_NULL) {
|
||||
if (cntr_stop() == 0) {
|
||||
instance->ticks_slot_previous = 0;
|
||||
instance->ticks_slot_previous = 0U;
|
||||
}
|
||||
|
||||
return;
|
||||
|
@ -1020,7 +1020,7 @@ static inline void ticker_job_compare_update(struct ticker_instance *instance,
|
|||
* the operation is pre-empted and current h/w counter runs
|
||||
* ahead of compare value to be set.
|
||||
*/
|
||||
i = 10;
|
||||
i = 10U;
|
||||
do {
|
||||
u32_t ticks_elapsed;
|
||||
|
||||
|
@ -1060,7 +1060,7 @@ void ticker_job(void *param)
|
|||
|
||||
return;
|
||||
}
|
||||
instance->job_guard = 1;
|
||||
instance->job_guard = 1U;
|
||||
|
||||
/* Back up the previous known tick */
|
||||
ticks_previous = instance->ticks_current;
|
||||
|
@ -1071,7 +1071,7 @@ void ticker_job(void *param)
|
|||
|
||||
first = instance->ticks_elapsed_first + 1;
|
||||
if (first == DOUBLE_BUFFER_SIZE) {
|
||||
first = 0;
|
||||
first = 0U;
|
||||
}
|
||||
instance->ticks_elapsed_first = first;
|
||||
|
||||
|
@ -1081,18 +1081,18 @@ void ticker_job(void *param)
|
|||
instance->ticks_current += ticks_elapsed;
|
||||
instance->ticks_current &= 0x00FFFFFF;
|
||||
|
||||
flag_elapsed = 1;
|
||||
flag_elapsed = 1U;
|
||||
} else {
|
||||
/* No elapsed value in queue */
|
||||
flag_elapsed = 0;
|
||||
ticks_elapsed = 0;
|
||||
flag_elapsed = 0U;
|
||||
ticks_elapsed = 0U;
|
||||
}
|
||||
|
||||
/* Initialise internal re-insert list */
|
||||
insert_head = TICKER_NULL;
|
||||
|
||||
/* Initialise flag used to update next compare value */
|
||||
flag_compare_update = 0;
|
||||
flag_compare_update = 0U;
|
||||
|
||||
/* Remember the old head, so as to decide if new compare needs to be
|
||||
* set.
|
||||
|
@ -1104,7 +1104,7 @@ void ticker_job(void *param)
|
|||
|
||||
/* Detect change in head of the list */
|
||||
if (instance->ticker_id_head != ticker_id_old_head) {
|
||||
flag_compare_update = 1;
|
||||
flag_compare_update = 1U;
|
||||
}
|
||||
|
||||
/* Handle expired tickers */
|
||||
|
@ -1114,7 +1114,7 @@ void ticker_job(void *param)
|
|||
|
||||
/* detect change in head of the list */
|
||||
if (instance->ticker_id_head != ticker_id_old_head) {
|
||||
flag_compare_update = 1;
|
||||
flag_compare_update = 1U;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1123,7 +1123,7 @@ void ticker_job(void *param)
|
|||
|
||||
/* detect change in head of the list */
|
||||
if (instance->ticker_id_head != ticker_id_old_head) {
|
||||
flag_compare_update = 1;
|
||||
flag_compare_update = 1U;
|
||||
}
|
||||
|
||||
/* Processing any list inquiries */
|
||||
|
@ -1133,7 +1133,7 @@ void ticker_job(void *param)
|
|||
}
|
||||
|
||||
/* Permit worker job to run */
|
||||
instance->job_guard = 0;
|
||||
instance->job_guard = 0U;
|
||||
|
||||
/* update compare if head changed */
|
||||
if (flag_compare_update) {
|
||||
|
@ -1193,10 +1193,10 @@ u32_t ticker_init(u8_t instance_index, u8_t count_node, void *node,
|
|||
|
||||
instance->ticker_id_head = TICKER_NULL;
|
||||
instance->ticker_id_slot_previous = TICKER_NULL;
|
||||
instance->ticks_slot_previous = 0;
|
||||
instance->ticks_current = 0;
|
||||
instance->ticks_elapsed_first = 0;
|
||||
instance->ticks_elapsed_last = 0;
|
||||
instance->ticks_slot_previous = 0U;
|
||||
instance->ticks_current = 0U;
|
||||
instance->ticks_elapsed_first = 0U;
|
||||
instance->ticks_elapsed_last = 0U;
|
||||
|
||||
return TICKER_STATUS_SUCCESS;
|
||||
}
|
||||
|
@ -1236,7 +1236,7 @@ u32_t ticker_start(u8_t instance_index, u8_t user_id, u8_t ticker_id,
|
|||
|
||||
last = user->last + 1;
|
||||
if (last >= user->count_user_op) {
|
||||
last = 0;
|
||||
last = 0U;
|
||||
}
|
||||
|
||||
if (last == user->first) {
|
||||
|
@ -1280,7 +1280,7 @@ u32_t ticker_update(u8_t instance_index, u8_t user_id, u8_t ticker_id,
|
|||
|
||||
last = user->last + 1;
|
||||
if (last >= user->count_user_op) {
|
||||
last = 0;
|
||||
last = 0U;
|
||||
}
|
||||
|
||||
if (last == user->first) {
|
||||
|
@ -1320,7 +1320,7 @@ u32_t ticker_stop(u8_t instance_index, u8_t user_id, u8_t ticker_id,
|
|||
|
||||
last = user->last + 1;
|
||||
if (last >= user->count_user_op) {
|
||||
last = 0;
|
||||
last = 0U;
|
||||
}
|
||||
|
||||
if (last == user->first) {
|
||||
|
@ -1355,7 +1355,7 @@ u32_t ticker_next_slot_get(u8_t instance_index, u8_t user_id, u8_t *ticker_id,
|
|||
|
||||
last = user->last + 1;
|
||||
if (last >= user->count_user_op) {
|
||||
last = 0;
|
||||
last = 0U;
|
||||
}
|
||||
|
||||
if (last == user->first) {
|
||||
|
@ -1392,7 +1392,7 @@ u32_t ticker_job_idle_get(u8_t instance_index, u8_t user_id,
|
|||
|
||||
last = user->last + 1;
|
||||
if (last >= user->count_user_op) {
|
||||
last = 0;
|
||||
last = 0U;
|
||||
}
|
||||
|
||||
if (last == user->first) {
|
||||
|
|
|
@ -112,8 +112,8 @@ u32_t mayfly_enqueue(u8_t caller_id, u8_t callee_id, u8_t chain,
|
|||
|
||||
void mayfly_run(u8_t callee_id)
|
||||
{
|
||||
u8_t disable = 0;
|
||||
u8_t enable = 0;
|
||||
u8_t disable = 0U;
|
||||
u8_t enable = 0U;
|
||||
u8_t caller_id;
|
||||
|
||||
/* iterate through each caller queue to this callee_id */
|
||||
|
@ -178,7 +178,7 @@ void mayfly_run(u8_t callee_id)
|
|||
|
||||
if (mft[callee_id][caller_id].disable_req !=
|
||||
mft[callee_id][caller_id].disable_ack) {
|
||||
disable = 1;
|
||||
disable = 1U;
|
||||
|
||||
mft[callee_id][caller_id].disable_ack =
|
||||
mft[callee_id][caller_id].disable_req;
|
||||
|
@ -186,7 +186,7 @@ void mayfly_run(u8_t callee_id)
|
|||
|
||||
if (mft[callee_id][caller_id].enable_req !=
|
||||
mft[callee_id][caller_id].enable_ack) {
|
||||
enable = 1;
|
||||
enable = 1U;
|
||||
|
||||
mft[callee_id][caller_id].enable_ack =
|
||||
mft[callee_id][caller_id].enable_req;
|
||||
|
|
|
@ -67,7 +67,7 @@ void *mem_acquire(void **mem_head)
|
|||
|
||||
void mem_release(void *mem, void **mem_head)
|
||||
{
|
||||
u16_t free_count = 0;
|
||||
u16_t free_count = 0U;
|
||||
|
||||
/* Get the free count from the list and increment it */
|
||||
if (*mem_head) {
|
||||
|
@ -86,7 +86,7 @@ void mem_release(void *mem, void **mem_head)
|
|||
|
||||
u16_t mem_free_count_get(void *mem_head)
|
||||
{
|
||||
u16_t free_count = 0;
|
||||
u16_t free_count = 0U;
|
||||
|
||||
/* Get the free count from the list */
|
||||
if (mem_head) {
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
u8_t util_ones_count_get(u8_t *octets, u8_t octets_len)
|
||||
{
|
||||
u8_t one_count = 0;
|
||||
u8_t one_count = 0U;
|
||||
|
||||
while (octets_len--) {
|
||||
u8_t bite;
|
||||
|
|
|
@ -49,7 +49,7 @@ int at_get_number(struct at_client *at, u32_t *val)
|
|||
|
||||
skip_space(at);
|
||||
|
||||
for (i = 0, *val = 0;
|
||||
for (i = 0U, *val = 0U;
|
||||
isdigit((unsigned char)at->buf[at->pos]);
|
||||
at->pos++, i++) {
|
||||
*val = *val * 10 + at->buf[at->pos] - '0';
|
||||
|
@ -105,7 +105,7 @@ static int get_cmd_value(struct at_client *at, struct net_buf *buf,
|
|||
} else {
|
||||
cmd_len++;
|
||||
at->buf[at->pos] = '\0';
|
||||
at->pos = 0;
|
||||
at->pos = 0U;
|
||||
at->cmd_state = cmd_state;
|
||||
break;
|
||||
}
|
||||
|
@ -135,7 +135,7 @@ static int get_response_string(struct at_client *at, struct net_buf *buf,
|
|||
} else {
|
||||
cmd_len++;
|
||||
at->buf[at->pos] = '\0';
|
||||
at->pos = 0;
|
||||
at->pos = 0U;
|
||||
at->state = state;
|
||||
break;
|
||||
}
|
||||
|
@ -152,7 +152,7 @@ static int get_response_string(struct at_client *at, struct net_buf *buf,
|
|||
static void reset_buffer(struct at_client *at)
|
||||
{
|
||||
(void)memset(at->buf, 0, at->buf_max_len);
|
||||
at->pos = 0;
|
||||
at->pos = 0U;
|
||||
}
|
||||
|
||||
static int at_state_start(struct at_client *at, struct net_buf *buf)
|
||||
|
|
|
@ -383,7 +383,7 @@ static bool range_is_valid(u16_t start, u16_t end, u16_t *err)
|
|||
/* Handle 0 is invalid */
|
||||
if (!start || !end) {
|
||||
if (err) {
|
||||
*err = 0;
|
||||
*err = 0U;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -811,7 +811,7 @@ static u8_t att_read_type_rsp(struct bt_att *att, struct bt_uuid *uuid,
|
|||
data.att = att;
|
||||
data.uuid = uuid;
|
||||
data.rsp = net_buf_add(data.buf, sizeof(*data.rsp));
|
||||
data.rsp->len = 0;
|
||||
data.rsp->len = 0U;
|
||||
|
||||
/* Pre-set error if no attr will be found in handle */
|
||||
data.err = BT_ATT_ERR_ATTRIBUTE_NOT_FOUND;
|
||||
|
@ -1115,7 +1115,7 @@ static u8_t att_read_group_rsp(struct bt_att *att, struct bt_uuid *uuid,
|
|||
data.att = att;
|
||||
data.uuid = uuid;
|
||||
data.rsp = net_buf_add(data.buf, sizeof(*data.rsp));
|
||||
data.rsp->len = 0;
|
||||
data.rsp->len = 0U;
|
||||
data.group = NULL;
|
||||
|
||||
bt_gatt_foreach_attr(start_handle, end_handle, read_group_cb, &data);
|
||||
|
@ -1199,7 +1199,7 @@ static u8_t write_cb(const struct bt_gatt_attr *attr, void *user_data)
|
|||
{
|
||||
struct write_data *data = user_data;
|
||||
int write;
|
||||
u8_t flags = 0;
|
||||
u8_t flags = 0U;
|
||||
|
||||
BT_DBG("handle 0x%04x offset %u", attr->handle, data->offset);
|
||||
|
||||
|
@ -1222,7 +1222,7 @@ static u8_t write_cb(const struct bt_gatt_attr *attr, void *user_data)
|
|||
return BT_GATT_ITER_STOP;
|
||||
}
|
||||
|
||||
data->err = 0;
|
||||
data->err = 0U;
|
||||
|
||||
return BT_GATT_ITER_CONTINUE;
|
||||
}
|
||||
|
@ -1338,7 +1338,7 @@ append:
|
|||
|
||||
net_buf_add_mem(data->buf, data->value, data->len);
|
||||
|
||||
data->err = 0;
|
||||
data->err = 0U;
|
||||
|
||||
return BT_GATT_ITER_CONTINUE;
|
||||
}
|
||||
|
@ -1419,7 +1419,7 @@ static u8_t att_exec_write_rsp(struct bt_att *att, u8_t flags)
|
|||
{
|
||||
struct bt_conn *conn = att->chan.chan.conn;
|
||||
struct net_buf *buf;
|
||||
u8_t err = 0;
|
||||
u8_t err = 0U;
|
||||
|
||||
while ((buf = net_buf_get(&att->prep_queue, K_NO_WAIT))) {
|
||||
struct bt_attr_data *data = net_buf_user_data(buf);
|
||||
|
|
|
@ -178,7 +178,7 @@ int bt_avdtp_l2cap_recv(struct bt_l2cap_chan *chan, struct net_buf *buf)
|
|||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(handler); i++) {
|
||||
for (i = 0U; i < ARRAY_SIZE(handler); i++) {
|
||||
if (sigid == handler[i].sig_id) {
|
||||
handler[i].func(session, buf, msgtype);
|
||||
return 0;
|
||||
|
|
|
@ -1057,7 +1057,7 @@ static void bt_conn_reset_rx_state(struct bt_conn *conn)
|
|||
|
||||
net_buf_unref(conn->rx);
|
||||
conn->rx = NULL;
|
||||
conn->rx_len = 0;
|
||||
conn->rx_len = 0U;
|
||||
}
|
||||
|
||||
void bt_conn_recv(struct bt_conn *conn, struct net_buf *buf, u8_t flags)
|
||||
|
@ -1122,7 +1122,7 @@ void bt_conn_recv(struct bt_conn *conn, struct net_buf *buf, u8_t flags)
|
|||
|
||||
buf = conn->rx;
|
||||
conn->rx = NULL;
|
||||
conn->rx_len = 0;
|
||||
conn->rx_len = 0U;
|
||||
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -189,7 +189,7 @@ static int gatt_register(struct bt_gatt_service *svc)
|
|||
u16_t count = svc->attr_count;
|
||||
|
||||
if (sys_slist_is_empty(&db)) {
|
||||
handle = 0;
|
||||
handle = 0U;
|
||||
goto populate;
|
||||
}
|
||||
|
||||
|
@ -266,8 +266,8 @@ static void sc_process(struct k_work *work)
|
|||
sc_range[1] = sys_cpu_to_le16(sc->end);
|
||||
|
||||
atomic_clear_bit(sc->flags, SC_RANGE_CHANGED);
|
||||
sc->start = 0;
|
||||
sc->end = 0;
|
||||
sc->start = 0U;
|
||||
sc->end = 0U;
|
||||
|
||||
sc->params.attr = &gatt_attrs[2];
|
||||
sc->params.func = sc_indicate_rsp;
|
||||
|
@ -1294,7 +1294,7 @@ static void gatt_find_type_rsp(struct bt_conn *conn, u8_t err,
|
|||
const struct bt_att_find_type_rsp *rsp = pdu;
|
||||
struct bt_gatt_discover_params *params = user_data;
|
||||
u8_t i;
|
||||
u16_t end_handle = 0, start_handle;
|
||||
u16_t end_handle = 0U, start_handle;
|
||||
|
||||
BT_DBG("err 0x%02x", err);
|
||||
|
||||
|
@ -1303,7 +1303,7 @@ static void gatt_find_type_rsp(struct bt_conn *conn, u8_t err,
|
|||
}
|
||||
|
||||
/* Parse attributes found */
|
||||
for (i = 0; length >= sizeof(rsp->list[i]);
|
||||
for (i = 0U; length >= sizeof(rsp->list[i]);
|
||||
i++, length -= sizeof(rsp->list[i])) {
|
||||
struct bt_gatt_attr attr = {};
|
||||
struct bt_gatt_service_val value;
|
||||
|
@ -1458,7 +1458,7 @@ static u16_t parse_include(struct bt_conn *conn, const void *pdu,
|
|||
u16_t length)
|
||||
{
|
||||
const struct bt_att_read_type_rsp *rsp = pdu;
|
||||
u16_t handle = 0;
|
||||
u16_t handle = 0U;
|
||||
struct bt_gatt_include value;
|
||||
union {
|
||||
struct bt_uuid uuid;
|
||||
|
@ -1556,7 +1556,7 @@ static u16_t parse_characteristic(struct bt_conn *conn, const void *pdu,
|
|||
u16_t length)
|
||||
{
|
||||
const struct bt_att_read_type_rsp *rsp = pdu;
|
||||
u16_t handle = 0;
|
||||
u16_t handle = 0U;
|
||||
union {
|
||||
struct bt_uuid uuid;
|
||||
struct bt_uuid_16 u16;
|
||||
|
@ -1684,7 +1684,7 @@ static u16_t parse_service(struct bt_conn *conn, const void *pdu,
|
|||
u16_t length)
|
||||
{
|
||||
const struct bt_att_read_group_rsp *rsp = pdu;
|
||||
u16_t start_handle, end_handle = 0;
|
||||
u16_t start_handle, end_handle = 0U;
|
||||
union {
|
||||
struct bt_uuid uuid;
|
||||
struct bt_uuid_16 u16;
|
||||
|
@ -1816,7 +1816,7 @@ static void gatt_find_info_rsp(struct bt_conn *conn, u8_t err,
|
|||
{
|
||||
const struct bt_att_find_info_rsp *rsp = pdu;
|
||||
struct bt_gatt_discover_params *params = user_data;
|
||||
u16_t handle = 0;
|
||||
u16_t handle = 0U;
|
||||
u8_t len;
|
||||
union {
|
||||
const struct bt_att_info_16 *i16;
|
||||
|
@ -2037,7 +2037,7 @@ static int gatt_read_multiple(struct bt_conn *conn,
|
|||
return -ENOMEM;
|
||||
}
|
||||
|
||||
for (i = 0; i < params->handle_count; i++) {
|
||||
for (i = 0U; i < params->handle_count; i++) {
|
||||
net_buf_add_le16(buf, params->handles[i]);
|
||||
}
|
||||
|
||||
|
|
|
@ -623,7 +623,7 @@ static void hci_disconn_complete(struct net_buf *buf)
|
|||
STACK_ANALYZE("tx stack", tx_thread_stack);
|
||||
|
||||
bt_conn_set_state(conn, BT_CONN_DISCONNECTED);
|
||||
conn->handle = 0;
|
||||
conn->handle = 0U;
|
||||
|
||||
if (conn->type != BT_CONN_TYPE_LE) {
|
||||
#if defined(CONFIG_BT_BREDR)
|
||||
|
@ -885,7 +885,7 @@ static void le_enh_conn_complete(struct bt_hci_evt_le_enh_conn_complete *evt)
|
|||
conn->le.latency = sys_le16_to_cpu(evt->latency);
|
||||
conn->le.timeout = sys_le16_to_cpu(evt->supv_timeout);
|
||||
conn->role = evt->role;
|
||||
conn->err = 0;
|
||||
conn->err = 0U;
|
||||
|
||||
/*
|
||||
* Use connection address (instead of identity address) as initiator
|
||||
|
@ -1619,7 +1619,7 @@ static void conn_complete(struct net_buf *buf)
|
|||
}
|
||||
|
||||
conn->handle = handle;
|
||||
conn->err = 0;
|
||||
conn->err = 0U;
|
||||
conn->encrypt = evt->encr_enabled;
|
||||
update_sec_level_br(conn);
|
||||
bt_conn_set_state(conn, BT_CONN_CONNECTED);
|
||||
|
@ -1676,7 +1676,7 @@ static void link_key_notify(struct net_buf *buf)
|
|||
}
|
||||
|
||||
/* clear any old Link Key flags */
|
||||
conn->br.link_key->flags = 0;
|
||||
conn->br.link_key->flags = 0U;
|
||||
|
||||
switch (evt->key_type) {
|
||||
case BT_LK_COMBINATION:
|
||||
|
@ -2054,7 +2054,7 @@ static void report_discovery_results(void)
|
|||
continue;
|
||||
}
|
||||
|
||||
priv->resolving = 1;
|
||||
priv->resolving = 1U;
|
||||
resolving_names = true;
|
||||
}
|
||||
|
||||
|
@ -2214,7 +2214,7 @@ static void remote_name_request_complete(struct net_buf *buf)
|
|||
}
|
||||
|
||||
priv = (struct discovery_priv *)&result->_priv;
|
||||
priv->resolving = 0;
|
||||
priv->resolving = 0U;
|
||||
|
||||
if (evt->status) {
|
||||
goto check_names;
|
||||
|
@ -3594,7 +3594,7 @@ static void read_bdaddr_complete(struct net_buf *buf)
|
|||
|
||||
bt_addr_copy(&bt_dev.id_addr[0].a, &rp->bdaddr);
|
||||
bt_dev.id_addr[0].type = BT_ADDR_LE_PUBLIC;
|
||||
bt_dev.id_count = 1;
|
||||
bt_dev.id_count = 1U;
|
||||
}
|
||||
|
||||
static void read_le_features_complete(struct net_buf *buf)
|
||||
|
@ -3777,7 +3777,7 @@ static int le_set_event_mask(void)
|
|||
{
|
||||
struct bt_hci_cp_le_set_event_mask *cp_mask;
|
||||
struct net_buf *buf;
|
||||
u64_t mask = 0;
|
||||
u64_t mask = 0U;
|
||||
|
||||
/* Set LE event mask */
|
||||
buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_EVENT_MASK, sizeof(*cp_mask));
|
||||
|
@ -4170,7 +4170,7 @@ static int set_event_mask(void)
|
|||
{
|
||||
struct bt_hci_cp_set_event_mask *ev;
|
||||
struct net_buf *buf;
|
||||
u64_t mask = 0;
|
||||
u64_t mask = 0U;
|
||||
|
||||
buf = bt_hci_cmd_create(BT_HCI_OP_SET_EVENT_MASK, sizeof(*ev));
|
||||
if (!buf) {
|
||||
|
@ -4864,7 +4864,7 @@ static int id_find(const bt_addr_le_t *addr)
|
|||
{
|
||||
u8_t id;
|
||||
|
||||
for (id = 0; id < bt_dev.id_count; id++) {
|
||||
for (id = 0U; id < bt_dev.id_count; id++) {
|
||||
if (!bt_addr_le_cmp(addr, &bt_dev.id_addr[id])) {
|
||||
return id;
|
||||
}
|
||||
|
|
|
@ -160,7 +160,7 @@ static void cind_handle_values(struct at_client *hf_at, u32_t index,
|
|||
|
||||
int cind_handle(struct at_client *hf_at)
|
||||
{
|
||||
u32_t index = 0;
|
||||
u32_t index = 0U;
|
||||
|
||||
/* Parsing Example: CIND: ("call",(0,1)) etc.. */
|
||||
while (at_has_next_list(hf_at)) {
|
||||
|
@ -286,7 +286,7 @@ void ag_indicator_handle_values(struct at_client *hf_at, u32_t index,
|
|||
|
||||
int cind_status_handle(struct at_client *hf_at)
|
||||
{
|
||||
u32_t index = 0;
|
||||
u32_t index = 0U;
|
||||
|
||||
while (at_has_next_list(hf_at)) {
|
||||
u32_t value;
|
||||
|
|
|
@ -1456,7 +1456,7 @@ static void l2cap_chan_le_recv_seg(struct bt_l2cap_le_chan *chan,
|
|||
struct net_buf *buf)
|
||||
{
|
||||
u16_t len;
|
||||
u16_t seg = 0;
|
||||
u16_t seg = 0U;
|
||||
|
||||
len = net_buf_frags_len(chan->_sdu);
|
||||
if (len) {
|
||||
|
|
|
@ -377,14 +377,14 @@ static int l2cap_br_info_rsp(struct bt_l2cap_br *l2cap, u8_t ident,
|
|||
}
|
||||
done:
|
||||
atomic_set_bit(l2cap->chan.flags, L2CAP_FLAG_SIG_INFO_DONE);
|
||||
l2cap->info_ident = 0;
|
||||
l2cap->info_ident = 0U;
|
||||
return err;
|
||||
}
|
||||
|
||||
static u8_t get_fixed_channels_mask(void)
|
||||
{
|
||||
struct bt_l2cap_fixed_chan *fchan;
|
||||
u8_t mask = 0;
|
||||
u8_t mask = 0U;
|
||||
|
||||
/* this needs to be enhanced if AMP Test Manager support is added */
|
||||
SYS_SLIST_FOR_EACH_CONTAINER(&br_fixed_channels, fchan, node) {
|
||||
|
|
|
@ -431,7 +431,7 @@ static const struct bt_mesh_model_op *find_op(struct bt_mesh_model *models,
|
|||
{
|
||||
u8_t i;
|
||||
|
||||
for (i = 0; i < model_count; i++) {
|
||||
for (i = 0U; i < model_count; i++) {
|
||||
const struct bt_mesh_model_op *op;
|
||||
|
||||
*model = &models[i];
|
||||
|
@ -718,7 +718,7 @@ struct bt_mesh_model *bt_mesh_model_find_vnd(struct bt_mesh_elem *elem,
|
|||
{
|
||||
u8_t i;
|
||||
|
||||
for (i = 0; i < elem->vnd_model_count; i++) {
|
||||
for (i = 0U; i < elem->vnd_model_count; i++) {
|
||||
if (elem->vnd_models[i].vnd.company == company &&
|
||||
elem->vnd_models[i].vnd.id == id) {
|
||||
return &elem->vnd_models[i];
|
||||
|
@ -733,7 +733,7 @@ struct bt_mesh_model *bt_mesh_model_find(struct bt_mesh_elem *elem,
|
|||
{
|
||||
u8_t i;
|
||||
|
||||
for (i = 0; i < elem->model_count; i++) {
|
||||
for (i = 0U; i < elem->model_count; i++) {
|
||||
if (elem->models[i].id == id) {
|
||||
return &elem->models[i];
|
||||
}
|
||||
|
|
|
@ -187,7 +187,7 @@ static void adv_thread(void *p1, void *p2, void *p3)
|
|||
|
||||
/* busy == 0 means this was canceled */
|
||||
if (BT_MESH_ADV(buf)->busy) {
|
||||
BT_MESH_ADV(buf)->busy = 0;
|
||||
BT_MESH_ADV(buf)->busy = 0U;
|
||||
adv_send(buf);
|
||||
}
|
||||
|
||||
|
@ -245,7 +245,7 @@ void bt_mesh_adv_send(struct net_buf *buf, const struct bt_mesh_send_cb *cb,
|
|||
|
||||
BT_MESH_ADV(buf)->cb = cb;
|
||||
BT_MESH_ADV(buf)->cb_data = cb_data;
|
||||
BT_MESH_ADV(buf)->busy = 1;
|
||||
BT_MESH_ADV(buf)->busy = 1U;
|
||||
|
||||
net_buf_put(&adv_queue, net_buf_ref(buf));
|
||||
}
|
||||
|
|
|
@ -229,7 +229,7 @@ static void update_beacon_observation(void)
|
|||
}
|
||||
|
||||
sub->beacons_last = sub->beacons_cur;
|
||||
sub->beacons_cur = 0;
|
||||
sub->beacons_cur = 0U;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -398,8 +398,8 @@ void bt_mesh_beacon_enable(void)
|
|||
continue;
|
||||
}
|
||||
|
||||
sub->beacons_last = 0;
|
||||
sub->beacons_cur = 0;
|
||||
sub->beacons_last = 0U;
|
||||
sub->beacons_cur = 0U;
|
||||
|
||||
bt_mesh_net_beacon_update(sub);
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ static void hb_send(struct bt_mesh_model *model)
|
|||
{
|
||||
|
||||
struct bt_mesh_cfg_srv *cfg = model->user_data;
|
||||
u16_t feat = 0;
|
||||
u16_t feat = 0U;
|
||||
struct __packed {
|
||||
u8_t init_ttl;
|
||||
u16_t feat;
|
||||
|
@ -130,7 +130,7 @@ static int comp_add_elem(struct net_buf_simple *buf, struct bt_mesh_elem *elem,
|
|||
|
||||
static int comp_get_page_0(struct net_buf_simple *buf)
|
||||
{
|
||||
u16_t feat = 0;
|
||||
u16_t feat = 0U;
|
||||
const struct bt_mesh_comp *comp;
|
||||
int i;
|
||||
|
||||
|
@ -184,7 +184,7 @@ static void dev_comp_data_get(struct bt_mesh_model *model,
|
|||
page = net_buf_simple_pull_u8(buf);
|
||||
if (page != 0) {
|
||||
BT_WARN("Composition page %u not available", page);
|
||||
page = 0;
|
||||
page = 0U;
|
||||
}
|
||||
|
||||
bt_mesh_model_msg_init(&sdu, OP_DEV_COMP_DATA_STATUS);
|
||||
|
@ -643,7 +643,7 @@ static void app_key_get(struct bt_mesh_model *model,
|
|||
}
|
||||
|
||||
prev = BT_MESH_KEY_UNUSED;
|
||||
for (i = 0; i < ARRAY_SIZE(bt_mesh.app_keys); i++) {
|
||||
for (i = 0U; i < ARRAY_SIZE(bt_mesh.app_keys); i++) {
|
||||
struct bt_mesh_app_key *key = &bt_mesh.app_keys[i];
|
||||
|
||||
if (key->net_idx != get_idx) {
|
||||
|
@ -1049,7 +1049,7 @@ static void mod_pub_get(struct bt_mesh_model *model,
|
|||
struct bt_mesh_msg_ctx *ctx,
|
||||
struct net_buf_simple *buf)
|
||||
{
|
||||
u16_t elem_addr, pub_addr = 0;
|
||||
u16_t elem_addr, pub_addr = 0U;
|
||||
struct bt_mesh_model *mod;
|
||||
struct bt_mesh_elem *elem;
|
||||
u8_t *mod_id, status;
|
||||
|
@ -1181,7 +1181,7 @@ static u8_t va_add(u8_t *label_uuid, u16_t *addr)
|
|||
return STATUS_UNSPECIFIED;
|
||||
}
|
||||
|
||||
free_slot->ref = 1;
|
||||
free_slot->ref = 1U;
|
||||
free_slot->addr = *addr;
|
||||
memcpy(free_slot->uuid, label_uuid, 16);
|
||||
|
||||
|
@ -1280,14 +1280,14 @@ static void mod_pub_va_set(struct bt_mesh_model *model,
|
|||
if (!elem) {
|
||||
mod = NULL;
|
||||
vnd = (buf->len == 4);
|
||||
pub_addr = 0;
|
||||
pub_addr = 0U;
|
||||
status = STATUS_INVALID_ADDRESS;
|
||||
goto send_status;
|
||||
}
|
||||
|
||||
mod = get_model(elem, buf, &vnd);
|
||||
if (!mod) {
|
||||
pub_addr = 0;
|
||||
pub_addr = 0U;
|
||||
status = STATUS_INVALID_MODEL;
|
||||
goto send_status;
|
||||
}
|
||||
|
@ -1316,7 +1316,7 @@ static void mod_pub_va_set(struct bt_mesh_model *model,
|
|||
u8_t *mod_id, status;
|
||||
struct bt_mesh_model *mod;
|
||||
struct bt_mesh_elem *elem;
|
||||
u16_t elem_addr, pub_addr = 0;
|
||||
u16_t elem_addr, pub_addr = 0U;
|
||||
bool vnd;
|
||||
|
||||
elem_addr = net_buf_simple_pull_le16(buf);
|
||||
|
@ -2324,7 +2324,7 @@ static void net_key_get(struct bt_mesh_model *model,
|
|||
bt_mesh_model_msg_init(&msg, OP_NET_KEY_LIST);
|
||||
|
||||
prev = BT_MESH_KEY_UNUSED;
|
||||
for (i = 0; i < ARRAY_SIZE(bt_mesh.sub); i++) {
|
||||
for (i = 0U; i < ARRAY_SIZE(bt_mesh.sub); i++) {
|
||||
struct bt_mesh_subnet *sub = &bt_mesh.sub[i];
|
||||
|
||||
if (sub->net_idx == BT_MESH_KEY_UNUSED) {
|
||||
|
@ -3062,7 +3062,7 @@ static void hb_sub_send_status(struct bt_mesh_model *model,
|
|||
|
||||
uptime = k_uptime_get();
|
||||
if (uptime > cfg->hb_sub.expiry) {
|
||||
period = 0;
|
||||
period = 0U;
|
||||
} else {
|
||||
period = (cfg->hb_sub.expiry - uptime) / 1000;
|
||||
}
|
||||
|
|
|
@ -284,7 +284,7 @@ static int bt_mesh_ccm_decrypt(const u8_t key[16], u8_t nonce[13],
|
|||
last_blk = msg_len % 16;
|
||||
blk_cnt = (msg_len + 15) / 16;
|
||||
if (!last_blk) {
|
||||
last_blk = 16;
|
||||
last_blk = 16U;
|
||||
}
|
||||
|
||||
for (j = 0; j < blk_cnt; j++) {
|
||||
|
@ -448,7 +448,7 @@ static int bt_mesh_ccm_encrypt(const u8_t key[16], u8_t nonce[13],
|
|||
last_blk = msg_len % 16;
|
||||
blk_cnt = (msg_len + 15) / 16;
|
||||
if (!last_blk) {
|
||||
last_blk = 16;
|
||||
last_blk = 16U;
|
||||
}
|
||||
|
||||
for (j = 0; j < blk_cnt; j++) {
|
||||
|
@ -541,8 +541,8 @@ static void create_proxy_nonce(u8_t nonce[13], const u8_t *pdu,
|
|||
nonce[6] = pdu[6];
|
||||
|
||||
/* Pad */
|
||||
nonce[7] = 0;
|
||||
nonce[8] = 0;
|
||||
nonce[7] = 0U;
|
||||
nonce[8] = 0U;
|
||||
|
||||
/* IV Index */
|
||||
sys_put_be32(iv_index, &nonce[9]);
|
||||
|
@ -568,8 +568,8 @@ static void create_net_nonce(u8_t nonce[13], const u8_t *pdu,
|
|||
nonce[6] = pdu[6];
|
||||
|
||||
/* Pad */
|
||||
nonce[7] = 0;
|
||||
nonce[8] = 0;
|
||||
nonce[7] = 0U;
|
||||
nonce[8] = 0U;
|
||||
|
||||
/* IV Index */
|
||||
sys_put_be32(iv_index, &nonce[9]);
|
||||
|
|
|
@ -176,7 +176,7 @@ static void friend_clear(struct bt_mesh_friend *frnd)
|
|||
if (frnd->last) {
|
||||
/* Cancel the sending if necessary */
|
||||
if (frnd->pending_buf) {
|
||||
BT_MESH_ADV(frnd->last)->busy = 0;
|
||||
BT_MESH_ADV(frnd->last)->busy = 0U;
|
||||
}
|
||||
|
||||
net_buf_unref(frnd->last);
|
||||
|
@ -195,12 +195,12 @@ static void friend_clear(struct bt_mesh_friend *frnd)
|
|||
}
|
||||
}
|
||||
|
||||
frnd->valid = 0;
|
||||
frnd->established = 0;
|
||||
frnd->pending_buf = 0;
|
||||
frnd->fsn = 0;
|
||||
frnd->queue_size = 0;
|
||||
frnd->pending_req = 0;
|
||||
frnd->valid = 0U;
|
||||
frnd->established = 0U;
|
||||
frnd->pending_buf = 0U;
|
||||
frnd->fsn = 0U;
|
||||
frnd->queue_size = 0U;
|
||||
frnd->pending_req = 0U;
|
||||
(void)memset(frnd->sub_list, 0, sizeof(frnd->sub_list));
|
||||
}
|
||||
|
||||
|
@ -237,7 +237,7 @@ void bt_mesh_friend_sec_update(u16_t net_idx)
|
|||
}
|
||||
|
||||
if (net_idx == BT_MESH_KEY_ANY || frnd->net_idx == net_idx) {
|
||||
frnd->sec_update = 1;
|
||||
frnd->sec_update = 1U;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -398,8 +398,8 @@ static struct net_buf *encode_friend_ctl(struct bt_mesh_friend *frnd,
|
|||
info.src = bt_mesh_primary_addr();
|
||||
info.dst = frnd->lpn;
|
||||
|
||||
info.ctl = 1;
|
||||
info.ttl = 0;
|
||||
info.ctl = 1U;
|
||||
info.ttl = 0U;
|
||||
|
||||
seq = bt_mesh_next_seq();
|
||||
info.seq[0] = seq >> 16;
|
||||
|
@ -456,12 +456,12 @@ static void enqueue_sub_cfm(struct bt_mesh_friend *frnd, u8_t xact)
|
|||
}
|
||||
|
||||
frnd->last = buf;
|
||||
frnd->send_last = 1;
|
||||
frnd->send_last = 1U;
|
||||
}
|
||||
|
||||
static void friend_recv_delay(struct bt_mesh_friend *frnd)
|
||||
{
|
||||
frnd->pending_req = 1;
|
||||
frnd->pending_req = 1U;
|
||||
k_delayed_work_submit(&frnd->timer, recv_delay(frnd));
|
||||
BT_DBG("Waiting RecvDelay of %d ms", recv_delay(frnd));
|
||||
}
|
||||
|
@ -552,7 +552,7 @@ static void enqueue_update(struct bt_mesh_friend *frnd, u8_t md)
|
|||
return;
|
||||
}
|
||||
|
||||
frnd->sec_update = 0;
|
||||
frnd->sec_update = 0U;
|
||||
enqueue_buf(frnd, buf);
|
||||
}
|
||||
|
||||
|
@ -588,12 +588,12 @@ int bt_mesh_friend_poll(struct bt_mesh_net_rx *rx, struct net_buf_simple *buf)
|
|||
|
||||
if (!frnd->established) {
|
||||
BT_DBG("Friendship established with 0x%04x", frnd->lpn);
|
||||
frnd->established = 1;
|
||||
frnd->established = 1U;
|
||||
}
|
||||
|
||||
if (msg->fsn == frnd->fsn && frnd->last) {
|
||||
BT_DBG("Re-sending last PDU");
|
||||
frnd->send_last = 1;
|
||||
frnd->send_last = 1U;
|
||||
} else {
|
||||
if (frnd->last) {
|
||||
net_buf_unref(frnd->last);
|
||||
|
@ -687,7 +687,7 @@ static void clear_procedure_start(struct bt_mesh_friend *frnd)
|
|||
BT_DBG("LPN 0x%04x (old) Friend 0x%04x", frnd->lpn, frnd->clear.frnd);
|
||||
|
||||
frnd->clear.start = k_uptime_get_32() + (2 * frnd->poll_to);
|
||||
frnd->clear.repeat_sec = 1;
|
||||
frnd->clear.repeat_sec = 1U;
|
||||
|
||||
send_friend_clear(frnd);
|
||||
}
|
||||
|
@ -763,7 +763,7 @@ static void enqueue_offer(struct bt_mesh_friend *frnd, s8_t rssi)
|
|||
}
|
||||
|
||||
frnd->last = buf;
|
||||
frnd->send_last = 1;
|
||||
frnd->send_last = 1U;
|
||||
}
|
||||
|
||||
#define RECV_WIN CONFIG_BT_MESH_FRIEND_RECV_WIN
|
||||
|
@ -865,7 +865,7 @@ int bt_mesh_friend_req(struct bt_mesh_net_rx *rx, struct net_buf_simple *buf)
|
|||
for (i = 0; i < ARRAY_SIZE(bt_mesh.frnd); i++) {
|
||||
if (!bt_mesh.frnd[i].valid) {
|
||||
frnd = &bt_mesh.frnd[i];
|
||||
frnd->valid = 1;
|
||||
frnd->valid = 1U;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -979,7 +979,7 @@ static void buf_send_start(u16_t duration, int err, void *user_data)
|
|||
|
||||
BT_DBG("err %d", err);
|
||||
|
||||
frnd->pending_buf = 0;
|
||||
frnd->pending_buf = 0U;
|
||||
|
||||
/* Friend Offer doesn't follow the re-sending semantics */
|
||||
if (!frnd->established) {
|
||||
|
@ -1025,7 +1025,7 @@ static void friend_timeout(struct k_work *work)
|
|||
|
||||
if (frnd->send_last && frnd->last) {
|
||||
BT_DBG("Sending frnd->last %p", frnd->last);
|
||||
frnd->send_last = 0;
|
||||
frnd->send_last = 0U;
|
||||
goto send_last;
|
||||
}
|
||||
|
||||
|
@ -1047,8 +1047,8 @@ static void friend_timeout(struct k_work *work)
|
|||
frnd->queue_size--;
|
||||
|
||||
send_last:
|
||||
frnd->pending_req = 0;
|
||||
frnd->pending_buf = 1;
|
||||
frnd->pending_req = 0U;
|
||||
frnd->pending_buf = 1U;
|
||||
bt_mesh_adv_send(frnd->last, &buf_sent_cb, frnd);
|
||||
}
|
||||
|
||||
|
|
|
@ -91,7 +91,7 @@ static size_t health_get_current(struct bt_mesh_model *mod,
|
|||
BT_ERR("Failed to get faults (err %d)", err);
|
||||
sys_put_le16(comp->cid, company_ptr);
|
||||
*test_id = HEALTH_TEST_STANDARD;
|
||||
fault_count = 0;
|
||||
fault_count = 0U;
|
||||
} else {
|
||||
sys_put_le16(company_id, company_ptr);
|
||||
net_buf_simple_add(msg, fault_count);
|
||||
|
@ -100,7 +100,7 @@ static size_t health_get_current(struct bt_mesh_model *mod,
|
|||
BT_WARN("No callback for getting faults");
|
||||
sys_put_le16(comp->cid, company_ptr);
|
||||
*test_id = HEALTH_TEST_STANDARD;
|
||||
fault_count = 0;
|
||||
fault_count = 0U;
|
||||
}
|
||||
|
||||
return fault_count;
|
||||
|
|
|
@ -227,14 +227,14 @@ static void clear_friendship(bool force, bool disable)
|
|||
}
|
||||
|
||||
lpn->frnd = BT_MESH_ADDR_UNASSIGNED;
|
||||
lpn->fsn = 0;
|
||||
lpn->req_attempts = 0;
|
||||
lpn->recv_win = 0;
|
||||
lpn->queue_size = 0;
|
||||
lpn->disable = 0;
|
||||
lpn->sent_req = 0;
|
||||
lpn->established = 0;
|
||||
lpn->clear_success = 0;
|
||||
lpn->fsn = 0U;
|
||||
lpn->req_attempts = 0U;
|
||||
lpn->recv_win = 0U;
|
||||
lpn->queue_size = 0U;
|
||||
lpn->disable = 0U;
|
||||
lpn->sent_req = 0U;
|
||||
lpn->established = 0U;
|
||||
lpn->clear_success = 0U;
|
||||
|
||||
group_zero(lpn->added);
|
||||
group_zero(lpn->pending);
|
||||
|
@ -244,7 +244,7 @@ static void clear_friendship(bool force, bool disable)
|
|||
* Friendship is created, in case lpn->groups doesn't get
|
||||
* modified meanwhile.
|
||||
*/
|
||||
lpn->groups_changed = 1;
|
||||
lpn->groups_changed = 1U;
|
||||
|
||||
if (disable) {
|
||||
lpn_set_state(BT_MESH_LPN_DISABLED);
|
||||
|
@ -321,7 +321,7 @@ static void req_sent(u16_t duration, int err, void *user_data)
|
|||
|
||||
if (err) {
|
||||
BT_ERR("Sending request failed (err %d)", err);
|
||||
lpn->sent_req = 0;
|
||||
lpn->sent_req = 0U;
|
||||
group_zero(lpn->pending);
|
||||
return;
|
||||
}
|
||||
|
@ -370,7 +370,7 @@ static int send_friend_poll(void)
|
|||
|
||||
if (lpn->sent_req) {
|
||||
if (lpn->sent_req != TRANS_CTL_OP_FRIEND_POLL) {
|
||||
lpn->pending_poll = 1;
|
||||
lpn->pending_poll = 1U;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -379,7 +379,7 @@ static int send_friend_poll(void)
|
|||
err = bt_mesh_ctl_send(&tx, TRANS_CTL_OP_FRIEND_POLL, &fsn, 1,
|
||||
NULL, &req_sent_cb, NULL);
|
||||
if (err == 0) {
|
||||
lpn->pending_poll = 0;
|
||||
lpn->pending_poll = 0U;
|
||||
lpn->sent_req = TRANS_CTL_OP_FRIEND_POLL;
|
||||
}
|
||||
|
||||
|
@ -451,8 +451,8 @@ static void friend_response_received(struct bt_mesh_lpn *lpn)
|
|||
k_delayed_work_cancel(&lpn->timer);
|
||||
bt_mesh_scan_disable();
|
||||
lpn_set_state(BT_MESH_LPN_ESTABLISHED);
|
||||
lpn->req_attempts = 0;
|
||||
lpn->sent_req = 0;
|
||||
lpn->req_attempts = 0U;
|
||||
lpn->sent_req = 0U;
|
||||
}
|
||||
|
||||
void bt_mesh_lpn_msg_received(struct bt_mesh_net_rx *rx)
|
||||
|
@ -527,8 +527,8 @@ int bt_mesh_lpn_friend_offer(struct bt_mesh_net_rx *rx,
|
|||
if (err) {
|
||||
friend_cred_clear(cred);
|
||||
lpn->frnd = BT_MESH_ADDR_UNASSIGNED;
|
||||
lpn->recv_win = 0;
|
||||
lpn->queue_size = 0;
|
||||
lpn->recv_win = 0U;
|
||||
lpn->queue_size = 0U;
|
||||
return err;
|
||||
}
|
||||
|
||||
|
@ -564,7 +564,7 @@ int bt_mesh_lpn_friend_clear_cfm(struct bt_mesh_net_rx *rx,
|
|||
return 0;
|
||||
}
|
||||
|
||||
lpn->clear_success = 1;
|
||||
lpn->clear_success = 1U;
|
||||
clear_friendship(false, lpn->disable);
|
||||
|
||||
return 0;
|
||||
|
@ -593,7 +593,7 @@ static void lpn_group_add(u16_t group)
|
|||
}
|
||||
|
||||
*free_slot = group;
|
||||
lpn->groups_changed = 1;
|
||||
lpn->groups_changed = 1U;
|
||||
}
|
||||
|
||||
static void lpn_group_del(u16_t group)
|
||||
|
@ -606,7 +606,7 @@ static void lpn_group_del(u16_t group)
|
|||
if (atomic_test_bit(lpn->added, i) ||
|
||||
atomic_test_bit(lpn->pending, i)) {
|
||||
atomic_set_bit(lpn->to_remove, i);
|
||||
lpn->groups_changed = 1;
|
||||
lpn->groups_changed = 1U;
|
||||
} else {
|
||||
lpn->groups[i] = BT_MESH_ADDR_UNASSIGNED;
|
||||
}
|
||||
|
@ -713,7 +713,7 @@ static void update_timeout(struct bt_mesh_lpn *lpn)
|
|||
|
||||
if (lpn->req_attempts < 6) {
|
||||
BT_WARN("Retrying first Friend Poll");
|
||||
lpn->sent_req = 0;
|
||||
lpn->sent_req = 0U;
|
||||
if (send_friend_poll() == 0) {
|
||||
return;
|
||||
}
|
||||
|
@ -767,7 +767,7 @@ static void lpn_timeout(struct k_work *work)
|
|||
if (lpn->req_attempts < REQ_ATTEMPTS(lpn)) {
|
||||
u8_t req = lpn->sent_req;
|
||||
|
||||
lpn->sent_req = 0;
|
||||
lpn->sent_req = 0U;
|
||||
|
||||
if (!req || req == TRANS_CTL_OP_FRIEND_POLL) {
|
||||
send_friend_poll();
|
||||
|
@ -780,7 +780,7 @@ static void lpn_timeout(struct k_work *work)
|
|||
|
||||
BT_ERR("No response from Friend after %u retries",
|
||||
lpn->req_attempts);
|
||||
lpn->req_attempts = 0;
|
||||
lpn->req_attempts = 0U;
|
||||
clear_friendship(false, false);
|
||||
break;
|
||||
case BT_MESH_LPN_RECV_DELAY:
|
||||
|
@ -898,7 +898,7 @@ int bt_mesh_lpn_friend_sub_cfm(struct bt_mesh_net_rx *rx,
|
|||
sub_update(TRANS_CTL_OP_FRIEND_SUB_REM);
|
||||
|
||||
if (!lpn->sent_req) {
|
||||
lpn->groups_changed = 0;
|
||||
lpn->groups_changed = 0U;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -952,7 +952,7 @@ int bt_mesh_lpn_friend_update(struct bt_mesh_net_rx *rx,
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
lpn->established = 1;
|
||||
lpn->established = 1U;
|
||||
|
||||
BT_INFO("Friendship established with 0x%04x", lpn->frnd);
|
||||
|
||||
|
@ -984,7 +984,7 @@ int bt_mesh_lpn_friend_update(struct bt_mesh_net_rx *rx,
|
|||
sub_update(TRANS_CTL_OP_FRIEND_SUB_REM);
|
||||
|
||||
if (!lpn->sent_req) {
|
||||
lpn->groups_changed = 0;
|
||||
lpn->groups_changed = 0U;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ int bt_mesh_provision(const u8_t net_key[16], u16_t net_idx,
|
|||
return err;
|
||||
}
|
||||
|
||||
bt_mesh.seq = 0;
|
||||
bt_mesh.seq = 0U;
|
||||
|
||||
bt_mesh_comp_provision(addr);
|
||||
|
||||
|
@ -81,13 +81,13 @@ void bt_mesh_reset(void)
|
|||
return;
|
||||
}
|
||||
|
||||
bt_mesh.iv_index = 0;
|
||||
bt_mesh.seq = 0;
|
||||
bt_mesh.iv_update = 0;
|
||||
bt_mesh.pending_update = 0;
|
||||
bt_mesh.valid = 0;
|
||||
bt_mesh.ivu_duration = 0;
|
||||
bt_mesh.ivu_initiator = 0;
|
||||
bt_mesh.iv_index = 0U;
|
||||
bt_mesh.seq = 0U;
|
||||
bt_mesh.iv_update = 0U;
|
||||
bt_mesh.pending_update = 0U;
|
||||
bt_mesh.valid = 0U;
|
||||
bt_mesh.ivu_duration = 0U;
|
||||
bt_mesh.ivu_initiator = 0U;
|
||||
|
||||
k_delayed_work_cancel(&bt_mesh.ivu_timer);
|
||||
|
||||
|
|
|
@ -130,7 +130,7 @@ static bool msg_cache_match(struct bt_mesh_net_rx *rx,
|
|||
u64_t hash = msg_hash(rx, pdu);
|
||||
u16_t i;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(msg_cache); i++) {
|
||||
for (i = 0U; i < ARRAY_SIZE(msg_cache); i++) {
|
||||
if (msg_cache[i] == hash) {
|
||||
return true;
|
||||
}
|
||||
|
@ -340,8 +340,8 @@ void friend_cred_clear(struct friend_cred *cred)
|
|||
{
|
||||
cred->net_idx = BT_MESH_KEY_UNUSED;
|
||||
cred->addr = BT_MESH_ADDR_UNASSIGNED;
|
||||
cred->lpn_counter = 0;
|
||||
cred->frnd_counter = 0;
|
||||
cred->lpn_counter = 0U;
|
||||
cred->frnd_counter = 0U;
|
||||
(void)memset(cred->cred, 0, sizeof(cred->cred));
|
||||
}
|
||||
|
||||
|
@ -453,7 +453,7 @@ int bt_mesh_net_create(u16_t idx, u8_t flags, const u8_t key[16],
|
|||
}
|
||||
|
||||
(void)memset(msg_cache, 0, sizeof(msg_cache));
|
||||
msg_cache_next = 0;
|
||||
msg_cache_next = 0U;
|
||||
|
||||
sub = &bt_mesh.sub[0];
|
||||
|
||||
|
@ -472,7 +472,7 @@ int bt_mesh_net_create(u16_t idx, u8_t flags, const u8_t key[16],
|
|||
}
|
||||
}
|
||||
|
||||
bt_mesh.valid = 1;
|
||||
bt_mesh.valid = 1U;
|
||||
sub->net_idx = idx;
|
||||
|
||||
if (IS_ENABLED(CONFIG_BT_MESH_GATT_PROXY)) {
|
||||
|
@ -585,7 +585,7 @@ void bt_mesh_iv_update_test(bool enable)
|
|||
{
|
||||
bt_mesh.ivu_test = enable;
|
||||
/* Reset the duration variable - needed for some PTS tests */
|
||||
bt_mesh.ivu_duration = 0;
|
||||
bt_mesh.ivu_duration = 0U;
|
||||
}
|
||||
|
||||
bool bt_mesh_iv_update(void)
|
||||
|
@ -657,7 +657,7 @@ bool bt_mesh_net_iv_update(u32_t iv_index, bool iv_update)
|
|||
BT_WARN("Performing IV Index Recovery");
|
||||
(void)memset(bt_mesh.rpl, 0, sizeof(bt_mesh.rpl));
|
||||
bt_mesh.iv_index = iv_index;
|
||||
bt_mesh.seq = 0;
|
||||
bt_mesh.seq = 0U;
|
||||
goto do_update;
|
||||
}
|
||||
|
||||
|
@ -683,13 +683,13 @@ bool bt_mesh_net_iv_update(u32_t iv_index, bool iv_update)
|
|||
/* Defer change to Normal Operation if there are pending acks */
|
||||
if (!iv_update && bt_mesh_tx_in_progress()) {
|
||||
BT_WARN("IV Update deferred because of pending transfer");
|
||||
bt_mesh.pending_update = 1;
|
||||
bt_mesh.pending_update = 1U;
|
||||
return false;
|
||||
}
|
||||
|
||||
do_update:
|
||||
bt_mesh.iv_update = iv_update;
|
||||
bt_mesh.ivu_duration = 0;
|
||||
bt_mesh.ivu_duration = 0U;
|
||||
|
||||
if (bt_mesh.iv_update) {
|
||||
bt_mesh.iv_index = iv_index;
|
||||
|
@ -699,7 +699,7 @@ do_update:
|
|||
bt_mesh_rpl_reset();
|
||||
} else {
|
||||
BT_DBG("Normal mode entered");
|
||||
bt_mesh.seq = 0;
|
||||
bt_mesh.seq = 0U;
|
||||
}
|
||||
|
||||
k_delayed_work_submit(&bt_mesh.ivu_timer, BT_MESH_IVU_TIMEOUT);
|
||||
|
@ -835,14 +835,14 @@ int bt_mesh_net_encode(struct bt_mesh_net_tx *tx, struct net_buf_simple *buf,
|
|||
&nid, &enc, &priv)) {
|
||||
BT_WARN("Falling back to master credentials");
|
||||
|
||||
tx->friend_cred = 0;
|
||||
tx->friend_cred = 0U;
|
||||
|
||||
nid = tx->sub->keys[tx->sub->kr_flag].nid;
|
||||
enc = tx->sub->keys[tx->sub->kr_flag].enc;
|
||||
priv = tx->sub->keys[tx->sub->kr_flag].privacy;
|
||||
}
|
||||
} else {
|
||||
tx->friend_cred = 0;
|
||||
tx->friend_cred = 0U;
|
||||
nid = tx->sub->keys[tx->sub->kr_flag].nid;
|
||||
enc = tx->sub->keys[tx->sub->kr_flag].enc;
|
||||
priv = tx->sub->keys[tx->sub->kr_flag].privacy;
|
||||
|
@ -1051,7 +1051,7 @@ static int friend_decrypt(struct bt_mesh_subnet *sub, const u8_t *data,
|
|||
if (NID(data) == cred->cred[1].nid &&
|
||||
!net_decrypt(sub, cred->cred[1].enc, cred->cred[1].privacy,
|
||||
data, data_len, rx, buf)) {
|
||||
rx->new_key = 1;
|
||||
rx->new_key = 1U;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -1078,7 +1078,7 @@ static bool net_find_and_decrypt(const u8_t *data, size_t data_len,
|
|||
#if (defined(CONFIG_BT_MESH_LOW_POWER) || \
|
||||
defined(CONFIG_BT_MESH_FRIEND))
|
||||
if (!friend_decrypt(sub, data, data_len, rx, buf)) {
|
||||
rx->friend_cred = 1;
|
||||
rx->friend_cred = 1U;
|
||||
rx->ctx.net_idx = sub->net_idx;
|
||||
rx->sub = sub;
|
||||
return true;
|
||||
|
@ -1100,7 +1100,7 @@ static bool net_find_and_decrypt(const u8_t *data, size_t data_len,
|
|||
if (NID(data) == sub->keys[1].nid &&
|
||||
!net_decrypt(sub, sub->keys[1].enc, sub->keys[1].privacy,
|
||||
data, data_len, rx, buf)) {
|
||||
rx->new_key = 1;
|
||||
rx->new_key = 1U;
|
||||
rx->ctx.net_idx = sub->net_idx;
|
||||
rx->sub = sub;
|
||||
return true;
|
||||
|
|
|
@ -216,7 +216,7 @@ static void free_segments(void)
|
|||
|
||||
link.tx.buf[i] = NULL;
|
||||
/* Mark as canceled */
|
||||
BT_MESH_ADV(buf)->busy = 0;
|
||||
BT_MESH_ADV(buf)->busy = 0U;
|
||||
net_buf_unref(buf);
|
||||
}
|
||||
}
|
||||
|
@ -414,7 +414,7 @@ static int prov_send_adv(struct net_buf_simple *msg)
|
|||
net_buf_simple_pull(msg, seg_len);
|
||||
|
||||
buf = start;
|
||||
for (seg_id = 1; msg->len > 0; seg_id++) {
|
||||
for (seg_id = 1U; msg->len > 0; seg_id++) {
|
||||
if (seg_id >= ARRAY_SIZE(link.tx.buf)) {
|
||||
BT_ERR("Too big message");
|
||||
free_segments();
|
||||
|
@ -638,7 +638,7 @@ static int prov_auth(u8_t method, u8_t action, u8_t size)
|
|||
bt_rand(str, size);
|
||||
|
||||
/* Normalize to '0' .. '9' & 'A' .. 'Z' */
|
||||
for (i = 0; i < size; i++) {
|
||||
for (i = 0U; i < size; i++) {
|
||||
str[i] %= 36;
|
||||
if (str[i] < 10) {
|
||||
str[i] += '0';
|
||||
|
@ -1065,7 +1065,7 @@ static void prov_data(const u8_t *data)
|
|||
prov_send(&msg);
|
||||
|
||||
/* Ignore any further PDUs on this link */
|
||||
link.expect = 0;
|
||||
link.expect = 0U;
|
||||
|
||||
/* Store info, since bt_mesh_provision() will end up clearing it */
|
||||
if (IS_ENABLED(CONFIG_BT_MESH_GATT_PROXY)) {
|
||||
|
@ -1124,7 +1124,7 @@ static void close_link(u8_t err, u8_t reason)
|
|||
prov_send_fail_msg(err);
|
||||
}
|
||||
|
||||
link.rx.seg = 0;
|
||||
link.rx.seg = 0U;
|
||||
bearer_ctl_send(LINK_CLOSE, &reason, sizeof(reason));
|
||||
#endif
|
||||
|
||||
|
@ -1273,7 +1273,7 @@ static void prov_msg_recv(void)
|
|||
|
||||
gen_prov_ack_send(link.rx.id);
|
||||
link.rx.prev_id = link.rx.id;
|
||||
link.rx.id = 0;
|
||||
link.rx.id = 0U;
|
||||
|
||||
if (type != PROV_FAILED && type != link.expect) {
|
||||
BT_WARN("Unexpected msg 0x%02x != 0x%02x", type, link.expect);
|
||||
|
|
|
@ -225,7 +225,7 @@ static void send_filter_status(struct bt_mesh_proxy_client *client,
|
|||
net_buf_simple_add_u8(buf, 0x01);
|
||||
}
|
||||
|
||||
for (filter_size = 0, i = 0; i < ARRAY_SIZE(client->filter); i++) {
|
||||
for (filter_size = 0U, i = 0; i < ARRAY_SIZE(client->filter); i++) {
|
||||
if (client->filter[i] != BT_MESH_ADDR_UNASSIGNED) {
|
||||
filter_size++;
|
||||
}
|
||||
|
@ -361,7 +361,7 @@ void bt_mesh_proxy_identity_start(struct bt_mesh_subnet *sub)
|
|||
void bt_mesh_proxy_identity_stop(struct bt_mesh_subnet *sub)
|
||||
{
|
||||
sub->node_id = BT_MESH_NODE_IDENTITY_STOPPED;
|
||||
sub->node_id_start = 0;
|
||||
sub->node_id_start = 0U;
|
||||
}
|
||||
|
||||
int bt_mesh_proxy_identity_enable(void)
|
||||
|
|
|
@ -167,8 +167,8 @@ static int iv_set(int argc, char **argv, char *val)
|
|||
BT_DBG("val %s", val ? val : "(null)");
|
||||
|
||||
if (!val) {
|
||||
bt_mesh.iv_index = 0;
|
||||
bt_mesh.iv_update = 0;
|
||||
bt_mesh.iv_index = 0U;
|
||||
bt_mesh.iv_update = 0U;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -202,7 +202,7 @@ static int seq_set(int argc, char **argv, char *val)
|
|||
BT_DBG("val %s", val ? val : "(null)");
|
||||
|
||||
if (!val) {
|
||||
bt_mesh.seq = 0;
|
||||
bt_mesh.seq = 0U;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -824,7 +824,7 @@ static int mesh_commit(void)
|
|||
cfg->default_ttl = stored_cfg.cfg.default_ttl;
|
||||
}
|
||||
|
||||
bt_mesh.valid = 1;
|
||||
bt_mesh.valid = 1U;
|
||||
|
||||
bt_mesh_net_start();
|
||||
|
||||
|
@ -1199,7 +1199,7 @@ static void store_pending_keys(void)
|
|||
}
|
||||
}
|
||||
|
||||
update->valid = 0;
|
||||
update->valid = 0U;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1429,7 +1429,7 @@ void bt_mesh_store_subnet(struct bt_mesh_subnet *sub)
|
|||
|
||||
update = key_update_find(false, sub->net_idx, &free_slot);
|
||||
if (update) {
|
||||
update->clear = 0;
|
||||
update->clear = 0U;
|
||||
schedule_store(BT_MESH_KEYS_PENDING);
|
||||
return;
|
||||
}
|
||||
|
@ -1439,10 +1439,10 @@ void bt_mesh_store_subnet(struct bt_mesh_subnet *sub)
|
|||
return;
|
||||
}
|
||||
|
||||
free_slot->valid = 1;
|
||||
free_slot->valid = 1U;
|
||||
free_slot->key_idx = sub->net_idx;
|
||||
free_slot->app_key = 0;
|
||||
free_slot->clear = 0;
|
||||
free_slot->app_key = 0U;
|
||||
free_slot->clear = 0U;
|
||||
|
||||
schedule_store(BT_MESH_KEYS_PENDING);
|
||||
}
|
||||
|
@ -1455,7 +1455,7 @@ void bt_mesh_store_app_key(struct bt_mesh_app_key *key)
|
|||
|
||||
update = key_update_find(true, key->app_idx, &free_slot);
|
||||
if (update) {
|
||||
update->clear = 0;
|
||||
update->clear = 0U;
|
||||
schedule_store(BT_MESH_KEYS_PENDING);
|
||||
return;
|
||||
}
|
||||
|
@ -1465,10 +1465,10 @@ void bt_mesh_store_app_key(struct bt_mesh_app_key *key)
|
|||
return;
|
||||
}
|
||||
|
||||
free_slot->valid = 1;
|
||||
free_slot->valid = 1U;
|
||||
free_slot->key_idx = key->app_idx;
|
||||
free_slot->app_key = 1;
|
||||
free_slot->clear = 0;
|
||||
free_slot->app_key = 1U;
|
||||
free_slot->clear = 0U;
|
||||
|
||||
schedule_store(BT_MESH_KEYS_PENDING);
|
||||
}
|
||||
|
@ -1498,7 +1498,7 @@ void bt_mesh_clear_subnet(struct bt_mesh_subnet *sub)
|
|||
|
||||
update = key_update_find(false, sub->net_idx, &free_slot);
|
||||
if (update) {
|
||||
update->clear = 1;
|
||||
update->clear = 1U;
|
||||
schedule_store(BT_MESH_KEYS_PENDING);
|
||||
return;
|
||||
}
|
||||
|
@ -1508,10 +1508,10 @@ void bt_mesh_clear_subnet(struct bt_mesh_subnet *sub)
|
|||
return;
|
||||
}
|
||||
|
||||
free_slot->valid = 1;
|
||||
free_slot->valid = 1U;
|
||||
free_slot->key_idx = sub->net_idx;
|
||||
free_slot->app_key = 0;
|
||||
free_slot->clear = 1;
|
||||
free_slot->app_key = 0U;
|
||||
free_slot->clear = 1U;
|
||||
|
||||
schedule_store(BT_MESH_KEYS_PENDING);
|
||||
}
|
||||
|
@ -1524,7 +1524,7 @@ void bt_mesh_clear_app_key(struct bt_mesh_app_key *key)
|
|||
|
||||
update = key_update_find(true, key->app_idx, &free_slot);
|
||||
if (update) {
|
||||
update->clear = 1;
|
||||
update->clear = 1U;
|
||||
schedule_store(BT_MESH_KEYS_PENDING);
|
||||
return;
|
||||
}
|
||||
|
@ -1534,10 +1534,10 @@ void bt_mesh_clear_app_key(struct bt_mesh_app_key *key)
|
|||
return;
|
||||
}
|
||||
|
||||
free_slot->valid = 1;
|
||||
free_slot->valid = 1U;
|
||||
free_slot->key_idx = key->app_idx;
|
||||
free_slot->app_key = 1;
|
||||
free_slot->clear = 1;
|
||||
free_slot->app_key = 1U;
|
||||
free_slot->clear = 1U;
|
||||
|
||||
schedule_store(BT_MESH_KEYS_PENDING);
|
||||
}
|
||||
|
|
|
@ -76,7 +76,7 @@ static void get_faults(u8_t *faults, u8_t faults_size, u8_t *dst, u8_t *count)
|
|||
{
|
||||
u8_t i, limit = *count;
|
||||
|
||||
for (i = 0, *count = 0; i < faults_size && *count < limit; i++) {
|
||||
for (i = 0U, *count = 0U; i < faults_size && *count < limit; i++) {
|
||||
if (faults[i]) {
|
||||
*dst++ = faults[i];
|
||||
(*count)++;
|
||||
|
@ -893,18 +893,18 @@ static int cmd_relay(const struct shell *shell, size_t argc, char *argv[])
|
|||
if (argc > 2) {
|
||||
count = strtoul(argv[2], NULL, 0);
|
||||
} else {
|
||||
count = 2;
|
||||
count = 2U;
|
||||
}
|
||||
|
||||
if (argc > 3) {
|
||||
interval = strtoul(argv[3], NULL, 0);
|
||||
} else {
|
||||
interval = 20;
|
||||
interval = 20U;
|
||||
}
|
||||
|
||||
new_transmit = BT_MESH_TRANSMIT(count, interval);
|
||||
} else {
|
||||
new_transmit = 0;
|
||||
new_transmit = 0U;
|
||||
}
|
||||
|
||||
err = bt_mesh_cfg_relay_set(net.net_idx, net.dst, val,
|
||||
|
@ -1559,7 +1559,7 @@ static int cmd_provision(const struct shell *shell, size_t argc, char *argv[])
|
|||
if (argc > 3) {
|
||||
iv_index = strtoul(argv[3], NULL, 0);
|
||||
} else {
|
||||
iv_index = 0;
|
||||
iv_index = 0U;
|
||||
}
|
||||
|
||||
err = bt_mesh_provision(default_key, net_idx, 0, iv_index, addr,
|
||||
|
@ -1884,7 +1884,7 @@ static int cmd_add_fault(const struct shell *shell, size_t argc, char *argv[])
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
for (i = 0; i < sizeof(cur_faults); i++) {
|
||||
for (i = 0U; i < sizeof(cur_faults); i++) {
|
||||
if (!cur_faults[i]) {
|
||||
cur_faults[i] = fault_id;
|
||||
break;
|
||||
|
@ -1897,7 +1897,7 @@ static int cmd_add_fault(const struct shell *shell, size_t argc, char *argv[])
|
|||
return 0;
|
||||
}
|
||||
|
||||
for (i = 0; i < sizeof(reg_faults); i++) {
|
||||
for (i = 0U; i < sizeof(reg_faults); i++) {
|
||||
if (!reg_faults[i]) {
|
||||
reg_faults[i] = fault_id;
|
||||
break;
|
||||
|
@ -1931,9 +1931,9 @@ static int cmd_del_fault(const struct shell *shell, size_t argc, char *argv[])
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
for (i = 0; i < sizeof(cur_faults); i++) {
|
||||
for (i = 0U; i < sizeof(cur_faults); i++) {
|
||||
if (cur_faults[i] == fault_id) {
|
||||
cur_faults[i] = 0;
|
||||
cur_faults[i] = 0U;
|
||||
shell_print(shell, "Fault cleared");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -175,7 +175,7 @@ static void seg_tx_reset(struct seg_tx *tx)
|
|||
|
||||
tx->cb = NULL;
|
||||
tx->cb_data = NULL;
|
||||
tx->seq_auth = 0;
|
||||
tx->seq_auth = 0U;
|
||||
tx->sub = NULL;
|
||||
tx->dst = BT_MESH_ADDR_UNASSIGNED;
|
||||
|
||||
|
@ -192,11 +192,11 @@ static void seg_tx_reset(struct seg_tx *tx)
|
|||
tx->seg[i] = NULL;
|
||||
}
|
||||
|
||||
tx->nack_count = 0;
|
||||
tx->nack_count = 0U;
|
||||
|
||||
if (bt_mesh.pending_update) {
|
||||
BT_DBG("Proceding with pending IV Update");
|
||||
bt_mesh.pending_update = 0;
|
||||
bt_mesh.pending_update = 0U;
|
||||
/* bt_mesh_net_iv_update() will re-enable the flag if this
|
||||
* wasn't the only transfer.
|
||||
*/
|
||||
|
@ -337,7 +337,7 @@ static int send_seg(struct bt_mesh_net_tx *net_tx, struct net_buf_simple *sdu,
|
|||
seg_hdr = SEG_HDR(1, net_tx->aid);
|
||||
}
|
||||
|
||||
seg_o = 0;
|
||||
seg_o = 0U;
|
||||
tx->dst = net_tx->ctx->addr;
|
||||
tx->seg_n = (sdu->len - 1) / 12;
|
||||
tx->nack_count = tx->seg_n + 1;
|
||||
|
@ -357,7 +357,7 @@ static int send_seg(struct bt_mesh_net_tx *net_tx, struct net_buf_simple *sdu,
|
|||
|
||||
BT_DBG("SeqZero 0x%04x", seq_zero);
|
||||
|
||||
for (seg_o = 0; sdu->len; seg_o++) {
|
||||
for (seg_o = 0U; sdu->len; seg_o++) {
|
||||
struct net_buf *seg;
|
||||
u16_t len;
|
||||
int err;
|
||||
|
@ -465,7 +465,7 @@ int bt_mesh_trans_send(struct bt_mesh_net_tx *tx, struct net_buf_simple *msg,
|
|||
|
||||
if (tx->ctx->app_idx == BT_MESH_KEY_DEV) {
|
||||
key = bt_mesh.dev_key;
|
||||
tx->aid = 0;
|
||||
tx->aid = 0U;
|
||||
} else {
|
||||
struct bt_mesh_app_key *app_key;
|
||||
|
||||
|
@ -485,9 +485,9 @@ int bt_mesh_trans_send(struct bt_mesh_net_tx *tx, struct net_buf_simple *msg,
|
|||
}
|
||||
|
||||
if (!tx->ctx->send_rel || net_buf_simple_tailroom(msg) < 8) {
|
||||
tx->aszmic = 0;
|
||||
tx->aszmic = 0U;
|
||||
} else {
|
||||
tx->aszmic = 1;
|
||||
tx->aszmic = 1U;
|
||||
}
|
||||
|
||||
if (BT_MESH_ADDR_IS_VIRTUAL(tx->ctx->addr)) {
|
||||
|
@ -629,7 +629,7 @@ static int sdu_recv(struct bt_mesh_net_rx *rx, u32_t seq, u8_t hdr,
|
|||
return 0;
|
||||
}
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(bt_mesh.app_keys); i++) {
|
||||
for (i = 0U; i < ARRAY_SIZE(bt_mesh.app_keys); i++) {
|
||||
struct bt_mesh_app_key *key = &bt_mesh.app_keys[i];
|
||||
struct bt_mesh_app_keys *keys;
|
||||
|
||||
|
@ -1015,14 +1015,14 @@ static void seg_rx_reset(struct seg_rx *rx, bool full_reset)
|
|||
&rx->seq_auth);
|
||||
}
|
||||
|
||||
rx->in_use = 0;
|
||||
rx->in_use = 0U;
|
||||
|
||||
/* We don't always reset these values since we need to be able to
|
||||
* send an ack if we receive a segment after we've already received
|
||||
* the full SDU.
|
||||
*/
|
||||
if (full_reset) {
|
||||
rx->seq_auth = 0;
|
||||
rx->seq_auth = 0U;
|
||||
rx->sub = NULL;
|
||||
rx->src = BT_MESH_ADDR_UNASSIGNED;
|
||||
rx->dst = BT_MESH_ADDR_UNASSIGNED;
|
||||
|
@ -1137,7 +1137,7 @@ static struct seg_rx *seg_rx_alloc(struct bt_mesh_net_rx *net_rx,
|
|||
continue;
|
||||
}
|
||||
|
||||
rx->in_use = 1;
|
||||
rx->in_use = 1U;
|
||||
net_buf_simple_reset(&rx->buf);
|
||||
rx->sub = net_rx->sub;
|
||||
rx->ctl = net_rx->ctl;
|
||||
|
@ -1147,7 +1147,7 @@ static struct seg_rx *seg_rx_alloc(struct bt_mesh_net_rx *net_rx,
|
|||
rx->ttl = net_rx->ctx.send_ttl;
|
||||
rx->src = net_rx->ctx.addr;
|
||||
rx->dst = net_rx->ctx.recv_dst;
|
||||
rx->block = 0;
|
||||
rx->block = 0U;
|
||||
|
||||
BT_DBG("New RX context. Block Complete 0x%08x",
|
||||
BLOCK_COMPLETE(seg_n));
|
||||
|
|
|
@ -102,7 +102,7 @@ static inline void encode_hdr(struct bt_monitor_hdr *hdr, u32_t timestamp,
|
|||
struct bt_monitor_ts32 *ts;
|
||||
|
||||
hdr->opcode = sys_cpu_to_le16(opcode);
|
||||
hdr->flags = 0;
|
||||
hdr->flags = 0U;
|
||||
|
||||
ts = (void *)hdr->ext;
|
||||
ts->type = BT_MONITOR_TS32;
|
||||
|
|
|
@ -917,12 +917,12 @@ static int rfcomm_send_pn(struct bt_rfcomm_dlc *dlc, u8_t cr)
|
|||
/* If PN comes in already opened dlc or cfc not supported
|
||||
* these should be 0
|
||||
*/
|
||||
pn->credits = 0;
|
||||
pn->flow_ctrl = 0;
|
||||
pn->credits = 0U;
|
||||
pn->flow_ctrl = 0U;
|
||||
}
|
||||
pn->max_retrans = 0;
|
||||
pn->ack_timer = 0;
|
||||
pn->priority = 0;
|
||||
pn->max_retrans = 0U;
|
||||
pn->ack_timer = 0U;
|
||||
pn->priority = 0U;
|
||||
|
||||
fcs = rfcomm_calc_fcs(BT_RFCOMM_FCS_LEN_UIH, buf->data);
|
||||
net_buf_add_u8(buf, fcs);
|
||||
|
|
|
@ -260,7 +260,7 @@ static void send_err_rsp(struct bt_l2cap_chan *chan, u16_t err,
|
|||
static u16_t parse_data_elem(struct net_buf *buf,
|
||||
struct bt_sdp_data_elem *data_elem)
|
||||
{
|
||||
u8_t size_field_len = 0; /* Space used to accommodate the size */
|
||||
u8_t size_field_len = 0U; /* Space used to accommodate the size */
|
||||
|
||||
if (buf->len < 1) {
|
||||
BT_WARN("Malformed packet");
|
||||
|
@ -462,7 +462,7 @@ static u16_t find_services(struct net_buf *buf,
|
|||
struct bt_sdp_record *record;
|
||||
u32_t uuid_list_size;
|
||||
u16_t res;
|
||||
u8_t att_idx, rec_idx = 0;
|
||||
u8_t att_idx, rec_idx = 0U;
|
||||
bool found;
|
||||
union {
|
||||
struct bt_uuid uuid;
|
||||
|
@ -528,7 +528,7 @@ static u16_t find_services(struct net_buf *buf,
|
|||
/* Go over the list of services, and look for a service which
|
||||
* doesn't have this UUID
|
||||
*/
|
||||
for (rec_idx = 0; rec_idx < num_services; rec_idx++) {
|
||||
for (rec_idx = 0U; rec_idx < num_services; rec_idx++) {
|
||||
record = matching_recs[rec_idx];
|
||||
|
||||
if (!record) {
|
||||
|
@ -538,7 +538,7 @@ static u16_t find_services(struct net_buf *buf,
|
|||
found = false;
|
||||
|
||||
/* Search for the UUID in all the attrs of the svc */
|
||||
for (att_idx = 0; att_idx < record->attr_count;
|
||||
for (att_idx = 0U; att_idx < record->attr_count;
|
||||
att_idx++) {
|
||||
search_uuid(&record->attrs[att_idx].val,
|
||||
&u.uuid, &found, 1);
|
||||
|
@ -576,8 +576,8 @@ static u16_t sdp_svc_search_req(struct bt_sdp *sdp, struct net_buf *buf,
|
|||
struct net_buf *resp_buf;
|
||||
struct bt_sdp_record *record;
|
||||
struct bt_sdp_record *matching_recs[BT_SDP_MAX_SERVICES];
|
||||
u16_t max_rec_count, total_recs = 0, current_recs = 0, res;
|
||||
u8_t cont_state_size, cont_state = 0, idx = 0, count = 0;
|
||||
u16_t max_rec_count, total_recs = 0U, current_recs = 0U, res;
|
||||
u8_t cont_state_size, cont_state = 0U, idx = 0U, count = 0U;
|
||||
bool pkt_full = false;
|
||||
|
||||
res = find_services(buf, matching_recs);
|
||||
|
@ -595,7 +595,7 @@ static u16_t sdp_svc_search_req(struct bt_sdp *sdp, struct net_buf *buf,
|
|||
cont_state_size = net_buf_pull_u8(buf);
|
||||
|
||||
/* Zero out the matching services beyond max_rec_count */
|
||||
for (idx = 0; idx < num_services; idx++) {
|
||||
for (idx = 0U; idx < num_services; idx++) {
|
||||
if (count == max_rec_count) {
|
||||
matching_recs[idx] = NULL;
|
||||
continue;
|
||||
|
@ -811,7 +811,7 @@ static u8_t select_attrs(struct bt_sdp_attribute *attr, u8_t att_idx,
|
|||
u32_t attr_size, seq_size;
|
||||
u8_t idx_filter;
|
||||
|
||||
for (idx_filter = 0; idx_filter < sad->num_filters; idx_filter++) {
|
||||
for (idx_filter = 0U; idx_filter < sad->num_filters; idx_filter++) {
|
||||
|
||||
att_id_lower = (sad->filter[idx_filter] >> 16);
|
||||
att_id_upper = (sad->filter[idx_filter]);
|
||||
|
@ -867,7 +867,7 @@ static u8_t select_attrs(struct bt_sdp_attribute *attr, u8_t att_idx,
|
|||
sad->seq = net_buf_add(sad->rsp_buf,
|
||||
sizeof(*sad->seq));
|
||||
sad->seq->type = BT_SDP_SEQ16;
|
||||
sad->seq->size = 0;
|
||||
sad->seq->size = 0U;
|
||||
}
|
||||
|
||||
/* Add attribute ID */
|
||||
|
@ -951,7 +951,7 @@ static u16_t create_attr_list(struct bt_sdp *sdp, struct bt_sdp_record *record,
|
|||
sad.seq = NULL;
|
||||
sad.filter = filter;
|
||||
sad.state = state;
|
||||
sad.att_list_len = 0;
|
||||
sad.att_list_len = 0U;
|
||||
sad.new_service = true;
|
||||
|
||||
idx_att = bt_sdp_foreach_attr(sad.rec, next_att, select_attrs, &sad);
|
||||
|
@ -984,7 +984,7 @@ static u16_t get_att_search_list(struct net_buf *buf, u32_t *filter,
|
|||
u16_t res;
|
||||
u32_t size;
|
||||
|
||||
*num_filters = 0;
|
||||
*num_filters = 0U;
|
||||
res = parse_data_elem(buf, &data_elem);
|
||||
if (res) {
|
||||
return res;
|
||||
|
@ -1071,7 +1071,7 @@ static u16_t sdp_svc_att_req(struct bt_sdp *sdp, struct net_buf *buf,
|
|||
struct net_buf *rsp_buf;
|
||||
u32_t svc_rec_hdl;
|
||||
u16_t max_att_len, res, att_list_len;
|
||||
u8_t num_filters, cont_state_size, next_att = 0;
|
||||
u8_t num_filters, cont_state_size, next_att = 0U;
|
||||
|
||||
if (buf->len < 6) {
|
||||
BT_WARN("Malformed packet");
|
||||
|
@ -1141,7 +1141,7 @@ static u16_t sdp_svc_att_req(struct bt_sdp *sdp, struct net_buf *buf,
|
|||
/* For empty responses, add an empty data element sequence */
|
||||
net_buf_add_u8(rsp_buf, BT_SDP_SEQ8);
|
||||
net_buf_add_u8(rsp_buf, 0);
|
||||
att_list_len = 2;
|
||||
att_list_len = 2U;
|
||||
}
|
||||
|
||||
/* Add continuation state */
|
||||
|
@ -1186,8 +1186,8 @@ static u16_t sdp_svc_search_att_req(struct bt_sdp *sdp, struct net_buf *buf,
|
|||
struct bt_sdp_record *record;
|
||||
struct bt_sdp_att_rsp *rsp;
|
||||
struct bt_sdp_data_elem_seq *seq = NULL;
|
||||
u16_t max_att_len, res, att_list_len = 0;
|
||||
u8_t num_filters, cont_state_size, next_svc = 0, next_att = 0;
|
||||
u16_t max_att_len, res, att_list_len = 0U;
|
||||
u8_t num_filters, cont_state_size, next_svc = 0U, next_att = 0U;
|
||||
bool dry_run = false;
|
||||
|
||||
res = find_services(buf, matching_recs);
|
||||
|
@ -1248,10 +1248,10 @@ static u16_t sdp_svc_search_att_req(struct bt_sdp *sdp, struct net_buf *buf,
|
|||
if (!cont_state_size) {
|
||||
seq = net_buf_add(rsp_buf, sizeof(*seq));
|
||||
seq->type = BT_SDP_SEQ16;
|
||||
seq->size = 0;
|
||||
seq->size = 0U;
|
||||
|
||||
/* 3 bytes for Outer Data Element Sequence declaration */
|
||||
att_list_len = 3;
|
||||
att_list_len = 3U;
|
||||
}
|
||||
|
||||
rsp_buf_cpy = rsp_buf;
|
||||
|
@ -1289,7 +1289,7 @@ static u16_t sdp_svc_search_att_req(struct bt_sdp *sdp, struct net_buf *buf,
|
|||
rsp_buf_cpy = NULL;
|
||||
}
|
||||
|
||||
next_att = 0;
|
||||
next_att = 0U;
|
||||
}
|
||||
|
||||
if (!dry_run) {
|
||||
|
@ -1297,7 +1297,7 @@ static u16_t sdp_svc_search_att_req(struct bt_sdp *sdp, struct net_buf *buf,
|
|||
/* For empty responses, add an empty data elem seq */
|
||||
net_buf_add_u8(rsp_buf, BT_SDP_SEQ8);
|
||||
net_buf_add_u8(rsp_buf, 0);
|
||||
att_list_len = 2;
|
||||
att_list_len = 2U;
|
||||
}
|
||||
/* Search exhausted */
|
||||
net_buf_add_u8(rsp_buf, 0);
|
||||
|
@ -1607,7 +1607,7 @@ static u16_t sdp_client_get_total(struct bt_sdp_client *session,
|
|||
*/
|
||||
if (session->cstate.length == 0) {
|
||||
seq = net_buf_pull_u8(buf);
|
||||
pulled = 1;
|
||||
pulled = 1U;
|
||||
switch (seq) {
|
||||
case BT_SDP_SEQ8:
|
||||
*total = net_buf_pull_u8(buf);
|
||||
|
@ -1619,14 +1619,14 @@ static u16_t sdp_client_get_total(struct bt_sdp_client *session,
|
|||
break;
|
||||
default:
|
||||
BT_WARN("Sequence type 0x%02x not handled", seq);
|
||||
*total = 0;
|
||||
*total = 0U;
|
||||
break;
|
||||
}
|
||||
|
||||
BT_DBG("Total %u octets of all attributes", *total);
|
||||
} else {
|
||||
pulled = 0;
|
||||
*total = 0;
|
||||
pulled = 0U;
|
||||
*total = 0U;
|
||||
}
|
||||
|
||||
return pulled;
|
||||
|
@ -1648,7 +1648,7 @@ static u16_t get_record_len(struct net_buf *buf)
|
|||
break;
|
||||
default:
|
||||
BT_WARN("Sequence type 0x%02x not handled", seq);
|
||||
len = 0;
|
||||
len = 0U;
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -121,7 +121,7 @@ static int set(int argc, char **argv, char *val)
|
|||
BT_ERR("Invalid length ID address in storage");
|
||||
(void)memset(bt_dev.id_addr, 0,
|
||||
sizeof(bt_dev.id_addr));
|
||||
bt_dev.id_count = 0;
|
||||
bt_dev.id_count = 0U;
|
||||
} else {
|
||||
int i;
|
||||
|
||||
|
|
|
@ -959,7 +959,7 @@ static void smp_br_distribute_keys(struct bt_smp_br *smp)
|
|||
if (atomic_test_bit(smp->flags, SMP_FLAG_BOND)) {
|
||||
bt_keys_add_type(keys, BT_KEYS_LOCAL_CSRK);
|
||||
memcpy(keys->local_csrk.val, info->csrk, 16);
|
||||
keys->local_csrk.cnt = 0;
|
||||
keys->local_csrk.cnt = 0U;
|
||||
}
|
||||
|
||||
smp_br_send(smp, buf, sign_info_sent);
|
||||
|
@ -1671,7 +1671,7 @@ static u8_t smp_send_pairing_confirm(struct bt_smp *smp)
|
|||
switch (smp->method) {
|
||||
case PASSKEY_CONFIRM:
|
||||
case JUST_WORKS:
|
||||
r = 0;
|
||||
r = 0U;
|
||||
break;
|
||||
case PASSKEY_DISPLAY:
|
||||
case PASSKEY_INPUT:
|
||||
|
@ -1843,7 +1843,7 @@ static void bt_smp_distribute_keys(struct bt_smp *smp)
|
|||
if (atomic_test_bit(smp->flags, SMP_FLAG_BOND)) {
|
||||
bt_keys_add_type(keys, BT_KEYS_LOCAL_CSRK);
|
||||
memcpy(keys->local_csrk.val, info->csrk, 16);
|
||||
keys->local_csrk.cnt = 0;
|
||||
keys->local_csrk.cnt = 0U;
|
||||
}
|
||||
|
||||
smp_send(smp, buf, sign_info_sent);
|
||||
|
@ -2878,7 +2878,7 @@ static u8_t sc_smp_check_confirm(struct bt_smp *smp)
|
|||
switch (smp->method) {
|
||||
case PASSKEY_CONFIRM:
|
||||
case JUST_WORKS:
|
||||
r = 0;
|
||||
r = 0U;
|
||||
break;
|
||||
case PASSKEY_DISPLAY:
|
||||
case PASSKEY_INPUT:
|
||||
|
@ -3299,7 +3299,7 @@ static u8_t display_passkey(struct bt_smp *smp)
|
|||
smp->passkey %= 1000000;
|
||||
}
|
||||
|
||||
smp->passkey_round = 0;
|
||||
smp->passkey_round = 0U;
|
||||
|
||||
if (bt_auth && bt_auth->passkey_display) {
|
||||
atomic_set_bit(smp->flags, SMP_FLAG_DISPLAY);
|
||||
|
|
|
@ -49,7 +49,7 @@ static int cmd_auth_pincode(const struct shell *shell,
|
|||
size_t argc, char *argv[])
|
||||
{
|
||||
struct bt_conn *conn;
|
||||
u8_t max = 16;
|
||||
u8_t max = 16U;
|
||||
|
||||
if (default_conn) {
|
||||
conn = default_conn;
|
||||
|
|
|
@ -354,7 +354,7 @@ static int cmd_write_without_rsp(const struct shell *shell,
|
|||
sign = !strcmp(argv[0], "signed-write");
|
||||
handle = strtoul(argv[1], NULL, 16);
|
||||
gatt_write_buf[0] = strtoul(argv[2], NULL, 16);
|
||||
len = 1;
|
||||
len = 1U;
|
||||
|
||||
if (argc > 3) {
|
||||
int i;
|
||||
|
@ -366,14 +366,14 @@ static int cmd_write_without_rsp(const struct shell *shell,
|
|||
}
|
||||
}
|
||||
|
||||
repeat = 0;
|
||||
repeat = 0U;
|
||||
|
||||
if (argc > 4) {
|
||||
repeat = strtoul(argv[4], NULL, 16);
|
||||
}
|
||||
|
||||
if (!repeat) {
|
||||
repeat = 1;
|
||||
repeat = 1U;
|
||||
}
|
||||
|
||||
while (repeat--) {
|
||||
|
@ -691,9 +691,9 @@ static ssize_t write_met(struct bt_conn *conn, const struct bt_gatt_attr *attr,
|
|||
* reset the metrics.
|
||||
*/
|
||||
if (delta > 1000000000) {
|
||||
write_count = 0;
|
||||
write_len = 0;
|
||||
write_rate = 0;
|
||||
write_count = 0U;
|
||||
write_len = 0U;
|
||||
write_rate = 0U;
|
||||
cycle_stamp = k_cycle_get_32();
|
||||
} else {
|
||||
write_count++;
|
||||
|
|
|
@ -68,8 +68,8 @@ static int l2cap_recv_metrics(struct bt_l2cap_chan *chan, struct net_buf *buf)
|
|||
* reset the metrics.
|
||||
*/
|
||||
if (delta > 1000000000) {
|
||||
len = 0;
|
||||
l2cap_rate = 0;
|
||||
len = 0U;
|
||||
l2cap_rate = 0U;
|
||||
cycle_stamp = k_cycle_get_32();
|
||||
} else {
|
||||
len += buf->len;
|
||||
|
|
|
@ -36,9 +36,9 @@ int cmd_ll_addr_get(const struct shell *shell, size_t argc, char *argv[])
|
|||
|
||||
str_type = argv[1];
|
||||
if (!strcmp(str_type, "random")) {
|
||||
addr_type = 1;
|
||||
addr_type = 1U;
|
||||
} else if (!strcmp(str_type, "public")) {
|
||||
addr_type = 0;
|
||||
addr_type = 0U;
|
||||
} else {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
@ -149,10 +149,10 @@ int cmd_advx(const struct shell *shell, size_t argc, char *argv[])
|
|||
|
||||
if (argc > 1) {
|
||||
if (!strcmp(argv[1], "on")) {
|
||||
evt_prop = 0;
|
||||
enable = 1;
|
||||
evt_prop = 0U;
|
||||
enable = 1U;
|
||||
} else if (!strcmp(argv[1], "off")) {
|
||||
enable = 0;
|
||||
enable = 0U;
|
||||
goto disable;
|
||||
} else {
|
||||
return -EINVAL;
|
||||
|
@ -216,7 +216,7 @@ exit:
|
|||
|
||||
int cmd_scanx(const struct shell *shell, size_t argc, char *argv[])
|
||||
{
|
||||
u8_t type = 0;
|
||||
u8_t type = 0U;
|
||||
u8_t enable;
|
||||
s32_t err;
|
||||
|
||||
|
@ -226,13 +226,13 @@ int cmd_scanx(const struct shell *shell, size_t argc, char *argv[])
|
|||
|
||||
if (argc > 1) {
|
||||
if (!strcmp(argv[1], "on")) {
|
||||
enable = 1;
|
||||
type = 1;
|
||||
enable = 1U;
|
||||
type = 1U;
|
||||
} else if (!strcmp(argv[1], "passive")) {
|
||||
enable = 1;
|
||||
type = 0;
|
||||
enable = 1U;
|
||||
type = 0U;
|
||||
} else if (!strcmp(argv[1], "off")) {
|
||||
enable = 0;
|
||||
enable = 0U;
|
||||
goto disable;
|
||||
} else {
|
||||
return -EINVAL;
|
||||
|
|
|
@ -51,10 +51,10 @@ int cmd_ticker_info(const struct shell *shell, size_t argc, char *argv[])
|
|||
u8_t i;
|
||||
|
||||
ticker_id = TICKER_NULL;
|
||||
ticks_to_expire = 0;
|
||||
ticks_current = 0;
|
||||
tickers_count = 0;
|
||||
retry = 4;
|
||||
ticks_to_expire = 0U;
|
||||
ticks_current = 0U;
|
||||
tickers_count = 0U;
|
||||
retry = 4U;
|
||||
do {
|
||||
u32_t volatile err_cb = TICKER_STATUS_BUSY;
|
||||
u32_t ticks_previous;
|
||||
|
@ -90,7 +90,7 @@ int cmd_ticker_info(const struct shell *shell, size_t argc, char *argv[])
|
|||
}
|
||||
|
||||
if (tickers_count) {
|
||||
tickers_count = 0;
|
||||
tickers_count = 0U;
|
||||
|
||||
shell_print(shell, "Query reset, %u retries "
|
||||
"remaining.", retry);
|
||||
|
@ -115,7 +115,7 @@ int cmd_ticker_info(const struct shell *shell, size_t argc, char *argv[])
|
|||
shell_print(shell, " id offset offset");
|
||||
shell_print(shell, " (tick) (us)");
|
||||
shell_print(shell, "---------------------");
|
||||
for (i = 0; i < tickers_count; i++) {
|
||||
for (i = 0U; i < tickers_count; i++) {
|
||||
shell_print(shell, "%03u %08u %08u", tickers[i].id,
|
||||
tickers[i].ticks_to_expire,
|
||||
HAL_TICKER_TICKS_TO_US(tickers[i].ticks_to_expire));
|
||||
|
|
|
@ -102,7 +102,7 @@ static int read_copy_flash_block(off_t start_addr, u32_t size,
|
|||
{
|
||||
off_t fl_addr;
|
||||
u32_t num_read;
|
||||
u32_t offset = 0;
|
||||
u32_t offset = 0U;
|
||||
|
||||
/* adjust offset if starting address is not erase-aligned address */
|
||||
if (start_addr & (CONFIG_DISK_FLASH_ERASE_ALIGNMENT - 1)) {
|
||||
|
|
|
@ -73,7 +73,7 @@ static int disk_ram_access_ioctl(struct disk_info *disk, u8_t cmd, void *buff)
|
|||
*(u32_t *)buff = RAMDISK_SECTOR_SIZE;
|
||||
break;
|
||||
case DISK_IOCTL_GET_ERASE_BLOCK_SZ:
|
||||
*(u32_t *)buff = 1;
|
||||
*(u32_t *)buff = 1U;
|
||||
break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
|
|
|
@ -120,7 +120,7 @@ int cfb_print(struct device *dev, char *str, u16_t x, u16_t y)
|
|||
if ((fb->screen_info & SCREEN_INFO_MONO_VTILED) && !(y % 8)) {
|
||||
for (size_t i = 0; i < strlen(str); i++) {
|
||||
if (x + fptr->width > fb->x_res) {
|
||||
x = 0;
|
||||
x = 0U;
|
||||
y += fptr->height;
|
||||
}
|
||||
x += fb->kerning + draw_char_vtmono(fb, str[i], x, y);
|
||||
|
@ -285,16 +285,16 @@ int cfb_framebuffer_init(struct device *dev)
|
|||
|
||||
fb->x_res = cfg.x_resolution;
|
||||
fb->y_res = cfg.y_resolution;
|
||||
fb->ppt = 8;
|
||||
fb->ppt = 8U;
|
||||
fb->pixel_format = cfg.current_pixel_format;
|
||||
fb->screen_info = cfg.screen_info;
|
||||
fb->buf = NULL;
|
||||
fb->font_idx = 0;
|
||||
fb->font_idx = 0U;
|
||||
fb->kerning = 0;
|
||||
fb->inverted = false;
|
||||
|
||||
fb->fonts = __font_entry_start;
|
||||
fb->font_idx = 0;
|
||||
fb->font_idx = 0U;
|
||||
|
||||
fb->size = fb->x_res * fb->y_res / fb->ppt;
|
||||
fb->buf = k_malloc(fb->size);
|
||||
|
|
|
@ -214,7 +214,7 @@ static int fatfs_truncate(struct fs_file_t *zfp, off_t length)
|
|||
* optimization.
|
||||
*/
|
||||
unsigned int bw;
|
||||
u8_t c = 0;
|
||||
u8_t c = 0U;
|
||||
|
||||
for (int i = cur_length; i < length; i++) {
|
||||
res = f_write(zfp->filep, &c, 1, &bw);
|
||||
|
|
|
@ -292,7 +292,7 @@ fcb_offset_last_n(struct fcb *fcb, u8_t entries,
|
|||
|
||||
/* assure a minimum amount of entries */
|
||||
if (!entries) {
|
||||
entries = 1;
|
||||
entries = 1U;
|
||||
}
|
||||
|
||||
i = 0;
|
||||
|
|
|
@ -709,7 +709,7 @@ ssize_t nvs_write(struct nvs_fs *fs, u16_t id, const void *data, size_t len)
|
|||
/* find latest entry with same id */
|
||||
wlk_addr = fs->ate_wra;
|
||||
rd_addr = wlk_addr;
|
||||
freed_space = 0;
|
||||
freed_space = 0U;
|
||||
|
||||
while (1) {
|
||||
rd_addr = wlk_addr;
|
||||
|
@ -811,7 +811,7 @@ ssize_t nvs_read_hist(struct nvs_fs *fs, u16_t id, void *data, size_t len,
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
cnt_his = 0;
|
||||
cnt_his = 0U;
|
||||
|
||||
wlk_addr = fs->ate_wra;
|
||||
rd_addr = wlk_addr;
|
||||
|
|
|
@ -396,7 +396,7 @@ static int cmd_write(const struct shell *shell, size_t argc, char **argv)
|
|||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
buf_len = 0;
|
||||
buf_len = 0U;
|
||||
while (arg_offset < argc) {
|
||||
buf[buf_len++] = strtol(argv[arg_offset++], NULL, 16);
|
||||
|
||||
|
@ -410,7 +410,7 @@ static int cmd_write(const struct shell *shell, size_t argc, char **argv)
|
|||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
buf_len = 0;
|
||||
buf_len = 0U;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -109,7 +109,7 @@ static int log_status(const struct shell *shell,
|
|||
shell_fprintf(shell, SHELL_NORMAL,
|
||||
"----------------------------------------------------------\r\n");
|
||||
|
||||
for (i = 0; i < modules_cnt; i++) {
|
||||
for (i = 0U; i < modules_cnt; i++) {
|
||||
dynamic_lvl = log_filter_get(backend, CONFIG_LOG_DOMAIN_ID,
|
||||
i, true);
|
||||
compiled_lvl = log_filter_get(backend, CONFIG_LOG_DOMAIN_ID,
|
||||
|
@ -148,7 +148,7 @@ static int module_id_get(const char *name)
|
|||
const char *tmp_name;
|
||||
u32_t i;
|
||||
|
||||
for (i = 0; i < modules_cnt; i++) {
|
||||
for (i = 0U; i < modules_cnt; i++) {
|
||||
tmp_name = log_source_name_get(CONFIG_LOG_DOMAIN_ID, i);
|
||||
|
||||
if (strncmp(tmp_name, name, 64) == 0) {
|
||||
|
|
|
@ -187,7 +187,7 @@ int log_printk(const char *fmt, va_list ap)
|
|||
*/
|
||||
static u32_t count_args(const char *fmt)
|
||||
{
|
||||
u32_t args = 0;
|
||||
u32_t args = 0U;
|
||||
bool prev = false; /* if previous char was a modificator. */
|
||||
|
||||
while (*fmt != '\0') {
|
||||
|
@ -480,7 +480,7 @@ u32_t log_filter_set(struct log_backend const *const backend,
|
|||
|
||||
if (backend == NULL) {
|
||||
struct log_backend const *backend;
|
||||
u32_t max = 0;
|
||||
u32_t max = 0U;
|
||||
u32_t current;
|
||||
|
||||
for (int i = 0; i < log_backend_count_get(); i++) {
|
||||
|
|
|
@ -190,7 +190,7 @@ static void copy_args_to_msg(struct log_msg *msg, u32_t *args, u32_t nargs)
|
|||
args += LOG_MSG_NARGS_HEAD_CHUNK;
|
||||
} else {
|
||||
memcpy(msg->payload.single.args, args, nargs * sizeof(u32_t));
|
||||
nargs = 0;
|
||||
nargs = 0U;
|
||||
}
|
||||
|
||||
while (nargs) {
|
||||
|
@ -258,7 +258,7 @@ struct log_msg *log_msg_hexdump_create(const char *str,
|
|||
} else {
|
||||
memcpy(msg->payload.single.bytes, data, length);
|
||||
msg->hdr.params.generic.ext = 0;
|
||||
length = 0;
|
||||
length = 0U;
|
||||
}
|
||||
|
||||
prev_cont = &msg->payload.ext.next;
|
||||
|
|
|
@ -398,7 +398,7 @@ static void hexdump_print(struct log_msg *msg,
|
|||
const struct log_output *log_output,
|
||||
int prefix_offset, u32_t flags)
|
||||
{
|
||||
u32_t offset = 0;
|
||||
u32_t offset = 0U;
|
||||
u32_t length;
|
||||
|
||||
print_formatted(log_output, "%s", log_msg_str_get(msg));
|
||||
|
@ -524,7 +524,7 @@ void log_output_msg_process(const struct log_output *log_output,
|
|||
|
||||
void log_output_timestamp_freq_set(u32_t frequency)
|
||||
{
|
||||
timestamp_div = 1;
|
||||
timestamp_div = 1U;
|
||||
/* There is no point to have frequency higher than 1MHz (ns are not
|
||||
* printed) and too high frequency leads to overflows in calculations.
|
||||
*/
|
||||
|
|
|
@ -113,7 +113,7 @@ static u8_t *mem_pool_data_alloc(struct net_buf *buf, size_t *size,
|
|||
memcpy(block.data, &block.id, sizeof(block.id));
|
||||
|
||||
ref_count = (u8_t *)block.data + sizeof(block.id);
|
||||
*ref_count = 1;
|
||||
*ref_count = 1U;
|
||||
|
||||
/* Return pointer to the byte following the ref count */
|
||||
return ref_count + 1;
|
||||
|
@ -171,7 +171,7 @@ static u8_t *heap_data_alloc(struct net_buf *buf, size_t *size, s32_t timeout)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
*ref_count = 1;
|
||||
*ref_count = 1U;
|
||||
|
||||
return ref_count + 1;
|
||||
}
|
||||
|
|
|
@ -110,7 +110,7 @@ void net_6lo_set_context(struct net_if *iface,
|
|||
/* If the context information already exists, update or remove
|
||||
* as per data.
|
||||
*/
|
||||
for (i = 0; i < CONFIG_NET_MAX_6LO_CONTEXTS; i++) {
|
||||
for (i = 0U; i < CONFIG_NET_MAX_6LO_CONTEXTS; i++) {
|
||||
if (!ctx_6co[i].is_used) {
|
||||
unused = i;
|
||||
continue;
|
||||
|
@ -145,7 +145,7 @@ get_6lo_context_by_cid(struct net_if *iface, u8_t cid)
|
|||
{
|
||||
u8_t i;
|
||||
|
||||
for (i = 0; i < CONFIG_NET_MAX_6LO_CONTEXTS; i++) {
|
||||
for (i = 0U; i < CONFIG_NET_MAX_6LO_CONTEXTS; i++) {
|
||||
if (!ctx_6co[i].is_used) {
|
||||
continue;
|
||||
}
|
||||
|
@ -164,7 +164,7 @@ get_6lo_context_by_addr(struct net_if *iface, struct in6_addr *addr)
|
|||
{
|
||||
u8_t i;
|
||||
|
||||
for (i = 0; i < CONFIG_NET_MAX_6LO_CONTEXTS; i++) {
|
||||
for (i = 0U; i < CONFIG_NET_MAX_6LO_CONTEXTS; i++) {
|
||||
if (!ctx_6co[i].is_used) {
|
||||
continue;
|
||||
}
|
||||
|
@ -682,7 +682,7 @@ static inline bool compress_IPHC_header(struct net_pkt *pkt,
|
|||
struct net_6lo_context *dst = NULL;
|
||||
#endif
|
||||
struct net_ipv6_hdr *ipv6 = NET_IPV6_HDR(pkt);
|
||||
u8_t offset = 0;
|
||||
u8_t offset = 0U;
|
||||
struct net_buf *frag;
|
||||
u8_t compressed;
|
||||
|
||||
|
@ -1217,8 +1217,8 @@ static inline void uncompress_cid(struct net_pkt *pkt,
|
|||
static inline bool uncompress_IPHC_header(struct net_pkt *pkt)
|
||||
{
|
||||
struct net_udp_hdr *udp = NULL;
|
||||
u8_t offset = 2;
|
||||
u8_t chksum = 0;
|
||||
u8_t offset = 2U;
|
||||
u8_t chksum = 0U;
|
||||
struct net_ipv6_hdr *ipv6;
|
||||
struct net_buf *frag;
|
||||
u16_t len;
|
||||
|
|
|
@ -152,7 +152,7 @@ static s32_t check_hash(enum net_ip_protocol proto,
|
|||
u32_t *cache_value)
|
||||
{
|
||||
int i, free_pos = -1;
|
||||
u32_t value = 0;
|
||||
u32_t value = 0U;
|
||||
|
||||
value = ports_to_hash(remote_port, local_port);
|
||||
|
||||
|
@ -278,7 +278,7 @@ static void cache_clear(void)
|
|||
|
||||
for (i = 0; i < CONFIG_NET_MAX_CONN; i++) {
|
||||
conn_cache[i].idx = -1;
|
||||
conn_cache_neg[i].value = 0;
|
||||
conn_cache_neg[i].value = 0U;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -559,7 +559,7 @@ int net_conn_register(enum net_ip_protocol proto,
|
|||
struct net_conn_handle **handle)
|
||||
{
|
||||
int i;
|
||||
u8_t rank = 0;
|
||||
u8_t rank = 0U;
|
||||
|
||||
i = find_conn_handler(proto, remote_addr, local_addr, remote_port,
|
||||
local_port);
|
||||
|
@ -808,7 +808,7 @@ enum net_verdict net_conn_input(enum net_ip_protocol proto, struct net_pkt *pkt)
|
|||
|
||||
#if defined(CONFIG_NET_CONN_CACHE)
|
||||
enum net_verdict verdict;
|
||||
u32_t cache_value = 0;
|
||||
u32_t cache_value = 0U;
|
||||
s32_t pos;
|
||||
|
||||
verdict = cache_check(proto, pkt, &cache_value, &pos);
|
||||
|
|
|
@ -57,7 +57,7 @@ int net_icmpv4_get_hdr(struct net_pkt *pkt, struct net_icmp_hdr *hdr)
|
|||
|
||||
int net_icmpv4_set_chksum(struct net_pkt *pkt)
|
||||
{
|
||||
u16_t chksum = 0;
|
||||
u16_t chksum = 0U;
|
||||
struct net_buf *frag;
|
||||
struct net_buf *temp_frag;
|
||||
u16_t temp_pos;
|
||||
|
|
|
@ -77,7 +77,7 @@ static inline void setup_ipv6_header(struct net_pkt *pkt, u16_t extra_len,
|
|||
u8_t icmp_code)
|
||||
{
|
||||
struct net_buf *frag = pkt->frags;
|
||||
const u32_t unused = 0;
|
||||
const u32_t unused = 0U;
|
||||
u16_t pos;
|
||||
|
||||
NET_IPV6_HDR(pkt)->vtc = 0x60;
|
||||
|
@ -104,7 +104,7 @@ static inline void setup_ipv6_header(struct net_pkt *pkt, u16_t extra_len,
|
|||
|
||||
int net_icmpv6_set_chksum(struct net_pkt *pkt)
|
||||
{
|
||||
u16_t chksum = 0;
|
||||
u16_t chksum = 0U;
|
||||
struct net_buf *frag;
|
||||
struct net_buf *temp_frag;
|
||||
u16_t temp_pos;
|
||||
|
@ -200,7 +200,7 @@ int net_icmpv6_set_ns_hdr(struct net_pkt *pkt, struct net_icmpv6_ns_hdr *hdr)
|
|||
struct net_buf *frag;
|
||||
u16_t pos;
|
||||
|
||||
hdr->reserved = 0;
|
||||
hdr->reserved = 0U;
|
||||
|
||||
frag = net_pkt_write(pkt, pkt->frags, net_pkt_ip_hdr_len(pkt) +
|
||||
net_pkt_ipv6_ext_len(pkt) +
|
||||
|
|
|
@ -226,7 +226,7 @@ static inline struct net_buf *handle_ext_hdr_options(struct net_pkt *pkt,
|
|||
enum net_verdict *verdict)
|
||||
{
|
||||
u8_t opt_type, opt_len;
|
||||
u16_t length = 0, loc;
|
||||
u16_t length = 0U, loc;
|
||||
#if defined(CONFIG_NET_RPL)
|
||||
bool result;
|
||||
#endif
|
||||
|
@ -443,7 +443,7 @@ enum net_verdict net_ipv6_process_pkt(struct net_pkt *pkt, bool is_loopback)
|
|||
u8_t first_option;
|
||||
u16_t offset;
|
||||
u16_t length;
|
||||
u16_t total_len = 0;
|
||||
u16_t total_len = 0U;
|
||||
u8_t ext_bitmap;
|
||||
|
||||
if (real_len < pkt_len) {
|
||||
|
@ -539,9 +539,9 @@ enum net_verdict net_ipv6_process_pkt(struct net_pkt *pkt, bool is_loopback)
|
|||
frag = pkt->frags;
|
||||
next = hdr->nexthdr;
|
||||
first_option = next;
|
||||
length = 0;
|
||||
ext_bitmap = 0;
|
||||
start_of_ext = 0;
|
||||
length = 0U;
|
||||
ext_bitmap = 0U;
|
||||
start_of_ext = 0U;
|
||||
offset = sizeof(struct net_ipv6_hdr);
|
||||
prev_hdr = &NET_IPV6_HDR(pkt)->nexthdr - &NET_IPV6_HDR(pkt)->vtc;
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@ int net_ipv6_find_last_ext_hdr(struct net_pkt *pkt, u16_t *next_hdr_idx,
|
|||
next = NET_IPV6_HDR(pkt)->nexthdr;
|
||||
|
||||
/* Initial value if no extension fragments are found */
|
||||
*next_hdr_idx = 6;
|
||||
*next_hdr_idx = 6U;
|
||||
*last_hdr_idx = sizeof(struct net_ipv6_hdr);
|
||||
|
||||
/* First check the simplest case where there is no extension headers
|
||||
|
@ -100,7 +100,7 @@ int net_ipv6_find_last_ext_hdr(struct net_pkt *pkt, u16_t *next_hdr_idx,
|
|||
|
||||
case NET_IPV6_NEXTHDR_HBHO:
|
||||
case NET_IPV6_NEXTHDR_DESTO:
|
||||
length = 0;
|
||||
length = 0U;
|
||||
frag = net_frag_read_u8(frag, offset, &offset,
|
||||
(u8_t *)&length);
|
||||
if (!frag) {
|
||||
|
@ -143,7 +143,7 @@ out:
|
|||
/* Current next_hdr_idx offset is based on respective fragment, but we
|
||||
* need to calculate next_hdr_idx offset based on whole packet.
|
||||
*/
|
||||
pkt_offset = 0;
|
||||
pkt_offset = 0U;
|
||||
frag = pkt->frags;
|
||||
while (frag) {
|
||||
if (next_hdr_frag == frag) {
|
||||
|
@ -158,7 +158,7 @@ out:
|
|||
/* Current last_hdr_idx offset is based on respective fragment, but we
|
||||
* need to calculate last_hdr_idx offset based on whole packet.
|
||||
*/
|
||||
pkt_offset = 0;
|
||||
pkt_offset = 0U;
|
||||
frag = pkt->frags;
|
||||
while (frag) {
|
||||
if (last_hdr_frag == frag) {
|
||||
|
@ -238,7 +238,7 @@ static bool reassembly_cancel(u32_t id,
|
|||
NET_DBG("IPv6 reassembly id 0x%x remaining %d ms",
|
||||
reassembly[i].id, remaining);
|
||||
|
||||
reassembly[i].id = 0;
|
||||
reassembly[i].id = 0U;
|
||||
|
||||
for (j = 0; j < NET_IPV6_FRAGMENTS_MAX_PKT; j++) {
|
||||
if (!reassembly[i].pkt[j]) {
|
||||
|
@ -808,8 +808,8 @@ int net_ipv6_send_fragmented_pkt(struct net_if *iface, struct net_pkt *pkt,
|
|||
goto fail;
|
||||
}
|
||||
|
||||
frag_count = 0;
|
||||
frag_offset = 0;
|
||||
frag_count = 0U;
|
||||
frag_offset = 0U;
|
||||
|
||||
/* The Maximum payload can fit into each packet after IPv6 header,
|
||||
* Extenstion headers and Fragmentation header.
|
||||
|
|
|
@ -695,10 +695,10 @@ static struct net_pkt *update_ll_reserve(struct net_pkt *pkt,
|
|||
|
||||
orig_frag = pkt->frags;
|
||||
copy_len = orig_frag->len;
|
||||
pos = 0;
|
||||
pos = 0U;
|
||||
|
||||
pkt->frags = NULL;
|
||||
room_len = 0;
|
||||
room_len = 0U;
|
||||
frag = NULL;
|
||||
|
||||
while (orig_frag) {
|
||||
|
@ -720,14 +720,14 @@ static struct net_pkt *update_ll_reserve(struct net_pkt *pkt,
|
|||
orig_frag->data + pos, copy_len);
|
||||
|
||||
room_len -= copy_len;
|
||||
copy_len = 0;
|
||||
copy_len = 0U;
|
||||
} else {
|
||||
memcpy(net_buf_add(frag, room_len),
|
||||
orig_frag->data + pos, room_len);
|
||||
|
||||
copy_len -= room_len;
|
||||
pos += room_len;
|
||||
room_len = 0;
|
||||
room_len = 0U;
|
||||
}
|
||||
|
||||
if (!copy_len) {
|
||||
|
@ -743,7 +743,7 @@ static struct net_pkt *update_ll_reserve(struct net_pkt *pkt,
|
|||
}
|
||||
|
||||
copy_len = orig_frag->len;
|
||||
pos = 0;
|
||||
pos = 0U;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1226,8 +1226,8 @@ static void ns_routing_info(struct net_pkt *pkt,
|
|||
static enum net_verdict handle_ns_input(struct net_pkt *pkt)
|
||||
{
|
||||
u16_t total_len = net_pkt_get_len(pkt);
|
||||
u8_t prev_opt_len = 0;
|
||||
u8_t flags = 0;
|
||||
u8_t prev_opt_len = 0U;
|
||||
u8_t flags = 0U;
|
||||
bool routing = false;
|
||||
struct net_icmpv6_nd_opt_hdr nd_opt_hdr;
|
||||
struct net_icmpv6_ns_hdr ns_hdr;
|
||||
|
@ -1578,7 +1578,7 @@ static void ipv6_nd_reachable_timeout(struct k_work *work)
|
|||
|
||||
case NET_IPV6_NBR_STATE_DELAY:
|
||||
data->state = NET_IPV6_NBR_STATE_PROBE;
|
||||
data->ns_count = 0;
|
||||
data->ns_count = 0U;
|
||||
|
||||
NET_DBG("nbr %p moving %s state to PROBE (%d)",
|
||||
nbr,
|
||||
|
@ -1744,7 +1744,7 @@ static inline bool handle_na_neighbor(struct net_pkt *pkt,
|
|||
|
||||
if (net_is_solicited(pkt)) {
|
||||
ipv6_nbr_set_state(nbr, NET_IPV6_NBR_STATE_REACHABLE);
|
||||
net_ipv6_nbr_data(nbr)->ns_count = 0;
|
||||
net_ipv6_nbr_data(nbr)->ns_count = 0U;
|
||||
|
||||
/* We might have active timer from PROBE */
|
||||
net_ipv6_nbr_data(nbr)->reachable = 0;
|
||||
|
@ -1836,8 +1836,8 @@ send_pending:
|
|||
static enum net_verdict handle_na_input(struct net_pkt *pkt)
|
||||
{
|
||||
u16_t total_len = net_pkt_get_len(pkt);
|
||||
u16_t tllao_offset = 0;
|
||||
u8_t prev_opt_len = 0;
|
||||
u16_t tllao_offset = 0U;
|
||||
u8_t prev_opt_len = 0U;
|
||||
struct net_icmpv6_nd_opt_hdr nd_opt_hdr;
|
||||
struct net_icmpv6_na_hdr na_hdr;
|
||||
struct net_if_addr *ifaddr;
|
||||
|
@ -2112,7 +2112,7 @@ int net_ipv6_send_rs(struct net_if *iface)
|
|||
struct net_pkt *pkt;
|
||||
struct net_buf *frag;
|
||||
bool unspec_src;
|
||||
u8_t llao_len = 0;
|
||||
u8_t llao_len = 0U;
|
||||
int ret;
|
||||
|
||||
pkt = net_pkt_get_reserve_tx(net_if_get_ll_reserve(iface, NULL),
|
||||
|
|
|
@ -1180,7 +1180,7 @@ static int recv_udp(struct net_context *context,
|
|||
.sa_family = net_context_get_family(context),
|
||||
};
|
||||
struct sockaddr *laddr = NULL;
|
||||
u16_t lport = 0;
|
||||
u16_t lport = 0U;
|
||||
int ret;
|
||||
|
||||
ARG_UNUSED(timeout);
|
||||
|
|
|
@ -400,14 +400,14 @@ struct net_if *net_if_get_first_by_type(const struct net_l2 *l2)
|
|||
static u8_t get_ipaddr_diff(const u8_t *src, const u8_t *dst, int addr_len)
|
||||
{
|
||||
u8_t j, k, xor;
|
||||
u8_t len = 0;
|
||||
u8_t len = 0U;
|
||||
|
||||
for (j = 0; j < addr_len; j++) {
|
||||
for (j = 0U; j < addr_len; j++) {
|
||||
if (src[j] == dst[j]) {
|
||||
len += 8;
|
||||
} else {
|
||||
xor = src[j] ^ dst[j];
|
||||
for (k = 0; k < 8; k++) {
|
||||
for (k = 0U; k < 8; k++) {
|
||||
if (!(xor & 0x80)) {
|
||||
len++;
|
||||
xor <<= 1;
|
||||
|
@ -1996,7 +1996,7 @@ const struct in6_addr *net_if_ipv6_select_src_addr(struct net_if *dst_iface,
|
|||
{
|
||||
#if defined(CONFIG_NET_IPV6)
|
||||
struct in6_addr *src = NULL;
|
||||
u8_t best_match = 0;
|
||||
u8_t best_match = 0U;
|
||||
struct net_if *iface;
|
||||
|
||||
if (!net_ipv6_is_ll_addr(dst) && !net_ipv6_is_addr_mcast(dst)) {
|
||||
|
@ -2383,7 +2383,7 @@ const struct in_addr *net_if_ipv4_select_src_addr(struct net_if *dst_iface,
|
|||
{
|
||||
#if defined(CONFIG_NET_IPV4)
|
||||
struct in_addr *src = NULL;
|
||||
u8_t best_match = 0;
|
||||
u8_t best_match = 0U;
|
||||
struct net_if *iface;
|
||||
|
||||
if (!net_ipv4_is_ll_addr(dst) && !net_ipv4_is_addr_mcast(dst)) {
|
||||
|
|
|
@ -85,7 +85,7 @@ static inline void mgmt_push_event(u32_t mgmt_event, struct net_if *iface,
|
|||
u16_t o_idx = out_event + 1;
|
||||
|
||||
if (o_idx == CONFIG_NET_MGMT_EVENT_QUEUE_SIZE) {
|
||||
o_idx = 0;
|
||||
o_idx = 0U;
|
||||
}
|
||||
|
||||
if (events[o_idx].event) {
|
||||
|
@ -123,7 +123,7 @@ static inline struct mgmt_event_entry *mgmt_pop_event(void)
|
|||
|
||||
static inline void mgmt_clean_event(struct mgmt_event_entry *mgmt_event)
|
||||
{
|
||||
mgmt_event->event = 0;
|
||||
mgmt_event->event = 0U;
|
||||
mgmt_event->iface = NULL;
|
||||
}
|
||||
|
||||
|
@ -136,7 +136,7 @@ static inline void mgmt_rebuild_global_event_mask(void)
|
|||
{
|
||||
struct net_mgmt_event_callback *cb, *tmp;
|
||||
|
||||
global_event_mask = 0;
|
||||
global_event_mask = 0U;
|
||||
|
||||
SYS_SLIST_FOR_EACH_CONTAINER_SAFE(&event_callbacks, cb, tmp, node) {
|
||||
mgmt_add_event_mask(cb->event_mask);
|
||||
|
@ -369,7 +369,7 @@ int net_mgmt_event_wait_on_iface(struct net_if *iface,
|
|||
void net_mgmt_event_init(void)
|
||||
{
|
||||
sys_slist_init(&event_callbacks);
|
||||
global_event_mask = 0;
|
||||
global_event_mask = 0U;
|
||||
|
||||
in_event = -1;
|
||||
out_event = -1;
|
||||
|
|
|
@ -566,7 +566,7 @@ static struct net_pkt *net_pkt_get(struct k_mem_slab *slab,
|
|||
#endif /* CONFIG_NET_CONTEXT_PRIORITY */
|
||||
|
||||
if (slab != &rx_pkts) {
|
||||
uint16_t iface_len, data_len = 0;
|
||||
uint16_t iface_len, data_len = 0U;
|
||||
enum net_ip_protocol proto;
|
||||
|
||||
iface_len = net_if_get_mtu(iface);
|
||||
|
@ -1087,7 +1087,7 @@ int net_frag_linear_copy(struct net_buf *dst, struct net_buf *src,
|
|||
}
|
||||
|
||||
/* traverse the fragment chain until len bytes are copied */
|
||||
copied = 0;
|
||||
copied = 0U;
|
||||
while (src && len > 0) {
|
||||
to_copy = min(len, src->len - offset);
|
||||
memcpy(dst->data + copied, src->data + offset, to_copy);
|
||||
|
@ -1097,7 +1097,7 @@ int net_frag_linear_copy(struct net_buf *dst, struct net_buf *src,
|
|||
len -= to_copy;
|
||||
src = src->frags;
|
||||
/* after the first iteration, this value will be 0 */
|
||||
offset = 0;
|
||||
offset = 0U;
|
||||
}
|
||||
|
||||
if (len > 0) {
|
||||
|
@ -1239,7 +1239,7 @@ u16_t net_pkt_append_memset(struct net_pkt *pkt, u16_t len, const u8_t data,
|
|||
{
|
||||
struct net_buf *frag;
|
||||
struct net_context *ctx = NULL;
|
||||
u16_t max_len, appended = 0;
|
||||
u16_t max_len, appended = 0U;
|
||||
|
||||
if (!pkt || !len) {
|
||||
return 0;
|
||||
|
@ -1321,7 +1321,7 @@ static inline struct net_buf *net_frag_read_byte(struct net_buf *frag,
|
|||
*pos = offset + 1;
|
||||
|
||||
if (*pos >= frag->len) {
|
||||
*pos = 0;
|
||||
*pos = 0U;
|
||||
|
||||
return frag->frags;
|
||||
}
|
||||
|
@ -1356,7 +1356,7 @@ static inline struct net_buf *adjust_offset(struct net_buf *frag,
|
|||
struct net_buf *net_frag_read(struct net_buf *frag, u16_t offset,
|
||||
u16_t *pos, u16_t len, u8_t *data)
|
||||
{
|
||||
u16_t copy = 0;
|
||||
u16_t copy = 0U;
|
||||
|
||||
frag = adjust_offset(frag, offset, pos);
|
||||
if (!frag) {
|
||||
|
@ -1466,7 +1466,7 @@ static inline struct net_buf *adjust_write_offset(struct net_pkt *pkt,
|
|||
return frag;
|
||||
}
|
||||
|
||||
*pos = 0;
|
||||
*pos = 0U;
|
||||
|
||||
return check_and_create_data(pkt, frag->frags,
|
||||
timeout);
|
||||
|
@ -1495,7 +1495,7 @@ static inline struct net_buf *adjust_write_offset(struct net_pkt *pkt,
|
|||
/* Create empty space */
|
||||
net_buf_add(frag, tailroom);
|
||||
|
||||
*pos = 0;
|
||||
*pos = 0U;
|
||||
|
||||
return check_and_create_data(pkt,
|
||||
frag->frags,
|
||||
|
@ -1557,7 +1557,7 @@ struct net_buf *net_pkt_write(struct net_pkt *pkt, struct net_buf *frag,
|
|||
}
|
||||
|
||||
data += count;
|
||||
offset = 0;
|
||||
offset = 0U;
|
||||
frag = frag->frags;
|
||||
|
||||
if (!frag) {
|
||||
|
@ -1618,7 +1618,7 @@ static inline bool insert_data(struct net_pkt *pkt, struct net_buf *frag,
|
|||
data += count;
|
||||
}
|
||||
|
||||
offset = 0;
|
||||
offset = 0U;
|
||||
|
||||
insert = net_pkt_get_frag(pkt, timeout);
|
||||
if (!insert) {
|
||||
|
@ -1644,7 +1644,7 @@ static inline struct net_buf *adjust_insert_offset(struct net_buf *frag,
|
|||
|
||||
while (frag) {
|
||||
if (offset == frag->len) {
|
||||
*pos = 0;
|
||||
*pos = 0U;
|
||||
|
||||
return frag->frags;
|
||||
}
|
||||
|
@ -1903,7 +1903,7 @@ int net_pkt_pull(struct net_pkt *pkt, u16_t offset, u16_t len)
|
|||
temp = frag;
|
||||
frag = frag->frags;
|
||||
temp->frags = NULL;
|
||||
offset = 0;
|
||||
offset = 0U;
|
||||
|
||||
net_buf_unref(temp);
|
||||
|
||||
|
@ -1916,7 +1916,7 @@ int net_pkt_pull(struct net_pkt *pkt, u16_t offset, u16_t len)
|
|||
memmove(frag->data, frag->data + len,
|
||||
frag->len - len);
|
||||
frag->len -= len;
|
||||
len = 0;
|
||||
len = 0U;
|
||||
|
||||
if (!frag->len) {
|
||||
temp = frag;
|
||||
|
@ -1941,13 +1941,13 @@ int net_pkt_pull(struct net_pkt *pkt, u16_t offset, u16_t len)
|
|||
len -= avail;
|
||||
prev = frag;
|
||||
frag = frag->frags;
|
||||
offset = 0;
|
||||
offset = 0U;
|
||||
} else {
|
||||
memmove(frag->data + offset,
|
||||
frag->data + offset + len,
|
||||
avail - len);
|
||||
frag->len -= len;
|
||||
len = 0;
|
||||
len = 0U;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2096,7 +2096,7 @@ void net_pkt_set_appdata_values(struct net_pkt *pkt,
|
|||
enum net_ip_protocol proto)
|
||||
{
|
||||
size_t total_len = net_pkt_get_len(pkt);
|
||||
u16_t proto_len = 0;
|
||||
u16_t proto_len = 0U;
|
||||
struct net_buf *frag;
|
||||
u16_t offset;
|
||||
|
||||
|
|
|
@ -2694,7 +2694,7 @@ static void address_lifetime_cb(struct net_if *iface, void *user_data)
|
|||
if (prefix) {
|
||||
prefix_len = prefix->len;
|
||||
} else {
|
||||
prefix_len = 128;
|
||||
prefix_len = 128U;
|
||||
}
|
||||
|
||||
if (ipv6->unicast[i].is_infinite) {
|
||||
|
|
|
@ -256,7 +256,7 @@ struct net_route_entry *net_route_lookup(struct net_if *iface,
|
|||
struct in6_addr *dst)
|
||||
{
|
||||
struct net_route_entry *route, *found = NULL;
|
||||
u8_t longest_match = 0;
|
||||
u8_t longest_match = 0U;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < CONFIG_NET_MAX_ROUTES && longest_match < 128; i++) {
|
||||
|
|
|
@ -100,7 +100,7 @@ static int net_rpl_mrhof_neighbor_link_cb(struct net_if *iface,
|
|||
int status, int numtx)
|
||||
{
|
||||
u16_t packet_etx = numtx * NET_RPL_MC_ETX_DIVISOR;
|
||||
u16_t recorded_etx = 0;
|
||||
u16_t recorded_etx = 0U;
|
||||
struct net_ipv6_nbr_data *data;
|
||||
u16_t new_etx;
|
||||
|
||||
|
@ -261,7 +261,7 @@ static u16_t net_rpl_mrhof_calc_rank(struct net_rpl_parent *parent,
|
|||
u16_t base_rank)
|
||||
{
|
||||
u16_t new_rank;
|
||||
u16_t rank_increase = 0;
|
||||
u16_t rank_increase = 0U;
|
||||
struct net_ipv6_nbr_data *data;
|
||||
|
||||
if (!parent) {
|
||||
|
@ -320,7 +320,7 @@ static int net_rpl_mrhof_update_mc(struct net_rpl_instance *instance)
|
|||
|
||||
instance->mc.flags = NET_RPL_MC_FLAG_P;
|
||||
instance->mc.aggregated = NET_RPL_MC_A_ADDITIVE;
|
||||
instance->mc.precedence = 0;
|
||||
instance->mc.precedence = 0U;
|
||||
|
||||
dag = instance->current_dag;
|
||||
|
||||
|
@ -330,7 +330,7 @@ static int net_rpl_mrhof_update_mc(struct net_rpl_instance *instance)
|
|||
}
|
||||
|
||||
if (dag->rank == NET_RPL_ROOT_RANK(instance)) {
|
||||
path_metric = 0;
|
||||
path_metric = 0U;
|
||||
} else {
|
||||
path_metric = calculate_path_metric(dag->preferred_parent);
|
||||
}
|
||||
|
|
|
@ -717,7 +717,7 @@ static void new_dio_interval(struct net_rpl_instance *instance)
|
|||
"ROOT" : "");
|
||||
#endif /* CONFIG_NET_STATISTICS_RPL */
|
||||
|
||||
instance->dio_counter = 0;
|
||||
instance->dio_counter = 0U;
|
||||
instance->dio_send = true;
|
||||
|
||||
k_delayed_work_submit(&instance->dio_timer, time);
|
||||
|
@ -727,7 +727,7 @@ static void net_rpl_dio_reset_timer(struct net_rpl_instance *instance)
|
|||
{
|
||||
if (instance->dio_interval_current > instance->dio_interval_min) {
|
||||
instance->dio_interval_current = instance->dio_interval_min;
|
||||
instance->dio_counter = 0;
|
||||
instance->dio_counter = 0U;
|
||||
|
||||
new_dio_interval(instance);
|
||||
}
|
||||
|
@ -1022,7 +1022,7 @@ static void dao_timer(struct net_rpl_instance *instance)
|
|||
#endif
|
||||
|
||||
#if defined(CONFIG_NET_RPL_DAO_ACK)
|
||||
instance->dao_transmissions = 1;
|
||||
instance->dao_transmissions = 1U;
|
||||
k_delayed_work_submit(&instance->dao_retransmit_timer,
|
||||
NET_RPL_DAO_RETRANSMIT_TIMEOUT);
|
||||
#endif
|
||||
|
@ -1317,7 +1317,7 @@ static void net_rpl_reset_dio_timer(struct net_rpl_instance *instance)
|
|||
* unless forced to do so.
|
||||
*/
|
||||
if (instance->dio_interval_current > instance->dio_interval_min) {
|
||||
instance->dio_counter = 0;
|
||||
instance->dio_counter = 0U;
|
||||
instance->dio_interval_current = instance->dio_interval_min;
|
||||
new_dio_interval(instance);
|
||||
}
|
||||
|
@ -2210,7 +2210,7 @@ static void send_mcast_dao(struct net_rpl_instance *instance)
|
|||
u8_t i;
|
||||
|
||||
/* Send a DAO for own multicast addresses */
|
||||
for (i = 0; i < NET_IF_MAX_IPV6_MADDR; i++) {
|
||||
for (i = 0U; i < NET_IF_MAX_IPV6_MADDR; i++) {
|
||||
addr =
|
||||
&instance->iface->config.ip.ipv6->mcast[i].address.in6_addr;
|
||||
|
||||
|
@ -2875,7 +2875,7 @@ static enum net_verdict handle_dio(struct net_pkt *pkt)
|
|||
|
||||
/* Handle any DIO suboptions */
|
||||
while (frag) {
|
||||
len = 0;
|
||||
len = 0U;
|
||||
frag = net_frag_read_u8(frag, pos, &pos, &subopt_type);
|
||||
if (!frag && pos == 0) {
|
||||
/* We are at the end of the message */
|
||||
|
@ -3050,7 +3050,7 @@ int net_rpl_dao_send(struct net_if *iface,
|
|||
struct in6_addr *prefix,
|
||||
u8_t lifetime)
|
||||
{
|
||||
u16_t value = 0;
|
||||
u16_t value = 0U;
|
||||
struct net_rpl_instance *instance;
|
||||
const struct in6_addr *src;
|
||||
struct net_rpl_dag *dag;
|
||||
|
@ -3437,11 +3437,11 @@ static enum net_verdict handle_dao(struct net_pkt *pkt)
|
|||
}
|
||||
}
|
||||
|
||||
target_len = 0;
|
||||
target_len = 0U;
|
||||
|
||||
/* Handle any DAO suboptions */
|
||||
while (frag) {
|
||||
len = 0;
|
||||
len = 0U;
|
||||
frag = net_frag_read_u8(frag, pos, &pos, &subopt_type);
|
||||
if (!frag && pos == 0) {
|
||||
/* We are at the end of the message */
|
||||
|
@ -3771,7 +3771,7 @@ static struct net_icmpv6_handler dao_ack_handler = {
|
|||
|
||||
int net_rpl_update_header(struct net_pkt *pkt, struct in6_addr *addr)
|
||||
{
|
||||
u16_t pos = 0;
|
||||
u16_t pos = 0U;
|
||||
struct net_rpl_parent *parent;
|
||||
struct net_buf *frag;
|
||||
u16_t sender_rank;
|
||||
|
@ -4032,7 +4032,7 @@ static int net_rpl_update_header_empty(struct net_pkt *pkt)
|
|||
struct net_rpl_parent *parent;
|
||||
struct net_route_entry *route;
|
||||
u8_t next_hdr, len, length;
|
||||
u8_t opt_type = 0, opt_len;
|
||||
u8_t opt_type = 0U, opt_len;
|
||||
u8_t instance_id, flags;
|
||||
u16_t pos;
|
||||
int ret;
|
||||
|
@ -4058,7 +4058,7 @@ static int net_rpl_update_header_empty(struct net_pkt *pkt)
|
|||
return 0;
|
||||
}
|
||||
|
||||
length = 0;
|
||||
length = 0U;
|
||||
|
||||
if (len != NET_RPL_HOP_BY_HOP_LEN - 8) {
|
||||
NET_DBG("Hop-by-hop ext header is wrong size "
|
||||
|
|
|
@ -711,7 +711,7 @@ __deprecated static inline void net_rpl_dag_set_not_used(
|
|||
{
|
||||
NET_ASSERT(dag);
|
||||
|
||||
dag->is_used = 0;
|
||||
dag->is_used = 0U;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -723,7 +723,7 @@ __deprecated static inline void net_rpl_dag_set_used(struct net_rpl_dag *dag)
|
|||
{
|
||||
NET_ASSERT(dag);
|
||||
|
||||
dag->is_used = 1;
|
||||
dag->is_used = 1U;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -777,7 +777,7 @@ __deprecated static inline void net_rpl_dag_join(struct net_rpl_dag *dag)
|
|||
{
|
||||
NET_ASSERT(dag);
|
||||
|
||||
dag->is_joined = 1;
|
||||
dag->is_joined = 1U;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -789,7 +789,7 @@ __deprecated static inline void net_rpl_dag_unjoin(struct net_rpl_dag *dag)
|
|||
{
|
||||
NET_ASSERT(dag);
|
||||
|
||||
dag->is_joined = 0;
|
||||
dag->is_joined = 0U;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -128,7 +128,7 @@ static void net_tcp_trace(struct net_pkt *pkt, struct net_tcp *tcp)
|
|||
ack = sys_get_be32(tcp_hdr->ack);
|
||||
|
||||
if (!tcp->sent_ack) {
|
||||
rel_ack = 0;
|
||||
rel_ack = 0U;
|
||||
} else {
|
||||
rel_ack = ack ? ack - tcp->sent_ack : 0;
|
||||
}
|
||||
|
@ -392,7 +392,7 @@ static int prepare_segment(struct net_tcp *tcp,
|
|||
struct net_pkt *alloc_pkt;
|
||||
u16_t dst_port, src_port;
|
||||
bool pkt_allocated;
|
||||
u8_t optlen = 0;
|
||||
u8_t optlen = 0U;
|
||||
int status;
|
||||
|
||||
NET_ASSERT(context);
|
||||
|
@ -668,13 +668,13 @@ static void net_tcp_set_syn_opt(struct net_tcp *tcp, u8_t *options,
|
|||
{
|
||||
u32_t recv_mss;
|
||||
|
||||
*optionlen = 0;
|
||||
*optionlen = 0U;
|
||||
|
||||
if (!(tcp->flags & NET_TCP_RECV_MSS_SET)) {
|
||||
recv_mss = net_tcp_get_recv_mss(tcp);
|
||||
tcp->flags |= NET_TCP_RECV_MSS_SET;
|
||||
} else {
|
||||
recv_mss = 0;
|
||||
recv_mss = 0U;
|
||||
}
|
||||
|
||||
recv_mss |= (NET_TCP_MSS_OPT << 24) | (NET_TCP_MSS_SIZE << 16);
|
||||
|
@ -764,9 +764,9 @@ int net_tcp_prepare_reset(struct net_tcp *tcp,
|
|||
}
|
||||
|
||||
segment.dst_addr = remote;
|
||||
segment.wnd = 0;
|
||||
segment.wnd = 0U;
|
||||
segment.options = NULL;
|
||||
segment.optlen = 0;
|
||||
segment.optlen = 0U;
|
||||
|
||||
status = prepare_segment(tcp, &segment, NULL, pkt);
|
||||
}
|
||||
|
@ -960,7 +960,7 @@ static void restart_timer(struct net_tcp *tcp)
|
|||
{
|
||||
if (!sys_slist_is_empty(&tcp->sent_list)) {
|
||||
tcp->flags |= NET_TCP_RETRYING;
|
||||
tcp->retry_timeout_shift = 0;
|
||||
tcp->retry_timeout_shift = 0U;
|
||||
k_delayed_work_submit(&tcp->retry_timer, retry_timeout(tcp));
|
||||
} else if (CONFIG_NET_TCP_TIME_WAIT_DELAY != 0 &&
|
||||
(tcp->fin_sent && tcp->fin_rcvd)) {
|
||||
|
@ -1354,7 +1354,7 @@ u16_t net_tcp_get_chksum(struct net_pkt *pkt, struct net_buf *frag)
|
|||
struct net_buf *net_tcp_set_chksum(struct net_pkt *pkt, struct net_buf *frag)
|
||||
{
|
||||
struct net_tcp_hdr *hdr;
|
||||
u16_t chksum = 0;
|
||||
u16_t chksum = 0U;
|
||||
u16_t pos;
|
||||
|
||||
hdr = net_pkt_tcp_data(pkt);
|
||||
|
@ -1417,7 +1417,7 @@ int net_tcp_parse_opts(struct net_pkt *pkt, int opt_totlen,
|
|||
}
|
||||
|
||||
if (!opt_totlen) {
|
||||
optlen = 0;
|
||||
optlen = 0U;
|
||||
goto error;
|
||||
}
|
||||
|
||||
|
@ -1877,7 +1877,7 @@ static inline int send_syn_segment(struct net_context *context,
|
|||
struct net_pkt *pkt = NULL;
|
||||
int ret;
|
||||
u8_t options[NET_TCP_MAX_OPT_SIZE];
|
||||
u8_t optionlen = 0;
|
||||
u8_t optionlen = 0U;
|
||||
|
||||
if (flags == NET_TCP_SYN) {
|
||||
net_tcp_set_syn_opt(context->tcp, options, &optionlen);
|
||||
|
@ -2541,7 +2541,7 @@ int net_tcp_accept(struct net_context *context, net_tcp_accept_cb_t cb,
|
|||
{
|
||||
struct sockaddr local_addr;
|
||||
struct sockaddr *laddr = NULL;
|
||||
u16_t lport = 0;
|
||||
u16_t lport = 0U;
|
||||
int ret;
|
||||
|
||||
NET_ASSERT(context->tcp);
|
||||
|
|
|
@ -93,7 +93,7 @@ static inline void reschedule(struct net_trickle *trickle)
|
|||
|
||||
/* Did the clock wrap */
|
||||
if ((s32_t)diff < 0) {
|
||||
diff = 0;
|
||||
diff = 0U;
|
||||
NET_DBG("Clock wrap");
|
||||
}
|
||||
|
||||
|
|
|
@ -96,7 +96,7 @@ fail:
|
|||
struct net_buf *net_udp_set_chksum(struct net_pkt *pkt, struct net_buf *frag)
|
||||
{
|
||||
struct net_udp_hdr *hdr;
|
||||
u16_t chksum = 0;
|
||||
u16_t chksum = 0U;
|
||||
u16_t pos;
|
||||
|
||||
hdr = net_pkt_udp_data(pkt);
|
||||
|
|
|
@ -78,17 +78,17 @@ char *net_sprint_ll_addr_buf(const u8_t *ll, u8_t ll_len,
|
|||
|
||||
switch (ll_len) {
|
||||
case 8:
|
||||
len = 8;
|
||||
len = 8U;
|
||||
break;
|
||||
case 6:
|
||||
len = 6;
|
||||
len = 6U;
|
||||
break;
|
||||
default:
|
||||
len = 6;
|
||||
len = 6U;
|
||||
break;
|
||||
}
|
||||
|
||||
for (i = 0, blen = buflen; i < len && blen > 0; i++) {
|
||||
for (i = 0U, blen = buflen; i < len && blen > 0; i++) {
|
||||
ptr = net_byte_to_hex(ptr, (char)ll[i], 'A', true);
|
||||
*ptr++ = ':';
|
||||
blen -= 3;
|
||||
|
@ -109,7 +109,7 @@ static int net_value_to_udec(char *buf, u32_t value, int precision)
|
|||
int temp;
|
||||
char *start = buf;
|
||||
|
||||
divisor = 1000000000;
|
||||
divisor = 1000000000U;
|
||||
if (precision < 0)
|
||||
precision = 1;
|
||||
for (i = 9; i >= 0; i--, divisor /= 10) {
|
||||
|
@ -131,7 +131,7 @@ char *net_addr_ntop(sa_family_t family, const void *src,
|
|||
struct in_addr *addr;
|
||||
struct in6_addr *addr6;
|
||||
u16_t *w;
|
||||
u8_t i, bl, bh, longest = 1;
|
||||
u8_t i, bl, bh, longest = 1U;
|
||||
s8_t pos = -1;
|
||||
char delim = ':';
|
||||
unsigned char zeros[8] = { 0 };
|
||||
|
@ -145,7 +145,7 @@ char *net_addr_ntop(sa_family_t family, const void *src,
|
|||
w = (u16_t *)addr6->s6_addr16;
|
||||
len = 8;
|
||||
|
||||
for (i = 0; i < 8; i++) {
|
||||
for (i = 0U; i < 8; i++) {
|
||||
u8_t j;
|
||||
|
||||
for (j = i; j < 8; j++) {
|
||||
|
@ -157,7 +157,7 @@ char *net_addr_ntop(sa_family_t family, const void *src,
|
|||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < 8; i++) {
|
||||
for (i = 0U; i < 8; i++) {
|
||||
if (zeros[i] > longest) {
|
||||
longest = zeros[i];
|
||||
pos = i;
|
||||
|
@ -176,7 +176,7 @@ char *net_addr_ntop(sa_family_t family, const void *src,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
for (i = 0; i < len; i++) {
|
||||
for (i = 0U; i < len; i++) {
|
||||
/* IPv4 address a.b.c.d */
|
||||
if (len == 4) {
|
||||
u8_t l;
|
||||
|
@ -470,7 +470,7 @@ static inline u16_t calc_chksum_pkt(u16_t sum, struct net_pkt *pkt,
|
|||
u16_t net_calc_chksum(struct net_pkt *pkt, u8_t proto)
|
||||
{
|
||||
u16_t upper_layer_len;
|
||||
u16_t sum = 0;
|
||||
u16_t sum = 0U;
|
||||
|
||||
switch (net_pkt_family(pkt)) {
|
||||
#if defined(CONFIG_NET_IPV4)
|
||||
|
@ -752,7 +752,7 @@ int net_bytes_from_str(u8_t *buf, int buf_len, const char *src)
|
|||
unsigned int i;
|
||||
char *endptr;
|
||||
|
||||
for (i = 0; i < strlen(src); i++) {
|
||||
for (i = 0U; i < strlen(src); i++) {
|
||||
if (!(src[i] >= '0' && src[i] <= '9') &&
|
||||
!(src[i] >= 'A' && src[i] <= 'F') &&
|
||||
!(src[i] >= 'a' && src[i] <= 'f') &&
|
||||
|
@ -763,7 +763,7 @@ int net_bytes_from_str(u8_t *buf, int buf_len, const char *src)
|
|||
|
||||
(void)memset(buf, 0, buf_len);
|
||||
|
||||
for (i = 0; i < buf_len; i++) {
|
||||
for (i = 0U; i < buf_len; i++) {
|
||||
buf[i] = strtol(src, &endptr, 16);
|
||||
src = ++endptr;
|
||||
}
|
||||
|
|
|
@ -109,7 +109,7 @@ static inline void ethernet_update_length(struct net_if *iface,
|
|||
len -= frag->len;
|
||||
} else {
|
||||
frag->len = len;
|
||||
len = 0;
|
||||
len = 0U;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -387,7 +387,7 @@ static void gptp_init_clock_ds(void)
|
|||
|
||||
default_ds->priority2 = GPTP_PRIORITY2_DEFAULT;
|
||||
|
||||
default_ds->cur_utc_offset = 37; /* Current leap seconds TAI - UTC */
|
||||
default_ds->cur_utc_offset = 37U; /* Current leap seconds TAI - UTC */
|
||||
default_ds->flags.all = 0;
|
||||
default_ds->flags.octets[1] = GPTP_FLAG_TIME_TRACEABLE;
|
||||
default_ds->time_source = GPTP_TS_INTERNAL_OSCILLATOR;
|
||||
|
@ -418,7 +418,7 @@ static void gptp_init_clock_ds(void)
|
|||
/* Initialize properties data set. */
|
||||
|
||||
/* TODO: Get accurate values for below. From the GM. */
|
||||
prop_ds->cur_utc_offset = 37; /* Current leap seconds TAI - UTC */
|
||||
prop_ds->cur_utc_offset = 37U; /* Current leap seconds TAI - UTC */
|
||||
prop_ds->cur_utc_offset_valid = false;
|
||||
prop_ds->leap59 = false;
|
||||
prop_ds->leap61 = false;
|
||||
|
@ -468,7 +468,7 @@ static void gptp_init_port_ds(int port)
|
|||
port_ds->ini_log_half_sync_itv = CONFIG_NET_GPTP_INIT_LOG_SYNC_ITV - 1;
|
||||
port_ds->cur_log_half_sync_itv = port_ds->ini_log_half_sync_itv;
|
||||
port_ds->sync_receipt_timeout = CONFIG_NET_GPTP_SYNC_RECEIPT_TIMEOUT;
|
||||
port_ds->sync_receipt_timeout_time_itv = 10000000; /* 10ms */
|
||||
port_ds->sync_receipt_timeout_time_itv = 10000000U; /* 10ms */
|
||||
|
||||
port_ds->ini_log_pdelay_req_itv =
|
||||
CONFIG_NET_GPTP_INIT_LOG_PDELAY_REQ_ITV;
|
||||
|
@ -1009,7 +1009,7 @@ static void setup_vlan_events_listener(void)
|
|||
|
||||
void net_gptp_init(void)
|
||||
{
|
||||
gptp_domain.default_ds.nb_ports = 0;
|
||||
gptp_domain.default_ds.nb_ports = 0U;
|
||||
|
||||
#if defined(CONFIG_NET_GPTP_VLAN)
|
||||
/* If user has enabled gPTP over VLAN support, then we start gPTP
|
||||
|
|
|
@ -72,8 +72,8 @@ static void gptp_md_follow_up_prepare(struct net_pkt *pkt,
|
|||
fup->tlv.org_id[0] = GPTP_FUP_TLV_ORG_ID_BYTE_0;
|
||||
fup->tlv.org_id[1] = GPTP_FUP_TLV_ORG_ID_BYTE_1;
|
||||
fup->tlv.org_id[2] = GPTP_FUP_TLV_ORG_ID_BYTE_2;
|
||||
fup->tlv.org_sub_type[0] = 0;
|
||||
fup->tlv.org_sub_type[1] = 0;
|
||||
fup->tlv.org_sub_type[0] = 0U;
|
||||
fup->tlv.org_sub_type[1] = 0U;
|
||||
fup->tlv.org_sub_type[2] = GPTP_FUP_TLV_ORG_SUB_TYPE;
|
||||
|
||||
fup->tlv.cumulative_scaled_rate_offset =
|
||||
|
@ -211,8 +211,8 @@ static void gptp_md_pdelay_check_multiple_resp(int port)
|
|||
|
||||
static void gptp_md_compute_pdelay_rate_ratio(int port)
|
||||
{
|
||||
u64_t ingress_tstamp = 0;
|
||||
u64_t resp_evt_tstamp = 0;
|
||||
u64_t ingress_tstamp = 0U;
|
||||
u64_t resp_evt_tstamp = 0U;
|
||||
struct gptp_pdelay_resp_follow_up *fup;
|
||||
struct gptp_pdelay_req_state *state;
|
||||
struct gptp_port_ds *port_ds;
|
||||
|
@ -271,7 +271,7 @@ static void gptp_md_compute_pdelay_rate_ratio(int port)
|
|||
|
||||
static void gptp_md_compute_prop_time(int port)
|
||||
{
|
||||
u64_t t1_ns = 0, t2_ns = 0, t3_ns = 0, t4_ns = 0;
|
||||
u64_t t1_ns = 0U, t2_ns = 0U, t3_ns = 0U, t4_ns = 0U;
|
||||
struct gptp_pdelay_resp_follow_up *fup;
|
||||
struct gptp_pdelay_req_state *state;
|
||||
struct gptp_pdelay_resp *resp;
|
||||
|
|
|
@ -369,9 +369,9 @@ struct net_pkt *gptp_prepare_pdelay_resp(int port,
|
|||
GPTP_CLOCK_ID_LEN);
|
||||
|
||||
/* PTP configuration. */
|
||||
pdelay_resp->req_receipt_ts_secs_high = 0;
|
||||
pdelay_resp->req_receipt_ts_secs_low = 0;
|
||||
pdelay_resp->req_receipt_ts_nsecs = 0;
|
||||
pdelay_resp->req_receipt_ts_secs_high = 0U;
|
||||
pdelay_resp->req_receipt_ts_secs_low = 0U;
|
||||
pdelay_resp->req_receipt_ts_nsecs = 0U;
|
||||
|
||||
memcpy(&pdelay_resp->requesting_port_id,
|
||||
&query->port_id, sizeof(struct gptp_port_identity));
|
||||
|
@ -432,9 +432,9 @@ struct net_pkt *gptp_prepare_pdelay_follow_up(int port,
|
|||
GPTP_CLOCK_ID_LEN);
|
||||
|
||||
/* PTP configuration. */
|
||||
follow_up->resp_orig_ts_secs_high = 0;
|
||||
follow_up->resp_orig_ts_secs_low = 0;
|
||||
follow_up->resp_orig_ts_nsecs = 0;
|
||||
follow_up->resp_orig_ts_secs_high = 0U;
|
||||
follow_up->resp_orig_ts_secs_low = 0U;
|
||||
follow_up->resp_orig_ts_nsecs = 0U;
|
||||
|
||||
memcpy(&follow_up->requesting_port_id,
|
||||
&pdelay_resp->requesting_port_id,
|
||||
|
@ -533,7 +533,7 @@ struct net_pkt *gptp_prepare_announce(int port)
|
|||
|
||||
/* Clear reserved fields. */
|
||||
(void)memset(ann->reserved1, 0, sizeof(ann->reserved1));
|
||||
ann->reserved2 = 0;
|
||||
ann->reserved2 = 0U;
|
||||
|
||||
hdr->message_length = htons(sizeof(struct gptp_hdr) +
|
||||
sizeof(struct gptp_announce) - 8 +
|
||||
|
|
|
@ -1738,7 +1738,7 @@ static void gptp_updt_roles_tree(void)
|
|||
global_ds->current_utc_offset =
|
||||
global_ds->sys_current_utc_offset;
|
||||
global_ds->time_source = global_ds->sys_time_source;
|
||||
global_ds->master_steps_removed = 0;
|
||||
global_ds->master_steps_removed = 0U;
|
||||
} else {
|
||||
bmca_data = GPTP_PORT_BMCA_DATA(best_port);
|
||||
|
||||
|
|
|
@ -116,7 +116,7 @@ static inline void set_datagram_tag(u8_t *ptr, u16_t tag)
|
|||
static inline void set_up_frag_hdr(struct net_buf *frag, u16_t size,
|
||||
u8_t offset)
|
||||
{
|
||||
u8_t pos = 0;
|
||||
u8_t pos = 0U;
|
||||
|
||||
if (offset) {
|
||||
frag->data[pos] = NET_6LO_DISPATCH_FRAGN;
|
||||
|
@ -246,9 +246,9 @@ bool ieee802154_fragment(struct net_pkt *pkt, int hdr_diff)
|
|||
/* Datagram_size: total length before compression */
|
||||
size = net_pkt_get_len(pkt) + hdr_diff;
|
||||
|
||||
room = 0;
|
||||
offset = 0;
|
||||
processed = 0;
|
||||
room = 0U;
|
||||
offset = 0U;
|
||||
processed = 0U;
|
||||
first = true;
|
||||
datagram_tag++;
|
||||
|
||||
|
@ -337,7 +337,7 @@ static inline void clear_reass_cache(u16_t size, u16_t tag)
|
|||
{
|
||||
u8_t i;
|
||||
|
||||
for (i = 0; i < REASS_CACHE_SIZE; i++) {
|
||||
for (i = 0U; i < REASS_CACHE_SIZE; i++) {
|
||||
if (!(cache[i].size == size && cache[i].tag == tag)) {
|
||||
continue;
|
||||
}
|
||||
|
@ -347,8 +347,8 @@ static inline void clear_reass_cache(u16_t size, u16_t tag)
|
|||
}
|
||||
|
||||
cache[i].pkt = NULL;
|
||||
cache[i].size = 0;
|
||||
cache[i].tag = 0;
|
||||
cache[i].size = 0U;
|
||||
cache[i].tag = 0U;
|
||||
cache[i].used = false;
|
||||
k_delayed_work_cancel(&cache[i].timer);
|
||||
}
|
||||
|
@ -367,8 +367,8 @@ static void reass_timeout(struct k_work *work)
|
|||
}
|
||||
|
||||
cache->pkt = NULL;
|
||||
cache->size = 0;
|
||||
cache->tag = 0;
|
||||
cache->size = 0U;
|
||||
cache->tag = 0U;
|
||||
cache->used = false;
|
||||
}
|
||||
|
||||
|
@ -408,7 +408,7 @@ static inline struct frag_cache *get_reass_cache(u16_t size, u16_t tag)
|
|||
{
|
||||
u8_t i;
|
||||
|
||||
for (i = 0; i < REASS_CACHE_SIZE; i++) {
|
||||
for (i = 0U; i < REASS_CACHE_SIZE; i++) {
|
||||
if (cache[i].used) {
|
||||
if (cache[i].size == size &&
|
||||
cache[i].tag == tag) {
|
||||
|
@ -467,8 +467,8 @@ static inline enum net_verdict add_frag_to_cache(struct net_pkt *pkt,
|
|||
struct net_buf *frag;
|
||||
u16_t size;
|
||||
u16_t tag;
|
||||
u16_t offset = 0;
|
||||
u8_t pos = 0;
|
||||
u16_t offset = 0U;
|
||||
u8_t pos = 0U;
|
||||
|
||||
/* Parse total size of packet */
|
||||
size = get_datagram_size(pkt->frags->data);
|
||||
|
|
|
@ -246,8 +246,8 @@ validate_mac_command(struct ieee802154_mpdu *mpdu, u8_t *buf, u8_t length)
|
|||
struct ieee802154_command *c = (struct ieee802154_command *)buf;
|
||||
bool src_pan_brdcst_chk = false;
|
||||
bool dst_brdcst_chk = false;
|
||||
u8_t comp = 0;
|
||||
u8_t ar = 0;
|
||||
u8_t comp = 0U;
|
||||
u8_t ar = 0U;
|
||||
u8_t src, dst;
|
||||
|
||||
switch (c->cfi) {
|
||||
|
@ -262,14 +262,14 @@ validate_mac_command(struct ieee802154_mpdu *mpdu, u8_t *buf, u8_t length)
|
|||
case IEEE802154_CFI_ASSOCIATION_RESPONSE:
|
||||
case IEEE802154_CFI_DISASSOCIATION_NOTIFICATION:
|
||||
case IEEE802154_CFI_PAN_ID_CONLICT_NOTIFICATION:
|
||||
ar = 1;
|
||||
comp = 1;
|
||||
ar = 1U;
|
||||
comp = 1U;
|
||||
src = IEEE802154_EXT_ADDR_LENGTH;
|
||||
dst = IEEE802154_EXT_ADDR_LENGTH;
|
||||
|
||||
break;
|
||||
case IEEE802154_CFI_DATA_REQUEST:
|
||||
ar = 1;
|
||||
ar = 1U;
|
||||
src = IEEE802154_ADDR_MODE_SHORT |
|
||||
IEEE802154_ADDR_MODE_EXTENDED;
|
||||
|
||||
|
@ -277,14 +277,14 @@ validate_mac_command(struct ieee802154_mpdu *mpdu, u8_t *buf, u8_t length)
|
|||
IEEE802154_ADDR_MODE_NONE) {
|
||||
dst = IEEE802154_ADDR_MODE_NONE;
|
||||
} else {
|
||||
comp = 1;
|
||||
comp = 1U;
|
||||
dst = IEEE802154_ADDR_MODE_SHORT |
|
||||
IEEE802154_ADDR_MODE_EXTENDED;
|
||||
}
|
||||
|
||||
break;
|
||||
case IEEE802154_CFI_ORPHAN_NOTIFICATION:
|
||||
comp = 1;
|
||||
comp = 1U;
|
||||
src = IEEE802154_EXT_ADDR_LENGTH;
|
||||
dst = IEEE802154_ADDR_MODE_SHORT;
|
||||
|
||||
|
@ -308,7 +308,7 @@ validate_mac_command(struct ieee802154_mpdu *mpdu, u8_t *buf, u8_t length)
|
|||
|
||||
break;
|
||||
case IEEE802154_CFI_GTS_REQUEST:
|
||||
ar = 1;
|
||||
ar = 1U;
|
||||
src = IEEE802154_ADDR_MODE_SHORT;
|
||||
dst = IEEE802154_ADDR_MODE_NONE;
|
||||
|
||||
|
@ -502,14 +502,14 @@ static inline struct ieee802154_fcf_seq *generate_fcf_grounds(u8_t **p_buf,
|
|||
|
||||
fs = (struct ieee802154_fcf_seq *) *p_buf;
|
||||
|
||||
fs->fc.security_enabled = 0;
|
||||
fs->fc.frame_pending = 0;
|
||||
fs->fc.security_enabled = 0U;
|
||||
fs->fc.frame_pending = 0U;
|
||||
fs->fc.ar = ack;
|
||||
fs->fc.pan_id_comp = 0;
|
||||
fs->fc.reserved = 0;
|
||||
fs->fc.pan_id_comp = 0U;
|
||||
fs->fc.reserved = 0U;
|
||||
/** We support version 2006 only for now */
|
||||
fs->fc.seq_num_suppr = 0;
|
||||
fs->fc.ie_list = 0;
|
||||
fs->fc.seq_num_suppr = 0U;
|
||||
fs->fc.ie_list = 0U;
|
||||
fs->fc.frame_version = IEEE802154_VERSION_802154_2006;
|
||||
|
||||
*p_buf += sizeof(struct ieee802154_fcf_seq);
|
||||
|
@ -550,12 +550,12 @@ bool data_addr_to_fs_settings(struct net_linkaddr *dst,
|
|||
|
||||
fs->fc.dst_addr_mode = get_dst_addr_mode(dst, &broadcast);
|
||||
if (fs->fc.dst_addr_mode != IEEE802154_ADDR_MODE_NONE) {
|
||||
fs->fc.pan_id_comp = 1;
|
||||
fs->fc.pan_id_comp = 1U;
|
||||
|
||||
if (broadcast) {
|
||||
params->dst.short_addr = IEEE802154_BROADCAST_ADDRESS;
|
||||
params->dst.len = IEEE802154_SHORT_ADDR_LENGTH;
|
||||
fs->fc.ar = 0;
|
||||
fs->fc.ar = 0U;
|
||||
} else {
|
||||
params->dst.ext_addr = dst->addr;
|
||||
params->dst.len = dst->len;
|
||||
|
@ -644,7 +644,7 @@ u8_t *generate_aux_security_hdr(struct ieee802154_security_ctx *sec_ctx,
|
|||
|
||||
aux_sec->control.security_level = sec_ctx->level;
|
||||
aux_sec->control.key_id_mode = sec_ctx->key_mode;
|
||||
aux_sec->control.reserved = 0;
|
||||
aux_sec->control.reserved = 0U;
|
||||
|
||||
aux_sec->frame_counter = sys_cpu_to_le32(sec_ctx->frame_counter);
|
||||
|
||||
|
@ -683,7 +683,7 @@ bool ieee802154_create_data_frame(struct ieee802154_context *ctx,
|
|||
goto no_security_hdr;
|
||||
}
|
||||
|
||||
fs->fc.security_enabled = 1;
|
||||
fs->fc.security_enabled = 1U;
|
||||
|
||||
p_buf = generate_aux_security_hdr(&ctx->sec_ctx, p_buf);
|
||||
|
||||
|
@ -732,8 +732,8 @@ static inline bool cfi_to_fs_settings(enum ieee802154_cfi cfi,
|
|||
{
|
||||
switch (cfi) {
|
||||
case IEEE802154_CFI_DISASSOCIATION_NOTIFICATION:
|
||||
fs->fc.ar = 1;
|
||||
fs->fc.pan_id_comp = 1;
|
||||
fs->fc.ar = 1U;
|
||||
fs->fc.pan_id_comp = 1U;
|
||||
|
||||
/* Fall through for common src/dst addr mode handling */
|
||||
case IEEE802154_CFI_ASSOCIATION_REQUEST:
|
||||
|
@ -748,19 +748,19 @@ static inline bool cfi_to_fs_settings(enum ieee802154_cfi cfi,
|
|||
break;
|
||||
case IEEE802154_CFI_ASSOCIATION_RESPONSE:
|
||||
case IEEE802154_CFI_PAN_ID_CONLICT_NOTIFICATION:
|
||||
fs->fc.ar = 1;
|
||||
fs->fc.pan_id_comp = 1;
|
||||
fs->fc.ar = 1U;
|
||||
fs->fc.pan_id_comp = 1U;
|
||||
fs->fc.src_addr_mode = IEEE802154_ADDR_MODE_EXTENDED;
|
||||
fs->fc.dst_addr_mode = IEEE802154_ADDR_MODE_EXTENDED;
|
||||
|
||||
break;
|
||||
case IEEE802154_CFI_DATA_REQUEST:
|
||||
fs->fc.ar = 1;
|
||||
fs->fc.ar = 1U;
|
||||
/* ToDo: src/dst addr mode: see 5.3.4 */
|
||||
|
||||
break;
|
||||
case IEEE802154_CFI_ORPHAN_NOTIFICATION:
|
||||
fs->fc.pan_id_comp = 1;
|
||||
fs->fc.pan_id_comp = 1U;
|
||||
fs->fc.src_addr_mode = IEEE802154_ADDR_MODE_EXTENDED;
|
||||
fs->fc.dst_addr_mode = IEEE802154_ADDR_MODE_SHORT;
|
||||
|
||||
|
@ -775,7 +775,7 @@ static inline bool cfi_to_fs_settings(enum ieee802154_cfi cfi,
|
|||
|
||||
break;
|
||||
case IEEE802154_CFI_GTS_REQUEST:
|
||||
fs->fc.ar = 1;
|
||||
fs->fc.ar = 1U;
|
||||
fs->fc.src_addr_mode = IEEE802154_ADDR_MODE_SHORT;
|
||||
fs->fc.dst_addr_mode = IEEE802154_ADDR_MODE_NONE;
|
||||
|
||||
|
@ -789,7 +789,7 @@ static inline bool cfi_to_fs_settings(enum ieee802154_cfi cfi,
|
|||
|
||||
static inline u8_t mac_command_length(enum ieee802154_cfi cfi)
|
||||
{
|
||||
u8_t reserve = 1; /* cfi is at least present */
|
||||
u8_t reserve = 1U; /* cfi is at least present */
|
||||
|
||||
switch (cfi) {
|
||||
case IEEE802154_CFI_ASSOCIATION_REQUEST:
|
||||
|
@ -886,8 +886,8 @@ bool ieee802154_create_ack_frame(struct net_if *iface,
|
|||
|
||||
fs = generate_fcf_grounds(&p_buf, false);
|
||||
|
||||
fs->fc.dst_addr_mode = 0;
|
||||
fs->fc.src_addr_mode = 0;
|
||||
fs->fc.dst_addr_mode = 0U;
|
||||
fs->fc.src_addr_mode = 0U;
|
||||
|
||||
fs->fc.frame_type = IEEE802154_FRAME_TYPE_ACK;
|
||||
fs->sequence = seq;
|
||||
|
|
|
@ -125,7 +125,7 @@ static int ieee802154_scan(u32_t mgmt_request, struct net_if *iface,
|
|||
|
||||
/* ToDo: For now, we assume we are on 2.4Ghz
|
||||
* (device will have to export capabilities) */
|
||||
for (channel = 11; channel <= 26; channel++) {
|
||||
for (channel = 11U; channel <= 26; channel++) {
|
||||
if (IEEE802154_IS_CHAN_UNSCANNED(scan->channel_set, channel)) {
|
||||
continue;
|
||||
}
|
||||
|
@ -254,11 +254,11 @@ static int ieee802154_associate(u32_t mgmt_request, struct net_if *iface,
|
|||
}
|
||||
|
||||
cmd = ieee802154_get_mac_command(pkt);
|
||||
cmd->assoc_req.ci.dev_type = 0; /* RFD */
|
||||
cmd->assoc_req.ci.power_src = 0; /* ToDo: set right power source */
|
||||
cmd->assoc_req.ci.rx_on = 1; /* ToDo: that will depends on PM */
|
||||
cmd->assoc_req.ci.sec_capability = 0; /* ToDo: security support */
|
||||
cmd->assoc_req.ci.alloc_addr = 0; /* ToDo: handle short addr */
|
||||
cmd->assoc_req.ci.dev_type = 0U; /* RFD */
|
||||
cmd->assoc_req.ci.power_src = 0U; /* ToDo: set right power source */
|
||||
cmd->assoc_req.ci.rx_on = 1U; /* ToDo: that will depends on PM */
|
||||
cmd->assoc_req.ci.sec_capability = 0U; /* ToDo: security support */
|
||||
cmd->assoc_req.ci.alloc_addr = 0U; /* ToDo: handle short addr */
|
||||
|
||||
ctx->associated = false;
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ static inline int csma_ca_radio_send(struct net_if *iface,
|
|||
struct ieee802154_context *ctx = net_if_l2_data(iface);
|
||||
bool ack_required = prepare_for_ack(ctx, pkt, frag);
|
||||
u8_t be = CONFIG_NET_L2_IEEE802154_RADIO_CSMA_CA_MIN_BE;
|
||||
u8_t nb = 0;
|
||||
u8_t nb = 0U;
|
||||
int ret = -EIO;
|
||||
|
||||
NET_DBG("frag %p", frag);
|
||||
|
|
|
@ -155,7 +155,7 @@ static int cmd_ieee802154_disassociate(const struct shell *shell,
|
|||
|
||||
static inline u32_t parse_channel_set(char *str_set)
|
||||
{
|
||||
u32_t channel_set = 0;
|
||||
u32_t channel_set = 0U;
|
||||
char *p, *n;
|
||||
|
||||
p = str_set;
|
||||
|
|
|
@ -99,7 +99,7 @@ void ot_receive_handler(otMessage *aMessage, void *context)
|
|||
{
|
||||
struct openthread_context *ot_context = context;
|
||||
|
||||
u16_t offset = 0;
|
||||
u16_t offset = 0U;
|
||||
u16_t read_len;
|
||||
struct net_pkt *pkt;
|
||||
struct net_buf *prev_buf = NULL;
|
||||
|
|
|
@ -25,7 +25,7 @@ int pkt_list_add(struct openthread_context *context, struct net_pkt *pkt)
|
|||
|
||||
i_idx++;
|
||||
if (i_idx == CONFIG_OPENTHREAD_PKT_LIST_SIZE) {
|
||||
i_idx = 0;
|
||||
i_idx = 0U;
|
||||
}
|
||||
|
||||
if (i_idx == context->pkt_list_out_idx) {
|
||||
|
|
|
@ -87,7 +87,7 @@ static void handle_wifi_scan_done(struct net_mgmt_event_callback *cb)
|
|||
print(context.shell, SHELL_NORMAL, "Scan request done\n");
|
||||
}
|
||||
|
||||
scan_result = 0;
|
||||
scan_result = 0U;
|
||||
}
|
||||
|
||||
static void handle_wifi_connect_result(struct net_mgmt_event_callback *cb)
|
||||
|
@ -281,8 +281,8 @@ static int wifi_shell_init(struct device *unused)
|
|||
ARG_UNUSED(unused);
|
||||
|
||||
context.shell = NULL;
|
||||
context.all = 0;
|
||||
scan_result = 0;
|
||||
context.all = 0U;
|
||||
scan_result = 0U;
|
||||
|
||||
net_mgmt_init_event_callback(&wifi_shell_mgmt_cb,
|
||||
wifi_mgmt_event_handler,
|
||||
|
|
|
@ -196,7 +196,7 @@ static int get_port_number(const char *peer_addr_str,
|
|||
char *buf,
|
||||
size_t buf_len)
|
||||
{
|
||||
u16_t port = 0;
|
||||
u16_t port = 0U;
|
||||
char *ptr;
|
||||
int count, i;
|
||||
|
||||
|
@ -378,7 +378,7 @@ int net_app_init_client(struct net_app_ctx *ctx,
|
|||
}
|
||||
|
||||
if (client_addr) {
|
||||
u16_t local_port = 0;
|
||||
u16_t local_port = 0U;
|
||||
bool empty_addr = false;
|
||||
|
||||
addr.sa_family = remote_addr.sa_family;
|
||||
|
|
|
@ -104,7 +104,7 @@ static int decode_delta(struct option_context *context, u16_t opt,
|
|||
if (opt == COAP_OPTION_EXT_13) {
|
||||
u8_t val;
|
||||
|
||||
*hdr_len = 1;
|
||||
*hdr_len = 1U;
|
||||
context->frag = net_frag_read_u8(context->frag,
|
||||
context->offset,
|
||||
&context->offset,
|
||||
|
@ -119,7 +119,7 @@ static int decode_delta(struct option_context *context, u16_t opt,
|
|||
} else if (opt == COAP_OPTION_EXT_14) {
|
||||
u16_t val;
|
||||
|
||||
*hdr_len = 2;
|
||||
*hdr_len = 2U;
|
||||
context->frag = net_frag_read_be16(context->frag,
|
||||
context->offset,
|
||||
&context->offset,
|
||||
|
@ -268,8 +268,8 @@ static int parse_options(const struct coap_packet *cpkt,
|
|||
return r;
|
||||
}
|
||||
|
||||
num = 0;
|
||||
opt_len = 0;
|
||||
num = 0U;
|
||||
opt_len = 0U;
|
||||
|
||||
while (true) {
|
||||
struct coap_option *option;
|
||||
|
@ -603,9 +603,9 @@ static bool uri_path_eq(const struct coap_packet *cpkt,
|
|||
u8_t opt_num)
|
||||
{
|
||||
u8_t i;
|
||||
u8_t j = 0;
|
||||
u8_t j = 0U;
|
||||
|
||||
for (i = 0; i < opt_num && path[j]; i++) {
|
||||
for (i = 0U; i < opt_num && path[j]; i++) {
|
||||
if (options[i].delta != COAP_OPTION_URI_PATH) {
|
||||
continue;
|
||||
}
|
||||
|
@ -715,7 +715,7 @@ unsigned int coap_option_value_to_int(const struct coap_option *option)
|
|||
static int get_observe_option(const struct coap_packet *cpkt)
|
||||
{
|
||||
struct coap_option option = {};
|
||||
u16_t count = 1;
|
||||
u16_t count = 1U;
|
||||
int r;
|
||||
|
||||
r = coap_find_options(cpkt, COAP_OPTION_OBSERVE, &option, count);
|
||||
|
@ -939,7 +939,7 @@ static u8_t encode_extended_option(u16_t num, u8_t *opt, u16_t *ext)
|
|||
{
|
||||
if (num < COAP_OPTION_EXT_13) {
|
||||
*opt = num;
|
||||
*ext = 0;
|
||||
*ext = 0U;
|
||||
|
||||
return 0;
|
||||
} else if (num < COAP_OPTION_EXT_269) {
|
||||
|
@ -1049,21 +1049,21 @@ int coap_append_option_int(struct coap_packet *cpkt, u16_t code,
|
|||
u8_t data[4], len;
|
||||
|
||||
if (val == 0) {
|
||||
data[0] = 0;
|
||||
len = 0;
|
||||
data[0] = 0U;
|
||||
len = 0U;
|
||||
} else if (val < 0xFF) {
|
||||
data[0] = (u8_t) val;
|
||||
len = 1;
|
||||
len = 1U;
|
||||
} else if (val < 0xFFFF) {
|
||||
sys_put_be16(val, data);
|
||||
len = 2;
|
||||
len = 2U;
|
||||
} else if (val < 0xFFFFFF) {
|
||||
sys_put_be16(val, &data[1]);
|
||||
data[0] = val >> 16;
|
||||
len = 3;
|
||||
len = 3U;
|
||||
} else {
|
||||
sys_put_be32(val, data);
|
||||
len = 4;
|
||||
len = 4U;
|
||||
}
|
||||
|
||||
return coap_packet_append_option(cpkt, code, data, len);
|
||||
|
@ -1093,7 +1093,7 @@ int coap_find_options(const struct coap_packet *cpkt, u16_t code,
|
|||
return r;
|
||||
}
|
||||
|
||||
opt_len = 0;
|
||||
opt_len = 0U;
|
||||
count = 0;
|
||||
|
||||
while (context.delta <= code && count < veclen) {
|
||||
|
@ -1251,7 +1251,7 @@ struct net_buf *coap_packet_get_payload(const struct coap_packet *cpkt,
|
|||
}
|
||||
|
||||
*offset = 0xffff;
|
||||
*len = 0;
|
||||
*len = 0U;
|
||||
|
||||
coap_pkt_len = get_coap_packet_len(cpkt->pkt);
|
||||
|
||||
|
@ -1286,7 +1286,7 @@ int coap_append_block1_option(struct coap_packet *cpkt,
|
|||
struct coap_block_context *ctx)
|
||||
{
|
||||
u16_t bytes = coap_block_size_to_bytes(ctx->block_size);
|
||||
unsigned int val = 0;
|
||||
unsigned int val = 0U;
|
||||
int r;
|
||||
|
||||
if (is_request(cpkt)) {
|
||||
|
|
|
@ -174,7 +174,7 @@ enum coap_block_size default_block_size(void)
|
|||
static bool append_to_net_pkt(struct net_pkt *pkt, const char *str, u16_t len,
|
||||
u16_t *remaining, size_t *offset, size_t current)
|
||||
{
|
||||
u16_t pos = 0;
|
||||
u16_t pos = 0U;
|
||||
bool res;
|
||||
|
||||
if (!*remaining) {
|
||||
|
@ -374,7 +374,7 @@ int clear_more_flag(struct coap_packet *cpkt)
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
delta = 0;
|
||||
delta = 0U;
|
||||
/* Note: coap_well_known_core_get() added Option (delta and len) witho
|
||||
* out any extended options so parsing will not consider at the moment.
|
||||
*/
|
||||
|
@ -463,7 +463,7 @@ int coap_well_known_core_get(struct coap_resource *resource,
|
|||
goto end;
|
||||
}
|
||||
|
||||
format = 40; /* application/link-format */
|
||||
format = 40U; /* application/link-format */
|
||||
|
||||
r = coap_packet_append_option(response, COAP_OPTION_CONTENT_FORMAT,
|
||||
&format, sizeof(format));
|
||||
|
@ -652,7 +652,7 @@ int coap_well_known_core_get(struct coap_resource *resource,
|
|||
return r;
|
||||
}
|
||||
|
||||
format = 40; /* application/link-format */
|
||||
format = 40U; /* application/link-format */
|
||||
r = coap_packet_append_option(response, COAP_OPTION_CONTENT_FORMAT,
|
||||
&format, sizeof(format));
|
||||
if (r < 0) {
|
||||
|
|
|
@ -221,7 +221,7 @@ static bool append_to_coap_pkt(struct coap_packet *response,
|
|||
u16_t *remaining, size_t *offset,
|
||||
size_t current)
|
||||
{
|
||||
u16_t pos = 0;
|
||||
u16_t pos = 0U;
|
||||
bool res;
|
||||
|
||||
if (!*remaining) {
|
||||
|
@ -422,7 +422,7 @@ int clear_more_flag(struct coap_packet *cpkt)
|
|||
u8_t len;
|
||||
|
||||
offset = cpkt->hdr_len;
|
||||
delta = 0;
|
||||
delta = 0U;
|
||||
|
||||
while (1) {
|
||||
opt = cpkt->data[offset++];
|
||||
|
@ -504,7 +504,7 @@ int coap_well_known_core_get(struct coap_resource *resource,
|
|||
goto end;
|
||||
}
|
||||
|
||||
format = 40; /* application/link-format */
|
||||
format = 40U; /* application/link-format */
|
||||
|
||||
r = coap_packet_append_option(response, COAP_OPTION_CONTENT_FORMAT,
|
||||
&format, sizeof(format));
|
||||
|
@ -688,7 +688,7 @@ int coap_well_known_core_get(struct coap_resource *resource,
|
|||
return r;
|
||||
}
|
||||
|
||||
format = 40; /* application/link-format */
|
||||
format = 40U; /* application/link-format */
|
||||
r = coap_packet_append_option(response, COAP_OPTION_CONTENT_FORMAT,
|
||||
&format, sizeof(format));
|
||||
if (r < 0) {
|
||||
|
|
|
@ -161,7 +161,7 @@ static u8_t encode_extended_option(u16_t num, u8_t *opt, u16_t *ext)
|
|||
{
|
||||
if (num < COAP_OPTION_EXT_13) {
|
||||
*opt = num;
|
||||
*ext = 0;
|
||||
*ext = 0U;
|
||||
|
||||
return 0;
|
||||
} else if (num < COAP_OPTION_EXT_269) {
|
||||
|
@ -277,21 +277,21 @@ int coap_append_option_int(struct coap_packet *cpkt, u16_t code,
|
|||
u8_t data[4], len;
|
||||
|
||||
if (val == 0) {
|
||||
data[0] = 0;
|
||||
len = 0;
|
||||
data[0] = 0U;
|
||||
len = 0U;
|
||||
} else if (val < 0xFF) {
|
||||
data[0] = (u8_t) val;
|
||||
len = 1;
|
||||
len = 1U;
|
||||
} else if (val < 0xFFFF) {
|
||||
sys_put_be16(val, data);
|
||||
len = 2;
|
||||
len = 2U;
|
||||
} else if (val < 0xFFFFFF) {
|
||||
sys_put_be16(val, &data[1]);
|
||||
data[0] = val >> 16;
|
||||
len = 3;
|
||||
len = 3U;
|
||||
} else {
|
||||
sys_put_be32(val, data);
|
||||
len = 4;
|
||||
len = 4U;
|
||||
}
|
||||
|
||||
return coap_packet_append_option(cpkt, code, data, len);
|
||||
|
@ -399,7 +399,7 @@ static int decode_delta(u8_t *data, u16_t offset, u16_t *pos, u16_t max_len,
|
|||
if (opt == COAP_OPTION_EXT_13) {
|
||||
u8_t val;
|
||||
|
||||
*hdr_len = 1;
|
||||
*hdr_len = 1U;
|
||||
|
||||
ret = read_u8(data, offset, pos, max_len, &val);
|
||||
if (ret < 0) {
|
||||
|
@ -410,7 +410,7 @@ static int decode_delta(u8_t *data, u16_t offset, u16_t *pos, u16_t max_len,
|
|||
} else if (opt == COAP_OPTION_EXT_14) {
|
||||
u16_t val;
|
||||
|
||||
*hdr_len = 2;
|
||||
*hdr_len = 2U;
|
||||
|
||||
ret = read_be16(data, offset, pos, max_len, &val);
|
||||
if (ret < 0) {
|
||||
|
@ -572,9 +572,9 @@ int coap_packet_parse(struct coap_packet *cpkt, u8_t *data, u16_t len,
|
|||
}
|
||||
|
||||
offset = cpkt->offset;
|
||||
opt_len = 0;
|
||||
delta = 0;
|
||||
num = 0;
|
||||
opt_len = 0U;
|
||||
delta = 0U;
|
||||
num = 0U;
|
||||
|
||||
while (1) {
|
||||
struct coap_option *option;
|
||||
|
@ -606,9 +606,9 @@ int coap_find_options(const struct coap_packet *cpkt, u16_t code,
|
|||
int r;
|
||||
|
||||
offset = cpkt->hdr_len;
|
||||
opt_len = 0;
|
||||
delta = 0;
|
||||
num = 0;
|
||||
opt_len = 0U;
|
||||
delta = 0U;
|
||||
num = 0U;
|
||||
|
||||
while (delta <= code && num < veclen) {
|
||||
r = parse_option(cpkt->data, offset, &offset,
|
||||
|
@ -737,7 +737,7 @@ const u8_t *coap_packet_get_payload(const struct coap_packet *cpkt, u16_t *len)
|
|||
if (payload_len > 0) {
|
||||
*len = payload_len;
|
||||
} else {
|
||||
*len = 0;
|
||||
*len = 0U;
|
||||
}
|
||||
|
||||
return !(*len) ? NULL :
|
||||
|
@ -750,9 +750,9 @@ static bool uri_path_eq(const struct coap_packet *cpkt,
|
|||
u8_t opt_num)
|
||||
{
|
||||
u8_t i;
|
||||
u8_t j = 0;
|
||||
u8_t j = 0U;
|
||||
|
||||
for (i = 0; i < opt_num && path[j]; i++) {
|
||||
for (i = 0U; i < opt_num && path[j]; i++) {
|
||||
if (options[i].delta != COAP_OPTION_URI_PATH) {
|
||||
continue;
|
||||
}
|
||||
|
@ -862,7 +862,7 @@ int coap_append_block1_option(struct coap_packet *cpkt,
|
|||
struct coap_block_context *ctx)
|
||||
{
|
||||
u16_t bytes = coap_block_size_to_bytes(ctx->block_size);
|
||||
unsigned int val = 0;
|
||||
unsigned int val = 0U;
|
||||
int r;
|
||||
|
||||
if (is_request(cpkt)) {
|
||||
|
@ -1209,7 +1209,7 @@ void coap_pending_clear(struct coap_pending *pending)
|
|||
static int get_observe_option(const struct coap_packet *cpkt)
|
||||
{
|
||||
struct coap_option option = {};
|
||||
u16_t count = 1;
|
||||
u16_t count = 1U;
|
||||
int r;
|
||||
|
||||
r = coap_find_options(cpkt, COAP_OPTION_OBSERVE, &option, count);
|
||||
|
|
|
@ -343,7 +343,7 @@ int net_config_init(const char *app_info, u32_t flags, s32_t timeout)
|
|||
#if defined(CONFIG_NET_CONFIG_AUTO_INIT)
|
||||
static int init_net_app(struct device *device)
|
||||
{
|
||||
u32_t flags = 0;
|
||||
u32_t flags = 0U;
|
||||
int ret;
|
||||
|
||||
ARG_UNUSED(device);
|
||||
|
|
|
@ -55,9 +55,9 @@ int dns_msg_pack_qname(u16_t *len, u8_t *buf, u16_t size,
|
|||
u16_t lb_size;
|
||||
u16_t i;
|
||||
|
||||
lb_start = 0;
|
||||
lb_index = 1;
|
||||
lb_size = 0;
|
||||
lb_start = 0U;
|
||||
lb_index = 1U;
|
||||
lb_size = 0U;
|
||||
|
||||
dn_size = dns_strlen(domain_name);
|
||||
if (dn_size == 0) {
|
||||
|
@ -65,7 +65,7 @@ int dns_msg_pack_qname(u16_t *len, u8_t *buf, u16_t size,
|
|||
}
|
||||
|
||||
/* traverse the domain name str, including the null-terminator :) */
|
||||
for (i = 0; i < dn_size + 1; i++) {
|
||||
for (i = 0U; i < dn_size + 1; i++) {
|
||||
if (lb_index >= size) {
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
@ -77,12 +77,12 @@ int dns_msg_pack_qname(u16_t *len, u8_t *buf, u16_t size,
|
|||
break;
|
||||
case '.':
|
||||
buf[lb_start] = lb_size;
|
||||
lb_size = 0;
|
||||
lb_size = 0U;
|
||||
lb_start = lb_index;
|
||||
break;
|
||||
case '\0':
|
||||
buf[lb_start] = lb_size;
|
||||
buf[lb_index] = 0;
|
||||
buf[lb_index] = 0U;
|
||||
break;
|
||||
}
|
||||
lb_index += 1;
|
||||
|
@ -354,7 +354,7 @@ int dns_copy_qname(u8_t *buf, u16_t *len, u16_t size,
|
|||
int rc = -EINVAL;
|
||||
int i = 0;
|
||||
|
||||
*len = 0;
|
||||
*len = 0U;
|
||||
|
||||
/* Iterate ANCOUNT + 1 to allow the Query's QNAME to be parsed.
|
||||
* This is required to avoid 'alias loops'
|
||||
|
|
|
@ -467,7 +467,7 @@ static int dns_read(struct net_context *ctx,
|
|||
int hostname_len = strlen(hostname);
|
||||
struct net_buf *result;
|
||||
struct dns_msg_t dns_msg;
|
||||
u16_t dns_id = 0;
|
||||
u16_t dns_id = 0U;
|
||||
int data_len;
|
||||
int queries;
|
||||
int offset;
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue