uniform code writing-disable interrupt

This commit is contained in:
thewon86
2022-04-20 10:56:11 +08:00
committed by guo
parent 5fa15a19a0
commit f5b0bfd3f4
47 changed files with 293 additions and 290 deletions

View File

@@ -627,7 +627,7 @@ rt_err_t rym_recv_on_device(
rt_err_t res;
rt_err_t (*odev_rx_ind)(rt_device_t dev, rt_size_t size);
rt_uint16_t odev_flag;
int int_lvl;
rt_base_t level;
RT_ASSERT(_rym_the_ctx == 0);
_rym_the_ctx = ctx;
@@ -641,13 +641,13 @@ rt_err_t rym_recv_on_device(
odev_rx_ind = dev->rx_indicate;
/* no data should be received before the device has been fully setted up.
*/
int_lvl = rt_hw_interrupt_disable();
level = rt_hw_interrupt_disable();
rt_device_set_rx_indicate(dev, _rym_rx_ind);
odev_flag = dev->open_flag;
/* make sure the device don't change the content. */
dev->open_flag &= ~RT_DEVICE_FLAG_STREAM;
rt_hw_interrupt_enable(int_lvl);
rt_hw_interrupt_enable(level);
res = rt_device_open(dev, oflag);
if (res != RT_EOK)
@@ -660,12 +660,12 @@ rt_err_t rym_recv_on_device(
__exit:
/* no rx_ind should be called before the callback has been fully detached.
*/
int_lvl = rt_hw_interrupt_disable();
level = rt_hw_interrupt_disable();
rt_sem_detach(&ctx->sem);
dev->open_flag = odev_flag;
rt_device_set_rx_indicate(dev, odev_rx_ind);
rt_hw_interrupt_enable(int_lvl);
rt_hw_interrupt_enable(level);
_rym_the_ctx = RT_NULL;
@@ -684,7 +684,7 @@ rt_err_t rym_send_on_device(
rt_err_t res = 0;
rt_err_t (*odev_rx_ind)(rt_device_t dev, rt_size_t size);
rt_uint16_t odev_flag;
int int_lvl;
rt_base_t level;
RT_ASSERT(_rym_the_ctx == 0);
_rym_the_ctx = ctx;
@@ -698,13 +698,13 @@ rt_err_t rym_send_on_device(
odev_rx_ind = dev->rx_indicate;
/* no data should be received before the device has been fully setted up.
*/
int_lvl = rt_hw_interrupt_disable();
level = rt_hw_interrupt_disable();
rt_device_set_rx_indicate(dev, _rym_rx_ind);
odev_flag = dev->open_flag;
/* make sure the device don't change the content. */
dev->open_flag &= ~RT_DEVICE_FLAG_STREAM;
rt_hw_interrupt_enable(int_lvl);
rt_hw_interrupt_enable(level);
res = rt_device_open(dev, oflag);
if (res != RT_EOK)
@@ -716,12 +716,12 @@ rt_err_t rym_send_on_device(
__exit:
int_lvl = rt_hw_interrupt_disable();
level = rt_hw_interrupt_disable();
rt_sem_detach(&ctx->sem);
dev->open_flag = odev_flag;
rt_device_set_rx_indicate(dev, odev_rx_ind);
rt_hw_interrupt_enable(int_lvl);
rt_hw_interrupt_enable(level);
_rym_the_ctx = RT_NULL;