Revision 7de0cc90

View differences:

core/inc/aos_confcheck.h
43 43

  
44 44
/* kernel parameters and options */
45 45

  
46
#ifndef AMIROOS_CFG_DBG
46
#if !defined(AMIROOS_CFG_DBG)
47 47
  #error "AMIROOS_CFG_DBG not defined in aosconf.h"
48
#endif
48
#endif /* !defined(AMIROOS_CFG_DBG) */
49 49

  
50
#ifndef AMIROOS_CFG_TESTS_ENABLE
50
#if !defined(AMIROOS_CFG_TESTS_ENABLE)
51 51
  #error "AMIROOS_CFG_TESTS_ENABLE not defined in aosconf.h"
52
#endif
52
#endif /* !defined(AMIROOS_CFG_TESTS_ENABLE) */
53 53

  
54
#ifndef AMIROOS_CFG_PROFILE
54
#if !defined(AMIROOS_CFG_PROFILE)
55 55
  #error "AMIROOS_CFG_PROFILE not defined in aosconf.h"
56
#endif
56
#endif /* !defined(AMIROOS_CFG_PROFILE) */
57 57

  
58
#ifndef AMIROOS_CFG_MAIN_LOOP_TIMEOUT
58
#if !defined(AMIROOS_CFG_MAIN_LOOP_TIMEOUT)
59 59
  #error "AMIROOS_CFG_MAIN_LOOP_TIMEOUT not defined in aosconf.h"
60
#endif
60
#endif /* !defined(AMIROOS_CFG_MAIN_LOOP_TIMEOUT) */
61 61

  
62 62
/* SSSP parameters and options */
63 63

  
64
#ifndef AMIROOS_CFG_SSSP_ENABLE
64
#if !defined(AMIROOS_CFG_SSSP_ENABLE)
65 65
  #error "AMIROOS_CFG_SSSP_ENABLE not defined in aosconf.h"
66
#endif
66
#endif /* !defined(AMIROOS_CFG_SSSP_ENABLE) */
67 67

  
68 68
# if (AMIROOS_CFG_SSSP_ENABLE == true)
69 69

  
70
  #ifndef AMIROOS_CFG_SSSP_MASTER
70
  #if !defined(AMIROOS_CFG_SSSP_MASTER)
71 71
    #error "AMIROOS_CFG_SSSP_MASTER not defined in aosconf.h"
72
  #endif
72
  #endif /* !defined(AMIROOS_CFG_SSSP_MASTER) */
73 73

  
74
  #ifndef AMIROOS_CFG_SSSP_STACK_START
74
  #if !defined(AMIROOS_CFG_SSSP_STACK_START)
75 75
    #error "AMIROOS_CFG_SSSP_STACK_START not defined in aosconf.h"
76
  #endif
76
  #endif /* !defined(AMIROOS_CFG_SSSP_STACK_START) */
77 77

  
78
  #ifndef AMIROOS_CFG_SSSP_STACK_END
78
  #if !defined(AMIROOS_CFG_SSSP_STACK_END)
79 79
    #error "AMIROOS_CFG_SSSP_STACK_END not defined in aosconf.h"
80
  #endif
80
  #endif /* !defined(AMIROOS_CFG_SSSP_STACK_END) */
81 81

  
82 82
  #if (AMIROOS_CFG_SSSP_STACK_START == true) && (AMIROOS_CFG_SSSP_STACK_END == true)
83 83
    #warning "AMIROOS_CFG_SSSP_STACK_START and AMIROOS_CFG_SSSP_STACK_END both enabled in aosconf.h"
84 84
    #if (AMIROOS_CFG_SSSP_MASTER != true)
85 85
      #error "AMIROOS_CFG_SSSP_MASTER must be enabled in this case"
86
    #endif
87
  #endif
86
    #endif /* (AMIROOS_CFG_SSSP_MASTER != true) */
87
  #endif /* (AMIROOS_CFG_SSSP_STACK_START == true) && (AMIROOS_CFG_SSSP_STACK_END == true) */
88 88

  
89
  #ifndef AMIROOS_CFG_SSSP_SIGNALDELAY
89
  #if !defined(AMIROOS_CFG_SSSP_SIGNALDELAY)
90 90
    #error "AMIROOS_CFG_SSSP_SIGNALDELAY not defined in aosconf.h"
91
  #endif
91
  #endif /* !defined(AMIROOS_CFG_SSSP_SIGNALDELAY) */
92 92

  
93
  #ifndef AMIROOS_CFG_SSSP_SYSSYNCPERIOD
93
  #if !defined(AMIROOS_CFG_SSSP_SYSSYNCPERIOD)
94 94
    #error "AMIROOS_CFG_SSSP_SYSSYNCPERIOD not defined in aosconf.h"
95
  #endif
95
  #endif /* !defined(AMIROOS_CFG_SSSP_SYSSYNCPERIOD) */
96 96

  
97
#endif
97
#endif /* (AMIROOS_CFG_SSSP_ENABLE == true) */
98 98

  
99 99
/* system shell options */
100 100

  
101
#ifndef AMIROOS_CFG_SHELL_ENABLE
101
#if !defined(AMIROOS_CFG_SHELL_ENABLE)
102 102
  #error "AMIROOS_CFG_SHELL_ENABLE not defined in aosconf.h"
103
#endif
103
#endif /* !defined(AMIROOS_CFG_SHELL_ENABLE) */
104 104

  
105 105
#if (AMIROOS_CFG_SHELL_ENABLE == true)
106 106

  
107
  #ifndef AMIROOS_CFG_SHELL_STACKSIZE
107
  #if !defined(AMIROOS_CFG_SHELL_STACKSIZE)
108 108
    #error "AMIROOS_CFG_SHELL_STACKSIZE not defined in aosconf.h"
109
  #endif
109
  #endif /* !defined(AMIROOS_CFG_SHELL_STACKSIZE) */
110 110

  
111
  #ifndef AMIROOS_CFG_SHELL_THREADPRIO
111
  #if !defined(AMIROOS_CFG_SHELL_THREADPRIO)
112 112
    #error "AMIROOS_CFG_SHELL_THREADPRIO not defined in aosconf.h"
113
  #endif
113
  #endif /* !defined(AMIROOS_CFG_SHELL_THREADPRIO) */
114 114

  
115
  #ifndef AMIROOS_CFG_SHELL_LINEWIDTH
115
  #if !defined(AMIROOS_CFG_SHELL_LINEWIDTH)
116 116
    #error "AMIROOS_CFG_SHELL_LINEWIDTH not defined in aosconf.h"
117
  #endif
117
  #endif /* !defined(AMIROOS_CFG_SHELL_LINEWIDTH) */
118 118

  
119
  #ifndef AMIROOS_CFG_SHELL_MAXARGS
119
  #if !defined(AMIROOS_CFG_SHELL_MAXARGS)
120 120
    #error "AMIROOS_CFG_SHELL_MAXARGS not defined in aosconf.h"
121
  #endif
121
  #endif /* !defined(AMIROOS_CFG_SHELL_MAXARGS) */
122 122

  
123
#else /* AMIROOS_CFG_SHELL_ENABLE == false */
123
#else /* (AMIROOS_CFG_SHELL_ENABLE == true) */
124 124

  
125 125
  #if (AMIROOS_CFG_TESTS_ENABLE == true)
126 126
    #pragma message "AMiRo-OS shell enabled implicitely via AMIROOS_CFG_TESTS_ENABLE"
127
  #endif
127
  #endif /* (AMIROOS_CFG_TESTS_ENABLE == true) */
128 128

  
129
#endif /* AMIROOS_CFG_SHELL_ENABLE */
129
#endif /* (AMIROOS_CFG_SHELL_ENABLE == true) */
130 130

  
131 131
/******************************************************************************/
132 132
/* DATA STRUCTURES AND TYPES                                                  */
core/inc/aos_debug.h
98 98
  }                                                                           \
99 99
}
100 100

  
101
#else /* (AMIROOS_CFG_DBG != true) */
101
#else /* (AMIROOS_CFG_DBG == true) */
102 102

  
103 103
#define aosDbgPrintf(fmt, ...) {                          \
104 104
  (void)(fmt);                                            \
......
117 117
  (void)(r);                                              \
118 118
}
119 119

  
120
#endif /* AMIROOS_CFG_DBG */
120
#endif /* (AMIROOS_CFG_DBG == true) */
121 121

  
122 122
/******************************************************************************/
123 123
/* EXTERN DECLARATIONS                                                        */
core/inc/aos_iostream.h
142 142
/* EXTERN DECLARATIONS                                                        */
143 143
/******************************************************************************/
144 144

  
145
#ifdef __cplusplus
145
#if defined(__cplusplus)
146 146
extern "C" {
147
#endif
147
#endif /* defined(__cplusplus) */
148 148
  void aosIOStreamInit(AosIOStream* stream);
149 149
  void aosIOChannelInit(AosIOChannel* channel, BaseAsynchronousChannel* asyncchannel);
150 150
  void aosIOStreamAddChannel(AosIOStream* stream, AosIOChannel* channel);
......
153 153
  void aosIOChannelInputDisable(AosIOChannel* channel);
154 154
  void aosIOChannelOutputEnable(AosIOChannel* channel);
155 155
  void aosIOChannelOutputDisable(AosIOChannel* channel);
156
#ifdef __cplusplus
156
#if defined(__cplusplus)
157 157
}
158
#endif
158
#endif /* defined(__cplusplus) */
159 159

  
160 160
/******************************************************************************/
161 161
/* INLINE FUNCTIONS                                                           */
core/inc/aos_shell.h
367 367
/* EXTERN DECLARATIONS                                                        */
368 368
/******************************************************************************/
369 369

  
370
#ifdef __cplusplus
370
#if defined(__cplusplus)
371 371
extern "C" {
372
#endif
372
#endif /* defined(__cplusplus) */
373 373
  void aosShellInit(aos_shell_t* shell, event_source_t* oseventsource, const char* prompt, char* line, size_t linesize, char** arglist, size_t arglistsize);
374 374
  void aosShellStreamInit(AosShellStream* stream);
375 375
  void aosShellChannelInit(AosShellChannel* channel, BaseAsynchronousChannel* asyncchannel);
......
383 383
  void aosShellChannelOutputEnable(AosShellChannel* channel);
384 384
  void aosShellChannelOutputDisable(AosShellChannel* channel);
385 385
  THD_FUNCTION(aosShellThread, shell);
386
#ifdef __cplusplus
386
#if defined(__cplusplus)
387 387
}
388
#endif
388
#endif /* defined(__cplusplus) */
389 389

  
390 390
/******************************************************************************/
391 391
/* INLINE FUNCTIONS                                                           */
core/inc/aos_system.h
82 82
 */
83 83
#define AOS_SYSTEM_SSSP_TIMEOUT                 (10 * AMIROOS_CFG_SSSP_SIGNALDELAY)
84 84

  
85
#endif /* AMIROOS_CFG_SSSP_ENABLE == true */
85
#endif /* (AMIROOS_CFG_SSSP_ENABLE == true) */
86 86

  
87 87
/******************************************************************************/
88 88
/* SETTINGS                                                                   */
......
137 137
 */
138 138
typedef uint16_t aos_ssspmoduleid_t;
139 139

  
140
#endif /* AMIROOS_CFG_SSSP_ENABLE == true */
140
#endif /* (AMIROOS_CFG_SSSP_ENABLE == true) */
141 141

  
142 142
/**
143 143
 * @brief   AMiRo-OS base system structure.
......
160 160
     */
161 161
    aos_ssspmoduleid_t moduleId;
162 162
  } sssp;
163
#endif /* AMIROOS_CFG_SSSP_ENABLE == true */
163
#endif /* (AMIROOS_CFG_SSSP_ENABLE == true) */
164 164

  
165 165
  /**
166 166
   * @brief   System I/O stream.
......
184 184
  } events;
185 185

  
186 186
#if (AMIROOS_CFG_SHELL_ENABLE == true) || (AMIROOS_CFG_TESTS_ENABLE == true) || defined(__DOXYGEN__)
187

  
187 188
  /**
188 189
   * @brief   Pointer to the shell object.
189 190
   */
190 191
  aos_shell_t shell;
191
#endif
192

  
193
#endif /* (AMIROOS_CFG_SHELL_ENABLE == true) || (AMIROOS_CFG_TESTS_ENABLE == true) */
192 194

  
193 195
} aos_system_t;
194 196

  
......
212 214
 */
213 215
extern aos_system_t aos;
214 216

  
215
#ifdef __cplusplus
217
#if defined(__cplusplus)
216 218
extern "C" {
217
#endif
219
#endif /* defined(__cplusplus) */
218 220
#if (AMIROOS_CFG_SHELL_ENABLE == true) || (AMIROOS_CFG_TESTS_ENABLE == true)
219 221
  void aosSysInit(const char* shellPrompt);
220
#else
222
#else /* (AMIROOS_CFG_SHELL_ENABLE == true) || (AMIROOS_CFG_TESTS_ENABLE == true) */
221 223
  void aosSysInit(void);
222
#endif
224
#endif /* (AMIROOS_CFG_SHELL_ENABLE == true) || (AMIROOS_CFG_TESTS_ENABLE == true) */
223 225
  void aosSysStart(void);
224 226
#if (AMIROOS_CFG_SSSP_ENABLE == true) || defined (__DOXYGEN__)
225 227
  eventmask_t aosSysSsspStartupOsInitSyncCheck(event_listener_t* syncEvtListener);
226
#endif
228
#endif /* (AMIROOS_CFG_SSSP_ENABLE == true) */
227 229
  void aosSysGetUptimeX(aos_timestamp_t* ut);
228 230
#if (HAL_USE_RTC == TRUE)
229 231
  void aosSysGetDateTime(struct tm* dt);
230 232
  void aosSysSetDateTime(struct tm* dt);
231
#endif /* HAL_USE_RTC == TRUE */
233
#endif /* (HAL_USE_RTC == TRUE) */
232 234
  void aosSysShutdownInit(aos_shutdown_t shutdown);
233 235
  void aosSysStop(void);
234 236
  void aosSysDeinit(void);
235 237
  void aosSysShutdownFinal(aos_shutdown_t shutdown);
236
#ifdef __cplusplus
238
#if defined(__cplusplus)
237 239
}
238
#endif
240
#endif /* defined(__cplusplus) */
239 241

  
240 242
/******************************************************************************/
241 243
/* INLINE FUNCTIONS                                                           */
core/inc/aos_thread.h
118 118
/* EXTERN DECLARATIONS                                                        */
119 119
/******************************************************************************/
120 120

  
121
#ifdef __cplusplus
121
#if defined(__cplusplus)
122 122
extern "C" {
123
#endif
123
#endif /* defined(_cplusplus) */
124 124
  void aosThdSleepUntilS(const aos_timestamp_t t);
125 125
#if (AMIROOS_CFG_DBG == true) && (CH_DBG_FILL_THREADS == TRUE)
126 126
  size_t aosThdGetStackPeakUtilization(thread_t* thread);
127
#endif
128
#ifdef __cplusplus
127
#endif /* (AMIROOS_CFG_DBG == true) && (CH_DBG_FILL_THREADS == TRUE) */
128
#if defined(__cplusplus)
129 129
}
130
#endif
130
#endif /* defined(_cplusplus) */
131 131

  
132 132
/******************************************************************************/
133 133
/* INLINE FUNCTIONS                                                           */
......
292 292
         ((size_t)PORT_GUARD_PAGE_SIZE + sizeof(struct port_intctx) + sizeof(struct port_extctx) + (size_t)PORT_INT_REQUIRED_STACK);
293 293
}
294 294

  
295
#endif /* AMIROOS_CFG_DBG == true */
295
#endif /* (AMIROOS_CFG_DBG == true) */
296 296

  
297 297
#endif /* AMIROOS_THREAD_H */
298 298

  
core/inc/aos_time.h
236 236
/* EXTERN DECLARATIONS                                                        */
237 237
/******************************************************************************/
238 238

  
239
#ifdef __cplusplus
239
#if defined(__cplusplus)
240 240
extern "C" {
241
#endif
241
#endif /* defined(__cplusplus) */
242 242
  uint8_t aosTimeDayOfWeekFromDate(const uint16_t day, const uint8_t month, const uint16_t year);
243
#ifdef __cplusplus
243
#if defined(__cplusplus)
244 244
}
245
#endif
245
#endif /* defined(__cplusplus) */
246 246

  
247 247
/******************************************************************************/
248 248
/* INLINE FUNCTIONS                                                           */
core/inc/aos_timer.h
123 123
/* EXTERN DECLARATIONS                                                        */
124 124
/******************************************************************************/
125 125

  
126
#ifdef __cplusplus
126
#if defined(__cplusplus)
127 127
extern "C" {
128
#endif
128
#endif /* defined(__cplusplus) */
129 129
  void aosTimerInit(aos_timer_t* timer);
130 130
  void aosTimerSetAbsoluteI(aos_timer_t* timer, aos_timestamp_t* uptime, vtfunc_t cb, void* par);
131 131
  void aosTimerSetIntervalI(aos_timer_t* timer, aos_interval_t offset, vtfunc_t cb, void* par);
......
133 133
  void aosPeriodicTimerInit(aos_periodictimer_t* ptimer);
134 134
  void aosPeriodicTimerSetI(aos_periodictimer_t* ptimer, aos_interval_t interval, vtfunc_t cb, void* par);
135 135
  void aosPeriodicTimerSetLongI(aos_periodictimer_t* ptimer, aos_longinterval_t* interval, vtfunc_t cb, void* par);
136
#ifdef __cplusplus
136
#if defined(__cplusplus)
137 137
}
138
#endif
138
#endif /* defined(__cplusplus) */
139 139

  
140 140
/******************************************************************************/
141 141
/* INLINE FUNCTIONS                                                           */
core/inc/aos_unittest.h
117 117
/* EXTERN DECLARATIONS                                                        */
118 118
/******************************************************************************/
119 119

  
120
#ifdef __cplusplus
120
#if defined(__cplusplus)
121 121
extern "C" {
122
#endif
122
#endif /* defined(__cplusplus) */
123 123
  uint32_t aosUtResultTotal(aos_utresult_t* result);
124 124
  float aosUtResultRatio(aos_utresult_t* result);
125 125
  void aosUtResultPrintSummary(BaseSequentialStream* stream, aos_utresult_t* result, char* heading);
......
130 130
  void aosUtFailed(BaseSequentialStream* stream, aos_utresult_t* result);
131 131
  void aosUtFailedMsg(BaseSequentialStream* stream, aos_utresult_t* result, const char* fmt, ...);
132 132
  void aosUtInfoMsg(BaseSequentialStream* stream, const char* fmt, ...);
133
#ifdef __cplusplus
133
#if defined(__cplusplus)
134 134
}
135
#endif
135
#endif /* defined(__cplusplus) */
136 136

  
137 137
/******************************************************************************/
138 138
/* INLINE FUNCTIONS                                                           */
139 139
/******************************************************************************/
140 140

  
141
#endif /* AMIROOS_CFG_TESTS_ENABLE == true */
141
#endif /* (AMIROOS_CFG_TESTS_ENABLE == true) */
142 142

  
143 143
#endif /* AMIROOS_UNITTEST_H */
144 144

  
core/src/aos_main.cpp
33 33
 */
34 34
#if defined(AMIROOS_CFG_MAIN_EXTRA_INCLUDE_HEADER)
35 35
#include AMIROOS_CFG_MAIN_EXTRA_INCLUDE_HEADER
36
#endif
36
#endif /* defined(AMIROOS_CFG_MAIN_EXTRA_INCLUDE_HEADER) */
37 37

  
38 38
/******************************************************************************/
39 39
/* LOCAL DEFINITIONS                                                          */
......
81 81
 */
82 82
#define SSSP_STACKINIT_CANMSGID_ABORT           0x001
83 83

  
84
#else /* AMIROOS_CFG_SSSP_ENABLE == false */
84
#else /* (AMIROOS_CFG_SSSP_ENABLE == true) */
85 85

  
86 86
/**
87 87
 * @brief   Default shutdown mode if SSSP is unavailable.
88 88
 */
89 89
#define AOS_SHUTDOWN_DEFAULT                    AOS_SHUTDOWN_DEEPSLEEP
90 90

  
91
#endif /* AMIROOS_CFG_SSSP_ENABLE */
91
#endif /* (AMIROOS_CFG_SSSP_ENABLE == true) */
92 92

  
93 93
/**
94 94
 * @brief   CAN message identifier for calender synchronization message.
......
136 136
 */
137 137
#if defined(AMIROOS_CFG_MAIN_EXTRA_STATIC_VARIABLES)
138 138
AMIROOS_CFG_MAIN_EXTRA_STATIC_VARIABLES
139
#endif
139
#endif /* defined(AMIROOS_CFG_MAIN_EXTRA_STATIC_VARIABLES) */
140 140

  
141 141
/******************************************************************************/
142 142
/* LOCAL FUNCTIONS                                                            */
......
152 152
{
153 153
#if (AMIROOS_CFG_DBG == true)
154 154
  aosprintf("CTRL: unexpected/unknown event received. mask: 0x%08X; flags: 0x%08X\n", mask, flags);
155
#else
155
#else /* (AMIROOS_CFG_DBG == true) */
156 156
  (void)(mask);
157 157
  (void)(flags);
158
#endif
158
#endif /* (AMIROOS_CFG_DBG == true) */
159 159
  return;
160 160
}
161 161

  
......
175 175

  
176 176
  return;
177 177
}
178
#endif /* AMIROOS_CFG_SSSP_ENABLE == true */
178
#endif /* (AMIROOS_CFG_SSSP_ENABLE == true) */
179 179

  
180 180
/**
181 181
 * @brief   Helper function to serialize data.
......
276 276
  return;
277 277
}
278 278

  
279
#endif /* HAL_USE_RTC == TRUE */
279
#endif /* (HAL_USE_RTC == TRUE) */
280 280

  
281 281
#if (AMIROOS_CFG_SSSP_ENABLE == true) || defined(__DOXYGEN__)
282 282
/**
......
325 325
  CANRxFrame canRxFrame;
326 326
#if (AMIROOS_CFG_SSSP_STACK_START != true) || (AMIROOS_CFG_DBG == true)
327 327
  aos_ssspmoduleid_t lastid = 0;
328
#endif
328
#endif /* (AMIROOS_CFG_SSSP_STACK_START != true) || (AMIROOS_CFG_DBG == true) */
329 329
  flags_t flags;
330 330
  aos_timestamp_t uptime;
331 331

  
......
405 405
        aosDbgPrintf(">>> 3-4 (abort)\n");
406 406
        break;
407 407
    }
408
#endif
408
#endif /* (AMIROOS_CFG_DBG == true) */
409 409

  
410 410
    // reset wfe flag for the next iteration
411 411
    flags.wfe_next = true;
......
446 446
#if (AMIROOS_CFG_SSSP_STACK_END != true)
447 447
        aosDbgPrintf("disabling UP\n");
448 448
        apalControlGpioSet(&moduleSsspGpioUp, APAL_GPIO_OFF);
449
#endif
449
#endif /* (AMIROOS_CFG_SSSP_STACK_END != true) */
450 450
        // set shutdown flag and exit the loop
451 451
        shutdown = AOS_SHUTDOWN_PASSIVE;
452 452
        break;
......
474 474
      // get the flags
475 475
      eventflags_t oseventflags = chEvtGetAndClearFlags(&_eventListenerOS);
476 476
      // there should be no OS events at this point
477
#ifdef MODULE_SSSP_STARTUP_3_OSEVENT_HOOK
477
#if defined(MODULE_SSSP_STARTUP_3_OSEVENT_HOOK)
478 478
      MODULE_SSSP_STARTUP_3_OSEVENT_HOOK(eventmask, eventflags);
479
#else
479
#else /* defined(MODULE_SSSP_STARTUP_3_OSEVENT_HOOK) */
480 480
      _unexpectedEventError(eventmask, oseventflags);
481
#endif
481
#endif /* defined(MODULE_SSSP_STARTUP_3_OSEVENT_HOOK) */
482 482
    }
483 483
    // if a CAN event occurred
484 484
    if ((eventmask & eventListenerCan.events)) {
......
536 536
          // proceed immediately
537 537
          stage = STAGE_3_2;
538 538
          flags.wfe_next = false;
539
#else
539
#else /* (AMIROOS_CFG_SSSP_STACK_START == true) */
540 540
          // set the timeout timer
541 541
          chVTSet(&timerTimeout, chTimeUS2I(AOS_SYSTEM_SSSP_TIMEOUT), _ssspTimerCallback, &eventSourceTimeout);
542 542
          // proceed
543 543
          stage = STAGE_3_3_WAITFORFIRSTID;
544
#endif
545
#else
544
#endif /* (AMIROOS_CFG_SSSP_STACK_START == true) */
545
#else /* (AMIROOS_CFG_SSSP_MASTER == true) */
546 546
          // set the timeout timer
547 547
          chVTSet(&timerTimeout, chTimeUS2I(AOS_SYSTEM_SSSP_TIMEOUT), _ssspTimerCallback, &eventSourceTimeout);
548
#endif
548
#endif /* (AMIROOS_CFG_SSSP_MASTER == true) */
549 549
        }
550 550

  
551 551
#if (AMIROOS_CFG_SSSP_MASTER != true)
......
568 568
            // proceed
569 569
            stage = STAGE_3_2;
570 570
            flags.wfe_next = false;
571
#else
571
#else /* (AMIROOS_CFG_SSSP_STACK_START == true) */
572 572
            // set the timeout timer
573 573
            chVTSet(&timerTimeout, chTimeUS2I(AOS_SYSTEM_SSSP_TIMEOUT), _ssspTimerCallback, &eventSourceTimeout);
574 574
            // proceed
575 575
            stage = STAGE_3_3_WAITFORFIRSTID;
576
#endif
576
#endif /* (AMIROOS_CFG_SSSP_STACK_START == true) */
577 577
          }
578 578
        }
579
#endif
579
#endif /* (AMIROOS_CFG_SSSP_MASTER != true) */
580 580

  
581 581
        break;
582 582
      } /* end of STAGE_3_1 */
......
599 599
            chEvtBroadcast(&eventSourceTimeout);
600 600
            break;
601 601
          }
602
#if (AMIROOS_CFG_SSSP_STACK_START != true) || (AMIROOS_CFG_DBG == true)
602
#if (AMIROOS_CFG_DBG == true)
603 603
          lastid = aos.sssp.moduleId;
604
#endif
604
#endif /* (AMIROOS_CFG_DBG == true) */
605 605
#if (AMIROOS_CFG_SSSP_STACK_END == true)
606 606
          // sequence is already over
607 607
          // deactivate S
......
609 609
          apalControlGpioSet(&moduleSsspGpioSync, APAL_GPIO_OFF);
610 610
          // proceed
611 611
          stage = STAGE_3_3_WAITFORID;
612
#else
612
#else /* (AMIROOS_CFG_SSSP_STACK_END == true) */
613 613
          // set the delay timer so the UP signal is activated later
614 614
          chVTSet(&timerDelay, chTimeUS2I(AMIROOS_CFG_SSSP_SIGNALDELAY), _ssspTimerCallback, &eventSourceDelay);
615
#endif
615
#endif /* (AMIROOS_CFG_SSSP_STACK_END == true) */
616 616
        }
617 617

  
618 618
        // if a delay event occurred
......
629 629
          // proceed
630 630
          stage = STAGE_3_3_WAITFORID;
631 631
        }
632
#endif
632
#endif /* (AMIROOS_CFG_SSSP_STACK_START == true) */
633 633

  
634 634
        break;
635 635
      } /* end of STAGE_3_2 */
......
666 666
            eventmask &= ~(eventListenerTimeout.events);
667 667
          }
668 668
        }
669
#endif
669
#endif /* (AMIROOS_CFG_SSSP_STACK_START != true) */
670 670
        break;
671 671
      } /* end of STAGE_3_3_WAITFORFIRSTID */
672 672

  
......
728 728
          // activate UP
729 729
          aosDbgPrintf("enabling UP\n");
730 730
          apalControlGpioSet(&moduleSsspGpioUp, APAL_GPIO_ON);
731
#endif
731
#endif /* (AMIROOS_CFG_SSSP_STACK_END != true) */
732 732
          // deactivate S
733 733
          aosDbgPrintf("disabling S\n");
734 734
          apalControlGpioSet(&moduleSsspGpioSync, APAL_GPIO_OFF);
......
739 739
          // proceed
740 740
          stage = STAGE_3_3_WAITFORID;
741 741
        }
742
#endif
742
#endif /* (AMIROOS_CFG_SSSP_STACK_START != true) */
743 743

  
744 744
        break;
745 745
      } /* end of STAGE_3_3_WAITFORIDORSIG */
......
760 760
            // Plausibility of the received ID is not checked at this point but is done by other modules still in a previous stage.
761 761
            lastid = _deserialize(canRxFrame.data8, 4);
762 762
            aosDbgPrintf("ID (%u)\n", lastid);
763
#endif
763
#endif /* (AMIROOS_CFG_SSSP_STACK_START != true) || (AMIROOS_CFG_DBG == true) */
764 764
            // restart timeout timer
765 765
            chVTSet(&timerTimeout, chTimeUS2I(AOS_SYSTEM_SSSP_TIMEOUT), _ssspTimerCallback, &eventSourceTimeout);
766 766
            chEvtWaitAnyTimeout(eventListenerTimeout.events, TIME_IMMEDIATE);
767 767
            eventmask &= ~(eventListenerTimeout.events);
768 768
          }
769 769
        }
770
#endif
770
#endif /* (AMIROOS_CFG_SSSP_STACK_END != true) */
771 771

  
772 772
        break;
773 773
      } /* end of STAGE_3_3_WAITFORID */
......
877 877
#if (AMIROOS_CFG_SSSP_STACK_END != true)
878 878
  aosDbgPrintf("disabling UP\n");
879 879
  apalControlGpioSet(&moduleSsspGpioUp, APAL_GPIO_OFF);
880
#endif
880
#endif /* (AMIROOS_CFG_SSSP_STACK_END != true) */
881 881
  aosDbgPrintf("disabling S\n");
882 882
  apalControlGpioSet(&moduleSsspGpioSync, APAL_GPIO_OFF);
883 883
  aosSysGetUptime(&uptime);
......
885 885

  
886 886
  return shutdown;
887 887
}
888
#endif /* AMIROOS_CFG_SSSP_ENABLE == true */
888
#endif /* (AMIROOS_CFG_SSSP_ENABLE == true) */
889 889

  
890 890
/**
891 891
 * @brief   Application entry point.
......
899 899
  aos_shutdown_t shutdown = AOS_SHUTDOWN_NONE;
900 900
#if defined(AMIROOS_CFG_MAIN_EXTRA_THREAD_VARIABLES)
901 901
  AMIROOS_CFG_MAIN_EXTRA_THREAD_VARIABLES
902
#endif
902
#endif /* defined(AMIROOS_CFG_MAIN_EXTRA_THREAD_VARIABLES) */
903 903

  
904 904
  /*
905 905
   * ##########################################################################
......
910 910
#if defined(AMIROOS_CFG_MAIN_INIT_HOOK_0)
911 911
#if defined(AMIROOS_CFG_MAIN_INIT_HOOK_0_ARGS)
912 912
  AMIROOS_CFG_MAIN_INIT_HOOK_0(AMIROOS_CFG_MAIN_INIT_HOOK_0_ARGS);
913
#else
913
#else /* defined(AMIROOS_CFG_MAIN_INIT_HOOK_0_ARGS) */
914 914
  AMIROOS_CFG_MAIN_INIT_HOOK_0();
915
#endif
916
#endif
915
#endif /* defined(AMIROOS_CFG_MAIN_INIT_HOOK_0_ARGS) */
916
#endif /* defined(AMIROOS_CFG_MAIN_INIT_HOOK_0) */
917 917

  
918 918
  /* hardware, kernel, and operating system initialization */
919 919
  // ChibiOS/HAL and custom hal additions (if any)
920 920
  halInit();
921
#ifdef MODULE_INIT_HAL_EXTRA
921
#if defined(MODULE_INIT_HAL_EXTRA)
922 922
  MODULE_INIT_HAL_EXTRA();
923
#endif
923
#endif /* defined(MODULE_INIT_HAL_EXTRA) */
924 924

  
925 925
#if defined(AMIROOS_CFG_MAIN_INIT_HOOK_1)
926 926
#if defined(AMIROOS_CFG_MAIN_INIT_HOOK_1_ARGS)
927 927
  AMIROOS_CFG_MAIN_INIT_HOOK_1(AMIROOS_CFG_MAIN_INIT_HOOK_1_ARGS);
928
#else
928
#else /* defined(AMIROOS_CFG_MAIN_INIT_HOOK_1_ARGS) */
929 929
  AMIROOS_CFG_MAIN_INIT_HOOK_1();
930
#endif
931
#endif
930
#endif /* defined(AMIROOS_CFG_MAIN_INIT_HOOK_1_ARGS) */
931
#endif /* defined(AMIROOS_CFG_MAIN_INIT_HOOK_1) */
932 932

  
933 933
  // ChibiOS/RT kernel and custom kernel additions (if any)
934 934
  chSysInit();
935
#ifdef MODULE_INIT_KERNEL_EXTRA
935
#if defined(MODULE_INIT_KERNEL_EXTRA)
936 936
  MODULE_INIT_KERNEL_EXTRA();
937
#endif
937
#endif /* defined(MODULE_INIT_KERNEL_EXTRA) */
938 938

  
939 939
#if defined(AMIROOS_CFG_MAIN_INIT_HOOK_2)
940 940
#if defined(AMIROOS_CFG_MAIN_INIT_HOOK_2_ARGS)
941 941
  AMIROOS_CFG_MAIN_INIT_HOOK_2(AMIROOS_CFG_MAIN_INIT_HOOK_2_ARGS);
942
#else
942
#else /* defined(AMIROOS_CFG_MAIN_INIT_HOOK_2_ARGS) */
943 943
  AMIROOS_CFG_MAIN_INIT_HOOK_2();
944
#endif
945
#endif
944
#endif /* defined(AMIROOS_CFG_MAIN_INIT_HOOK_2_ARGS) */
945
#endif /* defined(AMIROOS_CFG_MAIN_INIT_HOOK_2) */
946 946

  
947 947
  // AMiRo-OS and custom OS additions (if any)
948 948
#if (AMIROOS_CFG_SHELL_ENABLE == true) || (AMIROOS_CFG_TESTS_ENABLE == true)
949 949
  aosSysInit(moduleShellPrompt);
950
#else
950
#else /* (AMIROOS_CFG_SHELL_ENABLE == true) || (AMIROOS_CFG_TESTS_ENABLE == true) */
951 951
  aosSysInit();
952
#endif
953
#ifdef MODULE_INIT_OS_EXTRA
952
#endif /* (AMIROOS_CFG_SHELL_ENABLE == true) || (AMIROOS_CFG_TESTS_ENABLE == true) */
953
#if defined(MODULE_INIT_OS_EXTRA)
954 954
  MODULE_INIT_OS_EXTRA();
955
#endif
955
#endif /* defined(MODULE_INIT_OS_EXTRA) */
956 956

  
957 957
#if defined(AMIROOS_CFG_MAIN_INIT_HOOK_3)
958 958
#if defined(AMIROOS_CFG_MAIN_INIT_HOOK_3_ARGS)
959 959
  AMIROOS_CFG_MAIN_INIT_HOOK_3(AMIROOS_CFG_MAIN_INIT_HOOK_3_ARGS);
960
#else
960
#else /* defined(AMIROOS_CFG_MAIN_INIT_HOOK_3_ARGS) */
961 961
  AMIROOS_CFG_MAIN_INIT_HOOK_3();
962
#endif
963
#endif
962
#endif /* defined(AMIROOS_CFG_MAIN_INIT_HOOK_3_ARGS) */
963
#endif /* defined(AMIROOS_CFG_MAIN_INIT_HOOK_3) */
964 964

  
965 965
  /* event associations */
966 966
#if (AMIROOS_CFG_SSSP_ENABLE == true)
967 967
  ioeventflagsmask |= MODULE_SSSP_EVENTFLAGS_PD | MODULE_SSSP_EVENTFLAGS_SYNC;
968 968
#if (AMIROOS_CFG_SSSP_STACK_START != true)
969 969
  ioeventflagsmask |= MODULE_SSSP_EVENTFLAGS_DN;
970
#endif
970
#endif /* (AMIROOS_CFG_SSSP_STACK_START != true) */
971 971
#if (AMIROOS_CFG_SSSP_STACK_END != true)
972 972
  ioeventflagsmask |= MODULE_SSSP_EVENTFLAGS_UP;
973
#endif
974
#endif /* AMIROOS_CFG_SSSP_ENABLE == true */
973
#endif /* (AMIROOS_CFG_SSSP_STACK_END != true) */
974
#endif /* (AMIROOS_CFG_SSSP_ENABLE == true) */
975 975
  if (ioeventflagsmask != 0) {
976 976
    chEvtRegisterMaskWithFlags(&aos.events.io, &_eventListenerIO, IOEVENT_MASK, ioeventflagsmask);
977 977
  }
......
980 980
#if defined(AMIROOS_CFG_MAIN_INIT_HOOK_4)
981 981
#if defined(AMIROOS_CFG_MAIN_INIT_HOOK_4_ARGS)
982 982
  AMIROOS_CFG_MAIN_INIT_HOOK_4(AMIROOS_CFG_MAIN_INIT_HOOK_4_ARGS);
983
#else
983
#else /* defined(AMIROOS_CFG_MAIN_INIT_HOOK_4_ARGS) */
984 984
  AMIROOS_CFG_MAIN_INIT_HOOK_4();
985
#endif
986
#endif
985
#endif /* defined(AMIROOS_CFG_MAIN_INIT_HOOK_4_ARGS) */
986
#endif /* defined(AMIROOS_CFG_MAIN_INIT_HOOK_4) */
987 987

  
988 988
  /* periphery communication initialization */
989 989
  // module specific initialization (if any)
990
#ifdef MODULE_INIT_PERIPHERY_COMM
990
#if defined(MODULE_INIT_PERIPHERY_COMM)
991 991
  MODULE_INIT_PERIPHERY_COMM();
992
#endif
992
#endif /* defined(MODULE_INIT_PERIPHERY_COMM) */
993 993
#if (AMIROOS_CFG_SSSP_ENABLE == true)
994 994
  // CAN (mandatory)
995 995
  canStart(&MODULE_HAL_CAN, &moduleHalCanConfig);
996
#endif
996
#endif /* (AMIROOS_CFG_SSSP_ENABLE == true) */
997 997
  // user interface (if any)
998
#ifdef MODULE_HAL_PROGIF
998
#if defined(MODULE_HAL_PROGIF)
999 999
  aosIOChannelInit(&_stdiochannel, (BaseAsynchronousChannel*)&MODULE_HAL_PROGIF);
1000 1000
  aosIOChannelOutputEnable(&_stdiochannel);
1001 1001
  aosIOStreamAddChannel(&aos.iostream, &_stdiochannel);
......
1004 1004
  aosShellChannelInputEnable(&_stdshellchannel);
1005 1005
  aosShellChannelOutputEnable(&_stdshellchannel);
1006 1006
  aosShellStreamAddChannel(&aos.shell.stream, &_stdshellchannel);
1007
#endif
1008
#endif
1007
#endif /* (AMIROOS_CFG_SHELL_ENABLE == true) || (AMIROOS_CFG_TESTS_ENABLE == true) */
1008
#endif /* defined(MODULE_HAL_PROGIF) */
1009 1009

  
1010 1010
#if defined(AMIROOS_CFG_MAIN_INIT_HOOK_5)
1011 1011
#if defined(AMIROOS_CFG_MAIN_INIT_HOOK_5_ARGS)
1012 1012
  AMIROOS_CFG_MAIN_INIT_HOOK_5(AMIROOS_CFG_MAIN_INIT_HOOK_5_ARGS);
1013
#else
1013
#else /* defined(AMIROOS_CFG_MAIN_INIT_HOOK_5_ARGS) */
1014 1014
  AMIROOS_CFG_MAIN_INIT_HOOK_5();
1015
#endif
1016
#endif
1015
#endif /* defined(AMIROOS_CFG_MAIN_INIT_HOOK_5_ARGS) */
1016
#endif /* defined(AMIROOS_CFG_MAIN_INIT_HOOK_5) */
1017 1017

  
1018 1018
  /* module is ready -> print welcome prompt */
1019 1019
  aosprintf("\n");
......
1035 1035
#if defined(AMIROOS_CFG_MAIN_INIT_HOOK_6)
1036 1036
#if defined(AMIROOS_CFG_MAIN_INIT_HOOK_6_ARGS)
1037 1037
  AMIROOS_CFG_MAIN_INIT_HOOK_6(AMIROOS_CFG_MAIN_INIT_HOOK_6_ARGS);
1038
#else
1038
#else /* defined(AMIROOS_CFG_MAIN_INIT_HOOK_6_ARGS) */
1039 1039
  AMIROOS_CFG_MAIN_INIT_HOOK_6();
1040
#endif
1041
#endif
1040
#endif /* defined(AMIROOS_CFG_MAIN_INIT_HOOK_6_ARGS) */
1041
#endif /* defined(AMIROOS_CFG_MAIN_INIT_HOOK_6) */
1042 1042

  
1043 1043
#if (AMIROOS_CFG_TESTS_ENABLE == true)
1044 1044
#if defined(MODULE_INIT_TESTS)
1045 1045
  MODULE_INIT_TESTS();
1046
#else
1047
  #warning "MODULE_INIT_TESTS() not defined"
1048
#endif
1049
#endif
1046
#else /* defined(MODULE_INIT_TESTS) */
1047
  #warning "AMIROOS_CFG_TESTS_ENABLE set to true, but MODULE_INIT_TESTS() not defined"
1048
#endif /* defined(MODULE_INIT_TESTS) */
1049
#endif /* (AMIROOS_CFG_TESTS_ENABLE == true) */
1050 1050

  
1051 1051
#if defined(AMIROOS_CFG_MAIN_INIT_HOOK_7)
1052 1052
#if defined(AMIROOS_CFG_MAIN_INIT_HOOK_7_ARGS)
1053 1053
  AMIROOS_CFG_MAIN_INIT_HOOK_7(AMIROOS_CFG_MAIN_INIT_HOOK_7_ARGS);
1054
#else
1054
#else /* defined(AMIROOS_CFG_MAIN_INIT_HOOK_7_ARGS) */
1055 1055
  AMIROOS_CFG_MAIN_INIT_HOOK_7();
1056
#endif
1057
#endif
1056
#endif /* defined(AMIROOS_CFG_MAIN_INIT_HOOK_7_ARGS) */
1057
#endif /* defined(AMIROOS_CFG_MAIN_INIT_HOOK_7) */
1058 1058

  
1059 1059
#if (AMIROOS_CFG_SSSP_ENABLE == true)
1060 1060
  /* SSSP startup OS synchronization phase (end of startup stage 2) */
......
1070 1070
      if (eventflags & MODULE_SSSP_EVENTFLAGS_PD) {
1071 1071
        shutdown = AOS_SHUTDOWN_PASSIVE;
1072 1072
      } else {
1073
#ifdef MODULE_SSSP_STARTUP_2_2_IOEVENT_HOOK
1073
#if defined(MODULE_SSSP_STARTUP_2_2_IOEVENT_HOOK)
1074 1074
        MODULE_SSSP_STARTUP_2_2_IOEVENT_HOOK(eventmask, eventflags);
1075
#else
1075
#else /* defined(MODULE_SSSP_STARTUP_2_2_IOEVENT_HOOK) */
1076 1076
        // ignore any other IO events
1077
#endif
1077
#endif /* defined(MODULE_SSSP_STARTUP_2_2_IOEVENT_HOOK) */
1078 1078
      }
1079 1079
    }
1080 1080
    // OS event
......
1096 1096
  if (shutdown == AOS_SHUTDOWN_NONE) {
1097 1097
    shutdown = _ssspModuleStackInitialization();
1098 1098
  }
1099
#endif /* AMIROOS_CFG_SSSP_ENABLE == true */
1099
#endif /* (AMIROOS_CFG_SSSP_ENABLE == true) */
1100 1100

  
1101 1101
  /*
1102 1102
   * There must be no delays at this point, thus no hook is allowed.
......
1126 1126
    canTransmitTimeout(&MODULE_HAL_CAN, CAN_ANY_MAILBOX, &frame, TIME_IMMEDIATE);
1127 1127

  
1128 1128
    aosDbgPrintf("done\n");
1129
#else /* AMIROOS_CFG_SSSP_MASTER == false */
1129
#else /* (AMIROOS_CFG_SSSP_MASTER == true) */
1130 1130
    CANRxFrame frame;
1131 1131
    uint64_t encoded;
1132 1132
    struct tm t;
......
1136 1136
#if (AMIROOS_CFG_DBG == true)
1137 1137
    // increase timeout in debug mode due to additional delays introduced by the many prinf() calls
1138 1138
    if (canReceiveTimeout(&MODULE_HAL_CAN, CAN_ANY_MAILBOX, &frame, chTimeUS2I(10 * AOS_SYSTEM_SSSP_TIMEOUT)) == MSG_OK) {
1139
#else
1139
#else /* (AMIROOS_CFG_DBG == true) */
1140 1140
    if (canReceiveTimeout(&MODULE_HAL_CAN, CAN_ANY_MAILBOX, &frame, chTimeUS2I(AOS_SYSTEM_SSSP_TIMEOUT)) == MSG_OK) {
1141
#endif
1141
#endif /* (AMIROOS_CFG_DBG == true) */
1142 1142
      // validate message
1143 1143
      if (frame.DLC == 8 &&
1144 1144
          frame.RTR == CAN_RTR_DATA &&
......
1157 1157
    } else {
1158 1158
      aosDbgPrintf("fail (timeout)\n");
1159 1159
    }
1160
#endif /* AMIROOS_CFG_SSSP_MASTER == false */
1160
#endif /* (AMIROOS_CFG_SSSP_MASTER == true) */
1161 1161
    aosDbgPrintf("\n");
1162 1162
  }
1163 1163
#endif /* (AMIROOS_CFG_SSSP_ENABLE == true) && (HAL_USE_RTC == TRUE) */
......
1165 1165
#if defined(AMIROOS_CFG_MAIN_INIT_HOOK_8)
1166 1166
#if defined(AMIROOS_CFG_MAIN_INIT_HOOK_8_ARGS)
1167 1167
  AMIROOS_CFG_MAIN_INIT_HOOK_8(AMIROOS_CFG_MAIN_INIT_HOOK_8_ARGS);
1168
#else
1168
#else /* defined(AMIROOS_CFG_MAIN_INIT_HOOK_8_ARGS) */
1169 1169
  AMIROOS_CFG_MAIN_INIT_HOOK_8();
1170
#endif
1171
#endif
1170
#endif /* defined(AMIROOS_CFG_MAIN_INIT_HOOK_8_ARGS) */
1171
#endif /* defined(AMIROOS_CFG_MAIN_INIT_HOOK_8) */
1172 1172

  
1173 1173
  /* completely start AMiRo-OS */
1174 1174
  if (shutdown == AOS_SHUTDOWN_NONE) {
......
1178 1178
#if defined(AMIROOS_CFG_MAIN_INIT_HOOK_9)
1179 1179
#if defined(AMIROOS_CFG_MAIN_INIT_HOOK_9_ARGS)
1180 1180
  AMIROOS_CFG_MAIN_INIT_HOOK_9(AMIROOS_CFG_MAIN_INIT_HOOK_9_ARGS);
1181
#else
1181
#else /* defined(AMIROOS_CFG_MAIN_INIT_HOOK_9_ARGS) */
1182 1182
  AMIROOS_CFG_MAIN_INIT_HOOK_9();
1183
#endif
1184
#endif
1183
#endif /* defined(AMIROOS_CFG_MAIN_INIT_HOOK_9_ARGS) */
1184
#endif /* defined(AMIROOS_CFG_MAIN_INIT_HOOK_9) */
1185 1185

  
1186 1186
  /*
1187 1187
   * ##########################################################################
......
1194 1194
    // wait for an event
1195 1195
#if (AMIROOS_CFG_MAIN_LOOP_TIMEOUT != 0)
1196 1196
    eventmask = chEvtWaitOneTimeout(ALL_EVENTS, chTimeUS2I(AMIROOS_CFG_MAIN_LOOP_TIMEOUT));
1197
#else
1197
#else /* (AMIROOS_CFG_MAIN_LOOP_TIMEOUT != 0) */
1198 1198
    eventmask = chEvtWaitOne(ALL_EVENTS);
1199
#endif
1199
#endif /* (AMIROOS_CFG_MAIN_LOOP_TIMEOUT != 0) */
1200 1200

  
1201 1201
#if defined(AMIROOS_CFG_MAIN_LOOP_HOOK_0)
1202 1202
#if defined(AMIROOS_CFG_MAIN_LOOP_HOOK_0_ARGS)
1203 1203
    AMIROOS_CFG_MAIN_LOOP_HOOK_0(AMIROOS_CFG_MAIN_LOOP_HOOK_0_ARGS);
1204
#else
1204
#else /* defined(AMIROOS_CFG_MAIN_LOOP_HOOK_0_ARGS) */
1205 1205
    AMIROOS_CFG_MAIN_LOOP_HOOK_0();
1206
#endif
1207
#endif
1206
#endif /* defined(AMIROOS_CFG_MAIN_LOOP_HOOK_0_ARGS) */
1207
#endif /* defined(AMIROOS_CFG_MAIN_LOOP_HOOK_0) */
1208 1208

  
1209 1209
    switch (eventmask) {
1210 1210
      // if this was an I/O event
......
1217 1217
          shutdown = AOS_SHUTDOWN_PASSIVE;
1218 1218
        }
1219 1219
        // all other events
1220
#ifdef MODULE_MAIN_LOOP_IO_EVENT
1220
#if defined(MODULE_MAIN_LOOP_IO_EVENT)
1221 1221
        else {
1222 1222
          MODULE_MAIN_LOOP_IO_EVENT(eventflags);
1223 1223
        }
1224
#endif
1225
#else /* AMIROOS_CFG_SSSP_ENABLE == false */
1226
#ifdef MODULE_MAIN_LOOP_IO_EVENT
1224
#endif /* defined(MODULE_MAIN_LOOP_IO_EVENT) */
1225
#else /* (AMIROOS_CFG_SSSP_ENABLE == true) */
1226
#if defined(MODULE_MAIN_LOOP_IO_EVENT)
1227 1227
        MODULE_MAIN_LOOP_IO_EVENT(eventflags);
1228
#endif
1229
#endif /* AMIROOS_CFG_SSSP_ENABLE */
1228
#endif /* defined(MODULE_MAIN_LOOP_IO_EVENT) */
1229
#endif /* (AMIROOS_CFG_SSSP_ENABLE == true) */
1230 1230
        break;
1231 1231

  
1232 1232
      // if this was an OS event
......
1247 1247
          case AOS_SYSTEM_EVENTFLAGS_RESTART:
1248 1248
            shutdown = AOS_SHUTDOWN_RESTART;
1249 1249
            break;
1250
#else /* AMIROOS_CFG_SSSP_ENABLE == false */
1250
#else /* (AMIROOS_CFG_SSSP_ENABLE == true) */
1251 1251
          case AOS_SYSTEM_EVENTFLAGS_SHUTDOWN:
1252 1252
            shutdown = AOS_SHUTDOWN_DEFAULT;
1253 1253
            break;
1254
#endif /* AMIROOS_CFG_SSSP_ENABLE */
1254
#endif /* (AMIROOS_CFG_SSSP_ENABLE == true) */
1255 1255
          default:
1256 1256
            _unexpectedEventError(eventmask, eventflags);
1257 1257
            break;
......
1263 1263
        eventflags = 0;
1264 1264
#if (AMIROOS_CFG_MAIN_LOOP_TIMEOUT == 0)
1265 1265
        _unexpectedEventError(eventmask, eventflags);
1266
#endif
1266
#endif /* (AMIROOS_CFG_MAIN_LOOP_TIMEOUT == 0) */
1267 1267
        break;
1268 1268
    }
1269 1269

  
1270 1270
#if defined(AMIROOS_CFG_MAIN_LOOP_HOOK_1)
1271 1271
#if defined(AMIROOS_CFG_MAIN_LOOP_HOOK_1_ARGS)
1272 1272
    AMIROOS_CFG_MAIN_LOOP_HOOK_1(AMIROOS_CFG_MAIN_LOOP_HOOK_1_ARGS);
1273
#else
1273
#else /* defined(AMIROOS_CFG_MAIN_LOOP_HOOK_1_ARGS) */
1274 1274
    AMIROOS_CFG_MAIN_LOOP_HOOK_1();
1275
#endif
1276
#endif
1275
#endif /* defined(AMIROOS_CFG_MAIN_LOOP_HOOK_1_ARGS) */
1276
#endif /* defined(AMIROOS_CFG_MAIN_LOOP_HOOK_1) */
1277 1277
  }
1278 1278

  
1279 1279
  /*
......
1285 1285
#if defined(AMIROOS_CFG_MAIN_SHUTDOWN_HOOK_0)
1286 1286
#if defined(AMIROOS_CFG_MAIN_SHUTDOWN_HOOK_0_ARGS)
1287 1287
    AMIROOS_CFG_MAIN_SHUTDOWN_HOOK_0(AMIROOS_CFG_MAIN_SHUTDOWN_HOOK_0_ARGS);
1288
#else
1288
#else /* defined(AMIROOS_CFG_MAIN_SHUTDOWN_HOOK_0_ARGS) */
1289 1289
    AMIROOS_CFG_MAIN_SHUTDOWN_HOOK_0();
1290
#endif
1291
#endif
1290
#endif /* defined(AMIROOS_CFG_MAIN_SHUTDOWN_HOOK_0_ARGS) */
1291
#endif /* defined(AMIROOS_CFG_MAIN_SHUTDOWN_HOOK_0) */
1292 1292

  
1293 1293
  // initialize/acknowledge shutdown
1294 1294
  aosSysShutdownInit(shutdown);
......
1296 1296
#if defined(AMIROOS_CFG_MAIN_SHUTDOWN_HOOK_1)
1297 1297
#if defined(AMIROOS_CFG_MAIN_SHUTDOWN_HOOK_1_ARGS)
1298 1298
    AMIROOS_CFG_MAIN_SHUTDOWN_HOOK_1(AMIROOS_CFG_MAIN_SHUTDOWN_HOOK_1_ARGS);
1299
#else
1299
#else /* defined(AMIROOS_CFG_MAIN_SHUTDOWN_HOOK_1_ARGS) */
1300 1300
    AMIROOS_CFG_MAIN_SHUTDOWN_HOOK_1();
1301
#endif
1302
#endif
1301
#endif /* defined(AMIROOS_CFG_MAIN_SHUTDOWN_HOOK_1_ARGS) */
1302
#endif /* defined(AMIROOS_CFG_MAIN_SHUTDOWN_HOOK_1) */
1303 1303

  
1304 1304
  // stop system threads
1305 1305
  aosSysStop();
......
1307 1307
#if defined(AMIROOS_CFG_MAIN_SHUTDOWN_HOOK_2)
1308 1308
#if defined(AMIROOS_CFG_MAIN_SHUTDOWN_HOOK_2_ARGS)
1309 1309
    AMIROOS_CFG_MAIN_SHUTDOWN_HOOK_2(AMIROOS_CFG_MAIN_SHUTDOWN_HOOK_2_ARGS);
1310
#else
1310
#else /* defined(AMIROOS_CFG_MAIN_SHUTDOWN_HOOK_2_ARGS) */
1311 1311
    AMIROOS_CFG_MAIN_SHUTDOWN_HOOK_2();
1312
#endif
1313
#endif
1312
#endif /* defined(AMIROOS_CFG_MAIN_SHUTDOWN_HOOK_2_ARGS) */
1313
#endif /* defined(AMIROOS_CFG_MAIN_SHUTDOWN_HOOK_2) */
1314 1314

  
1315 1315
  // deinitialize system
1316 1316
  aosSysDeinit();
......
1318 1318
#if defined(AMIROOS_CFG_MAIN_SHUTDOWN_HOOK_3)
1319 1319
#if defined(AMIROOS_CFG_MAIN_SHUTDOWN_HOOK_3_ARGS)
1320 1320
    AMIROOS_CFG_MAIN_SHUTDOWN_HOOK_3(AMIROOS_CFG_MAIN_SHUTDOWN_HOOK_3_ARGS);
1321
#else
1321
#else /* defined(AMIROOS_CFG_MAIN_SHUTDOWN_HOOK_3_ARGS) */
1322 1322
    AMIROOS_CFG_MAIN_SHUTDOWN_HOOK_3();
1323
#endif
1324
#endif
1323
#endif /* defined(AMIROOS_CFG_MAIN_SHUTDOWN_HOOK_3_ARGS) */
1324
#endif /* defined(AMIROOS_CFG_MAIN_SHUTDOWN_HOOK_3) */
1325 1325

  
1326 1326
  /* stop all periphery communication */
1327 1327
#if (AMIROOS_CFG_SSSP_ENABLE == true)
1328 1328
  // CAN (mandatory)
1329 1329
  canStop(&MODULE_HAL_CAN);
1330
#endif
1331
#ifdef MODULE_SHUTDOWN_PERIPHERY_COMM
1330
#endif /* (AMIROOS_CFG_SSSP_ENABLE == true) */
1331
#if defined(MODULE_SHUTDOWN_PERIPHERY_COMM)
1332 1332
  MODULE_SHUTDOWN_PERIPHERY_COMM();
1333
#endif
1333
#endif /* defined(MODULE_SHUTDOWN_PERIPHERY_COMM) */
1334 1334

  
1335 1335
#if defined(AMIROOS_CFG_MAIN_SHUTDOWN_HOOK_4)
1336 1336
#if defined(AMIROOS_CFG_MAIN_SHUTDOWN_HOOK_4_ARGS)
1337 1337
    AMIROOS_CFG_MAIN_SHUTDOWN_HOOK_4(AMIROOS_CFG_MAIN_SHUTDOWN_HOOK_4_ARGS);
1338
#else
1338
#else /* defined(AMIROOS_CFG_MAIN_SHUTDOWN_HOOK_4_ARGS) */
1339 1339
    AMIROOS_CFG_MAIN_SHUTDOWN_HOOK_4();
1340
#endif
1341
#endif
1340
#endif /* defined(AMIROOS_CFG_MAIN_SHUTDOWN_HOOK_4_ARGS) */
1341
#endif /* defined(AMIROOS_CFG_MAIN_SHUTDOWN_HOOK_4) */
1342 1342

  
1343 1343
  // finally hand over to bootloader
1344 1344
  aosSysShutdownFinal(shutdown);
core/src/aos_shell.c
336 336
               dt.tm_min,
337 337
               dt.tm_sec);
338 338
    }
339
#endif /* HAL_USE_RTC == TRUE */
339
#endif /* (HAL_USE_RTC == TRUE) */
340 340
    else {
341 341
      aosDbgAssert(false);
342 342
    }
core/src/aos_system.c
34 34
#if (AMIROOS_CFG_TESTS_ENABLE == true)
35 35
#include <ch_test.h>
36 36
#include <rt_test_root.h>
37
#endif
37
#endif /* (AMIROOS_CFG_TESTS_ENABLE == true) */
38 38

  
39 39
/******************************************************************************/
40 40
/* LOCAL DEFINITIONS                                                          */
......
90 90
static int _shellcmd_shutdowncb(BaseSequentialStream* stream, int argc, char* argv[]);
91 91
#if (AMIROOS_CFG_TESTS_ENABLE == true) || defined(__DOXYGEN__)
92 92
static int _shellcmd_kerneltestcb(BaseSequentialStream* stream, int argc, char* argv[]);
93
#endif /* AMIROOS_CFG_TESTS_ENABLE == true */
93
#endif /* (AMIROOS_CFG_TESTS_ENABLE == true) */
94 94
#endif /* (AMIROOS_CFG_SHELL_ENABLE == true) || (AMIROOS_CFG_TESTS_ENABLE == true) */
95 95

  
96 96
/**
......
168 168
static aos_shellcommand_t _shellcmd_shutdown = {
169 169
#if (AMIROOS_CFG_SSSP_ENABLE == true)
170 170
  /* name     */ "system:shutdown",
171
#else
171
#else /* (AMIROOS_CFG_SSSP_ENABLE == true) */
172 172
  /* name     */ "module:shutdown",
173
#endif
173
#endif /* (AMIROOS_CFG_SSSP_ENABLE == true) */
174 174
  /* callback */ _shellcmd_shutdowncb,
175 175
  /* next     */ NULL,
176 176
};
......
184 184
  /* callback */ _shellcmd_kerneltestcb,
185 185
  /* next     */ NULL,
186 186
};
187
#endif /* AMIROOS_CFG_TESTS_ENABLE == true */
187
#endif /* (AMIROOS_CFG_TESTS_ENABLE == true) */
188 188
#endif /* (AMIROOS_CFG_SHELL_ENABLE == true) || (AMIROOS_CFG_TESTS_ENABLE == true) */
189 189

  
190 190
/******************************************************************************/
......
263 263
#if (HAL_USE_RTC == TRUE)
264 264
  struct tm dt;
265 265
  aosSysGetDateTime(&dt);
266
#endif /* HAL_USE_RTC == TRUE */
266
#endif /* (HAL_USE_RTC == TRUE) */
267 267

  
268 268
  // print static information about module and operating system
269 269
  _printSystemInfoSeparator(stream, '=', SYSTEM_INFO_WIDTH);
270 270
  _printSystemInfoLine(stream, "Module", SYSTEM_INFO_NAMEWIDTH, "%s", BOARD_NAME);
271
#ifdef PLATFORM_NAME
271
#if defined(PLATFORM_NAME)
272 272
  _printSystemInfoLine(stream, "Platform", SYSTEM_INFO_NAMEWIDTH, "%s", PLATFORM_NAME);
273
#endif
274
#ifdef PORT_CORE_VARIANT_NAME
273
#endif /* defined(PLATFORM_NAME) */
274
#if defined(PORT_CORE_VARIANT_NAME)
275 275
  _printSystemInfoLine(stream, "Core Variant", SYSTEM_INFO_NAMEWIDTH, "%s", PORT_CORE_VARIANT_NAME);
276
#endif
276
#endif /* defined(PORT_CORE_VARIANT_NAME) */
277 277
  _printSystemInfoLine(stream, "Architecture", SYSTEM_INFO_NAMEWIDTH, "%s", PORT_ARCHITECTURE_NAME);
278 278
  _printSystemInfoSeparator(stream, '-', SYSTEM_INFO_WIDTH);
279 279
#if (AMIROOS_CFG_SSSP_ENABLE == true)
280 280
  _printSystemInfoLine(stream, "AMiRo-OS" , SYSTEM_INFO_NAMEWIDTH, "%u.%u.%u %s (SSSP %u.%u)", AMIROOS_VERSION_MAJOR, AMIROOS_VERSION_MINOR, AMIROOS_VERSION_PATCH, AMIROOS_RELEASE_TYPE, AOS_SYSTEM_SSSP_VERSION_MAJOR, AOS_SYSTEM_SSSP_VERSION_MINOR);
281
#else
281
#else /* (AMIROOS_CFG_SSSP_ENABLE == true) */
282 282
  _printSystemInfoLine(stream, "AMiRo-OS" , SYSTEM_INFO_NAMEWIDTH, "%u.%u.%u %s", AMIROOS_VERSION_MAJOR, AMIROOS_VERSION_MINOR, AMIROOS_VERSION_PATCH, AMIROOS_RELEASE_TYPE);
283
#endif
283
#endif /* (AMIROOS_CFG_SSSP_ENABLE == true) */
284 284
  _printSystemInfoLine(stream, "AMiRo-LLD" , SYSTEM_INFO_NAMEWIDTH, "%u.%u.%u %s (periphAL %u.%u)", AMIRO_LLD_VERSION_MAJOR, AMIRO_LLD_VERSION_MINOR, AMIRO_LLD_VERSION_PATCH, AMIRO_LLD_RELEASE_TYPE, PERIPHAL_VERSION_MAJOR, PERIPHAL_VERSION_MINOR);
285 285
  _printSystemInfoLine(stream, "ChibiOS/RT" , SYSTEM_INFO_NAMEWIDTH, "%u.%u.%u %s", CH_KERNEL_MAJOR, CH_KERNEL_MINOR, CH_KERNEL_PATCH, (CH_KERNEL_STABLE == 1) ? "stable" : "non-stable");
286 286
  _printSystemInfoLine(stream, "ChibiOS/HAL", SYSTEM_INFO_NAMEWIDTH, "%u.%u.%u %s", CH_HAL_MAJOR, CH_HAL_MINOR, CH_HAL_PATCH, (CH_HAL_STABLE == 1) ? "stable" : "non-stable");
......
307 307
        aosprintf("WARNING: Bootloader and AMiRo-OS implement incompatible SSSP versions!\n");
308 308
      }
309 309
    }
310
#endif
310
#endif /* (AMIROOS_CFG_SSSP_ENABLE == true) */
311 311
    _printSystemInfoLine(stream, "Compiler", SYSTEM_INFO_NAMEWIDTH, "%s %u.%u.%u", (BL_CALLBACK_TABLE_ADDRESS->vCompiler.identifier == BL_VERSION_ID_GCC) ? "GCC" : "<compiler unknown>", BL_CALLBACK_TABLE_ADDRESS->vCompiler.major, BL_CALLBACK_TABLE_ADDRESS->vCompiler.minor, BL_CALLBACK_TABLE_ADDRESS->vCompiler.patch); // TODO: support other compilers than GCC
312 312
  } else {
313 313
    if (stream) {
......
325 325
  } else {
326 326
    _printSystemInfoLine(stream, "Module ID", SYSTEM_INFO_NAMEWIDTH, "not available");
327 327
  }
328
#endif
328
#endif /* (AMIROOS_CFG_SSSP_ENABLE == true) */
329 329
#if (HAL_USE_RTC == TRUE)
330 330
  _printSystemInfoLine(stream, "Date", SYSTEM_INFO_NAMEWIDTH, "%s %02u-%02u-%04u", (dt.tm_wday == 0) ? "Sunday" : (dt.tm_wday == 1) ? "Monday" : (dt.tm_wday == 2) ? "Tuesday" : (dt.tm_wday == 3) ? "Wednesday" : (dt.tm_wday == 4) ? "Thursday" : (dt.tm_wday == 5) ? "Friday" : "Saturday",
331 331
                       dt.tm_mday,
332 332
                       dt.tm_mon + 1,
333 333
                       dt.tm_year + 1900);
334 334
  _printSystemInfoLine(stream, "Time", SYSTEM_INFO_NAMEWIDTH, "%02u:%02u:%02u", dt.tm_hour, dt.tm_min, dt.tm_sec);
335
#endif /* HAL_USE_RTC == TRUE */
335
#endif /* (HAL_USE_RTC == TRUE) */
336 336

  
337 337
  _printSystemInfoSeparator(stream, '=', SYSTEM_INFO_WIDTH);
338 338

  
......
475 475

  
476 476
      retval = AOS_OK;
477 477
    }
478
#endif /* HAL_USE_RTC == TRUE */
478
#endif /* (HAL_USE_RTC == TRUE) */
479 479
  }
480 480

  
481 481
  // print help, if required
......
501 501
    chprintf(stream, "      hour\n");
502 502
    chprintf(stream, "      minute\n");
503 503
    chprintf(stream, "      second\n");
504
#endif /* HAL_USE_RTC == TRUE */
504
#endif /* (HAL_USE_RTC == TRUE) */
505 505
  }
506 506

  
507 507
  return (argc > 1 && strcmp(argv[1], "--help") == 0) ? AOS_OK : retval;
......
542 542
  chprintf(stream, "%10u microseconds\n", (uint16_t)(uptime % MICROSECONDS_PER_MILLISECOND / MICROSECONDS_PER_MICROSECOND));
543 543
#if (AMIROOS_CFG_SSSP_ENABLE == true) && (AMIROOS_CFG_SSSP_MASTER != true) && (AMIROOS_CFG_PROFILE == true)
544 544
  chprintf(stream, "SSSP synchronization offset: %.3fus per %uus\n", _syssyncskew, AMIROOS_CFG_SSSP_SYSSYNCPERIOD);
545
#endif /* AMIROOS_CFG_SSSP_MASTER != true && AMIROOS_CFG_PROFILE == true */
545
#endif /* (AMIROOS_CFG_SSSP_ENABLE == true) && (AMIROOS_CFG_SSSP_MASTER != true) && (AMIROOS_CFG_PROFILE == true) */
546 546
  _printSystemInfoSeparator(stream, '=', SYSTEM_INFO_WIDTH);
547 547

  
548 548
  // print shell info
......
554 554
  chprintf(stream, "\tthread stack size:      %u bytes\n", aosThdGetStacksize(aos.shell.thread));
555 555
#if (CH_DBG_FILL_THREADS == TRUE)
556 556
  chprintf(stream, "\tstack peak utilization: %u bytes (%.2f%%)\n", aosThdGetStackPeakUtilization(aos.shell.thread), (float)aosThdGetStackPeakUtilization(aos.shell.thread) / (float)aosThdGetStacksize(aos.shell.thread) * 100.0f);
557
#endif /* CH_DBG_FILL_THREADS == TRUE */
558
#endif /* AMIROOS_CFG_DBG == true */
557
#endif /* (CH_DBG_FILL_THREADS == TRUE) */
558
#endif /* (AMIROOS_CFG_DBG == true) */
559 559
  _printSystemInfoSeparator(stream, '=', SYSTEM_INFO_WIDTH);
560 560

  
561 561
  return AOS_OK;
......
624 624
      return AOS_INVALID_ARGUMENTS;
625 625
    }
626 626
  }
627
#else /* AMIROOS_CFG_SSSP_ENABLE == false */
627
#else /* (AMIROOS_CFG_SSSP_ENABLE == true) */
628 628
  (void)argv;
629 629
  (void)argc;
630 630

  
631 631
  chEvtBroadcastFlags(&aos.events.os, AOS_SYSTEM_EVENTFLAGS_SHUTDOWN);
632 632
  chThdTerminate(chThdGetSelfX());
633 633
  return AOS_OK;
634
#endif /* AMIROOS_CFG_SSSP_ENABLE */
634
#endif /* (AMIROOS_CFG_SSSP_ENABLE == true) */
635 635
}
636 636

  
637 637
#if (AMIROOS_CFG_TESTS_ENABLE == true) || defined(__DOXYGEN__)
......
655 655

  
656 656
  return retval;
657 657
}
658
#endif /* AMIROOS_CFG_TESTS_ENABLE == true */
658
#endif /* (AMIROOS_CFG_TESTS_ENABLE == true) */
659 659
#endif /* (AMIROOS_CFG_SHELL_ENABLE == true) || (AMIROOS_CFG_TESTS_ENABLE == true) */
660 660

  
661 661
// suppress warning in case no interrupt GPIOs are defined
......
705 705
        _uptime -= uptime % AMIROOS_CFG_SSSP_SYSSYNCPERIOD;
706 706
#if (AMIROOS_CFG_PROFILE == true)
707 707
        _syssyncskew = ((1.0f - SYSTEM_SYSSYNCSKEW_LPFACTOR) * _syssyncskew) + (SYSTEM_SYSSYNCSKEW_LPFACTOR * (uptime % AMIROOS_CFG_SSSP_SYSSYNCPERIOD));
708
#endif
708
#endif /* (AMIROOS_CFG_PROFILE == true) */
709 709
      } else {
710 710
        _uptime += AMIROOS_CFG_SSSP_SYSSYNCPERIOD - (uptime % AMIROOS_CFG_SSSP_SYSSYNCPERIOD);
711 711
#if (AMIROOS_CFG_PROFILE == true)
712 712
        _syssyncskew = ((1.0f - SYSTEM_SYSSYNCSKEW_LPFACTOR) * _syssyncskew) - (SYSTEM_SYSSYNCSKEW_LPFACTOR * (AMIROOS_CFG_SSSP_SYSSYNCPERIOD - (uptime % AMIROOS_CFG_SSSP_SYSSYNCPERIOD)));
713
#endif
713
#endif /* (AMIROOS_CFG_PROFILE == true) */
714 714
      }
715 715
    }
716 716
  }
......
792 792
 */
793 793
#if (AMIROOS_CFG_SHELL_ENABLE == true) || (AMIROOS_CFG_TESTS_ENABLE == true) || defined(__DOXYGEN__)
794 794
void aosSysInit(const char* shellPrompt)
795
#else
795
#else /* (AMIROOS_CFG_SHELL_ENABLE == true) || (AMIROOS_CFG_TESTS_ENABLE == true) */
796 796
void aosSysInit(void)
797
#endif
797
#endif /* (AMIROOS_CFG_SHELL_ENABLE == true) || (AMIROOS_CFG_TESTS_ENABLE == true) */
798 798
{
799 799
  /* set control thread to maximum priority */
800 800
  chThdSetPriority(AOS_THD_CTRLPRIO);
......
807 807
#if (AMIROOS_CFG_SSSP_MASTER == true)
808 808
  chVTObjectInit(&_syssynctimer);
809 809
  _syssynctime = 0;
810
#endif
810
#endif /* (AMIROOS_CFG_SSSP_MASTER == true) */
811 811
#if (AMIROOS_CFG_SSSP_MASTER != true) && (AMIROOS_CFG_PROFILE == true)
812 812
  _syssyncskew = 0.0f;
813
#endif
814
#else /* AMIROOS_CFG_SSSP_ENABLE == false */
813
#endif /* (AMIROOS_CFG_SSSP_MASTER != true) && (AMIROOS_CFG_PROFILE == true) */
814
#else /* (AMIROOS_CFG_SSSP_ENABLE == true) */
815 815
  // start the uptime counter
816 816
  chSysLock();
817 817
  _synctime = chVTGetSystemTimeX();
818 818
  _uptime = 0;
819 819
  chVTSetI(&_systimer, SYSTIMER_PERIOD, &_uptimeCallback, NULL);
820 820
  chSysUnlock();
821
#endif /* AMIROOS_CFG_SSSP_ENABLE */
821
#endif /* (AMIROOS_CFG_SSSP_ENABLE == true) */
822 822

  
823 823
  /* initialize aos configuration */
824 824
#if (AMIROOS_CFG_SSSP_ENABLE == true)
825 825
  aos.sssp.stage = AOS_SSSP_STARTUP_2_1;
826 826
  aos.sssp.moduleId = 0;
827
#endif
827
#endif /* (AMIROOS_CFG_SSSP_ENABLE == true) */
828 828
  aosIOStreamInit(&aos.iostream);
829 829
  chEvtObjectInit(&aos.events.io);
830 830
  chEvtObjectInit(&aos.events.os);
......
837 837
  // SYNC signal
838 838
#if (AMIROOS_CFG_SSSP_MASTER == true)
839 839
  palSetPadCallback(moduleSsspGpioSync.gpio->port, moduleSsspGpioSync.gpio->pad, _intCallback, &moduleSsspGpioSync.gpio->pad);
840
#else
840
#else /* (AMIROOS_CFG_SSSP_MASTER == true) */
841 841
  palSetPadCallback(moduleSsspGpioSync.gpio->port, moduleSsspGpioSync.gpio->pad, _signalSyncCallback, &moduleSsspGpioSync.gpio->pad);
842
#endif
842
#endif /* (AMIROOS_CFG_SSSP_MASTER == true) */
843 843
  palEnablePadEvent(moduleSsspGpioSync.gpio->port, moduleSsspGpioSync.gpio->pad, APAL2CH_EDGE(moduleSsspGpioSync.meta.edge));
844 844
#if (AMIROOS_CFG_SSSP_STACK_START != true)
845 845
  // DN signal
846 846
  palSetPadCallback(moduleSsspGpioDn.gpio->port, moduleSsspGpioDn.gpio->pad, _intCallback, &moduleSsspGpioDn.gpio->pad);
847 847
  palEnablePadEvent(moduleSsspGpioDn.gpio->port, moduleSsspGpioDn.gpio->pad, APAL2CH_EDGE(moduleSsspGpioDn.meta.edge));
848
#endif
848
#endif /* (AMIROOS_CFG_SSSP_STACK_START != true) */
849 849
#if (AMIROOS_CFG_SSSP_STACK_END != true)
850 850
  // UP signal
851 851
  palSetPadCallback(moduleSsspGpioUp.gpio->port, moduleSsspGpioUp.gpio->pad, _intCallback, &moduleSsspGpioUp.gpio->pad);
852 852
  palEnablePadEvent(moduleSsspGpioUp.gpio->port, moduleSsspGpioUp.gpio->pad, APAL2CH_EDGE(moduleSsspGpioUp.meta.edge));
853
#endif
854
#endif /* AMIROOS_CFG_SSSP_ENABLE == true */
855
#ifdef MODULE_INIT_INTERRUPTS
853
#endif /* (AMIROOS_CFG_SSSP_STACK_END != true) */
854
#endif /* (AMIROOS_CFG_SSSP_ENABLE == true) */
855
#if defined(MODULE_INIT_INTERRUPTS)
856 856
  // further interrupt signals
857 857
  MODULE_INIT_INTERRUPTS();
858
#endif
858
#endif /* defined(MODULE_INIT_INTERRUPTS) */
859 859

  
860 860
#if (AMIROOS_CFG_SHELL_ENABLE == true) || (AMIROOS_CFG_TESTS_ENABLE == true)
861 861
  /* init shell */
......
872 872
  aosShellAddCommand(&aos.shell, &_shellcmd_shutdown);
873 873
#if (AMIROOS_CFG_TESTS_ENABLE == true)
874 874
  aosShellAddCommand(&aos.shell, &_shellcmd_kerneltest);
875
#endif
875
#endif /* (AMIROOS_CFG_TESTS_ENABLE == true) */
876 876
#endif /* (AMIROOS_CFG_SHELL_ENABLE == true) || (AMIROOS_CFG_TESTS_ENABLE == true) */
877 877

  
878 878
  return;
......
898 898
    chVTSetI(&_syssynctimer, chTimeUS2I((t > (AMIROOS_CFG_SSSP_SYSSYNCPERIOD / 2)) ? (t - (AMIROOS_CFG_SSSP_SYSSYNCPERIOD / 2)) : (t + (AMIROOS_CFG_SSSP_SYSSYNCPERIOD / 2))), _sysSyncTimerCallback, NULL);
899 899
    chSysUnlock();
900 900
  }
901
#endif
902
#endif /* AMIROOS_CFG_SSSP_ENABLE == true */
901
#endif /* (AMIROOS_CFG_SSSP_MASTER == true) */
902
#endif /* (AMIROOS_CFG_SSSP_ENABLE == true) */
903 903

  
904 904
  // print system information;
905 905
  _printSystemInfo((BaseSequentialStream*)&aos.iostream);
......
909 909
  // start system shell thread
910 910
#if (CH_CFG_USE_THREADHIERARCHY == TRUE)
911 911
  aos.shell.thread = chThdCreateStatic(_shell_wa, sizeof(_shell_wa), AMIROOS_CFG_SHELL_THREADPRIO, aosShellThread, &aos.shell, &ch.mainthread);
912
#else
912
#else /* (CH_CFG_USE_THREADHIERARCHY == TRUE) */
913 913
  aos.shell.thread = chThdCreateStatic(_shell_wa, sizeof(_shell_wa), AMIROOS_CFG_SHELL_THREADPRIO, aosShellThread, &aos.shell);
914
#endif
915
#endif
914
#endif /* (CH_CFG_USE_THREADHIERARCHY == TRUE) */
915
#endif /* (AMIROOS_CFG_SHELL_ENABLE == true) || (AMIROOS_CFG_TESTS_ENABLE == true) */
916 916

  
917 917
  return;
918 918
}
......
968 968
    return m;
969 969
  }
970 970
}
971
#endif /* AMIROOS_CFG_SSSP_ENABLE == true */
971
#endif /* (AMIROOS_CFG_SSSP_ENABLE == true) */
972 972

  
973 973
/**
974 974
 * @brief   Retrieves the system uptime.
......
1018 1018
  return;
1019 1019
}
1020 1020

  
1021
#endif /* HAL_USE_RTC == TRUE */
1021
#endif /* (HAL_USE_RTC == TRUE) */
1022 1022

  
1023 1023
/**
1024 1024
 * @brief   Initializes/Acknowledges a system shutdown/restart request.
......
1035 1035
#if (AMIROOS_CFG_SSSP_MASTER == true)
1036 1036
  // deactivate the system synchronization timer
1037 1037
  chVTReset(&_syssynctimer);
1038
#endif
1038
#endif /* (AMIROOS_CFG_SSSP_MASTER == true) */
1039 1039

  
1040 1040
  // update the system SSSP stage
1041 1041
  aos.sssp.stage = AOS_SSSP_SHUTDOWN_1_1;
......
1048 1048
  // activate the SYS_SYNC signal
1049 1049
  apalControlGpioSet(&moduleSsspGpioSync, APAL_GPIO_ON);
1050 1050
  chSysUnlock();
1051
#endif /* AMIROOS_CFG_SSSP_ENABLE == true */
1051
#endif /* (AMIROOS_CFG_SSSP_ENABLE == true) */
1052 1052

  
1053 1053
  switch (shutdown) {
1054 1054
    case AOS_SHUTDOWN_PASSIVE:
......
1080 1080
#if (AMIROOS_CFG_SSSP_ENABLE == true)
1081 1081
  // update the system SSSP stage
1082 1082
  aos.sssp.stage = AOS_SSSP_SHUTDOWN_1_2;
1083
#endif
1083
#endif /* (AMIROOS_CFG_SSSP_ENABLE == true) */
1084 1084

  
1085 1085
  return;
1086 1086
}
......
1092 1092
{
1093 1093
#if (AMIROOS_CFG_SHELL_ENABLE == true) || (AMIROOS_CFG_TESTS_ENABLE == true)
1094 1094
  chThdWait(aos.shell.thread);
1095
#endif
1095
#endif /* (AMIROOS_CFG_SHELL_ENABLE == true) || (AMIROOS_CFG_TESTS_ENABLE == true) */
1096 1096

  
1097 1097
  return;
1098 1098
}
......
1122 1122
#if (AMIROOS_CFG_SSSP_ENABLE == true)
1123 1123
  // update the system SSSP stage
1124 1124
  aos.sssp.stage = AOS_SSSP_SHUTDOWN_1_3;
1125
#endif
1125
#endif /* (AMIROOS_CFG_SSSP_ENABLE == true) */
1126 1126

  
1127 1127
  // validate bootloader
1128 1128
  if ((BL_CALLBACK_TABLE_ADDRESS->magicNumber == BL_MAGIC_NUMBER) &&
core/src/aos_unittest.c
293 293
  return;
294 294
}
295 295

  
296
#endif /* AMIROOS_CFG_TESTS_ENABLE == true */
296
#endif /* (AMIROOS_CFG_TESTS_ENABLE == true) */
297 297

  
298 298
/** @} */
modules/DiWheelDrive_1-1/aosconf.h
42 42
 */
43 43
#if defined(AMIRO_APPS) && (AMIRO_APPS == true)
44 44
  #include <osconf.h>
45
#endif
45
#endif /* defined(AMIRO_APPS) && (AMIRO_APPS == true) */
46 46

  
47 47
/*===========================================================================*/
48 48
/**
......
56 56
 */
57 57
#if !defined(OS_CFG_DBG)
58 58
  #define AMIROOS_CFG_DBG                       true
59
#else
59
#else /* !defined(OS_CFG_DBG) */
60 60
  #define AMIROOS_CFG_DBG                       OS_CFG_DBG
61
#endif
61
#endif /* !defined(OS_CFG_DBG) */
62 62

  
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff