Skip to content

Commit 2bf9ba0

Browse files
authored
Merge pull request #2661 from BernardXiong/pre-release_v4.0.1
Pre-release for v4.0.1
2 parents fa2d77a + 43c1236 commit 2bf9ba0

File tree

10 files changed

+21
-173
lines changed

10 files changed

+21
-173
lines changed

examples/nanopb/SConscript

Lines changed: 0 additions & 13 deletions
This file was deleted.

examples/nanopb/simple.c

Lines changed: 0 additions & 73 deletions
This file was deleted.

examples/nanopb/simple.options

Lines changed: 0 additions & 1 deletion
This file was deleted.

examples/nanopb/simple.pb.c

Lines changed: 0 additions & 18 deletions
This file was deleted.

examples/nanopb/simple.pb.h

Lines changed: 0 additions & 45 deletions
This file was deleted.

examples/nanopb/simple.proto

Lines changed: 0 additions & 10 deletions
This file was deleted.

include/rthw.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,10 +153,10 @@ extern rt_hw_spinlock_t _rt_critical_lock;
153153

154154
#define __RT_HW_SPIN_LOCK_INITIALIZER(lockname) {0}
155155

156-
#define __RT_HW_SPIN_LOCK_UNLOCKED(lockname) \
157-
(struct rt_hw_spinlock ) __RT_HW_SPIN_LOCK_INITIALIZER(lockname)
156+
#define __RT_HW_SPIN_LOCK_UNLOCKED(lockname) \
157+
(rt_hw_spinlock_t) __RT_HW_SPIN_LOCK_INITIALIZER(lockname)
158158

159-
#define RT_DEFINE_SPINLOCK(x) struct rt_hw_spinlock x = __RT_HW_SPIN_LOCK_UNLOCKED(x)
159+
#define RT_DEFINE_SPINLOCK(x) rt_hw_spinlock_t x = __RT_HW_SPIN_LOCK_UNLOCKED(x)
160160

161161
/**
162162
* ipi function

libcpu/arm/cortex-a/context_gcc.S

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,9 @@ rt_hw_interrupt_enable:
3434
bx lr
3535

3636
/*
37-
* void rt_hw_context_switch_to(rt_uint32 to);
38-
* r0 --> to
37+
* void rt_hw_context_switch_to(rt_uint32 to, struct rt_thread *to_thread);
38+
* r0 --> to (thread stack)
39+
* r1 --> to_thread
3940
*/
4041
.globl rt_hw_context_switch_to
4142
rt_hw_context_switch_to:
@@ -64,9 +65,10 @@ _guest_switch_lvl:
6465

6566
.section .text.isr, "ax"
6667
/*
67-
* void rt_hw_context_switch(rt_uint32 from, rt_uint32 to);
68-
* r0 --> from
69-
* r1 --> to
68+
* void rt_hw_context_switch(rt_uint32 from, rt_uint32 to, struct rt_thread *to_thread);
69+
* r0 --> from (from_thread stack)
70+
* r1 --> to (to_thread stack)
71+
* r2 --> to_thread
7072
*/
7173
.globl rt_hw_context_switch
7274
rt_hw_context_switch:
@@ -158,7 +160,7 @@ rt_hw_context_switch_interrupt:
158160
bl rt_cpus_lock_status_restore
159161

160162
#ifdef RT_USING_LWP
161-
ldmfd sp, {r13,r14}^ @pop usr_sp usr_lr
163+
ldmfd sp, {r13,r14}^ @pop usr_sp usr_lr
162164
add sp, #8
163165
#endif
164166

src/cpu.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,16 @@ rt_base_t rt_cpus_lock(void)
4242
pcpu = rt_cpu_self();
4343
if (pcpu->current_thread != RT_NULL)
4444
{
45-
if (pcpu->current_thread->cpus_lock_nest++ == 0)
45+
register rt_uint16_t lock_nest = pcpu->current_thread->cpus_lock_nest;
46+
47+
pcpu->current_thread->cpus_lock_nest++;
48+
if (lock_nest == 0)
4649
{
4750
pcpu->current_thread->scheduler_lock_nest++;
4851
rt_hw_spin_lock(&_cpus_lock);
4952
}
5053
}
54+
5155
return level;
5256
}
5357
RTM_EXPORT(rt_cpus_lock);
@@ -61,7 +65,9 @@ void rt_cpus_unlock(rt_base_t level)
6165

6266
if (pcpu->current_thread != RT_NULL)
6367
{
64-
if (--pcpu->current_thread->cpus_lock_nest == 0)
68+
pcpu->current_thread->cpus_lock_nest--;
69+
70+
if (pcpu->current_thread->cpus_lock_nest == 0)
6571
{
6672
pcpu->current_thread->scheduler_lock_nest--;
6773
rt_hw_spin_unlock(&_cpus_lock);

src/ipc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -753,8 +753,8 @@ rt_err_t rt_mutex_take(rt_mutex_t mutex, rt_int32_t time)
753753

754754
if (thread->error != RT_EOK)
755755
{
756-
/* interrupt by signal, try it again */
757-
if (thread->error == -RT_EINTR) goto __again;
756+
/* interrupt by signal, try it again */
757+
if (thread->error == -RT_EINTR) goto __again;
758758

759759
/* return error */
760760
return thread->error;

0 commit comments

Comments
 (0)