S105: more support (#4937)

* s105: ts_name for battery input

* flash: allow one copy for devices with 512K of flash

* s105: all outputs are open drain
This commit is contained in:
Andrey G 2023-01-05 00:39:17 +03:00 committed by GitHub
parent 6ef5fef590
commit e989859cb8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 28 additions and 1 deletions

View File

@ -5,6 +5,10 @@
* @todo Add your board-specific code, if any.
*/
/* NOTE:
* All outputs are in open drain mode as pull-up to 5V is
* used as level shifter for MOSFETs/IGBTs */
static void setInjectorPins() {
engineConfiguration->injectionPins[0] = Gpio::D8;
engineConfiguration->injectionPins[1] = Gpio::D9;
@ -33,10 +37,15 @@ void setBoardDefaultConfiguration() {
engineConfiguration->warningLedPin = Gpio::Unassigned;
engineConfiguration->malfunctionIndicatorPin = Gpio::E14;
engineConfiguration->malfunctionIndicatorPinMode = OM_OPENDRAIN;
engineConfiguration->tachOutputPin = Gpio::B8; /* not populated by default */
engineConfiguration->tachOutputPinMode = OM_OPENDRAIN;
//engineConfiguration->idle.solenoidPin = ?
engineConfiguration->idle.solenoidPinMode = OM_OPENDRAIN;
engineConfiguration->fanPin = Gpio::D6; /* not populated by default */
engineConfiguration->fanPinMode = OM_OPENDRAIN;
//engineConfiguration->mainRelayPin = ?;
engineConfiguration->mainRelayPinMode = OM_OPENDRAIN;
engineConfiguration->specs.cylindersCount = 4;
engineConfiguration->specs.firingOrder = FO_1_2_4_3;

View File

@ -206,6 +206,7 @@ pins:
id: EFI_ADC_9
class: analog_inputs
function: +12v (MR) (68K+6.8K divider)
ts_name: 63 VBat
type: vign
- pin: 68a

View File

@ -185,7 +185,11 @@ void writeToFlashNow(void) {
#if EFI_STORAGE_INT_FLASH == TRUE
// Flash two copies
int result1 = eraseAndFlashCopy(getFlashAddrFirstCopy(), persistentState);
int result2 = eraseAndFlashCopy(getFlashAddrSecondCopy(), persistentState);
int result2 = FLASH_RETURN_SUCCESS;
/* Only if second copy is supported */
if (getFlashAddrSecondCopy()) {
result2 = eraseAndFlashCopy(getFlashAddrSecondCopy(), persistentState);
}
// handle success/failure
isSuccess = (result1 == FLASH_RETURN_SUCCESS) && (result2 == FLASH_RETURN_SUCCESS);
@ -276,6 +280,11 @@ static FlashState readConfiguration() {
return firstCopy;
}
/* no second copy? */
if (getFlashAddrSecondCopy() == 0x0) {
return firstCopy;
}
efiPrintf("Reading second configuration copy");
return readOneConfigurationCopy(secondyCopyAddr);
#endif

View File

@ -23,11 +23,19 @@ size_t flashSectorSize(flashsector_t sector) {
return 0;
}
#define TM_ID_GetFlashSize() (*(__IO uint16_t *) (FLASHSIZE_BASE))
uintptr_t getFlashAddrFirstCopy() {
/* last 128K sector on 512K devices */
if (TM_ID_GetFlashSize() <= 512)
return 0x08060000;
return 0x080E0000;
}
uintptr_t getFlashAddrSecondCopy() {
/* no second copy on 512K devices */
if (TM_ID_GetFlashSize() <= 512)
return 0x000000000;
return 0x080C0000;
}
/*