uniform code writing-disable interrupt

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

View File

@@ -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);

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;\

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;