gpio: core: implement debug() hook for gpio chips
This commit is contained in:
parent
f1df6c8138
commit
3fa3f1ab8c
|
@ -402,6 +402,21 @@ int gpiochips_get_total_pins(void)
|
||||||
return cnt;
|
return cnt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void gpiochips_debug(void)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < BOARD_EXT_GPIOCHIPS; i++) {
|
||||||
|
gpiochip *chip = &chips[i];
|
||||||
|
|
||||||
|
if (chip->base == Gpio::Unassigned)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
efiPrintf("%s (base %d, size %d):\n", chip->name, (int)chip->base, chip->size);
|
||||||
|
chip->chip->debug();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#if EFI_PROD_CODE
|
#if EFI_PROD_CODE
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -476,4 +491,9 @@ int gpiochips_get_total_pins(void)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void gpiochips_debug(void)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* BOARD_EXT_GPIOCHIPS > 0 */
|
#endif /* BOARD_EXT_GPIOCHIPS > 0 */
|
||||||
|
|
|
@ -30,6 +30,7 @@ struct GpioChip {
|
||||||
virtual int setPadPWM(size_t /*pin*/, float /*frequency*/, float /*duty*/) { return -1; }
|
virtual int setPadPWM(size_t /*pin*/, float /*frequency*/, float /*duty*/) { return -1; }
|
||||||
virtual brain_pin_diag_e getDiag(size_t /*pin*/) { return PIN_OK; }
|
virtual brain_pin_diag_e getDiag(size_t /*pin*/) { return PIN_OK; }
|
||||||
virtual int deinit() { return 0; }
|
virtual int deinit() { return 0; }
|
||||||
|
virtual void debug() { }
|
||||||
|
|
||||||
/* chip needs reinitialization due to some critical issue */
|
/* chip needs reinitialization due to some critical issue */
|
||||||
bool need_init;
|
bool need_init;
|
||||||
|
@ -57,6 +58,8 @@ int gpiochips_writePad(brain_pin_e pin, int value);
|
||||||
int gpiochips_readPad(brain_pin_e pin);
|
int gpiochips_readPad(brain_pin_e pin);
|
||||||
brain_pin_diag_e gpiochips_getDiag(brain_pin_e pin);
|
brain_pin_diag_e gpiochips_getDiag(brain_pin_e pin);
|
||||||
|
|
||||||
|
void gpiochips_debug();
|
||||||
|
|
||||||
#if EFI_PROD_CODE
|
#if EFI_PROD_CODE
|
||||||
hardware_pwm* gpiochip_tryInitPwm(const char* msg, brain_pin_e pin, float frequency, float duty);
|
hardware_pwm* gpiochip_tryInitPwm(const char* msg, brain_pin_e pin, float frequency, float duty);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -186,6 +186,8 @@ static void reportPins() {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
efiPrintf("Total pins used: %d", totalPinsUsed);
|
efiPrintf("Total pins used: %d", totalPinsUsed);
|
||||||
|
|
||||||
|
gpiochips_debug();
|
||||||
}
|
}
|
||||||
|
|
||||||
__attribute__((weak)) const char * getBoardSpecificPinName(brain_pin_e /*brainPin*/) {
|
__attribute__((weak)) const char * getBoardSpecificPinName(brain_pin_e /*brainPin*/) {
|
||||||
|
|
Loading…
Reference in New Issue