2015-07-10 06:01:56 -07:00
|
|
|
/**
|
|
|
|
* @file io_pins.h
|
2017-04-21 10:36:51 -07:00
|
|
|
* @brief his file is about general input/output utility methods, not much EFI-specifics
|
2015-07-10 06:01:56 -07:00
|
|
|
*
|
|
|
|
* @date Jan 24, 2013
|
2020-01-13 18:57:43 -08:00
|
|
|
* @author Andrey Belomutskiy, (c) 2012-2020
|
2015-07-10 06:01:56 -07:00
|
|
|
*/
|
|
|
|
|
2020-02-18 05:16:19 -08:00
|
|
|
#pragma once
|
2015-07-10 06:01:56 -07:00
|
|
|
|
2018-09-16 19:26:57 -07:00
|
|
|
#include "global.h"
|
2015-07-10 06:01:56 -07:00
|
|
|
|
2020-11-26 21:24:41 -08:00
|
|
|
#define INITIAL_PIN_STATE -1
|
2015-07-10 06:01:56 -07:00
|
|
|
#define GPIO_NULL NULL
|
|
|
|
|
2017-04-21 10:36:51 -07:00
|
|
|
// mode >= 0 is always true since that's an unsigned
|
|
|
|
#define assertOMode(mode) { \
|
2019-12-13 21:14:36 -08:00
|
|
|
efiAssertVoid(CUSTOM_INVALID_MODE_SETTING, mode <= OM_OPENDRAIN_INVERTED, "invalid pin_output_mode_e"); \
|
2017-04-21 10:36:51 -07:00
|
|
|
}
|
2015-07-10 06:01:56 -07:00
|
|
|
|
|
|
|
|
2019-04-12 17:52:51 -07:00
|
|
|
#if EFI_GPIO_HARDWARE
|
2019-05-10 14:53:41 -07:00
|
|
|
EXTERNC void efiSetPadMode(const char *msg, brain_pin_e pin, iomode_t mode);
|
|
|
|
EXTERNC void efiSetPadUnused(brain_pin_e brainPin);
|
2017-04-21 13:20:06 -07:00
|
|
|
|
2019-07-04 00:25:35 -07:00
|
|
|
EXTERNC bool efiReadPin(brain_pin_e pin);
|
2017-05-15 02:03:40 -07:00
|
|
|
|
2019-07-04 00:25:35 -07:00
|
|
|
EXTERNC iomode_t getInputMode(pin_input_mode_e mode);
|
2019-04-12 17:52:51 -07:00
|
|
|
#if HAL_USE_ICU
|
2019-07-04 00:25:35 -07:00
|
|
|
EXTERNC void efiIcuStart(const char *msg, ICUDriver *icup, const ICUConfig *config);
|
2017-05-30 11:22:38 -07:00
|
|
|
#endif /* HAL_USE_ICU */
|
2020-12-09 21:10:58 -08:00
|
|
|
|
2017-04-21 13:20:06 -07:00
|
|
|
#endif /* EFI_GPIO_HARDWARE */
|
|
|
|
|
2020-12-09 21:10:58 -08:00
|
|
|
#if ! EFI_PROD_CODE
|
|
|
|
#define BRAIN_PIN_COUNT (1 << 8 * sizeof(brain_pin_e))
|
|
|
|
extern bool mockPinStates[BRAIN_PIN_COUNT];
|
2020-12-18 14:19:02 -08:00
|
|
|
|
|
|
|
void setMockState(brain_pin_e pin, bool state);
|
2020-12-09 21:10:58 -08:00
|
|
|
#endif
|