rusefi-1/firmware/main.h

78 lines
1.1 KiB
C
Raw Normal View History

2014-08-29 07:52:33 -07:00
/**
* @file main.h
*
* @date Nov 29, 2012
2015-01-12 15:04:10 -08:00
* @author Andrey Belomutskiy, (c) 2012-2015
2014-08-29 07:52:33 -07:00
*/
#pragma once
#ifndef MAIN_H_
#define MAIN_H_
#include <math.h>
2015-03-08 15:07:31 -07:00
#include "efilib.h"
2014-08-29 07:52:33 -07:00
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
#include "global.h"
#include "rusefi.h"
#include "efifeatures.h"
#include "efitime.h"
#include "rusefi_enums.h"
2015-01-13 18:06:35 -08:00
#ifdef __cplusplus
2015-01-15 13:03:51 -08:00
#include "cli_registry.h"
2014-08-29 07:52:33 -07:00
#include "datalogging.h"
2015-01-15 13:03:51 -08:00
#include "eficonsole.h"
2015-01-13 18:06:35 -08:00
#endif
2014-08-29 07:52:33 -07:00
#include "chprintf.h"
#ifdef __cplusplus
}
#endif /* __cplusplus */
// todo: access some existing configuration field
#define CORE_CLOCK 168000000
2014-09-12 20:04:25 -07:00
// 168 ticks in microsecond
#define US_TO_NT_MULTIPLIER 168
2015-01-02 18:03:33 -08:00
/**
* converts efitimeus_t to efitick_t
*/
#define US2NT(us) (((uint64_t)(us))*US_TO_NT_MULTIPLIER)
2014-09-12 20:04:25 -07:00
2015-01-02 18:03:33 -08:00
/**
* converts efitick_t to efitimeus_t
*/
#define NT2US(nt) ((nt) / US_TO_NT_MULTIPLIER)
2014-09-12 20:04:25 -07:00
2014-08-29 07:52:33 -07:00
/**
* number of SysClock ticks in one ms
*/
#define TICKS_IN_MS (CH_FREQUENCY / 1000)
#define Delay(ms) chThdSleepMilliseconds(ms)
#ifdef __cplusplus
extern "C"
{
#endif
int systicks2ms(int systicks);
bool lockAnyContext(void);
void unlockAnyContext(void);
#ifdef __cplusplus
}
#endif
#endif /* MAIN_H_ */