uniform code writing-disable interrupt
This commit is contained in:
parent
5fa15a19a0
commit
f5b0bfd3f4
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;\
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -98,7 +98,7 @@ void rt_hw_spin_unlock(rt_hw_spinlock_t *lock)
|
|||
/** shutdown CPU */
|
||||
RT_WEAK void rt_hw_cpu_shutdown()
|
||||
{
|
||||
rt_uint32_t level;
|
||||
register rt_int32_t level;
|
||||
rt_kprintf("shutdown...\n");
|
||||
|
||||
level = rt_hw_interrupt_disable();
|
||||
|
|
|
@ -240,7 +240,7 @@ void rt_hw_mmu_init(void)
|
|||
int rt_hw_mmu_map(unsigned long addr, unsigned long size, unsigned long attr)
|
||||
{
|
||||
int ret;
|
||||
rt_ubase_t level;
|
||||
rt_base_t level;
|
||||
|
||||
level = rt_hw_interrupt_disable();
|
||||
ret = rt_hw_mmu_setmtt(addr, addr + size, addr, attr);
|
||||
|
|
|
@ -151,7 +151,7 @@ rt_base_t rt_hw_cpu_dcache_status()
|
|||
*/
|
||||
RT_WEAK void rt_hw_cpu_shutdown()
|
||||
{
|
||||
rt_uint32_t level;
|
||||
rt_base_t level;
|
||||
rt_kprintf("shutdown...\n");
|
||||
|
||||
level = rt_hw_interrupt_disable();
|
||||
|
|
|
@ -163,7 +163,7 @@ RT_WEAK void rt_hw_cpu_reset()
|
|||
*/
|
||||
RT_WEAK void rt_hw_cpu_shutdown()
|
||||
{
|
||||
rt_uint32_t level;
|
||||
rt_base_t level;
|
||||
rt_kprintf("shutdown...\n");
|
||||
|
||||
level = rt_hw_interrupt_disable();
|
||||
|
|
|
@ -164,7 +164,7 @@ RT_WEAK void rt_hw_cpu_reset()
|
|||
*/
|
||||
RT_WEAK void rt_hw_cpu_shutdown()
|
||||
{
|
||||
rt_uint32_t level;
|
||||
rt_base_t level;
|
||||
rt_kprintf("shutdown...\n");
|
||||
|
||||
level = rt_hw_interrupt_disable();
|
||||
|
|
|
@ -65,7 +65,7 @@ void rt_hw_spin_unlock(rt_hw_spinlock_t *lock)
|
|||
/** shutdown CPU */
|
||||
RT_WEAK void rt_hw_cpu_shutdown()
|
||||
{
|
||||
rt_uint32_t level;
|
||||
rt_base_t level;
|
||||
rt_kprintf("shutdown...\n");
|
||||
|
||||
level = rt_hw_interrupt_disable();
|
||||
|
|
|
@ -162,7 +162,7 @@ RT_WEAK void rt_hw_cpu_reset()
|
|||
*/
|
||||
RT_WEAK void rt_hw_cpu_shutdown()
|
||||
{
|
||||
rt_uint32_t level;
|
||||
rt_base_t level;
|
||||
rt_kprintf("shutdown...\n");
|
||||
|
||||
level = rt_hw_interrupt_disable();
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
/** shutdown CPU */
|
||||
RT_WEAK void rt_hw_cpu_shutdown()
|
||||
{
|
||||
rt_uint32_t level;
|
||||
rt_base_t level;
|
||||
rt_kprintf("shutdown...\n");
|
||||
|
||||
level = rt_hw_interrupt_disable();
|
||||
|
|
|
@ -173,7 +173,7 @@ RT_WEAK void rt_hw_cpu_reset()
|
|||
*/
|
||||
RT_WEAK void rt_hw_cpu_shutdown()
|
||||
{
|
||||
rt_uint32_t level;
|
||||
rt_base_t level;
|
||||
rt_kprintf("shutdown...\n");
|
||||
|
||||
level = rt_hw_interrupt_disable();
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
#include <rtthread.h>
|
||||
#include <sep4020.h>
|
||||
|
||||
extern rt_uint32_t rt_hw_interrupt_disable(void);
|
||||
extern rt_base_t rt_hw_interrupt_disable(void);
|
||||
|
||||
//TODO
|
||||
#warning I DON'T KNOW IF THE MMU OPERATION WORKS ON SEP4020
|
||||
|
@ -175,12 +175,14 @@ RT_WEAK void rt_hw_cpu_reset()
|
|||
*/
|
||||
RT_WEAK void rt_hw_cpu_shutdown()
|
||||
{
|
||||
rt_uint32_t UNUSED level;
|
||||
rt_base_t level;
|
||||
rt_kprintf("shutdown...\n");
|
||||
|
||||
level = rt_hw_interrupt_disable();
|
||||
|
||||
RT_ASSERT(RT_NULL);
|
||||
while (level)
|
||||
{
|
||||
RT_ASSERT(RT_NULL);
|
||||
}
|
||||
}
|
||||
|
||||
/*@}*/
|
||||
|
|
|
@ -25,7 +25,7 @@ void rt_hw_cpu_reset()
|
|||
*/
|
||||
void rt_hw_cpu_shutdown()
|
||||
{
|
||||
rt_uint32_t level;
|
||||
rt_base_t level;
|
||||
rt_kprintf("shutdown...\n");
|
||||
|
||||
level = rt_hw_interrupt_disable();
|
||||
|
|
|
@ -61,7 +61,7 @@ const char *exception_name[] = {
|
|||
|
||||
rt_base_t rt_hw_interrupt_disable(void)
|
||||
{
|
||||
rt_base_t status = read_c0_status();
|
||||
register rt_base_t status = read_c0_status();
|
||||
clear_c0_status(ST0_IE);
|
||||
return status;
|
||||
}
|
||||
|
|
|
@ -803,7 +803,8 @@ void *rt_hw_mmu_v2p(rt_mmu_info *mmu_info, void* v_addr)
|
|||
}
|
||||
|
||||
#ifdef RT_USING_USERSPACE
|
||||
void init_mm_setup(unsigned int *mtbl, unsigned int size, unsigned int pv_off) {
|
||||
void init_mm_setup(unsigned int *mtbl, unsigned int size, unsigned int pv_off)
|
||||
{
|
||||
unsigned int va;
|
||||
|
||||
for (va = 0; va < 0x1000; va++) {
|
||||
|
|
|
@ -77,7 +77,7 @@ void uic_interrupt(rt_uint32_t uic_base, int vec_base)
|
|||
rt_isr_handler_t rt_hw_interrupt_install(int vector, rt_isr_handler_t new_handler,
|
||||
void* param, const char* name)
|
||||
{
|
||||
int intVal;
|
||||
rt_base_t level;
|
||||
rt_isr_handler_t old_handler;
|
||||
|
||||
if (((int)vector < 0) || ((int) vector >= MAX_HANDLERS))
|
||||
|
@ -86,13 +86,13 @@ rt_isr_handler_t rt_hw_interrupt_install(int vector, rt_isr_handler_t new_handle
|
|||
}
|
||||
|
||||
/* install the handler in the system interrupt table */
|
||||
intVal = rt_hw_interrupt_disable (); /* lock interrupts to prevent races */
|
||||
level = rt_hw_interrupt_disable(); /* lock interrupts to prevent races */
|
||||
|
||||
old_handler = isr_table[vector].handler;
|
||||
isr_table[vector].handler = new_handler;
|
||||
isr_table[vector].param = param;
|
||||
|
||||
rt_hw_interrupt_enable (intVal);
|
||||
rt_hw_interrupt_enable(level);
|
||||
}
|
||||
|
||||
void rt_hw_interrupt_mask(int vector)
|
||||
|
|
|
@ -151,7 +151,7 @@ void sw_clearpend(void)
|
|||
*/
|
||||
rt_base_t rt_hw_interrupt_disable(void)
|
||||
{
|
||||
rt_base_t value = 0;
|
||||
register rt_base_t value = 0;
|
||||
asm("csrrw %0, mstatus, %1":"=r"(value):"r"(0x1800));
|
||||
return value;
|
||||
}
|
||||
|
@ -188,7 +188,7 @@ void rt_hw_context_switch_interrupt(rt_ubase_t from, rt_ubase_t to)
|
|||
/* shutdown CPU */
|
||||
void rt_hw_cpu_shutdown(void)
|
||||
{
|
||||
rt_uint32_t level;
|
||||
rt_base_t level;
|
||||
rt_kprintf("shutdown...\n");
|
||||
|
||||
level = rt_hw_interrupt_disable();
|
||||
|
|
|
@ -153,7 +153,7 @@ void rt_hw_context_switch_interrupt(rt_ubase_t from, rt_ubase_t to)
|
|||
/** shutdown CPU */
|
||||
RT_WEAK void rt_hw_cpu_shutdown()
|
||||
{
|
||||
rt_uint32_t level;
|
||||
rt_base_t level;
|
||||
rt_kprintf("shutdown...\n");
|
||||
|
||||
level = rt_hw_interrupt_disable();
|
||||
|
|
|
@ -152,7 +152,7 @@ void rt_hw_context_switch(rt_ubase_t from, rt_ubase_t to)
|
|||
*/
|
||||
RT_WEAK void rt_hw_cpu_shutdown()
|
||||
{
|
||||
rt_uint32_t level;
|
||||
rt_base_t level;
|
||||
rt_kprintf("shutdown...\n");
|
||||
|
||||
level = rt_hw_interrupt_disable();
|
||||
|
|
|
@ -137,7 +137,7 @@ rt_uint8_t *rt_hw_stack_init(void *tentry,
|
|||
/** shutdown CPU */
|
||||
RT_WEAK void rt_hw_cpu_shutdown()
|
||||
{
|
||||
rt_uint32_t level;
|
||||
rt_base_t level;
|
||||
rt_kprintf("shutdown...\n");
|
||||
|
||||
level = rt_hw_interrupt_disable();
|
||||
|
|
|
@ -102,7 +102,7 @@ void rt_hw_context_switch_interrupt(rt_ubase_t from, rt_ubase_t to)
|
|||
/** shutdown CPU */
|
||||
void rt_hw_cpu_shutdown()
|
||||
{
|
||||
rt_uint32_t level;
|
||||
rt_base_t level;
|
||||
rt_kprintf("shutdown...\n");
|
||||
|
||||
level = rt_hw_interrupt_disable();
|
||||
|
|
|
@ -262,7 +262,7 @@ RT_WEAK void rt_hw_cpu_reset()
|
|||
*/
|
||||
RT_WEAK void rt_hw_cpu_shutdown()
|
||||
{
|
||||
rt_uint32_t level;
|
||||
rt_base_t level;
|
||||
rt_kprintf("shutdown...\n");
|
||||
|
||||
level = rt_hw_interrupt_disable();
|
||||
|
|
|
@ -19,7 +19,7 @@ rt_hw_spinlock_t _cpus_lock;
|
|||
*/
|
||||
static void _cpu_preempt_disable(void)
|
||||
{
|
||||
register rt_base_t level;
|
||||
rt_base_t level;
|
||||
struct rt_thread *current_thread;
|
||||
|
||||
/* disable interrupt */
|
||||
|
@ -44,7 +44,7 @@ static void _cpu_preempt_disable(void)
|
|||
*/
|
||||
static void _cpu_preempt_enable(void)
|
||||
{
|
||||
register rt_base_t level;
|
||||
rt_base_t level;
|
||||
struct rt_thread *current_thread;
|
||||
|
||||
/* disable interrupt */
|
||||
|
|
10
src/idle.c
10
src/idle.c
|
@ -155,13 +155,13 @@ void rt_thread_defunct_enqueue(rt_thread_t thread)
|
|||
*/
|
||||
rt_thread_t rt_thread_defunct_dequeue(void)
|
||||
{
|
||||
register rt_base_t lock;
|
||||
rt_base_t level;
|
||||
rt_thread_t thread = RT_NULL;
|
||||
rt_list_t *l = &_rt_thread_defunct;
|
||||
|
||||
#ifdef RT_USING_SMP
|
||||
/* disable interrupt */
|
||||
lock = rt_hw_interrupt_disable();
|
||||
level = rt_hw_interrupt_disable();
|
||||
if (l->next != l)
|
||||
{
|
||||
thread = rt_list_entry(l->next,
|
||||
|
@ -169,16 +169,16 @@ rt_thread_t rt_thread_defunct_dequeue(void)
|
|||
tlist);
|
||||
rt_list_remove(&(thread->tlist));
|
||||
}
|
||||
rt_hw_interrupt_enable(lock);
|
||||
rt_hw_interrupt_enable(level);
|
||||
#else
|
||||
if (l->next != l)
|
||||
{
|
||||
thread = rt_list_entry(l->next,
|
||||
struct rt_thread,
|
||||
tlist);
|
||||
lock = rt_hw_interrupt_disable();
|
||||
level = rt_hw_interrupt_disable();
|
||||
rt_list_remove(&(thread->tlist));
|
||||
rt_hw_interrupt_enable(lock);
|
||||
rt_hw_interrupt_enable(level);
|
||||
}
|
||||
#endif
|
||||
return thread;
|
||||
|
|
166
src/ipc.c
166
src/ipc.c
|
@ -220,13 +220,13 @@ rt_inline rt_err_t _ipc_list_resume(rt_list_t *list)
|
|||
rt_inline rt_err_t _ipc_list_resume_all(rt_list_t *list)
|
||||
{
|
||||
struct rt_thread *thread;
|
||||
register rt_ubase_t temp;
|
||||
rt_base_t level;
|
||||
|
||||
/* wakeup all suspended threads */
|
||||
while (!rt_list_isempty(list))
|
||||
{
|
||||
/* disable interrupt */
|
||||
temp = rt_hw_interrupt_disable();
|
||||
level = rt_hw_interrupt_disable();
|
||||
|
||||
/* get next suspended thread */
|
||||
thread = rt_list_entry(list->next, struct rt_thread, tlist);
|
||||
|
@ -241,7 +241,7 @@ rt_inline rt_err_t _ipc_list_resume_all(rt_list_t *list)
|
|||
rt_thread_resume(thread);
|
||||
|
||||
/* enable interrupt */
|
||||
rt_hw_interrupt_enable(temp);
|
||||
rt_hw_interrupt_enable(level);
|
||||
}
|
||||
|
||||
return RT_EOK;
|
||||
|
@ -483,7 +483,7 @@ RTM_EXPORT(rt_sem_delete);
|
|||
*/
|
||||
rt_err_t rt_sem_take(rt_sem_t sem, rt_int32_t timeout)
|
||||
{
|
||||
register rt_base_t temp;
|
||||
rt_base_t level;
|
||||
struct rt_thread *thread;
|
||||
|
||||
/* parameter check */
|
||||
|
@ -493,7 +493,7 @@ rt_err_t rt_sem_take(rt_sem_t sem, rt_int32_t timeout)
|
|||
RT_OBJECT_HOOK_CALL(rt_object_trytake_hook, (&(sem->parent.parent)));
|
||||
|
||||
/* disable interrupt */
|
||||
temp = rt_hw_interrupt_disable();
|
||||
level = rt_hw_interrupt_disable();
|
||||
|
||||
RT_DEBUG_LOG(RT_DEBUG_IPC, ("thread %s take sem:%s, which value is: %d\n",
|
||||
rt_thread_self()->name,
|
||||
|
@ -506,14 +506,14 @@ rt_err_t rt_sem_take(rt_sem_t sem, rt_int32_t timeout)
|
|||
sem->value --;
|
||||
|
||||
/* enable interrupt */
|
||||
rt_hw_interrupt_enable(temp);
|
||||
rt_hw_interrupt_enable(level);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* no waiting, return with timeout */
|
||||
if (timeout == 0)
|
||||
{
|
||||
rt_hw_interrupt_enable(temp);
|
||||
rt_hw_interrupt_enable(level);
|
||||
|
||||
return -RT_ETIMEOUT;
|
||||
}
|
||||
|
@ -551,7 +551,7 @@ rt_err_t rt_sem_take(rt_sem_t sem, rt_int32_t timeout)
|
|||
}
|
||||
|
||||
/* enable interrupt */
|
||||
rt_hw_interrupt_enable(temp);
|
||||
rt_hw_interrupt_enable(level);
|
||||
|
||||
/* do schedule */
|
||||
rt_schedule();
|
||||
|
@ -605,7 +605,7 @@ RTM_EXPORT(rt_sem_trytake);
|
|||
*/
|
||||
rt_err_t rt_sem_release(rt_sem_t sem)
|
||||
{
|
||||
register rt_base_t temp;
|
||||
rt_base_t level;
|
||||
register rt_bool_t need_schedule;
|
||||
|
||||
/* parameter check */
|
||||
|
@ -617,7 +617,7 @@ rt_err_t rt_sem_release(rt_sem_t sem)
|
|||
need_schedule = RT_FALSE;
|
||||
|
||||
/* disable interrupt */
|
||||
temp = rt_hw_interrupt_disable();
|
||||
level = rt_hw_interrupt_disable();
|
||||
|
||||
RT_DEBUG_LOG(RT_DEBUG_IPC, ("thread %s releases sem:%s, which value is: %d\n",
|
||||
rt_thread_self()->name,
|
||||
|
@ -638,13 +638,13 @@ rt_err_t rt_sem_release(rt_sem_t sem)
|
|||
}
|
||||
else
|
||||
{
|
||||
rt_hw_interrupt_enable(temp); /* enable interrupt */
|
||||
rt_hw_interrupt_enable(level); /* enable interrupt */
|
||||
return -RT_EFULL; /* value overflowed */
|
||||
}
|
||||
}
|
||||
|
||||
/* enable interrupt */
|
||||
rt_hw_interrupt_enable(temp);
|
||||
rt_hw_interrupt_enable(level);
|
||||
|
||||
/* resume a thread, re-schedule */
|
||||
if (need_schedule == RT_TRUE)
|
||||
|
@ -671,7 +671,7 @@ RTM_EXPORT(rt_sem_release);
|
|||
*/
|
||||
rt_err_t rt_sem_control(rt_sem_t sem, int cmd, void *arg)
|
||||
{
|
||||
rt_ubase_t level;
|
||||
rt_base_t level;
|
||||
|
||||
/* parameter check */
|
||||
RT_ASSERT(sem != RT_NULL);
|
||||
|
@ -913,7 +913,7 @@ RTM_EXPORT(rt_mutex_delete);
|
|||
*/
|
||||
rt_err_t rt_mutex_take(rt_mutex_t mutex, rt_int32_t timeout)
|
||||
{
|
||||
register rt_base_t temp;
|
||||
rt_base_t level;
|
||||
struct rt_thread *thread;
|
||||
|
||||
/* this function must not be used in interrupt even if time = 0 */
|
||||
|
@ -928,7 +928,7 @@ rt_err_t rt_mutex_take(rt_mutex_t mutex, rt_int32_t timeout)
|
|||
thread = rt_thread_self();
|
||||
|
||||
/* disable interrupt */
|
||||
temp = rt_hw_interrupt_disable();
|
||||
level = rt_hw_interrupt_disable();
|
||||
|
||||
RT_OBJECT_HOOK_CALL(rt_object_trytake_hook, (&(mutex->parent.parent)));
|
||||
|
||||
|
@ -948,7 +948,7 @@ rt_err_t rt_mutex_take(rt_mutex_t mutex, rt_int32_t timeout)
|
|||
}
|
||||
else
|
||||
{
|
||||
rt_hw_interrupt_enable(temp); /* enable interrupt */
|
||||
rt_hw_interrupt_enable(level); /* enable interrupt */
|
||||
return -RT_EFULL; /* value overflowed */
|
||||
}
|
||||
}
|
||||
|
@ -971,7 +971,7 @@ rt_err_t rt_mutex_take(rt_mutex_t mutex, rt_int32_t timeout)
|
|||
}
|
||||
else
|
||||
{
|
||||
rt_hw_interrupt_enable(temp); /* enable interrupt */
|
||||
rt_hw_interrupt_enable(level); /* enable interrupt */
|
||||
return -RT_EFULL; /* value overflowed */
|
||||
}
|
||||
}
|
||||
|
@ -984,7 +984,7 @@ rt_err_t rt_mutex_take(rt_mutex_t mutex, rt_int32_t timeout)
|
|||
thread->error = -RT_ETIMEOUT;
|
||||
|
||||
/* enable interrupt */
|
||||
rt_hw_interrupt_enable(temp);
|
||||
rt_hw_interrupt_enable(level);
|
||||
|
||||
return -RT_ETIMEOUT;
|
||||
}
|
||||
|
@ -1023,7 +1023,7 @@ rt_err_t rt_mutex_take(rt_mutex_t mutex, rt_int32_t timeout)
|
|||
}
|
||||
|
||||
/* enable interrupt */
|
||||
rt_hw_interrupt_enable(temp);
|
||||
rt_hw_interrupt_enable(level);
|
||||
|
||||
/* do schedule */
|
||||
rt_schedule();
|
||||
|
@ -1037,14 +1037,14 @@ rt_err_t rt_mutex_take(rt_mutex_t mutex, rt_int32_t timeout)
|
|||
{
|
||||
/* the mutex is taken successfully. */
|
||||
/* disable interrupt */
|
||||
temp = rt_hw_interrupt_disable();
|
||||
level = rt_hw_interrupt_disable();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* enable interrupt */
|
||||
rt_hw_interrupt_enable(temp);
|
||||
rt_hw_interrupt_enable(level);
|
||||
|
||||
RT_OBJECT_HOOK_CALL(rt_object_take_hook, (&(mutex->parent.parent)));
|
||||
|
||||
|
@ -1089,7 +1089,7 @@ RTM_EXPORT(rt_mutex_trytake);
|
|||
*/
|
||||
rt_err_t rt_mutex_release(rt_mutex_t mutex)
|
||||
{
|
||||
register rt_base_t temp;
|
||||
rt_base_t level;
|
||||
struct rt_thread *thread;
|
||||
rt_bool_t need_schedule;
|
||||
|
||||
|
@ -1106,7 +1106,7 @@ rt_err_t rt_mutex_release(rt_mutex_t mutex)
|
|||
thread = rt_thread_self();
|
||||
|
||||
/* disable interrupt */
|
||||
temp = rt_hw_interrupt_disable();
|
||||
level = rt_hw_interrupt_disable();
|
||||
|
||||
RT_DEBUG_LOG(RT_DEBUG_IPC,
|
||||
("mutex_release:current thread %s, mutex value: %d, hold: %d\n",
|
||||
|
@ -1120,7 +1120,7 @@ rt_err_t rt_mutex_release(rt_mutex_t mutex)
|
|||
thread->error = -RT_ERROR;
|
||||
|
||||
/* enable interrupt */
|
||||
rt_hw_interrupt_enable(temp);
|
||||
rt_hw_interrupt_enable(level);
|
||||
|
||||
return -RT_ERROR;
|
||||
}
|
||||
|
@ -1159,7 +1159,7 @@ rt_err_t rt_mutex_release(rt_mutex_t mutex)
|
|||
}
|
||||
else
|
||||
{
|
||||
rt_hw_interrupt_enable(temp); /* enable interrupt */
|
||||
rt_hw_interrupt_enable(level); /* enable interrupt */
|
||||
return -RT_EFULL; /* value overflowed */
|
||||
}
|
||||
|
||||
|
@ -1177,7 +1177,7 @@ rt_err_t rt_mutex_release(rt_mutex_t mutex)
|
|||
}
|
||||
else
|
||||
{
|
||||
rt_hw_interrupt_enable(temp); /* enable interrupt */
|
||||
rt_hw_interrupt_enable(level); /* enable interrupt */
|
||||
return -RT_EFULL; /* value overflowed */
|
||||
}
|
||||
|
||||
|
@ -1188,7 +1188,7 @@ rt_err_t rt_mutex_release(rt_mutex_t mutex)
|
|||
}
|
||||
|
||||
/* enable interrupt */
|
||||
rt_hw_interrupt_enable(temp);
|
||||
rt_hw_interrupt_enable(level);
|
||||
|
||||
/* perform a schedule */
|
||||
if (need_schedule == RT_TRUE)
|
||||
|
@ -1441,7 +1441,7 @@ rt_err_t rt_event_send(rt_event_t event, rt_uint32_t set)
|
|||
{
|
||||
struct rt_list_node *n;
|
||||
struct rt_thread *thread;
|
||||
register rt_ubase_t level;
|
||||
rt_base_t level;
|
||||
register rt_base_t status;
|
||||
rt_bool_t need_schedule;
|
||||
|
||||
|
@ -1569,7 +1569,7 @@ rt_err_t rt_event_recv(rt_event_t event,
|
|||
rt_uint32_t *recved)
|
||||
{
|
||||
struct rt_thread *thread;
|
||||
register rt_ubase_t level;
|
||||
rt_base_t level;
|
||||
register rt_base_t status;
|
||||
|
||||
/* parameter check */
|
||||
|
@ -1702,7 +1702,7 @@ RTM_EXPORT(rt_event_recv);
|
|||
*/
|
||||
rt_err_t rt_event_control(rt_event_t event, int cmd, void *arg)
|
||||
{
|
||||
rt_ubase_t level;
|
||||
rt_base_t level;
|
||||
|
||||
/* parameter check */
|
||||
RT_ASSERT(event != RT_NULL);
|
||||
|
@ -1993,7 +1993,7 @@ rt_err_t rt_mb_send_wait(rt_mailbox_t mb,
|
|||
rt_int32_t timeout)
|
||||
{
|
||||
struct rt_thread *thread;
|
||||
register rt_ubase_t temp;
|
||||
rt_base_t level;
|
||||
rt_uint32_t tick_delta;
|
||||
|
||||
/* parameter check */
|
||||
|
@ -2011,12 +2011,12 @@ rt_err_t rt_mb_send_wait(rt_mailbox_t mb,
|
|||
RT_OBJECT_HOOK_CALL(rt_object_put_hook, (&(mb->parent.parent)));
|
||||
|
||||
/* disable interrupt */
|
||||
temp = rt_hw_interrupt_disable();
|
||||
level = rt_hw_interrupt_disable();
|
||||
|
||||
/* for non-blocking call */
|
||||
if (mb->entry == mb->size && timeout == 0)
|
||||
{
|
||||
rt_hw_interrupt_enable(temp);
|
||||
rt_hw_interrupt_enable(level);
|
||||
return -RT_EFULL;
|
||||
}
|
||||
|
||||
|
@ -2030,7 +2030,7 @@ rt_err_t rt_mb_send_wait(rt_mailbox_t mb,
|
|||
if (timeout == 0)
|
||||
{
|
||||
/* enable interrupt */
|
||||
rt_hw_interrupt_enable(temp);
|
||||
rt_hw_interrupt_enable(level);
|
||||
|
||||
return -RT_EFULL;
|
||||
}
|
||||
|
@ -2057,7 +2057,7 @@ rt_err_t rt_mb_send_wait(rt_mailbox_t mb,
|
|||
}
|
||||
|
||||
/* enable interrupt */
|
||||
rt_hw_interrupt_enable(temp);
|
||||
rt_hw_interrupt_enable(level);
|
||||
|
||||
/* re-schedule */
|
||||
rt_schedule();
|
||||
|
@ -2070,7 +2070,7 @@ rt_err_t rt_mb_send_wait(rt_mailbox_t mb,
|
|||
}
|
||||
|
||||
/* disable interrupt */
|
||||
temp = rt_hw_interrupt_disable();
|
||||
level = rt_hw_interrupt_disable();
|
||||
|
||||
/* if it's not waiting forever and then re-calculate timeout tick */
|
||||
if (timeout > 0)
|
||||
|
@ -2096,7 +2096,7 @@ rt_err_t rt_mb_send_wait(rt_mailbox_t mb,
|
|||
}
|
||||
else
|
||||
{
|
||||
rt_hw_interrupt_enable(temp); /* enable interrupt */
|
||||
rt_hw_interrupt_enable(level); /* enable interrupt */
|
||||
return -RT_EFULL; /* value overflowed */
|
||||
}
|
||||
|
||||
|
@ -2106,7 +2106,7 @@ rt_err_t rt_mb_send_wait(rt_mailbox_t mb,
|
|||
_ipc_list_resume(&(mb->parent.suspend_thread));
|
||||
|
||||
/* enable interrupt */
|
||||
rt_hw_interrupt_enable(temp);
|
||||
rt_hw_interrupt_enable(level);
|
||||
|
||||
rt_schedule();
|
||||
|
||||
|
@ -2114,7 +2114,7 @@ rt_err_t rt_mb_send_wait(rt_mailbox_t mb,
|
|||
}
|
||||
|
||||
/* enable interrupt */
|
||||
rt_hw_interrupt_enable(temp);
|
||||
rt_hw_interrupt_enable(level);
|
||||
|
||||
return RT_EOK;
|
||||
}
|
||||
|
@ -2163,7 +2163,7 @@ RTM_EXPORT(rt_mb_send);
|
|||
*/
|
||||
rt_err_t rt_mb_urgent(rt_mailbox_t mb, rt_ubase_t value)
|
||||
{
|
||||
register rt_ubase_t temp;
|
||||
rt_base_t level;
|
||||
|
||||
/* parameter check */
|
||||
RT_ASSERT(mb != RT_NULL);
|
||||
|
@ -2172,11 +2172,11 @@ rt_err_t rt_mb_urgent(rt_mailbox_t mb, rt_ubase_t value)
|
|||
RT_OBJECT_HOOK_CALL(rt_object_put_hook, (&(mb->parent.parent)));
|
||||
|
||||
/* disable interrupt */
|
||||
temp = rt_hw_interrupt_disable();
|
||||
level = rt_hw_interrupt_disable();
|
||||
|
||||
if (mb->entry == mb->size)
|
||||
{
|
||||
rt_hw_interrupt_enable(temp);
|
||||
rt_hw_interrupt_enable(level);
|
||||
return -RT_EFULL;
|
||||
}
|
||||
|
||||
|
@ -2202,7 +2202,7 @@ rt_err_t rt_mb_urgent(rt_mailbox_t mb, rt_ubase_t value)
|
|||
_ipc_list_resume(&(mb->parent.suspend_thread));
|
||||
|
||||
/* enable interrupt */
|
||||
rt_hw_interrupt_enable(temp);
|
||||
rt_hw_interrupt_enable(level);
|
||||
|
||||
rt_schedule();
|
||||
|
||||
|
@ -2210,7 +2210,7 @@ rt_err_t rt_mb_urgent(rt_mailbox_t mb, rt_ubase_t value)
|
|||
}
|
||||
|
||||
/* enable interrupt */
|
||||
rt_hw_interrupt_enable(temp);
|
||||
rt_hw_interrupt_enable(level);
|
||||
|
||||
return RT_EOK;
|
||||
}
|
||||
|
@ -2238,7 +2238,7 @@ RTM_EXPORT(rt_mb_urgent);
|
|||
rt_err_t rt_mb_recv(rt_mailbox_t mb, rt_ubase_t *value, rt_int32_t timeout)
|
||||
{
|
||||
struct rt_thread *thread;
|
||||
register rt_ubase_t temp;
|
||||
rt_base_t level;
|
||||
rt_uint32_t tick_delta;
|
||||
|
||||
/* parameter check */
|
||||
|
@ -2256,12 +2256,12 @@ rt_err_t rt_mb_recv(rt_mailbox_t mb, rt_ubase_t *value, rt_int32_t timeout)
|
|||
RT_OBJECT_HOOK_CALL(rt_object_trytake_hook, (&(mb->parent.parent)));
|
||||
|
||||
/* disable interrupt */
|
||||
temp = rt_hw_interrupt_disable();
|
||||
level = rt_hw_interrupt_disable();
|
||||
|
||||
/* for non-blocking call */
|
||||
if (mb->entry == 0 && timeout == 0)
|
||||
{
|
||||
rt_hw_interrupt_enable(temp);
|
||||
rt_hw_interrupt_enable(level);
|
||||
|
||||
return -RT_ETIMEOUT;
|
||||
}
|
||||
|
@ -2276,7 +2276,7 @@ rt_err_t rt_mb_recv(rt_mailbox_t mb, rt_ubase_t *value, rt_int32_t timeout)
|
|||
if (timeout == 0)
|
||||
{
|
||||
/* enable interrupt */
|
||||
rt_hw_interrupt_enable(temp);
|
||||
rt_hw_interrupt_enable(level);
|
||||
|
||||
thread->error = -RT_ETIMEOUT;
|
||||
|
||||
|
@ -2305,7 +2305,7 @@ rt_err_t rt_mb_recv(rt_mailbox_t mb, rt_ubase_t *value, rt_int32_t timeout)
|
|||
}
|
||||
|
||||
/* enable interrupt */
|
||||
rt_hw_interrupt_enable(temp);
|
||||
rt_hw_interrupt_enable(level);
|
||||
|
||||
/* re-schedule */
|
||||
rt_schedule();
|
||||
|
@ -2318,7 +2318,7 @@ rt_err_t rt_mb_recv(rt_mailbox_t mb, rt_ubase_t *value, rt_int32_t timeout)
|
|||
}
|
||||
|
||||
/* disable interrupt */
|
||||
temp = rt_hw_interrupt_disable();
|
||||
level = rt_hw_interrupt_disable();
|
||||
|
||||
/* if it's not waiting forever and then re-calculate timeout tick */
|
||||
if (timeout > 0)
|
||||
|
@ -2350,7 +2350,7 @@ rt_err_t rt_mb_recv(rt_mailbox_t mb, rt_ubase_t *value, rt_int32_t timeout)
|
|||
_ipc_list_resume(&(mb->suspend_sender_thread));
|
||||
|
||||
/* enable interrupt */
|
||||
rt_hw_interrupt_enable(temp);
|
||||
rt_hw_interrupt_enable(level);
|
||||
|
||||
RT_OBJECT_HOOK_CALL(rt_object_take_hook, (&(mb->parent.parent)));
|
||||
|
||||
|
@ -2360,7 +2360,7 @@ rt_err_t rt_mb_recv(rt_mailbox_t mb, rt_ubase_t *value, rt_int32_t timeout)
|
|||
}
|
||||
|
||||
/* enable interrupt */
|
||||
rt_hw_interrupt_enable(temp);
|
||||
rt_hw_interrupt_enable(level);
|
||||
|
||||
RT_OBJECT_HOOK_CALL(rt_object_take_hook, (&(mb->parent.parent)));
|
||||
|
||||
|
@ -2385,7 +2385,7 @@ RTM_EXPORT(rt_mb_recv);
|
|||
*/
|
||||
rt_err_t rt_mb_control(rt_mailbox_t mb, int cmd, void *arg)
|
||||
{
|
||||
rt_ubase_t level;
|
||||
rt_base_t level;
|
||||
|
||||
/* parameter check */
|
||||
RT_ASSERT(mb != RT_NULL);
|
||||
|
@ -2744,7 +2744,7 @@ rt_err_t rt_mq_send_wait(rt_mq_t mq,
|
|||
rt_size_t size,
|
||||
rt_int32_t timeout)
|
||||
{
|
||||
register rt_ubase_t temp;
|
||||
rt_base_t level;
|
||||
struct rt_mq_message *msg;
|
||||
rt_uint32_t tick_delta;
|
||||
struct rt_thread *thread;
|
||||
|
@ -2770,7 +2770,7 @@ rt_err_t rt_mq_send_wait(rt_mq_t mq,
|
|||
RT_OBJECT_HOOK_CALL(rt_object_put_hook, (&(mq->parent.parent)));
|
||||
|
||||
/* disable interrupt */
|
||||
temp = rt_hw_interrupt_disable();
|
||||
level = rt_hw_interrupt_disable();
|
||||
|
||||
/* get a free list, there must be an empty item */
|
||||
msg = (struct rt_mq_message *)mq->msg_queue_free;
|
||||
|
@ -2778,7 +2778,7 @@ rt_err_t rt_mq_send_wait(rt_mq_t mq,
|
|||
if (msg == RT_NULL && timeout == 0)
|
||||
{
|
||||
/* enable interrupt */
|
||||
rt_hw_interrupt_enable(temp);
|
||||
rt_hw_interrupt_enable(level);
|
||||
|
||||
return -RT_EFULL;
|
||||
}
|
||||
|
@ -2793,7 +2793,7 @@ rt_err_t rt_mq_send_wait(rt_mq_t mq,
|
|||
if (timeout == 0)
|
||||
{
|
||||
/* enable interrupt */
|
||||
rt_hw_interrupt_enable(temp);
|
||||
rt_hw_interrupt_enable(level);
|
||||
|
||||
return -RT_EFULL;
|
||||
}
|
||||
|
@ -2820,7 +2820,7 @@ rt_err_t rt_mq_send_wait(rt_mq_t mq,
|
|||
}
|
||||
|
||||
/* enable interrupt */
|
||||
rt_hw_interrupt_enable(temp);
|
||||
rt_hw_interrupt_enable(level);
|
||||
|
||||
/* re-schedule */
|
||||
rt_schedule();
|
||||
|
@ -2833,7 +2833,7 @@ rt_err_t rt_mq_send_wait(rt_mq_t mq,
|
|||
}
|
||||
|
||||
/* disable interrupt */
|
||||
temp = rt_hw_interrupt_disable();
|
||||
level = rt_hw_interrupt_disable();
|
||||
|
||||
/* if it's not waiting forever and then re-calculate timeout tick */
|
||||
if (timeout > 0)
|
||||
|
@ -2849,7 +2849,7 @@ rt_err_t rt_mq_send_wait(rt_mq_t mq,
|
|||
mq->msg_queue_free = msg->next;
|
||||
|
||||
/* enable interrupt */
|
||||
rt_hw_interrupt_enable(temp);
|
||||
rt_hw_interrupt_enable(level);
|
||||
|
||||
/* the msg is the new tailer of list, the next shall be NULL */
|
||||
msg->next = RT_NULL;
|
||||
|
@ -2857,7 +2857,7 @@ rt_err_t rt_mq_send_wait(rt_mq_t mq,
|
|||
rt_memcpy(msg + 1, buffer, size);
|
||||
|
||||
/* disable interrupt */
|
||||
temp = rt_hw_interrupt_disable();
|
||||
level = rt_hw_interrupt_disable();
|
||||
/* link msg to message queue */
|
||||
if (mq->msg_queue_tail != RT_NULL)
|
||||
{
|
||||
|
@ -2878,7 +2878,7 @@ rt_err_t rt_mq_send_wait(rt_mq_t mq,
|
|||
}
|
||||
else
|
||||
{
|
||||
rt_hw_interrupt_enable(temp); /* enable interrupt */
|
||||
rt_hw_interrupt_enable(level); /* enable interrupt */
|
||||
return -RT_EFULL; /* value overflowed */
|
||||
}
|
||||
|
||||
|
@ -2888,7 +2888,7 @@ rt_err_t rt_mq_send_wait(rt_mq_t mq,
|
|||
_ipc_list_resume(&(mq->parent.suspend_thread));
|
||||
|
||||
/* enable interrupt */
|
||||
rt_hw_interrupt_enable(temp);
|
||||
rt_hw_interrupt_enable(level);
|
||||
|
||||
rt_schedule();
|
||||
|
||||
|
@ -2896,7 +2896,7 @@ rt_err_t rt_mq_send_wait(rt_mq_t mq,
|
|||
}
|
||||
|
||||
/* enable interrupt */
|
||||
rt_hw_interrupt_enable(temp);
|
||||
rt_hw_interrupt_enable(level);
|
||||
|
||||
return RT_EOK;
|
||||
}
|
||||
|
@ -2952,7 +2952,7 @@ RTM_EXPORT(rt_mq_send);
|
|||
*/
|
||||
rt_err_t rt_mq_urgent(rt_mq_t mq, const void *buffer, rt_size_t size)
|
||||
{
|
||||
register rt_ubase_t temp;
|
||||
rt_base_t level;
|
||||
struct rt_mq_message *msg;
|
||||
|
||||
/* parameter check */
|
||||
|
@ -2968,7 +2968,7 @@ rt_err_t rt_mq_urgent(rt_mq_t mq, const void *buffer, rt_size_t size)
|
|||
RT_OBJECT_HOOK_CALL(rt_object_put_hook, (&(mq->parent.parent)));
|
||||
|
||||
/* disable interrupt */
|
||||
temp = rt_hw_interrupt_disable();
|
||||
level = rt_hw_interrupt_disable();
|
||||
|
||||
/* get a free list, there must be an empty item */
|
||||
msg = (struct rt_mq_message *)mq->msg_queue_free;
|
||||
|
@ -2976,7 +2976,7 @@ rt_err_t rt_mq_urgent(rt_mq_t mq, const void *buffer, rt_size_t size)
|
|||
if (msg == RT_NULL)
|
||||
{
|
||||
/* enable interrupt */
|
||||
rt_hw_interrupt_enable(temp);
|
||||
rt_hw_interrupt_enable(level);
|
||||
|
||||
return -RT_EFULL;
|
||||
}
|
||||
|
@ -2984,13 +2984,13 @@ rt_err_t rt_mq_urgent(rt_mq_t mq, const void *buffer, rt_size_t size)
|
|||
mq->msg_queue_free = msg->next;
|
||||
|
||||
/* enable interrupt */
|
||||
rt_hw_interrupt_enable(temp);
|
||||
rt_hw_interrupt_enable(level);
|
||||
|
||||
/* copy buffer */
|
||||
rt_memcpy(msg + 1, buffer, size);
|
||||
|
||||
/* disable interrupt */
|
||||
temp = rt_hw_interrupt_disable();
|
||||
level = rt_hw_interrupt_disable();
|
||||
|
||||
/* link msg to the beginning of message queue */
|
||||
msg->next = (struct rt_mq_message *)mq->msg_queue_head;
|
||||
|
@ -3007,7 +3007,7 @@ rt_err_t rt_mq_urgent(rt_mq_t mq, const void *buffer, rt_size_t size)
|
|||
}
|
||||
else
|
||||
{
|
||||
rt_hw_interrupt_enable(temp); /* enable interrupt */
|
||||
rt_hw_interrupt_enable(level); /* enable interrupt */
|
||||
return -RT_EFULL; /* value overflowed */
|
||||
}
|
||||
|
||||
|
@ -3017,7 +3017,7 @@ rt_err_t rt_mq_urgent(rt_mq_t mq, const void *buffer, rt_size_t size)
|
|||
_ipc_list_resume(&(mq->parent.suspend_thread));
|
||||
|
||||
/* enable interrupt */
|
||||
rt_hw_interrupt_enable(temp);
|
||||
rt_hw_interrupt_enable(level);
|
||||
|
||||
rt_schedule();
|
||||
|
||||
|
@ -3025,7 +3025,7 @@ rt_err_t rt_mq_urgent(rt_mq_t mq, const void *buffer, rt_size_t size)
|
|||
}
|
||||
|
||||
/* enable interrupt */
|
||||
rt_hw_interrupt_enable(temp);
|
||||
rt_hw_interrupt_enable(level);
|
||||
|
||||
return RT_EOK;
|
||||
}
|
||||
|
@ -3064,7 +3064,7 @@ rt_err_t rt_mq_recv(rt_mq_t mq,
|
|||
rt_int32_t timeout)
|
||||
{
|
||||
struct rt_thread *thread;
|
||||
register rt_ubase_t temp;
|
||||
rt_base_t level;
|
||||
struct rt_mq_message *msg;
|
||||
rt_uint32_t tick_delta;
|
||||
|
||||
|
@ -3084,12 +3084,12 @@ rt_err_t rt_mq_recv(rt_mq_t mq,
|
|||
RT_OBJECT_HOOK_CALL(rt_object_trytake_hook, (&(mq->parent.parent)));
|
||||
|
||||
/* disable interrupt */
|
||||
temp = rt_hw_interrupt_disable();
|
||||
level = rt_hw_interrupt_disable();
|
||||
|
||||
/* for non-blocking call */
|
||||
if (mq->entry == 0 && timeout == 0)
|
||||
{
|
||||
rt_hw_interrupt_enable(temp);
|
||||
rt_hw_interrupt_enable(level);
|
||||
|
||||
return -RT_ETIMEOUT;
|
||||
}
|
||||
|
@ -3104,7 +3104,7 @@ rt_err_t rt_mq_recv(rt_mq_t mq,
|
|||
if (timeout == 0)
|
||||
{
|
||||
/* enable interrupt */
|
||||
rt_hw_interrupt_enable(temp);
|
||||
rt_hw_interrupt_enable(level);
|
||||
|
||||
thread->error = -RT_ETIMEOUT;
|
||||
|
||||
|
@ -3133,7 +3133,7 @@ rt_err_t rt_mq_recv(rt_mq_t mq,
|
|||
}
|
||||
|
||||
/* enable interrupt */
|
||||
rt_hw_interrupt_enable(temp);
|
||||
rt_hw_interrupt_enable(level);
|
||||
|
||||
/* re-schedule */
|
||||
rt_schedule();
|
||||
|
@ -3146,7 +3146,7 @@ rt_err_t rt_mq_recv(rt_mq_t mq,
|
|||
}
|
||||
|
||||
/* disable interrupt */
|
||||
temp = rt_hw_interrupt_disable();
|
||||
level = rt_hw_interrupt_disable();
|
||||
|
||||
/* if it's not waiting forever and then re-calculate timeout tick */
|
||||
if (timeout > 0)
|
||||
|
@ -3174,13 +3174,13 @@ rt_err_t rt_mq_recv(rt_mq_t mq,
|
|||
}
|
||||
|
||||
/* enable interrupt */
|
||||
rt_hw_interrupt_enable(temp);
|
||||
rt_hw_interrupt_enable(level);
|
||||
|
||||
/* copy message */
|
||||
rt_memcpy(buffer, msg + 1, size > mq->msg_size ? mq->msg_size : size);
|
||||
|
||||
/* disable interrupt */
|
||||
temp = rt_hw_interrupt_disable();
|
||||
level = rt_hw_interrupt_disable();
|
||||
/* put message to free list */
|
||||
msg->next = (struct rt_mq_message *)mq->msg_queue_free;
|
||||
mq->msg_queue_free = msg;
|
||||
|
@ -3191,7 +3191,7 @@ rt_err_t rt_mq_recv(rt_mq_t mq,
|
|||
_ipc_list_resume(&(mq->suspend_sender_thread));
|
||||
|
||||
/* enable interrupt */
|
||||
rt_hw_interrupt_enable(temp);
|
||||
rt_hw_interrupt_enable(level);
|
||||
|
||||
RT_OBJECT_HOOK_CALL(rt_object_take_hook, (&(mq->parent.parent)));
|
||||
|
||||
|
@ -3201,7 +3201,7 @@ rt_err_t rt_mq_recv(rt_mq_t mq,
|
|||
}
|
||||
|
||||
/* enable interrupt */
|
||||
rt_hw_interrupt_enable(temp);
|
||||
rt_hw_interrupt_enable(level);
|
||||
|
||||
RT_OBJECT_HOOK_CALL(rt_object_take_hook, (&(mq->parent.parent)));
|
||||
|
||||
|
@ -3226,7 +3226,7 @@ RTM_EXPORT(rt_mq_recv);
|
|||
*/
|
||||
rt_err_t rt_mq_control(rt_mq_t mq, int cmd, void *arg)
|
||||
{
|
||||
rt_ubase_t level;
|
||||
rt_base_t level;
|
||||
struct rt_mq_message *msg;
|
||||
|
||||
/* parameter check */
|
||||
|
|
|
@ -563,7 +563,7 @@ RTM_EXPORT(rt_smem_free);
|
|||
int memcheck(int argc, char *argv[])
|
||||
{
|
||||
int position;
|
||||
rt_ubase_t level;
|
||||
rt_base_t level;
|
||||
struct rt_small_mem_item *mem;
|
||||
struct rt_small_mem *m;
|
||||
struct rt_object_information *information;
|
||||
|
|
|
@ -146,7 +146,7 @@ RTM_EXPORT(rt_mp_init);
|
|||
rt_err_t rt_mp_detach(struct rt_mempool *mp)
|
||||
{
|
||||
struct rt_thread *thread;
|
||||
register rt_ubase_t level;
|
||||
rt_base_t level;
|
||||
|
||||
/* parameter check */
|
||||
RT_ASSERT(mp != RT_NULL);
|
||||
|
@ -264,7 +264,7 @@ RTM_EXPORT(rt_mp_create);
|
|||
rt_err_t rt_mp_delete(rt_mp_t mp)
|
||||
{
|
||||
struct rt_thread *thread;
|
||||
register rt_ubase_t level;
|
||||
rt_base_t level;
|
||||
|
||||
RT_DEBUG_NOT_IN_INTERRUPT;
|
||||
|
||||
|
@ -319,7 +319,7 @@ RTM_EXPORT(rt_mp_delete);
|
|||
void *rt_mp_alloc(rt_mp_t mp, rt_int32_t time)
|
||||
{
|
||||
rt_uint8_t *block_ptr;
|
||||
register rt_base_t level;
|
||||
rt_base_t level;
|
||||
struct rt_thread *thread;
|
||||
rt_uint32_t before_sleep = 0;
|
||||
|
||||
|
@ -417,7 +417,7 @@ void rt_mp_free(void *block)
|
|||
rt_uint8_t **block_ptr;
|
||||
struct rt_mempool *mp;
|
||||
struct rt_thread *thread;
|
||||
register rt_base_t level;
|
||||
rt_base_t level;
|
||||
|
||||
/* parameter check */
|
||||
if (block == RT_NULL) return;
|
||||
|
|
28
src/object.c
28
src/object.c
|
@ -253,7 +253,7 @@ RTM_EXPORT(rt_object_get_information);
|
|||
int rt_object_get_length(enum rt_object_class_type type)
|
||||
{
|
||||
int count = 0;
|
||||
rt_ubase_t level;
|
||||
rt_base_t level;
|
||||
struct rt_list_node *node = RT_NULL;
|
||||
struct rt_object_information *information = RT_NULL;
|
||||
|
||||
|
@ -288,7 +288,7 @@ RTM_EXPORT(rt_object_get_length);
|
|||
int rt_object_get_pointers(enum rt_object_class_type type, rt_object_t *pointers, int maxlen)
|
||||
{
|
||||
int index = 0;
|
||||
rt_ubase_t level;
|
||||
rt_base_t level;
|
||||
|
||||
struct rt_object *object;
|
||||
struct rt_list_node *node = RT_NULL;
|
||||
|
@ -330,7 +330,7 @@ void rt_object_init(struct rt_object *object,
|
|||
enum rt_object_class_type type,
|
||||
const char *name)
|
||||
{
|
||||
register rt_base_t temp;
|
||||
rt_base_t level;
|
||||
struct rt_list_node *node = RT_NULL;
|
||||
struct rt_object_information *information;
|
||||
#ifdef RT_USING_MODULE
|
||||
|
@ -370,7 +370,7 @@ void rt_object_init(struct rt_object *object,
|
|||
RT_OBJECT_HOOK_CALL(rt_object_attach_hook, (object));
|
||||
|
||||
/* lock interrupt */
|
||||
temp = rt_hw_interrupt_disable();
|
||||
level = rt_hw_interrupt_disable();
|
||||
|
||||
#ifdef RT_USING_MODULE
|
||||
if (module)
|
||||
|
@ -386,7 +386,7 @@ void rt_object_init(struct rt_object *object,
|
|||
}
|
||||
|
||||
/* unlock interrupt */
|
||||
rt_hw_interrupt_enable(temp);
|
||||
rt_hw_interrupt_enable(level);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -397,7 +397,7 @@ void rt_object_init(struct rt_object *object,
|
|||
*/
|
||||
void rt_object_detach(rt_object_t object)
|
||||
{
|
||||
register rt_base_t temp;
|
||||
rt_base_t level;
|
||||
|
||||
/* object check */
|
||||
RT_ASSERT(object != RT_NULL);
|
||||
|
@ -408,13 +408,13 @@ void rt_object_detach(rt_object_t object)
|
|||
object->type = 0;
|
||||
|
||||
/* lock interrupt */
|
||||
temp = rt_hw_interrupt_disable();
|
||||
level = rt_hw_interrupt_disable();
|
||||
|
||||
/* remove from old list */
|
||||
rt_list_remove(&(object->list));
|
||||
|
||||
/* unlock interrupt */
|
||||
rt_hw_interrupt_enable(temp);
|
||||
rt_hw_interrupt_enable(level);
|
||||
}
|
||||
|
||||
#ifdef RT_USING_HEAP
|
||||
|
@ -430,7 +430,7 @@ void rt_object_detach(rt_object_t object)
|
|||
rt_object_t rt_object_allocate(enum rt_object_class_type type, const char *name)
|
||||
{
|
||||
struct rt_object *object;
|
||||
register rt_base_t temp;
|
||||
rt_base_t level;
|
||||
struct rt_object_information *information;
|
||||
#ifdef RT_USING_MODULE
|
||||
struct rt_dlmodule *module = dlmodule_self();
|
||||
|
@ -466,7 +466,7 @@ rt_object_t rt_object_allocate(enum rt_object_class_type type, const char *name)
|
|||
RT_OBJECT_HOOK_CALL(rt_object_attach_hook, (object));
|
||||
|
||||
/* lock interrupt */
|
||||
temp = rt_hw_interrupt_disable();
|
||||
level = rt_hw_interrupt_disable();
|
||||
|
||||
#ifdef RT_USING_MODULE
|
||||
if (module)
|
||||
|
@ -482,7 +482,7 @@ rt_object_t rt_object_allocate(enum rt_object_class_type type, const char *name)
|
|||
}
|
||||
|
||||
/* unlock interrupt */
|
||||
rt_hw_interrupt_enable(temp);
|
||||
rt_hw_interrupt_enable(level);
|
||||
|
||||
/* return object */
|
||||
return object;
|
||||
|
@ -495,7 +495,7 @@ rt_object_t rt_object_allocate(enum rt_object_class_type type, const char *name)
|
|||
*/
|
||||
void rt_object_delete(rt_object_t object)
|
||||
{
|
||||
register rt_base_t temp;
|
||||
rt_base_t level;
|
||||
|
||||
/* object check */
|
||||
RT_ASSERT(object != RT_NULL);
|
||||
|
@ -507,13 +507,13 @@ void rt_object_delete(rt_object_t object)
|
|||
object->type = RT_Object_Class_Null;
|
||||
|
||||
/* lock interrupt */
|
||||
temp = rt_hw_interrupt_disable();
|
||||
level = rt_hw_interrupt_disable();
|
||||
|
||||
/* remove from old list */
|
||||
rt_list_remove(&(object->list));
|
||||
|
||||
/* unlock interrupt */
|
||||
rt_hw_interrupt_enable(temp);
|
||||
rt_hw_interrupt_enable(level);
|
||||
|
||||
/* free the memory of object */
|
||||
RT_KERNEL_FREE(object);
|
||||
|
|
|
@ -103,7 +103,7 @@ static void _rt_scheduler_stack_check(struct rt_thread *thread)
|
|||
(rt_ubase_t)thread->sp >
|
||||
(rt_ubase_t)thread->stack_addr + (rt_ubase_t)thread->stack_size)
|
||||
{
|
||||
rt_ubase_t level;
|
||||
rt_base_t level;
|
||||
|
||||
rt_kprintf("thread:%s stack overflow\n", thread->name);
|
||||
|
||||
|
@ -655,7 +655,7 @@ void rt_schedule_insert_thread(struct rt_thread *thread)
|
|||
int cpu_id;
|
||||
int bind_cpu;
|
||||
rt_uint32_t cpu_mask;
|
||||
register rt_base_t level;
|
||||
rt_base_t level;
|
||||
|
||||
RT_ASSERT(thread != RT_NULL);
|
||||
|
||||
|
@ -717,12 +717,12 @@ __exit:
|
|||
#else
|
||||
void rt_schedule_insert_thread(struct rt_thread *thread)
|
||||
{
|
||||
register rt_base_t temp;
|
||||
rt_base_t level;
|
||||
|
||||
RT_ASSERT(thread != RT_NULL);
|
||||
|
||||
/* disable interrupt */
|
||||
temp = rt_hw_interrupt_disable();
|
||||
level = rt_hw_interrupt_disable();
|
||||
|
||||
/* it's current thread, it should be RUNNING thread */
|
||||
if (thread == rt_current_thread)
|
||||
|
@ -748,7 +748,7 @@ void rt_schedule_insert_thread(struct rt_thread *thread)
|
|||
|
||||
__exit:
|
||||
/* enable interrupt */
|
||||
rt_hw_interrupt_enable(temp);
|
||||
rt_hw_interrupt_enable(level);
|
||||
}
|
||||
#endif /* RT_USING_SMP */
|
||||
|
||||
|
@ -762,7 +762,7 @@ __exit:
|
|||
#ifdef RT_USING_SMP
|
||||
void rt_schedule_remove_thread(struct rt_thread *thread)
|
||||
{
|
||||
register rt_base_t level;
|
||||
rt_base_t level;
|
||||
|
||||
RT_ASSERT(thread != RT_NULL);
|
||||
|
||||
|
@ -814,7 +814,7 @@ void rt_schedule_remove_thread(struct rt_thread *thread)
|
|||
#else
|
||||
void rt_schedule_remove_thread(struct rt_thread *thread)
|
||||
{
|
||||
register rt_base_t level;
|
||||
rt_base_t level;
|
||||
|
||||
RT_ASSERT(thread != RT_NULL);
|
||||
|
||||
|
@ -851,7 +851,7 @@ void rt_schedule_remove_thread(struct rt_thread *thread)
|
|||
#ifdef RT_USING_SMP
|
||||
void rt_enter_critical(void)
|
||||
{
|
||||
register rt_base_t level;
|
||||
rt_base_t level;
|
||||
struct rt_thread *current_thread;
|
||||
|
||||
/* disable interrupt */
|
||||
|
@ -890,7 +890,7 @@ void rt_enter_critical(void)
|
|||
#else
|
||||
void rt_enter_critical(void)
|
||||
{
|
||||
register rt_base_t level;
|
||||
rt_base_t level;
|
||||
|
||||
/* disable interrupt */
|
||||
level = rt_hw_interrupt_disable();
|
||||
|
@ -913,7 +913,7 @@ RTM_EXPORT(rt_enter_critical);
|
|||
#ifdef RT_USING_SMP
|
||||
void rt_exit_critical(void)
|
||||
{
|
||||
register rt_base_t level;
|
||||
rt_base_t level;
|
||||
struct rt_thread *current_thread;
|
||||
|
||||
/* disable interrupt */
|
||||
|
@ -954,7 +954,7 @@ void rt_exit_critical(void)
|
|||
#else
|
||||
void rt_exit_critical(void)
|
||||
{
|
||||
register rt_base_t level;
|
||||
rt_base_t level;
|
||||
|
||||
/* disable interrupt */
|
||||
level = rt_hw_interrupt_disable();
|
||||
|
|
|
@ -91,7 +91,7 @@ static void _signal_entry(void *parameter)
|
|||
*/
|
||||
static void _signal_deliver(rt_thread_t tid)
|
||||
{
|
||||
rt_ubase_t level;
|
||||
rt_base_t level;
|
||||
|
||||
level = rt_hw_interrupt_disable();
|
||||
|
||||
|
@ -321,7 +321,7 @@ void rt_signal_unmask(int signo)
|
|||
int rt_signal_wait(const rt_sigset_t *set, rt_siginfo_t *si, rt_int32_t timeout)
|
||||
{
|
||||
int ret = RT_EOK;
|
||||
rt_base_t level;
|
||||
rt_base_t level;
|
||||
rt_thread_t tid = rt_thread_self();
|
||||
struct siginfo_node *si_node = RT_NULL, *si_prev = RT_NULL;
|
||||
|
||||
|
|
54
src/thread.c
54
src/thread.c
|
@ -91,7 +91,7 @@ void rt_thread_inited_sethook(void (*hook)(rt_thread_t thread))
|
|||
static void _thread_exit(void)
|
||||
{
|
||||
struct rt_thread *thread;
|
||||
register rt_base_t level;
|
||||
rt_base_t level;
|
||||
|
||||
/* get current thread */
|
||||
thread = rt_thread_self();
|
||||
|
@ -127,7 +127,7 @@ static void _thread_exit(void)
|
|||
static void _thread_timeout(void *parameter)
|
||||
{
|
||||
struct rt_thread *thread;
|
||||
register rt_base_t temp;
|
||||
rt_base_t level;
|
||||
|
||||
thread = (struct rt_thread *)parameter;
|
||||
|
||||
|
@ -137,7 +137,7 @@ static void _thread_timeout(void *parameter)
|
|||
RT_ASSERT(rt_object_get_type((rt_object_t)thread) == RT_Object_Class_Thread);
|
||||
|
||||
/* disable interrupt */
|
||||
temp = rt_hw_interrupt_disable();
|
||||
level = rt_hw_interrupt_disable();
|
||||
|
||||
/* set error number */
|
||||
thread->error = -RT_ETIMEOUT;
|
||||
|
@ -149,7 +149,7 @@ static void _thread_timeout(void *parameter)
|
|||
rt_schedule_insert_thread(thread);
|
||||
|
||||
/* enable interrupt */
|
||||
rt_hw_interrupt_enable(temp);
|
||||
rt_hw_interrupt_enable(level);
|
||||
|
||||
/* do schedule */
|
||||
rt_schedule();
|
||||
|
@ -327,7 +327,7 @@ RTM_EXPORT(rt_thread_init);
|
|||
rt_thread_t rt_thread_self(void)
|
||||
{
|
||||
#ifdef RT_USING_SMP
|
||||
rt_base_t lock;
|
||||
register rt_base_t lock;
|
||||
rt_thread_t self;
|
||||
|
||||
lock = rt_hw_local_irq_disable();
|
||||
|
@ -393,7 +393,7 @@ RTM_EXPORT(rt_thread_startup);
|
|||
*/
|
||||
rt_err_t rt_thread_detach(rt_thread_t thread)
|
||||
{
|
||||
rt_base_t lock;
|
||||
rt_base_t level;
|
||||
|
||||
/* parameter check */
|
||||
RT_ASSERT(thread != RT_NULL);
|
||||
|
@ -410,7 +410,7 @@ rt_err_t rt_thread_detach(rt_thread_t thread)
|
|||
}
|
||||
|
||||
/* disable interrupt */
|
||||
lock = rt_hw_interrupt_disable();
|
||||
level = rt_hw_interrupt_disable();
|
||||
|
||||
/* release thread timer */
|
||||
rt_timer_detach(&(thread->thread_timer));
|
||||
|
@ -422,7 +422,7 @@ rt_err_t rt_thread_detach(rt_thread_t thread)
|
|||
rt_thread_defunct_enqueue(thread);
|
||||
|
||||
/* enable interrupt */
|
||||
rt_hw_interrupt_enable(lock);
|
||||
rt_hw_interrupt_enable(level);
|
||||
|
||||
return RT_EOK;
|
||||
}
|
||||
|
@ -496,7 +496,7 @@ RTM_EXPORT(rt_thread_create);
|
|||
*/
|
||||
rt_err_t rt_thread_delete(rt_thread_t thread)
|
||||
{
|
||||
rt_base_t lock;
|
||||
rt_base_t level;
|
||||
|
||||
/* parameter check */
|
||||
RT_ASSERT(thread != RT_NULL);
|
||||
|
@ -513,7 +513,7 @@ rt_err_t rt_thread_delete(rt_thread_t thread)
|
|||
}
|
||||
|
||||
/* disable interrupt */
|
||||
lock = rt_hw_interrupt_disable();
|
||||
level = rt_hw_interrupt_disable();
|
||||
|
||||
/* release thread timer */
|
||||
rt_timer_detach(&(thread->thread_timer));
|
||||
|
@ -525,7 +525,7 @@ rt_err_t rt_thread_delete(rt_thread_t thread)
|
|||
rt_thread_defunct_enqueue(thread);
|
||||
|
||||
/* enable interrupt */
|
||||
rt_hw_interrupt_enable(lock);
|
||||
rt_hw_interrupt_enable(level);
|
||||
|
||||
return RT_EOK;
|
||||
}
|
||||
|
@ -543,14 +543,14 @@ RTM_EXPORT(rt_thread_delete);
|
|||
rt_err_t rt_thread_yield(void)
|
||||
{
|
||||
struct rt_thread *thread;
|
||||
rt_base_t lock;
|
||||
rt_base_t level;
|
||||
|
||||
thread = rt_thread_self();
|
||||
lock = rt_hw_interrupt_disable();
|
||||
level = rt_hw_interrupt_disable();
|
||||
thread->remaining_tick = thread->init_tick;
|
||||
thread->stat |= RT_THREAD_STAT_YIELD;
|
||||
rt_schedule();
|
||||
rt_hw_interrupt_enable(lock);
|
||||
rt_hw_interrupt_enable(level);
|
||||
|
||||
return RT_EOK;
|
||||
}
|
||||
|
@ -567,7 +567,7 @@ RTM_EXPORT(rt_thread_yield);
|
|||
*/
|
||||
rt_err_t rt_thread_sleep(rt_tick_t tick)
|
||||
{
|
||||
register rt_base_t temp;
|
||||
rt_base_t level;
|
||||
struct rt_thread *thread;
|
||||
|
||||
/* set to current thread */
|
||||
|
@ -576,7 +576,7 @@ rt_err_t rt_thread_sleep(rt_tick_t tick)
|
|||
RT_ASSERT(rt_object_get_type((rt_object_t)thread) == RT_Object_Class_Thread);
|
||||
|
||||
/* disable interrupt */
|
||||
temp = rt_hw_interrupt_disable();
|
||||
level = rt_hw_interrupt_disable();
|
||||
|
||||
/* reset thread error */
|
||||
thread->error = RT_EOK;
|
||||
|
@ -589,7 +589,7 @@ rt_err_t rt_thread_sleep(rt_tick_t tick)
|
|||
rt_timer_start(&(thread->thread_timer));
|
||||
|
||||
/* enable interrupt */
|
||||
rt_hw_interrupt_enable(temp);
|
||||
rt_hw_interrupt_enable(level);
|
||||
|
||||
rt_schedule();
|
||||
|
||||
|
@ -626,7 +626,7 @@ RTM_EXPORT(rt_thread_delay);
|
|||
*/
|
||||
rt_err_t rt_thread_delay_until(rt_tick_t *tick, rt_tick_t inc_tick)
|
||||
{
|
||||
register rt_base_t level;
|
||||
rt_base_t level;
|
||||
struct rt_thread *thread;
|
||||
rt_tick_t cur_tick;
|
||||
|
||||
|
@ -719,7 +719,7 @@ RTM_EXPORT(rt_thread_mdelay);
|
|||
*/
|
||||
rt_err_t rt_thread_control(rt_thread_t thread, int cmd, void *arg)
|
||||
{
|
||||
register rt_base_t temp;
|
||||
rt_base_t level;
|
||||
|
||||
/* parameter check */
|
||||
RT_ASSERT(thread != RT_NULL);
|
||||
|
@ -730,7 +730,7 @@ rt_err_t rt_thread_control(rt_thread_t thread, int cmd, void *arg)
|
|||
case RT_THREAD_CTRL_CHANGE_PRIORITY:
|
||||
{
|
||||
/* disable interrupt */
|
||||
temp = rt_hw_interrupt_disable();
|
||||
level = rt_hw_interrupt_disable();
|
||||
|
||||
/* for ready thread, change queue */
|
||||
if ((thread->stat & RT_THREAD_STAT_MASK) == RT_THREAD_READY)
|
||||
|
@ -768,7 +768,7 @@ rt_err_t rt_thread_control(rt_thread_t thread, int cmd, void *arg)
|
|||
}
|
||||
|
||||
/* enable interrupt */
|
||||
rt_hw_interrupt_enable(temp);
|
||||
rt_hw_interrupt_enable(level);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -837,7 +837,7 @@ RTM_EXPORT(rt_thread_control);
|
|||
rt_err_t rt_thread_suspend(rt_thread_t thread)
|
||||
{
|
||||
register rt_base_t stat;
|
||||
register rt_base_t temp;
|
||||
rt_base_t level;
|
||||
|
||||
/* parameter check */
|
||||
RT_ASSERT(thread != RT_NULL);
|
||||
|
@ -854,7 +854,7 @@ rt_err_t rt_thread_suspend(rt_thread_t thread)
|
|||
}
|
||||
|
||||
/* disable interrupt */
|
||||
temp = rt_hw_interrupt_disable();
|
||||
level = rt_hw_interrupt_disable();
|
||||
|
||||
/* change thread stat */
|
||||
rt_schedule_remove_thread(thread);
|
||||
|
@ -864,7 +864,7 @@ rt_err_t rt_thread_suspend(rt_thread_t thread)
|
|||
rt_timer_stop(&(thread->thread_timer));
|
||||
|
||||
/* enable interrupt */
|
||||
rt_hw_interrupt_enable(temp);
|
||||
rt_hw_interrupt_enable(level);
|
||||
|
||||
RT_OBJECT_HOOK_CALL(rt_thread_suspend_hook, (thread));
|
||||
return RT_EOK;
|
||||
|
@ -883,7 +883,7 @@ RTM_EXPORT(rt_thread_suspend);
|
|||
*/
|
||||
rt_err_t rt_thread_resume(rt_thread_t thread)
|
||||
{
|
||||
register rt_base_t temp;
|
||||
rt_base_t level;
|
||||
|
||||
/* parameter check */
|
||||
RT_ASSERT(thread != RT_NULL);
|
||||
|
@ -900,7 +900,7 @@ rt_err_t rt_thread_resume(rt_thread_t thread)
|
|||
}
|
||||
|
||||
/* disable interrupt */
|
||||
temp = rt_hw_interrupt_disable();
|
||||
level = rt_hw_interrupt_disable();
|
||||
|
||||
/* remove from suspend list */
|
||||
rt_list_remove(&(thread->tlist));
|
||||
|
@ -911,7 +911,7 @@ rt_err_t rt_thread_resume(rt_thread_t thread)
|
|||
rt_schedule_insert_thread(thread);
|
||||
|
||||
/* enable interrupt */
|
||||
rt_hw_interrupt_enable(temp);
|
||||
rt_hw_interrupt_enable(level);
|
||||
|
||||
RT_OBJECT_HOOK_CALL(rt_thread_resume_hook, (thread));
|
||||
return RT_EOK;
|
||||
|
|
16
src/timer.c
16
src/timer.c
|
@ -156,7 +156,7 @@ static void _timer_init(rt_timer_t timer,
|
|||
static rt_err_t _timer_list_next_timeout(rt_list_t timer_list[], rt_tick_t *timeout_tick)
|
||||
{
|
||||
struct rt_timer *timer;
|
||||
register rt_base_t level;
|
||||
rt_base_t level;
|
||||
|
||||
/* disable interrupt */
|
||||
level = rt_hw_interrupt_disable();
|
||||
|
@ -288,7 +288,7 @@ RTM_EXPORT(rt_timer_init);
|
|||
*/
|
||||
rt_err_t rt_timer_detach(rt_timer_t timer)
|
||||
{
|
||||
register rt_base_t level;
|
||||
rt_base_t level;
|
||||
|
||||
/* parameter check */
|
||||
RT_ASSERT(timer != RT_NULL);
|
||||
|
@ -363,7 +363,7 @@ RTM_EXPORT(rt_timer_create);
|
|||
*/
|
||||
rt_err_t rt_timer_delete(rt_timer_t timer)
|
||||
{
|
||||
register rt_base_t level;
|
||||
rt_base_t level;
|
||||
|
||||
/* parameter check */
|
||||
RT_ASSERT(timer != RT_NULL);
|
||||
|
@ -398,7 +398,7 @@ rt_err_t rt_timer_start(rt_timer_t timer)
|
|||
{
|
||||
unsigned int row_lvl;
|
||||
rt_list_t *timer_list;
|
||||
register rt_base_t level;
|
||||
rt_base_t level;
|
||||
register rt_bool_t need_schedule;
|
||||
rt_list_t *row_head[RT_TIMER_SKIP_LIST_LEVEL];
|
||||
unsigned int tst_nr;
|
||||
|
@ -522,7 +522,7 @@ RTM_EXPORT(rt_timer_start);
|
|||
*/
|
||||
rt_err_t rt_timer_stop(rt_timer_t timer)
|
||||
{
|
||||
register rt_base_t level;
|
||||
rt_base_t level;
|
||||
|
||||
/* parameter check */
|
||||
RT_ASSERT(timer != RT_NULL);
|
||||
|
@ -558,7 +558,7 @@ RTM_EXPORT(rt_timer_stop);
|
|||
*/
|
||||
rt_err_t rt_timer_control(rt_timer_t timer, int cmd, void *arg)
|
||||
{
|
||||
register rt_base_t level;
|
||||
rt_base_t level;
|
||||
|
||||
/* parameter check */
|
||||
RT_ASSERT(timer != RT_NULL);
|
||||
|
@ -618,7 +618,7 @@ void rt_timer_check(void)
|
|||
{
|
||||
struct rt_timer *t;
|
||||
rt_tick_t current_tick;
|
||||
register rt_base_t level;
|
||||
rt_base_t level;
|
||||
rt_list_t list;
|
||||
|
||||
rt_list_init(&list);
|
||||
|
@ -704,7 +704,7 @@ void rt_soft_timer_check(void)
|
|||
{
|
||||
rt_tick_t current_tick;
|
||||
struct rt_timer *t;
|
||||
register rt_base_t level;
|
||||
rt_base_t level;
|
||||
rt_list_t list;
|
||||
|
||||
rt_list_init(&list);
|
||||
|
|
Loading…
Reference in New Issue