File tree Expand file tree Collapse file tree 4 files changed +25
-4
lines changed
boards/risc-v/qemu-rv/rv-virt/configs/smp64 Expand file tree Collapse file tree 4 files changed +25
-4
lines changed Original file line number Diff line number Diff line change @@ -69,7 +69,6 @@ CONFIG_NSH_BUILTIN_APPS=y
6969CONFIG_NSH_FILEIOSIZE=64
7070CONFIG_RAM_SIZE=33554432
7171CONFIG_RAM_START=0x80000000
72- CONFIG_RR_INTERVAL=200
7372CONFIG_SCHED_WAITPID=y
7473CONFIG_SERIAL_UART_ARCH_MMIO=y
7574CONFIG_SMP=y
@@ -82,3 +81,5 @@ CONFIG_SYSTEM_NSH_STACKSIZE=3072
8281CONFIG_TESTING_OSTEST=y
8382CONFIG_TESTING_SMP=y
8483CONFIG_USEC_PER_TICK=1000
84+ CONFIG_HRTIMER=y
85+ CONFIG_EXAMPLES_HELLO=y
Original file line number Diff line number Diff line change @@ -102,7 +102,9 @@ struct hrtimer_s
102102 hrtimer_cb func ; /* Expiration callback function */
103103 FAR void * arg ; /* Argument passed to callback */
104104 uint64_t expired ; /* Absolute expiration time (ns) */
105+ #ifdef CONFIG_SMP
105106 uint8_t cpus ; /* Number of cpus that are running the timer */
107+ #endif
106108};
107109
108110/****************************************************************************
@@ -142,7 +144,9 @@ void hrtimer_init(FAR hrtimer_t *hrtimer,
142144 hrtimer -> state = HRTIMER_STATE_INACTIVE ;
143145 hrtimer -> func = func ;
144146 hrtimer -> arg = arg ;
147+ #ifdef CONFIG_SMP
145148 hrtimer -> cpus = 0 ;
149+ #endif
146150}
147151
148152/****************************************************************************
Original file line number Diff line number Diff line change 4141
4242#define HRTIMER_CANCEL_SYNC_DELAY_MS 5
4343
44- #define hrtimer_is_free (hrtimer ) (((hrtimer)->state == HRTIMER_STATE_INACTIVE) && \
45- ((hrtimer)->cpus == 0))
44+ #ifdef CONFIG_SMP
45+ # define hrtimer_is_free (hrtimer ) (((hrtimer)->state == HRTIMER_STATE_INACTIVE) && \
46+ ((hrtimer)->cpus == 0))
47+ #else
48+ # define hrtimer_is_free (hrtimer ) (((hrtimer)->state == HRTIMER_STATE_INACTIVE))
49+ #endif
4650
4751/****************************************************************************
4852 * Public Functions
Original file line number Diff line number Diff line change @@ -98,11 +98,14 @@ void hrtimer_process(uint64_t now)
9898 DEBUGASSERT (hrtimer -> func != NULL );
9999
100100 hrtimer -> state = HRTIMER_STATE_RUNNING ;
101+
102+ #ifdef CONFIG_SMP
101103 hrtimer -> cpus ++ ;
102104
103105 /* cpus is a running reference counter and must never wrap */
104106
105107 DEBUGASSERT (hrtimer -> cpus != 0 );
108+ #endif
106109
107110 /* Leave critical section before invoking the callback */
108111
@@ -116,7 +119,9 @@ void hrtimer_process(uint64_t now)
116119
117120 flags = spin_lock_irqsave (& g_hrtimer_spinlock );
118121
122+ #ifdef CONFIG_SMP
119123 hrtimer -> cpus -- ;
124+ #endif
120125
121126 switch (hrtimer -> state )
122127 {
@@ -137,11 +142,14 @@ void hrtimer_process(uint64_t now)
137142 else
138143 {
139144 /* One-shot timer: deactivate when last instance ends */
140-
145+ #ifdef CONFIG_SMP
141146 if (hrtimer -> cpus == 0 )
142147 {
148+ #endif
143149 hrtimer -> state = HRTIMER_STATE_INACTIVE ;
150+ #ifdef CONFIG_SMP
144151 }
152+ #endif
145153 }
146154
147155 break ;
@@ -151,10 +159,14 @@ void hrtimer_process(uint64_t now)
151159 {
152160 /* Timer was canceled during callback execution */
153161
162+ #ifdef CONFIG_SMP
154163 if (hrtimer -> cpus == 0 )
155164 {
165+ #endif
156166 hrtimer -> state = HRTIMER_STATE_INACTIVE ;
167+ #ifdef CONFIG_SMP
157168 }
169+ #endif
158170
159171 break ;
160172 }
You can’t perform that action at this time.
0 commit comments