rusefi/firmware/util/efilib2.h

45 lines
827 B
C
Raw Normal View History

2015-07-10 06:01:56 -07:00
/**
* @file efilib2.h
*
* @date Apr 14, 2014
2017-01-03 03:05:22 -08:00
* @author Andrey Belomutskiy, (c) 2012-2017
2015-07-10 06:01:56 -07:00
*/
#ifndef EFILIB2_H_
#define EFILIB2_H_
2018-09-16 19:25:17 -07:00
#include "global.h"
2015-07-10 06:01:56 -07:00
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);
/**
* @return for a given stack memory region returns how much stack was ever used
*/
int getMaxUsedStack(uint8_t *ptr, int size);
2015-07-10 06:01:56 -07:00
class Overflow64Counter
{
public:
Overflow64Counter();
efitime_t get();
#if EFI_UNIT_TEST
efitime_t update(uint32_t value);
#endif
State64 state;
};
#if (EFI_PROD_CODE || EFI_SIMULATOR)
2017-03-21 11:58:14 -07:00
#define GET_TIMESTAMP() port_rt_get_counter_value()
2015-07-10 06:01:56 -07:00
#else
#define GET_TIMESTAMP() 0
#endif
#endif /* EFILIB2_H_ */