2015-07-10 06:01:56 -07:00
|
|
|
/**
|
|
|
|
* @file pin_repository.h
|
|
|
|
* @brief I/O pin registry header
|
|
|
|
*
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @date Jan 15, 2013
|
2020-01-13 18:57:43 -08:00
|
|
|
* @author Andrey Belomutskiy, (c) 2012-2020
|
2015-07-10 06:01:56 -07:00
|
|
|
*/
|
|
|
|
|
2020-04-01 16:00:56 -07:00
|
|
|
#pragma once
|
2015-07-10 06:01:56 -07:00
|
|
|
|
2018-11-03 10:17:58 -07:00
|
|
|
#include "global.h"
|
2015-07-10 06:01:56 -07:00
|
|
|
#include "io_pins.h"
|
2022-11-18 20:43:43 -08:00
|
|
|
#include "efi_gpio.h"
|
2023-08-21 20:09:30 -07:00
|
|
|
#include "plain_pin_repository.h"
|
2015-07-10 06:01:56 -07:00
|
|
|
|
2023-08-21 20:09:30 -07:00
|
|
|
bool isBrainPinValid(Gpio brainPin);
|
2024-08-11 15:27:14 -07:00
|
|
|
const char *hwOnChipPhysicalPinName(ioportid_t hwPort, int hwPin);
|
2023-08-21 20:09:30 -07:00
|
|
|
void initPinRepository();
|
|
|
|
bool brain_pin_is_onchip(Gpio brainPin);
|
|
|
|
bool brain_pin_is_ext(Gpio brainPin);
|
2022-01-03 11:21:54 -08:00
|
|
|
void pinDiag2string(char *buffer, size_t size, brain_pin_diag_e pin_diag);
|
2020-02-12 05:34:26 -08:00
|
|
|
|
2019-05-10 14:53:17 -07:00
|
|
|
/**
|
2019-05-10 15:51:48 -07:00
|
|
|
* Usually high-level code would invoke efiSetPadMode, not this method directly
|
2019-05-10 14:53:17 -07:00
|
|
|
*/
|
2023-08-21 19:26:09 -07:00
|
|
|
bool brain_pin_markUsed(brain_pin_e brainPin, const char *msg);
|
2023-08-21 20:09:30 -07:00
|
|
|
|
2015-07-10 06:01:56 -07:00
|
|
|
const char * getPinFunction(brain_input_pin_e brainPin);
|
2019-04-09 16:31:10 -07:00
|
|
|
|
2019-04-12 14:39:49 -07:00
|
|
|
#if EFI_PROD_CODE
|
2019-04-09 16:31:10 -07:00
|
|
|
/* For on-chip gpios only */
|
2023-08-21 19:26:09 -07:00
|
|
|
bool gpio_pin_markUsed(ioportid_t port, ioportmask_t pin, const char *msg);
|
|
|
|
void gpio_pin_markUnused(ioportid_t port, ioportmask_t pin);
|
2019-04-12 14:39:49 -07:00
|
|
|
#endif /* EFI_PROD_CODE*/
|
2015-07-10 06:01:56 -07:00
|
|
|
|
2019-06-02 13:48:38 -07:00
|
|
|
/* defined in ports/ */
|
2021-01-06 15:29:47 -08:00
|
|
|
int getPortPinIndex(ioportid_t port, ioportmask_t pin);
|
|
|
|
ioportid_t getBrainPinPort(brain_pin_e brainPin);
|
2023-08-21 20:09:30 -07:00
|
|
|
int getBrainPinIndex(Gpio brainPin);
|
|
|
|
size_t getBrainPinOnchipNum();
|
|
|
|
const char *hwPortname(Gpio brainPin);
|
2023-09-17 07:40:08 -07:00
|
|
|
const char *hwPhysicalPinName(Gpio brainPin);
|
2022-05-30 14:06:56 -07:00
|
|
|
// the main usage for human-readable board-specific pin reference is convenience of error messages in case of pin conflict.
|
2023-08-21 20:09:30 -07:00
|
|
|
const char * getBoardSpecificPinName(Gpio brainPin);
|
2019-06-02 13:48:38 -07:00
|
|
|
|
2024-05-12 10:07:02 -07:00
|
|
|
void debugBrainPin(char *buffer, size_t size, brain_pin_e brainPin);
|
|
|
|
|
2023-08-21 20:09:30 -07:00
|
|
|
const char* & getBrainUsedPin(size_t idx);
|