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
+2 -2
View File
@@ -37,7 +37,7 @@ static rt_size_t rt_pipe_read(rt_device_t dev,
void *buffer,
rt_size_t size)
{
rt_uint32_t level;
rt_base_t level;
rt_thread_t thread;
struct rt_audio_pipe *pipe;
rt_size_t read_nbytes;
@@ -119,7 +119,7 @@ static rt_size_t rt_pipe_write(rt_device_t dev,
const void *buffer,
rt_size_t size)
{
rt_uint32_t level;
rt_base_t level;
rt_thread_t thread;
struct rt_audio_pipe *pipe;
rt_size_t write_nbytes;
+6 -6
View File
@@ -91,7 +91,7 @@ rt_err_t rt_data_queue_push(struct rt_data_queue *queue,
rt_size_t data_size,
rt_int32_t timeout)
{
rt_ubase_t level;
rt_base_t level;
rt_thread_t thread;
rt_err_t result;
@@ -208,7 +208,7 @@ rt_err_t rt_data_queue_pop(struct rt_data_queue *queue,
rt_size_t *size,
rt_int32_t timeout)
{
rt_ubase_t level;
rt_base_t level;
rt_thread_t thread;
rt_err_t result;
@@ -330,7 +330,7 @@ rt_err_t rt_data_queue_peek(struct rt_data_queue *queue,
const void** data_ptr,
rt_size_t *size)
{
rt_ubase_t level;
rt_base_t level;
RT_ASSERT(queue != RT_NULL);
RT_ASSERT(queue->magic == DATAQUEUE_MAGIC);
@@ -361,7 +361,7 @@ RTM_EXPORT(rt_data_queue_peek);
*/
void rt_data_queue_reset(struct rt_data_queue *queue)
{
rt_ubase_t level;
rt_base_t level;
struct rt_thread *thread;
RT_ASSERT(queue != RT_NULL);
@@ -441,7 +441,7 @@ RTM_EXPORT(rt_data_queue_reset);
*/
rt_err_t rt_data_queue_deinit(struct rt_data_queue *queue)
{
rt_ubase_t level;
rt_base_t level;
RT_ASSERT(queue != RT_NULL);
RT_ASSERT(queue->magic == DATAQUEUE_MAGIC);
@@ -468,7 +468,7 @@ RTM_EXPORT(rt_data_queue_deinit);
*/
rt_uint16_t rt_data_queue_len(struct rt_data_queue *queue)
{
rt_ubase_t level;
rt_base_t level;
rt_int16_t len;
RT_ASSERT(queue != RT_NULL);
+7 -7
View File
@@ -510,7 +510,7 @@ void rt_pm_request(rt_uint8_t mode)
*/
void rt_pm_release(rt_uint8_t mode)
{
rt_ubase_t level;
rt_base_t level;
struct rt_pm *pm;
if (_pm_init_flag == 0)
@@ -535,7 +535,7 @@ void rt_pm_release(rt_uint8_t mode)
*/
void rt_pm_release_all(rt_uint8_t mode)
{
rt_ubase_t level;
rt_base_t level;
struct rt_pm *pm;
if (_pm_init_flag == 0)
@@ -589,7 +589,7 @@ void rt_pm_module_request(uint8_t module_id, rt_uint8_t mode)
*/
void rt_pm_module_release(uint8_t module_id, rt_uint8_t mode)
{
rt_ubase_t level;
rt_base_t level;
struct rt_pm *pm;
if (_pm_init_flag == 0)
@@ -620,7 +620,7 @@ void rt_pm_module_release(uint8_t module_id, rt_uint8_t mode)
*/
void rt_pm_module_release_all(uint8_t module_id, rt_uint8_t mode)
{
rt_ubase_t level;
rt_base_t level;
struct rt_pm *pm;
if (_pm_init_flag == 0)
@@ -646,7 +646,7 @@ void rt_pm_module_release_all(uint8_t module_id, rt_uint8_t mode)
*/
void rt_pm_sleep_request(rt_uint16_t module_id, rt_uint8_t mode)
{
rt_uint32_t level;
rt_base_t level;
if (module_id >= PM_MODULE_MAX_ID)
{
@@ -709,7 +709,7 @@ void rt_pm_sleep_light_request(rt_uint16_t module_id)
*/
void rt_pm_sleep_release(rt_uint16_t module_id, rt_uint8_t mode)
{
rt_uint32_t level;
rt_base_t level;
if (module_id >= PM_MODULE_MAX_ID)
{
@@ -797,7 +797,7 @@ void rt_pm_device_register(struct rt_device *device, const struct rt_device_pm_o
*/
void rt_pm_device_unregister(struct rt_device *device)
{
rt_ubase_t level;
rt_base_t level;
rt_uint32_t index;
RT_DEBUG_NOT_IN_INTERRUPT;
+1 -1
View File
@@ -85,7 +85,7 @@ static uint8_t spi_read_op(struct rt_spi_device *spi_device, uint8_t op, uint8_t
static void spi_write_op(struct rt_spi_device *spi_device, uint8_t op, uint8_t address, uint8_t data)
{
uint32_t level;
rt_base_t level;
uint8_t buffer[2];
level = rt_hw_interrupt_disable();
@@ -257,17 +257,17 @@ static void rt_usb_vcom_init(struct ufunction *func);
static void _vcom_reset_state(ufunction_t func)
{
struct vcom* data;
int lvl;
rt_base_t level;
RT_ASSERT(func != RT_NULL)
data = (struct vcom*)func->user_data;
lvl = rt_hw_interrupt_disable();
level = rt_hw_interrupt_disable();
data->connected = RT_FALSE;
data->in_sending = RT_FALSE;
/*rt_kprintf("reset USB serial\n", cnt);*/
rt_hw_interrupt_enable(lvl);
rt_hw_interrupt_enable(level);
}
/**
@@ -320,7 +320,7 @@ static rt_err_t _ep_in_handler(ufunction_t func, rt_size_t size)
*/
static rt_err_t _ep_out_handler(ufunction_t func, rt_size_t size)
{
rt_uint32_t level;
rt_base_t level;
struct vcom *data;
RT_ASSERT(func != RT_NULL);
@@ -687,7 +687,7 @@ static int _vcom_getc(struct rt_serial_device *serial)
{
int result;
rt_uint8_t ch;
rt_uint32_t level;
rt_base_t level;
struct ufunction *func;
struct vcom *data;
@@ -710,7 +710,7 @@ static int _vcom_getc(struct rt_serial_device *serial)
static rt_size_t _vcom_rb_block_put(struct vcom *data, const rt_uint8_t *buf, rt_size_t size)
{
rt_uint32_t level;
rt_base_t level;
rt_size_t put_len = 0;
rt_size_t w_ptr = 0;
rt_uint32_t res;
@@ -799,7 +799,7 @@ static rt_size_t _vcom_tx(struct rt_serial_device *serial, rt_uint8_t *buf, rt_s
}
static int _vcom_putc(struct rt_serial_device *serial, char c)
{
rt_uint32_t level;
rt_base_t level;
struct ufunction *func;
struct vcom *data;
@@ -838,7 +838,7 @@ static const struct rt_uart_ops usb_vcom_ops =
/* Vcom Tx Thread */
static void vcom_tx_thread_entry(void* parameter)
{
rt_uint32_t level;
rt_base_t level;
rt_uint32_t res;
struct ufunction *func = (struct ufunction *)parameter;
struct vcom *data = (struct vcom*)func->user_data;
+11 -11
View File
@@ -89,7 +89,7 @@ static void list_find_init(list_get_next_t *p, rt_uint8_t type, rt_list_t **arra
static rt_list_t *list_get_next(rt_list_t *current, list_get_next_t *arg)
{
int first_flag = 0;
rt_ubase_t level;
rt_base_t level;
rt_list_t *node, *list;
rt_list_t **array;
int nr;
@@ -153,7 +153,7 @@ static rt_list_t *list_get_next(rt_list_t *current, list_get_next_t *arg)
long list_thread(void)
{
rt_ubase_t level;
rt_base_t level;
list_get_next_t find_arg;
rt_list_t *obj_list[LIST_FIND_OBJ_NR];
rt_list_t *next = (rt_list_t *)RT_NULL;
@@ -267,7 +267,7 @@ static void show_wait_queue(struct rt_list_node *list)
#ifdef RT_USING_SEMAPHORE
long list_sem(void)
{
rt_ubase_t level;
rt_base_t level;
list_get_next_t find_arg;
rt_list_t *obj_list[LIST_FIND_OBJ_NR];
rt_list_t *next = (rt_list_t *)RT_NULL;
@@ -334,7 +334,7 @@ MSH_CMD_EXPORT(list_sem, list semaphore in system);
#ifdef RT_USING_EVENT
long list_event(void)
{
rt_ubase_t level;
rt_base_t level;
list_get_next_t find_arg;
rt_list_t *obj_list[LIST_FIND_OBJ_NR];
rt_list_t *next = (rt_list_t *)RT_NULL;
@@ -399,7 +399,7 @@ MSH_CMD_EXPORT(list_event, list event in system);
#ifdef RT_USING_MUTEX
long list_mutex(void)
{
rt_ubase_t level;
rt_base_t level;
list_get_next_t find_arg;
rt_list_t *obj_list[LIST_FIND_OBJ_NR];
rt_list_t *next = (rt_list_t *)RT_NULL;
@@ -457,7 +457,7 @@ MSH_CMD_EXPORT(list_mutex, list mutex in system);
#ifdef RT_USING_MAILBOX
long list_mailbox(void)
{
rt_ubase_t level;
rt_base_t level;
list_get_next_t find_arg;
rt_list_t *obj_list[LIST_FIND_OBJ_NR];
rt_list_t *next = (rt_list_t *)RT_NULL;
@@ -528,7 +528,7 @@ MSH_CMD_EXPORT(list_mailbox, list mail box in system);
#ifdef RT_USING_MESSAGEQUEUE
long list_msgqueue(void)
{
rt_ubase_t level;
rt_base_t level;
list_get_next_t find_arg;
rt_list_t *obj_list[LIST_FIND_OBJ_NR];
rt_list_t *next = (rt_list_t *)RT_NULL;
@@ -595,7 +595,7 @@ MSH_CMD_EXPORT(list_msgqueue, list message queue in system);
#ifdef RT_USING_MEMHEAP
long list_memheap(void)
{
rt_ubase_t level;
rt_base_t level;
list_get_next_t find_arg;
rt_list_t *obj_list[LIST_FIND_OBJ_NR];
rt_list_t *next = (rt_list_t *)RT_NULL;
@@ -652,7 +652,7 @@ MSH_CMD_EXPORT(list_memheap, list memory heap in system);
#ifdef RT_USING_MEMPOOL
long list_mempool(void)
{
rt_ubase_t level;
rt_base_t level;
list_get_next_t find_arg;
rt_list_t *obj_list[LIST_FIND_OBJ_NR];
rt_list_t *next = (rt_list_t *)RT_NULL;
@@ -731,7 +731,7 @@ MSH_CMD_EXPORT(list_mempool, list memory pool in system);
long list_timer(void)
{
rt_ubase_t level;
rt_base_t level;
list_get_next_t find_arg;
rt_list_t *obj_list[LIST_FIND_OBJ_NR];
rt_list_t *next = (rt_list_t *)RT_NULL;
@@ -829,7 +829,7 @@ static char *const device_type_str[RT_Device_Class_Unknown] =
long list_device(void)
{
rt_ubase_t level;
rt_base_t level;
list_get_next_t find_arg;
rt_list_t *obj_list[LIST_FIND_OBJ_NR];
rt_list_t *next = (rt_list_t *)RT_NULL;
+1 -1
View File
@@ -293,7 +293,7 @@ rt_uint32_t finsh_get_echo()
*/
rt_err_t finsh_set_password(const char *password)
{
rt_ubase_t level;
rt_base_t level;
rt_size_t pw_len = rt_strlen(password);
if (pw_len < FINSH_PASSWORD_MIN || pw_len > FINSH_PASSWORD_MAX)
+4 -4
View File
@@ -505,7 +505,7 @@ RTM_EXPORT(nanosleep);
static volatile struct timeval _timevalue;
static int _rt_clock_time_system_init(void)
{
register rt_base_t level;
rt_base_t level;
time_t time = 0;
rt_tick_t tick;
rt_device_t device;
@@ -593,7 +593,7 @@ int clock_gettime(clockid_t clockid, struct timespec *tp)
case CLOCK_REALTIME:
{
int tick;
register rt_base_t level;
rt_base_t level;
level = rt_hw_interrupt_disable();
tick = rt_tick_get(); /* get tick */
@@ -644,7 +644,7 @@ int clock_settime(clockid_t clockid, const struct timespec *tp)
LOG_W(_WARNING_NO_RTC);
return -1;
#else
register rt_base_t level;
rt_base_t level;
int second;
rt_tick_t tick;
rt_device_t device;
@@ -986,7 +986,7 @@ static volatile int8_t _current_timezone = RT_LIBC_DEFAULT_TIMEZONE;
void tz_set(int8_t tz)
{
register rt_base_t level;
rt_base_t level;
level = rt_hw_interrupt_disable();
_current_timezone = tz;
rt_hw_interrupt_enable(level);
+5 -5
View File
@@ -19,7 +19,7 @@
uint64_t __atomic_load_8(volatile void *ptr, int memorder)
{
volatile uint64_t *val_ptr = (volatile uint64_t *)ptr;
register rt_base_t level;
rt_base_t level;
uint64_t tmp;
level = rt_hw_interrupt_disable();
tmp = *val_ptr;
@@ -30,7 +30,7 @@ uint64_t __atomic_load_8(volatile void *ptr, int memorder)
void __atomic_store_8(volatile void *ptr, uint64_t val, int memorder)
{
volatile uint64_t *val_ptr = (volatile uint64_t *)ptr;
register rt_base_t level;
rt_base_t level;
level = rt_hw_interrupt_disable();
*val_ptr = val;
rt_hw_interrupt_enable(level);
@@ -39,7 +39,7 @@ void __atomic_store_8(volatile void *ptr, uint64_t val, int memorder)
uint64_t __atomic_exchange_8(volatile void *ptr, uint64_t val, int memorder)
{
volatile uint64_t *val_ptr = (volatile uint64_t *)ptr;
register rt_base_t level;
rt_base_t level;
uint64_t tmp;
level = rt_hw_interrupt_disable();
tmp = *val_ptr;
@@ -52,7 +52,7 @@ bool __atomic_compare_exchange_8(volatile void *ptr, volatile void *expected, ui
{
volatile uint64_t *val_ptr = (volatile uint64_t *)ptr;
volatile uint64_t *expected_ptr = (volatile uint64_t *)expected;
register rt_base_t level;
rt_base_t level;
bool exchanged;
level = rt_hw_interrupt_disable();
if (*val_ptr == *expected_ptr)
@@ -72,7 +72,7 @@ bool __atomic_compare_exchange_8(volatile void *ptr, volatile void *expected, ui
#define __atomic_fetch_op_8(OPNAME, OP) \
uint64_t __atomic_fetch_##OPNAME##_8(volatile void *ptr, uint64_t val, int memorder) {\
volatile uint64_t* val_ptr = (volatile uint64_t*)ptr;\
register rt_base_t level;\
rt_base_t level;\
uint64_t tmp;\
level = rt_hw_interrupt_disable();\
tmp = *val_ptr;\
+7 -6
View File
@@ -117,7 +117,7 @@ int aio_error (const struct aiocb *cb)
static void aio_fync_work(struct rt_work* work, void* work_data)
{
int result;
rt_ubase_t level;
rt_base_t level;
struct aiocb *cb = (struct aiocb*)work_data;
RT_ASSERT(cb != RT_NULL);
@@ -136,7 +136,7 @@ static void aio_fync_work(struct rt_work* work, void* work_data)
int aio_fsync(int op, struct aiocb *cb)
{
rt_ubase_t level;
rt_base_t level;
if (!cb) return -EINVAL;
level = rt_hw_interrupt_disable();
@@ -152,7 +152,7 @@ int aio_fsync(int op, struct aiocb *cb)
static void aio_read_work(struct rt_work* work, void* work_data)
{
int len;
rt_ubase_t level;
rt_base_t level;
uint8_t *buf_ptr;
struct aiocb *cb = (struct aiocb*)work_data;
@@ -222,7 +222,7 @@ static void aio_read_work(struct rt_work* work, void* work_data)
*/
int aio_read(struct aiocb *cb)
{
rt_ubase_t level;
rt_base_t level;
if (!cb) return -EINVAL;
if (cb->aio_offset < 0) return -EINVAL;
@@ -292,7 +292,8 @@ int aio_suspend(const struct aiocb *const list[], int nent,
static void aio_write_work(struct rt_work* work, void* work_data)
{
int len, oflags, level;
rt_base_t level;
int len, oflags;
uint8_t *buf_ptr;
struct aiocb *cb = (struct aiocb*)work_data;
@@ -361,7 +362,7 @@ static void aio_write_work(struct rt_work* work, void* work_data)
int aio_write(struct aiocb *cb)
{
int oflags;
rt_ubase_t level;
rt_base_t level;
if (!cb || (cb->aio_buf == NULL)) return -EINVAL;
+16 -16
View File
@@ -59,7 +59,7 @@ static rt_err_t console_getchar_rx_ind(rt_device_t dev, rt_size_t size)
void at_cli_init(void)
{
rt_base_t int_lvl;
rt_base_t level;
rt_device_t console;
rt_sem_init(&console_rx_notice, "cli_c", 0, RT_IPC_FLAG_FIFO);
@@ -69,7 +69,7 @@ void at_cli_init(void)
/* created must success */
RT_ASSERT(console_rx_fifo);
int_lvl = rt_hw_interrupt_disable();
level = rt_hw_interrupt_disable();
console = rt_console_get_device();
if (console)
{
@@ -78,22 +78,22 @@ void at_cli_init(void)
rt_device_set_rx_indicate(console, console_getchar_rx_ind);
}
rt_hw_interrupt_enable(int_lvl);
rt_hw_interrupt_enable(level);
}
void at_cli_deinit(void)
{
rt_base_t int_lvl;
rt_base_t level;
rt_device_t console;
int_lvl = rt_hw_interrupt_disable();
level = rt_hw_interrupt_disable();
console = rt_console_get_device();
if (console && odev_rx_ind)
{
/* restore RX indicate */
rt_device_set_rx_indicate(console, odev_rx_ind);
}
rt_hw_interrupt_enable(int_lvl);
rt_hw_interrupt_enable(level);
rt_sem_detach(&console_rx_notice);
rt_ringbuffer_destroy(console_rx_fifo);
@@ -111,14 +111,14 @@ static void server_cli_parser(void)
extern at_server_t at_get_server(void);
at_server_t server = at_get_server();
rt_base_t int_lvl;
rt_base_t level;
static rt_device_t device_bak;
static rt_err_t (*getchar_bak)(struct at_server *server, char *ch, rt_int32_t timeout);
static char endmark_back[AT_END_MARK_LEN];
/* backup server device and getchar function */
{
int_lvl = rt_hw_interrupt_disable();
level = rt_hw_interrupt_disable();
device_bak = server->device;
getchar_bak = server->get_char;
@@ -133,7 +133,7 @@ static void server_cli_parser(void)
rt_memset(server->end_mark, 0x00, AT_END_MARK_LEN);
server->end_mark[0] = '\r';
rt_hw_interrupt_enable(int_lvl);
rt_hw_interrupt_enable(level);
}
if (server)
@@ -149,7 +149,7 @@ static void server_cli_parser(void)
/* restore server device and getchar function */
{
int_lvl = rt_hw_interrupt_disable();
level = rt_hw_interrupt_disable();
server->device = device_bak;
server->get_char = getchar_bak;
@@ -157,7 +157,7 @@ static void server_cli_parser(void)
rt_memset(server->end_mark, 0x00, AT_END_MARK_LEN);
rt_memcpy(server->end_mark, endmark_back, strlen(endmark_back));
rt_hw_interrupt_enable(int_lvl);
rt_hw_interrupt_enable(level);
}
}
#endif /* AT_USING_SERVER */
@@ -211,7 +211,7 @@ static void client_cli_parser(at_client_t client)
char cur_line[FINSH_CMD_SIZE] = { 0 };
rt_size_t cur_line_len = 0;
static rt_err_t (*client_odev_rx_ind)(rt_device_t dev, rt_size_t size) = RT_NULL;
rt_base_t int_lvl;
rt_base_t level;
rt_thread_t at_client;
at_status_t client_odev_status;
@@ -225,10 +225,10 @@ static void client_cli_parser(at_client_t client)
/* backup client device RX indicate */
{
int_lvl = rt_hw_interrupt_disable();
level = rt_hw_interrupt_disable();
client_odev_rx_ind = client->device->rx_indicate;
rt_device_set_rx_indicate(client->device, client_getchar_rx_ind);
rt_hw_interrupt_enable(int_lvl);
rt_hw_interrupt_enable(level);
}
rt_sem_init(&client_rx_notice, "cli_r", 0, RT_IPC_FLAG_FIFO);
@@ -278,9 +278,9 @@ static void client_cli_parser(at_client_t client)
/* restore client device RX indicate */
{
int_lvl = rt_hw_interrupt_disable();
level = rt_hw_interrupt_disable();
rt_device_set_rx_indicate(client->device, client_odev_rx_ind);
rt_hw_interrupt_enable(int_lvl);
rt_hw_interrupt_enable(level);
}
rt_thread_delete(at_client);
+1 -2
View File
@@ -663,7 +663,7 @@ rt_err_t eth_device_ready(struct eth_device* dev)
rt_err_t eth_device_linkchange(struct eth_device* dev, rt_bool_t up)
{
rt_uint32_t level;
rt_base_t level;
RT_ASSERT(dev != RT_NULL);
@@ -740,7 +740,6 @@ static void eth_rx_thread_entry(void* parameter)
if (device->link_changed)
{
int status;
rt_uint32_t level;
level = rt_hw_interrupt_disable();
status = device->link_status;
+10 -10
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;
+4 -4
View File
@@ -86,7 +86,7 @@ void rt_prio_queue_detach(struct rt_prio_queue *que)
rt_thread_t thread;
/* disable interrupt */
rt_ubase_t temp = rt_hw_interrupt_disable();
rt_base_t level = rt_hw_interrupt_disable();
/* get next suspend thread */
thread = rt_list_entry(que->suspended_pop_list.next, struct rt_thread, tlist);
@@ -96,7 +96,7 @@ void rt_prio_queue_detach(struct rt_prio_queue *que)
rt_thread_resume(thread);
/* enable interrupt */
rt_hw_interrupt_enable(temp);
rt_hw_interrupt_enable(level);
}
rt_mp_detach(&que->pool);
}
@@ -136,7 +136,7 @@ rt_err_t rt_prio_queue_push(struct rt_prio_queue *que,
void *data,
rt_int32_t timeout)
{
rt_ubase_t level;
rt_base_t level;
struct rt_prio_queue_item *item;
RT_ASSERT(que);
@@ -182,7 +182,7 @@ rt_err_t rt_prio_queue_pop(struct rt_prio_queue *que,
void *data,
rt_int32_t timeout)
{
rt_ubase_t level;
rt_base_t level;
struct rt_prio_queue_item *item;
RT_ASSERT(que);
+14 -14
View File
@@ -222,7 +222,7 @@ static void _bus_out_entry(void *param)
/* wait for enough space */
while (sp < dnr)
{
rt_ubase_t lvl = rt_hw_interrupt_disable();
rt_base_t level = rt_hw_interrupt_disable();
RT_VBUS_OUT_RING->blocked = 1;
rt_vbus_smp_wmb();
@@ -235,7 +235,7 @@ static void _bus_out_entry(void *param)
RT_VBUS_OUT_RING->blocked = 0;
rt_hw_interrupt_enable(lvl);
rt_hw_interrupt_enable(level);
sp = _bus_ring_space_nr(RT_VBUS_OUT_RING);
}
@@ -474,11 +474,11 @@ rt_err_t rt_vbus_listen_on(rt_uint8_t chnr,
void rt_vbus_data_push(unsigned int id, struct rt_vbus_data *act)
{
rt_ubase_t lvl;
rt_base_t level;
RT_ASSERT(0 < id && id < RT_VBUS_CHANNEL_NR);
lvl = rt_hw_interrupt_disable();
level = rt_hw_interrupt_disable();
if (_bus_in_action[id][_IN_ACT_HEAD] == RT_NULL)
{
@@ -495,7 +495,7 @@ void rt_vbus_data_push(unsigned int id, struct rt_vbus_data *act)
_bus_in_action_nr[id]++;
#endif
rt_hw_interrupt_enable(lvl);
rt_hw_interrupt_enable(level);
#ifdef RT_VBUS_USING_FLOW_CONTROL
_chn_recv_wm[id].level++;
@@ -519,11 +519,11 @@ void rt_vbus_data_push(unsigned int id, struct rt_vbus_data *act)
struct rt_vbus_data* rt_vbus_data_pop(unsigned int id)
{
struct rt_vbus_data *act;
rt_ubase_t lvl;
rt_base_t level;
RT_ASSERT(0 < id && id < RT_VBUS_CHANNEL_NR);
lvl = rt_hw_interrupt_disable();
level = rt_hw_interrupt_disable();
act = _bus_in_action[id][_IN_ACT_HEAD];
if (act)
@@ -531,7 +531,7 @@ struct rt_vbus_data* rt_vbus_data_pop(unsigned int id)
_bus_in_action[id][_IN_ACT_HEAD] = act->next;
}
rt_hw_interrupt_enable(lvl);
rt_hw_interrupt_enable(level);
#ifdef RT_VBUS_USING_FLOW_CONTROL
if (_chn_recv_wm[id].level != 0)
@@ -901,9 +901,9 @@ int rt_vbus_request_chn(struct rt_vbus_request *req,
int i, chnr, err;
size_t plen = rt_strlen(req->name) + 2;
unsigned char *pbuf;
rt_ubase_t lvl;
rt_base_t level;
lvl = rt_hw_interrupt_disable();
level = rt_hw_interrupt_disable();
for (i = 0; i < ARRAY_SIZE(_sess); i++)
{
if (_sess[i].st == SESSIOM_AVAILABLE)
@@ -911,7 +911,7 @@ int rt_vbus_request_chn(struct rt_vbus_request *req,
}
if (i == ARRAY_SIZE(_sess))
{
rt_hw_interrupt_enable(lvl);
rt_hw_interrupt_enable(level);
return -RT_ERROR;
}
@@ -921,7 +921,7 @@ int rt_vbus_request_chn(struct rt_vbus_request *req,
if (req->is_server)
{
_sess[i].st = SESSIOM_LISTENING;
rt_hw_interrupt_enable(lvl);
rt_hw_interrupt_enable(level);
vbus_debug("request listening %s on %d\n", req->name, i);
@@ -933,12 +933,12 @@ int rt_vbus_request_chn(struct rt_vbus_request *req,
pbuf = rt_malloc(plen);
if (!pbuf)
{
rt_hw_interrupt_enable(lvl);
rt_hw_interrupt_enable(level);
return -RT_ENOMEM;
}
_sess[i].st = SESSIOM_ESTABLISHING;
rt_hw_interrupt_enable(lvl);
rt_hw_interrupt_enable(level);
pbuf[0] = RT_VBUS_CHN0_CMD_ENABLE;
rt_memcpy(pbuf+1, req->name, plen-1);
+9 -9
View File
@@ -41,7 +41,7 @@ void rt_wm_que_dump(struct rt_watermark_queue *wg);
rt_inline rt_err_t rt_wm_que_inc(struct rt_watermark_queue *wg,
int timeout)
{
rt_base_t ilvl;
rt_base_t level;
/* Assert as early as possible. */
if (timeout != 0)
@@ -49,7 +49,7 @@ rt_inline rt_err_t rt_wm_que_inc(struct rt_watermark_queue *wg,
RT_DEBUG_IN_THREAD_CONTEXT;
}
ilvl = rt_hw_interrupt_disable();
level = rt_hw_interrupt_disable();
while (wg->level > wg->high_mark)
{
@@ -57,7 +57,7 @@ rt_inline rt_err_t rt_wm_que_inc(struct rt_watermark_queue *wg,
if (timeout == 0)
{
rt_hw_interrupt_enable(ilvl);
rt_hw_interrupt_enable(level);
return -RT_EFULL;
}
@@ -72,12 +72,12 @@ rt_inline rt_err_t rt_wm_que_inc(struct rt_watermark_queue *wg,
&timeout);
rt_timer_start(&(thread->thread_timer));
}
rt_hw_interrupt_enable(ilvl);
rt_hw_interrupt_enable(level);
rt_schedule();
if (thread->error != RT_EOK)
return thread->error;
ilvl = rt_hw_interrupt_disable();
level = rt_hw_interrupt_disable();
}
wg->level++;
@@ -87,7 +87,7 @@ rt_inline rt_err_t rt_wm_que_inc(struct rt_watermark_queue *wg,
wg->level = ~0;
}
rt_hw_interrupt_enable(ilvl);
rt_hw_interrupt_enable(level);
return RT_EOK;
}
@@ -101,12 +101,12 @@ rt_inline rt_err_t rt_wm_que_inc(struct rt_watermark_queue *wg,
rt_inline void rt_wm_que_dec(struct rt_watermark_queue *wg)
{
int need_sched = 0;
rt_base_t ilvl;
rt_base_t level;
if (wg->level == 0)
return;
ilvl = rt_hw_interrupt_disable();
level = rt_hw_interrupt_disable();
wg->level--;
if (wg->level == wg->low_mark)
{
@@ -123,7 +123,7 @@ rt_inline void rt_wm_que_dec(struct rt_watermark_queue *wg)
need_sched = 1;
}
}
rt_hw_interrupt_enable(ilvl);
rt_hw_interrupt_enable(level);
if (need_sched)
rt_schedule();
+1 -1
View File
@@ -96,7 +96,7 @@ static void vmm_entry_glue(rt_uint32_t level,
void vmm_entry(struct vmm_entry_param *param)
{
rt_uint32_t level;
rt_base_t level;
level = rt_hw_interrupt_disable();