Skip to content

Commit

Permalink
fix build error
Browse files Browse the repository at this point in the history
common/espressif/esp_rmt.c: In function 'rmt_set_tx_thr_intr_en':
common/espressif/esp_rmt.c:654:48: error: passing argument 1 of 'spin_lock_irqsave' makes pointer from integer without a cast [-Werror=int-conversion]
  654 |       flags = spin_lock_irqsave(g_rmtdev_common.rmt_spinlock);
      |                                 ~~~~~~~~~~~~~~~^~~~~~~~~~~~~
      |                                                |
      |                                                spinlock_t {aka unsigned char}
/home/hujun5/downloads1/vela_sim/nuttx/include/nuttx/spinlock.h:617:55: note: expected 'volatile spinlock_t *' {aka 'volatile unsigned char *'} but argument is of type 'spinlock_t' {aka 'unsigned char'}
  617 | irqstate_t spin_lock_irqsave(FAR volatile spinlock_t *lock)
      |                                  ~~~~~~~~~~~~~~~~~~~~~^~~~
CC:  nsh_script.c common/espressif/esp_rmt.c:662:48: error: passing argument 1 of 'spin_lock_irqsave' makes pointer from integer without a cast [-Werror=int-conversion]
  662 |       flags = spin_lock_irqsave(g_rmtdev_common.rmt_spinlock);
      |                                 ~~~~~~~~~~~~~~~^~~~~~~~~~~~~
      |                                                |
      |                                                spinlock_t {aka unsigned char}
/home/hujun5/downloads1/vela_sim/nuttx/include/nuttx/spinlock.h:617:55: note: expected '

Signed-off-by: hujun5 <[email protected]>
  • Loading branch information
hujun260 committed Nov 26, 2024
1 parent 44eb22f commit ffa975d
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 36 deletions.
14 changes: 7 additions & 7 deletions arch/risc-v/src/common/espressif/esp_mcpwm.c
Original file line number Diff line number Diff line change
Expand Up @@ -1422,7 +1422,7 @@ static int esp_capture_start(struct cap_lowerhalf_s *lower)
struct mcpwm_cap_channel_lowerhalf_s *)lower;
irqstate_t flags;
mcpwm_hal_context_t *hal = &priv->common->hal;
flags = spin_lock_irqsave(priv->common->mcpwm_spinlock);
flags = spin_lock_irqsave(&priv->common->mcpwm_spinlock);

/* Enable channel and interruption for rising edge */

Expand All @@ -1444,7 +1444,7 @@ static int esp_capture_start(struct cap_lowerhalf_s *lower)
priv->enabled = true;
priv->ready = false;

spin_unlock_irqrestore(priv->common->mcpwm_spinlock, flags);
spin_unlock_irqrestore(&priv->common->mcpwm_spinlock, flags);
cpinfo("Channel enabled: %d\n", priv->channel_id);
return OK;
}
Expand Down Expand Up @@ -1474,7 +1474,7 @@ static int esp_capture_stop(struct cap_lowerhalf_s *lower)
struct mcpwm_cap_channel_lowerhalf_s *)lower;
irqstate_t flags;
mcpwm_hal_context_t *hal = &priv->common->hal;
flags = spin_lock_irqsave(priv->common->mcpwm_spinlock);
flags = spin_lock_irqsave(&priv->common->mcpwm_spinlock);

/* Disable channel and interrupts */

Expand All @@ -1485,7 +1485,7 @@ static int esp_capture_stop(struct cap_lowerhalf_s *lower)
false);
priv->enabled = false;

spin_unlock_irqrestore(priv->common->mcpwm_spinlock, flags);
spin_unlock_irqrestore(&priv->common->mcpwm_spinlock, flags);
cpinfo("Channel disabled: %d\n", priv->channel_id);
return OK;
}
Expand Down Expand Up @@ -1711,7 +1711,7 @@ static int IRAM_ATTR mcpwm_driver_isr_default(int irq, void *context,
struct mcpwm_motor_lowerhalf_s *priv = NULL;
#endif

flags = spin_lock_irqsave(common->mcpwm_spinlock);
flags = spin_lock_irqsave(&common->mcpwm_spinlock);
status = mcpwm_ll_intr_get_status(common->hal.dev);

/* Evaluate capture interrupt for all 3 cap channels */
Expand Down Expand Up @@ -1770,7 +1770,7 @@ static int IRAM_ATTR mcpwm_driver_isr_default(int irq, void *context,
#ifdef CONFIG_ESP_MCPWM_CAPTURE
if (lower == NULL)
{
spin_unlock_irqrestore(common->mcpwm_spinlock, flags);
spin_unlock_irqrestore(&common->mcpwm_spinlock, flags);
return OK;
}

Expand Down Expand Up @@ -1837,7 +1837,7 @@ static int IRAM_ATTR mcpwm_driver_isr_default(int irq, void *context,
}
#endif

spin_unlock_irqrestore(common->mcpwm_spinlock, flags);
spin_unlock_irqrestore(&common->mcpwm_spinlock, flags);
return OK;
}
#endif
Expand Down
22 changes: 11 additions & 11 deletions arch/risc-v/src/common/espressif/esp_rmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ static void rmt_module_enable(void)
{
irqstate_t flags;

flags = spin_lock_irqsave(g_rmtdev_common.rmt_spinlock);
flags = spin_lock_irqsave(&g_rmtdev_common.rmt_spinlock);

if (g_rmtdev_common.rmt_module_enabled == false)
{
Expand Down Expand Up @@ -454,7 +454,7 @@ static int rmt_set_rx_thr_intr_en(rmt_channel_t channel, bool en,
return -EINVAL;
}

flags = spin_lock_irqsave(g_rmtdev_common.rmt_spinlock);
flags = spin_lock_irqsave(&g_rmtdev_common.rmt_spinlock);
rmt_ll_rx_set_limit(g_rmtdev_common.hal.regs,
RMT_DECODE_RX_CHANNEL(channel), evt_thresh);
mask = RMT_LL_EVENT_RX_THRES(RMT_DECODE_RX_CHANNEL(channel));
Expand All @@ -463,7 +463,7 @@ static int rmt_set_rx_thr_intr_en(rmt_channel_t channel, bool en,
}
else
{
flags = spin_lock_irqsave(g_rmtdev_common.rmt_spinlock);
flags = spin_lock_irqsave(&g_rmtdev_common.rmt_spinlock);
mask = RMT_LL_EVENT_RX_THRES(RMT_DECODE_RX_CHANNEL(channel));
rmt_ll_enable_interrupt(g_rmtdev_common.hal.regs, mask, false);
spin_unlock_irqrestore(&g_rmtdev_common.rmt_spinlock, flags);
Expand Down Expand Up @@ -504,7 +504,7 @@ static int rmt_rx_start(rmt_channel_t channel, bool rx_idx_rst)

DEBUGASSERT(RMT_IS_RX_CHANNEL(channel));

flags = spin_lock_irqsave(g_rmtdev_common.rmt_spinlock);
flags = spin_lock_irqsave(&g_rmtdev_common.rmt_spinlock);

rmt_ll_rx_enable(g_rmtdev_common.hal.regs, ch, false);
if (rx_idx_rst)
Expand Down Expand Up @@ -551,7 +551,7 @@ static int rmt_tx_start(rmt_channel_t channel, bool tx_idx_rst)

DEBUGASSERT(RMT_IS_TX_CHANNEL(channel));

flags = spin_lock_irqsave(g_rmtdev_common.rmt_spinlock);
flags = spin_lock_irqsave(&g_rmtdev_common.rmt_spinlock);
if (tx_idx_rst)
{
rmt_ll_tx_reset_pointer(g_rmtdev_common.hal.regs, channel);
Expand Down Expand Up @@ -609,7 +609,7 @@ static int rmt_set_tx_loop_mode(rmt_channel_t channel, bool loop_en)

DEBUGASSERT(RMT_IS_TX_CHANNEL(channel));

flags = spin_lock_irqsave(g_rmtdev_common.rmt_spinlock);
flags = spin_lock_irqsave(&g_rmtdev_common.rmt_spinlock);
rmt_ll_tx_enable_loop(g_rmtdev_common.hal.regs, channel, loop_en);
spin_unlock_irqrestore(&g_rmtdev_common.rmt_spinlock, flags);

Expand Down Expand Up @@ -651,15 +651,15 @@ static int rmt_set_tx_thr_intr_en(rmt_channel_t channel, bool en,

DEBUGASSERT(evt_thresh <= item_block_len);

flags = spin_lock_irqsave(g_rmtdev_common.rmt_spinlock);
flags = spin_lock_irqsave(&g_rmtdev_common.rmt_spinlock);
rmt_ll_tx_set_limit(g_rmtdev_common.hal.regs, channel, evt_thresh);
rmt_ll_enable_interrupt(g_rmtdev_common.hal.regs,
RMT_LL_EVENT_TX_THRES(channel), true);
spin_unlock_irqrestore(&g_rmtdev_common.rmt_spinlock, flags);
}
else
{
flags = spin_lock_irqsave(g_rmtdev_common.rmt_spinlock);
flags = spin_lock_irqsave(&g_rmtdev_common.rmt_spinlock);
rmt_ll_enable_interrupt(g_rmtdev_common.hal.regs,
RMT_LL_EVENT_TX_THRES(channel), false);
spin_unlock_irqrestore(&g_rmtdev_common.rmt_spinlock, flags);
Expand Down Expand Up @@ -801,7 +801,7 @@ static int rmt_internal_config(rmt_dev_t *dev,
return -EINVAL;
}

flags = spin_lock_irqsave(g_rmtdev_common.rmt_spinlock);
flags = spin_lock_irqsave(&g_rmtdev_common.rmt_spinlock);

rmt_ll_enable_mem_access_nonfifo(dev, true);

Expand Down Expand Up @@ -866,7 +866,7 @@ static int rmt_internal_config(rmt_dev_t *dev,
uint8_t carrier_level = rmt_param->tx_config.carrier_level;
uint8_t idle_level = rmt_param->tx_config.idle_level;

flags = spin_lock_irqsave(g_rmtdev_common.rmt_spinlock);
flags = spin_lock_irqsave(&g_rmtdev_common.rmt_spinlock);
rmt_ll_tx_set_channel_clock_div(dev, channel, clk_div);
rmt_ll_tx_set_mem_blocks(dev, channel, mem_cnt);
rmt_ll_tx_reset_pointer(dev, channel);
Expand Down Expand Up @@ -918,7 +918,7 @@ static int rmt_internal_config(rmt_dev_t *dev,
uint8_t filter_cnt = rmt_param->rx_config.filter_ticks_thresh;
uint16_t threshold = rmt_param->rx_config.idle_threshold;

flags = spin_lock_irqsave(g_rmtdev_common.rmt_spinlock);
flags = spin_lock_irqsave(&g_rmtdev_common.rmt_spinlock);
rmt_ll_rx_set_channel_clock_div(dev, RMT_DECODE_RX_CHANNEL(channel),
clk_div);
rmt_ll_rx_set_mem_blocks(dev, RMT_DECODE_RX_CHANNEL(channel), mem_cnt);
Expand Down
14 changes: 7 additions & 7 deletions arch/xtensa/src/common/espressif/esp_mcpwm.c
Original file line number Diff line number Diff line change
Expand Up @@ -1446,7 +1446,7 @@ static int esp_capture_start(struct cap_lowerhalf_s *lower)
struct mcpwm_cap_channel_lowerhalf_s *)lower;
mcpwm_hal_context_t *hal = &priv->common->hal;
irqstate_t flags;
flags = spin_lock_irqsave(priv->common->mcpwm_spinlock);
flags = spin_lock_irqsave(&priv->common->mcpwm_spinlock);

DEBUGASSERT(priv->common->initialized);

Expand All @@ -1471,7 +1471,7 @@ static int esp_capture_start(struct cap_lowerhalf_s *lower)
priv->ready = false;

cpinfo("Channel enabled: %d\n", priv->channel_id);
spin_unlock_irqrestore(priv->common->mcpwm_spinlock, flags);
spin_unlock_irqrestore(&priv->common->mcpwm_spinlock, flags);

return OK;
}
Expand Down Expand Up @@ -1499,7 +1499,7 @@ static int esp_capture_stop(struct cap_lowerhalf_s *lower)
struct mcpwm_cap_channel_lowerhalf_s *)lower;
mcpwm_hal_context_t *hal = &priv->common->hal;
irqstate_t flags;
flags = spin_lock_irqsave(priv->common->mcpwm_spinlock);
flags = spin_lock_irqsave(&priv->common->mcpwm_spinlock);

/* Disable channel and interrupts */

Expand All @@ -1511,7 +1511,7 @@ static int esp_capture_stop(struct cap_lowerhalf_s *lower)
priv->enabled = false;

cpinfo("Channel disabled: %d\n", priv->channel_id);
spin_unlock_irqrestore(priv->common->mcpwm_spinlock, flags);
spin_unlock_irqrestore(&priv->common->mcpwm_spinlock, flags);

return OK;
}
Expand Down Expand Up @@ -1701,7 +1701,7 @@ static int IRAM_ATTR mcpwm_driver_isr_default(int irq, void *context,
struct mcpwm_motor_lowerhalf_s *priv = NULL;
#endif

flags = spin_lock_irqsave(common->mcpwm_spinlock);
flags = spin_lock_irqsave(&common->mcpwm_spinlock);
status = mcpwm_ll_intr_get_status(common->hal.dev);

/* Evaluate capture interrupt for all 3 cap channels */
Expand Down Expand Up @@ -1758,7 +1758,7 @@ static int IRAM_ATTR mcpwm_driver_isr_default(int irq, void *context,
#ifdef CONFIG_ESP_MCPWM_CAPTURE
if (lower == NULL)
{
spin_unlock_irqrestore(common->mcpwm_spinlock, flags);
spin_unlock_irqrestore(&common->mcpwm_spinlock, flags);
return OK;
}

Expand Down Expand Up @@ -1823,7 +1823,7 @@ static int IRAM_ATTR mcpwm_driver_isr_default(int irq, void *context,
}
#endif

spin_unlock_irqrestore(common->mcpwm_spinlock, flags);
spin_unlock_irqrestore(&common->mcpwm_spinlock, flags);
return OK;
}
#endif
Expand Down
22 changes: 11 additions & 11 deletions arch/xtensa/src/common/espressif/esp_rmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ static void rmt_module_enable(void)
{
irqstate_t flags;

flags = spin_lock_irqsave(g_rmtdev_common.rmt_spinlock);
flags = spin_lock_irqsave(&g_rmtdev_common.rmt_spinlock);

if (g_rmtdev_common.rmt_module_enabled == false)
{
Expand Down Expand Up @@ -501,7 +501,7 @@ static int rmt_set_rx_thr_intr_en(rmt_channel_t channel, bool en,
return -EINVAL;
}

flags = spin_lock_irqsave(g_rmtdev_common.rmt_spinlock);
flags = spin_lock_irqsave(&g_rmtdev_common.rmt_spinlock);
rmt_ll_rx_set_limit(g_rmtdev_common.hal.regs,
RMT_DECODE_RX_CHANNEL(channel), evt_thresh);
mask = RMT_LL_EVENT_RX_THRES(RMT_DECODE_RX_CHANNEL(channel));
Expand All @@ -510,7 +510,7 @@ static int rmt_set_rx_thr_intr_en(rmt_channel_t channel, bool en,
}
else
{
flags = spin_lock_irqsave(g_rmtdev_common.rmt_spinlock);
flags = spin_lock_irqsave(&g_rmtdev_common.rmt_spinlock);
mask = RMT_LL_EVENT_RX_THRES(RMT_DECODE_RX_CHANNEL(channel));
rmt_ll_enable_interrupt(g_rmtdev_common.hal.regs, mask, false);
spin_unlock_irqrestore(&g_rmtdev_common.rmt_spinlock, flags);
Expand Down Expand Up @@ -551,7 +551,7 @@ static int rmt_rx_start(rmt_channel_t channel, bool rx_idx_rst)

DEBUGASSERT(RMT_IS_RX_CHANNEL(channel));

flags = spin_lock_irqsave(g_rmtdev_common.rmt_spinlock);
flags = spin_lock_irqsave(&g_rmtdev_common.rmt_spinlock);

rmt_ll_rx_enable(g_rmtdev_common.hal.regs, ch, false);
if (rx_idx_rst)
Expand Down Expand Up @@ -598,7 +598,7 @@ static int rmt_tx_start(rmt_channel_t channel, bool tx_idx_rst)

DEBUGASSERT(RMT_IS_TX_CHANNEL(channel));

flags = spin_lock_irqsave(g_rmtdev_common.rmt_spinlock);
flags = spin_lock_irqsave(&g_rmtdev_common.rmt_spinlock);
if (tx_idx_rst)
{
rmt_ll_tx_reset_pointer(g_rmtdev_common.hal.regs, channel);
Expand Down Expand Up @@ -656,7 +656,7 @@ static int rmt_set_tx_loop_mode(rmt_channel_t channel, bool loop_en)

DEBUGASSERT(RMT_IS_TX_CHANNEL(channel));

flags = spin_lock_irqsave(g_rmtdev_common.rmt_spinlock);
flags = spin_lock_irqsave(&g_rmtdev_common.rmt_spinlock);
rmt_ll_tx_enable_loop(g_rmtdev_common.hal.regs, channel, loop_en);
spin_unlock_irqrestore(&g_rmtdev_common.rmt_spinlock, flags);

Expand Down Expand Up @@ -698,15 +698,15 @@ static int rmt_set_tx_thr_intr_en(rmt_channel_t channel, bool en,

DEBUGASSERT(evt_thresh <= item_block_len);

flags = spin_lock_irqsave(g_rmtdev_common.rmt_spinlock);
flags = spin_lock_irqsave(&g_rmtdev_common.rmt_spinlock);
rmt_ll_tx_set_limit(g_rmtdev_common.hal.regs, channel, evt_thresh);
rmt_ll_enable_interrupt(g_rmtdev_common.hal.regs,
RMT_LL_EVENT_TX_THRES(channel), true);
spin_unlock_irqrestore(&g_rmtdev_common.rmt_spinlock, flags);
}
else
{
flags = spin_lock_irqsave(g_rmtdev_common.rmt_spinlock);
flags = spin_lock_irqsave(&g_rmtdev_common.rmt_spinlock);
rmt_ll_enable_interrupt(g_rmtdev_common.hal.regs,
RMT_LL_EVENT_TX_THRES(channel), false);
spin_unlock_irqrestore(&g_rmtdev_common.rmt_spinlock, flags);
Expand Down Expand Up @@ -848,7 +848,7 @@ static int rmt_internal_config(rmt_dev_t *dev,
return -EINVAL;
}

flags = spin_lock_irqsave(g_rmtdev_common.rmt_spinlock);
flags = spin_lock_irqsave(&g_rmtdev_common.rmt_spinlock);

rmt_ll_enable_mem_access_nonfifo(dev, true);

Expand Down Expand Up @@ -913,7 +913,7 @@ static int rmt_internal_config(rmt_dev_t *dev,
uint8_t carrier_level = rmt_param->tx_config.carrier_level;
uint8_t idle_level = rmt_param->tx_config.idle_level;

flags = spin_lock_irqsave(g_rmtdev_common.rmt_spinlock);
flags = spin_lock_irqsave(&g_rmtdev_common.rmt_spinlock);
rmt_ll_tx_set_channel_clock_div(dev, channel, clk_div);
rmt_ll_tx_set_mem_blocks(dev, channel, mem_cnt);
rmt_ll_tx_reset_pointer(dev, channel);
Expand Down Expand Up @@ -965,7 +965,7 @@ static int rmt_internal_config(rmt_dev_t *dev,
uint8_t filter_cnt = rmt_param->rx_config.filter_ticks_thresh;
uint16_t threshold = rmt_param->rx_config.idle_threshold;

flags = spin_lock_irqsave(g_rmtdev_common.rmt_spinlock);
flags = spin_lock_irqsave(&g_rmtdev_common.rmt_spinlock);
rmt_ll_rx_set_channel_clock_div(dev, RMT_DECODE_RX_CHANNEL(channel),
clk_div);
rmt_ll_rx_set_mem_blocks(dev, RMT_DECODE_RX_CHANNEL(channel), mem_cnt);
Expand Down

0 comments on commit ffa975d

Please sign in to comment.