2019-03-31 14:14:53 -07:00
|
|
|
/*
|
2019-12-23 20:05:40 -08:00
|
|
|
* @file counter64.h
|
2019-03-31 14:14:53 -07:00
|
|
|
*
|
|
|
|
* Created on: Mar 31, 2019
|
2020-01-07 21:02:40 -08:00
|
|
|
* @author Andrey Belomutskiy, (c) 2012-2020
|
2019-03-31 14:14:53 -07:00
|
|
|
*/
|
|
|
|
|
2020-03-22 21:00:11 -07:00
|
|
|
#pragma once
|
2019-03-31 14:14:53 -07:00
|
|
|
|
|
|
|
#include "global.h"
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
// todo: would probably be better to keep the high bits as 32 bit field to be sure
|
|
|
|
volatile efitime_t highBits;
|
|
|
|
volatile uint32_t lowBits;
|
|
|
|
} State64;
|
|
|
|
|
|
|
|
void updateAndSet(State64 *state, uint32_t value);
|
|
|
|
|
|
|
|
class Overflow64Counter
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
Overflow64Counter();
|
|
|
|
|
|
|
|
efitime_t get();
|
|
|
|
#if EFI_UNIT_TEST
|
|
|
|
efitime_t update(uint32_t value);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
State64 state;
|
|
|
|
};
|