fsfw/osal/rtems/RtemsBasic.h

27 lines
683 B
C
Raw Permalink Normal View History

2020-11-17 19:35:37 +01:00
#ifndef FSFW_OSAL_RTEMS_RTEMSBASIC_H_
#define FSFW_OSAL_RTEMS_RTEMSBASIC_H_
2020-08-13 20:53:35 +02:00
#include "../../returnvalues/HasReturnvaluesIF.h"
2021-01-28 11:28:28 +01:00
#include <rtems.h>
#include <rtems/libio.h>
#include <rtems/error.h>
#include <rtems/stackchk.h>
2021-01-28 11:28:28 +01:00
#include <cstddef>
2018-07-13 18:28:26 +02:00
class RtemsBasic {
public:
static rtems_interval convertMsToTicks(uint32_t msIn) {
2018-07-13 18:28:26 +02:00
rtems_interval ticks_per_second = rtems_clock_get_ticks_per_second();
return (ticks_per_second * msIn) / 1000;
}
static rtems_interval convertTicksToMs(rtems_interval ticksIn) {
2018-07-13 18:28:26 +02:00
rtems_interval ticks_per_second = rtems_clock_get_ticks_per_second();
return (ticksIn * 1000) / ticks_per_second;
}
};
2020-11-17 19:35:37 +01:00
#endif /* FSFW_OSAL_RTEMS_RTEMSBASIC_H_ */