initial check in based on SVN revision 575
This commit is contained in:
87
source/hwFixes.c
Normal file
87
source/hwFixes.c
Normal file
@@ -0,0 +1,87 @@
|
||||
/*
|
||||
* hwFixes.c
|
||||
*
|
||||
* Created on: Mar 27, 2024
|
||||
* Author: Brian.Bailey
|
||||
*/
|
||||
|
||||
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
#include <stdint.h>
|
||||
|
||||
//Drivers
|
||||
#include "fsl_common.h"
|
||||
#include "fsl_gpio.h"
|
||||
|
||||
|
||||
#include "Fonts\fontLibrary.h"
|
||||
#include "Graphics\graphicsLibrary.h"
|
||||
#include "keys.h"
|
||||
#include "eeprom.h"
|
||||
|
||||
#include "hwFixes.h"
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Definitions
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Variables
|
||||
******************************************************************************/
|
||||
|
||||
HARDWARE_FIX_t hwf;
|
||||
|
||||
extern char tempString[40];
|
||||
|
||||
/*******************************************************************************
|
||||
* Static Function Declarations
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Public Functions
|
||||
******************************************************************************/
|
||||
|
||||
/*
|
||||
* Initialize hardware fix EEPROM and read out fix data
|
||||
*/
|
||||
void HWF_Init(void)
|
||||
{
|
||||
//Check if HWF eeprom page has been initialized
|
||||
if(EE_ReadUINT32(EE_HWFIX_INIT) != 1)
|
||||
{
|
||||
//erase HWF sector
|
||||
for(uint32_t i = EE_PAGE_HW_FIXES; i < EE_PAGE_HW_FIXES + EE_PAGE_SIZE; i++)
|
||||
{
|
||||
EE_WriteUINT32(i, 0x00000000);
|
||||
}
|
||||
|
||||
//Set HWF initialized
|
||||
EE_WriteUINT32(EE_HWFIX_INIT, true);
|
||||
EE_WriteUINT32(EE_HWFIX_MAIN_PCBA_PN, HWF_MIN_MAIN_PCBA_PN); //Default to earliest hardware
|
||||
hwf.mainPcbaPN = HWF_MIN_MAIN_PCBA_PN;
|
||||
}
|
||||
else
|
||||
{
|
||||
//Read hardware fix info
|
||||
hwf.vBattCap_021 = EE_ReadUINT32(EE_HWFIX_VBATT_CAP_021);
|
||||
hwf.mainPcbaPN = EE_ReadUINT32(EE_HWFIX_MAIN_PCBA_PN);
|
||||
|
||||
if(hwf.mainPcbaPN >= 208023) //Set vBattCap fix to true for 208023+
|
||||
{
|
||||
hwf.vBattCap_021 = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user