More adjustments for consistency.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@14235 27425a3e-05d8-49a3-a47f-9c15f0e5edd8
This commit is contained in:
parent
09945f4cc8
commit
4f8939fdc8
|
@ -79,13 +79,13 @@
|
|||
* + {static} chSchGoSleepTimeoutS()
|
||||
* }
|
||||
* class tm_calibration_t {
|
||||
* # __tm_calibration_init()
|
||||
* # __tm_calibration_object_init()
|
||||
* }
|
||||
* class system_debug_t {
|
||||
* # __dbg_object_init()
|
||||
* }
|
||||
* class trace_buffer_t {
|
||||
* # __trace_init()
|
||||
* # __trace_object_init()
|
||||
* }
|
||||
* class kernel_stats_t {
|
||||
* # __stats_object_init()
|
||||
|
|
|
@ -34,6 +34,13 @@
|
|||
/* Module constants. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* @brief Number of iterations in the calibration loop.
|
||||
* @note This is required in order to assess the best result in
|
||||
* architectures with instruction cache.
|
||||
*/
|
||||
#define TM_CALIBRATION_LOOP 4U
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Module pre-compile time settings. */
|
||||
/*===========================================================================*/
|
||||
|
@ -88,7 +95,6 @@ typedef struct {
|
|||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
void __tm_calibration_init(void);
|
||||
void chTMObjectInit(time_measurement_t *tmp);
|
||||
NOINLINE void chTMStartMeasurementX(time_measurement_t *tmp);
|
||||
NOINLINE void chTMStopMeasurementX(time_measurement_t *tmp);
|
||||
|
@ -102,6 +108,32 @@ extern "C" {
|
|||
/* Module inline functions. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* @brief Time measurement initialization.
|
||||
* @note Internal use only.
|
||||
*
|
||||
* @param[out] tcp pointer to the @p tm_calibration_t structure
|
||||
*
|
||||
* @notapi
|
||||
*/
|
||||
static inline void __tm_calibration_object_init(tm_calibration_t *tcp) {
|
||||
unsigned i;
|
||||
time_measurement_t tm;
|
||||
|
||||
/* Time Measurement subsystem calibration, it does a null measurement
|
||||
and calculates the call overhead which is subtracted to real
|
||||
measurements.*/
|
||||
tcp->offset = (rtcnt_t)0;
|
||||
chTMObjectInit(&tm);
|
||||
i = TM_CALIBRATION_LOOP;
|
||||
do {
|
||||
chTMStartMeasurementX(&tm);
|
||||
chTMStopMeasurementX(&tm);
|
||||
i--;
|
||||
} while (i > 0U);
|
||||
tcp->offset = tm.best;
|
||||
}
|
||||
|
||||
#endif /* CH_CFG_USE_TM == TRUE */
|
||||
|
||||
#endif /* CHTM_H */
|
||||
|
|
|
@ -248,7 +248,7 @@ typedef struct {
|
|||
extern "C" {
|
||||
#endif
|
||||
#if (CH_DBG_TRACE_MASK != CH_DBG_TRACE_MASK_DISABLED) || defined(__DOXYGEN__)
|
||||
void __trace_init(os_instance_t *oip);
|
||||
void __trace_object_init(trace_buffer_t *tbp);
|
||||
void __trace_ready(thread_t *tp, msg_t msg);
|
||||
void __trace_switch(thread_t *ntp, thread_t *otp);
|
||||
void __trace_isr_enter(const char *isr);
|
||||
|
|
|
@ -124,7 +124,7 @@ void chInstanceObjectInit(os_instance_t *oip,
|
|||
|
||||
#if CH_DBG_TRACE_MASK != CH_DBG_TRACE_MASK_DISABLED
|
||||
/* Trace buffer initialization.*/
|
||||
__trace_init(oip);
|
||||
__trace_object_init(&oip->trace_buffer);
|
||||
#endif
|
||||
|
||||
/* Statistics initialization.*/
|
||||
|
|
|
@ -163,16 +163,16 @@ void chSysInit(void) {
|
|||
ch_system.instances[i] = NULL;
|
||||
}
|
||||
|
||||
#if CH_CFG_USE_TM == TRUE
|
||||
/* Time Measurement calibration.*/
|
||||
__tm_calibration_object_init(&ch_system.tmc);
|
||||
#endif
|
||||
|
||||
#if (CH_CFG_USE_REGISTRY == TRUE) && (CH_CFG_SMP_MODE == TRUE)
|
||||
/* Registry initialization when SMP mode is enabled.*/
|
||||
chRegObjectInit(&ch_system.reglist);
|
||||
#endif
|
||||
|
||||
#if CH_CFG_USE_TM == TRUE
|
||||
/* Time Measurement initialization.*/
|
||||
__tm_calibration_init();
|
||||
#endif
|
||||
|
||||
/* User system initialization hook.*/
|
||||
CH_CFG_SYSTEM_INIT_HOOK();
|
||||
|
||||
|
|
|
@ -34,13 +34,6 @@
|
|||
/* Module local definitions. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* @brief Number of iterations in the calibration loop.
|
||||
* @note This is required in order to assess the best result in
|
||||
* architectures with instruction cache.
|
||||
*/
|
||||
#define TM_CALIBRATION_LOOP 4U
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Module exported variables. */
|
||||
/*===========================================================================*/
|
||||
|
@ -76,32 +69,6 @@ static inline void tm_stop(time_measurement_t *tmp,
|
|||
/* Module exported functions. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* @brief Time measurement initialization.
|
||||
* @note Internal use only.
|
||||
*
|
||||
* @param[out] tcp pointer to the @p tm_calibration_t structure
|
||||
*
|
||||
* @notapi
|
||||
*/
|
||||
void __tm_calibration_init(void) {
|
||||
time_measurement_t tm;
|
||||
unsigned i;
|
||||
|
||||
/* Time Measurement subsystem calibration, it does a null measurement
|
||||
and calculates the call overhead which is subtracted to real
|
||||
measurements.*/
|
||||
ch_system.tmc.offset = (rtcnt_t)0;
|
||||
chTMObjectInit(&tm);
|
||||
i = TM_CALIBRATION_LOOP;
|
||||
do {
|
||||
chTMStartMeasurementX(&tm);
|
||||
chTMStopMeasurementX(&tm);
|
||||
i--;
|
||||
} while (i > 0U);
|
||||
ch_system.tmc.offset = tm.best;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Initializes a @p TimeMeasurement object.
|
||||
*
|
||||
|
|
|
@ -81,18 +81,18 @@ NOINLINE static void trace_next(os_instance_t *oip) {
|
|||
* @brief Circular trace buffer initialization.
|
||||
* @note Internal use only.
|
||||
*
|
||||
* @param[out] oip pointer to the @p os_instance_t structure
|
||||
* @param[out] tbp pointer to the @p trace_buffer_t structure
|
||||
*
|
||||
* @notapi
|
||||
*/
|
||||
void __trace_init(os_instance_t *oip) {
|
||||
void __trace_object_init(trace_buffer_t *tbp) {
|
||||
unsigned i;
|
||||
|
||||
oip->trace_buffer.suspended = (uint16_t)~CH_DBG_TRACE_MASK;
|
||||
oip->trace_buffer.size = CH_DBG_TRACE_BUFFER_SIZE;
|
||||
oip->trace_buffer.ptr = &oip->trace_buffer.buffer[0];
|
||||
tbp->suspended = (uint16_t)~CH_DBG_TRACE_MASK;
|
||||
tbp->size = CH_DBG_TRACE_BUFFER_SIZE;
|
||||
tbp->ptr = &tbp->buffer[0];
|
||||
for (i = 0U; i < (unsigned)CH_DBG_TRACE_BUFFER_SIZE; i++) {
|
||||
oip->trace_buffer.buffer[i].type = CH_TRACE_TYPE_UNUSED;
|
||||
tbp->buffer[i].type = CH_TRACE_TYPE_UNUSED;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue