Callisto4Bootloader: PfmLib/platform_eeprom.c File Reference

Callisto4Bootloader

Macros | Functions
platform_eeprom.c File Reference
`#include "platform-eeprom-header.h"`
`#include "at24c01d.h"`
`#include "fsl_lpi2c.h"`
`#include "fsl_clock.h"`
`#include "fsl_iomuxc.h"`
`#include <stdio.h>`

Go to the source code of this file.

## Macros

#define | LPI2C_CLOCK_SOURCE_SELECT (0U)
| Select USB1 PLL (480 MHz) as master lpi2c clock source. More...
#define | LPI2C_CLOCK_SOURCE_DIVIDER (5U)
| Clock divider for master lpi2c clock source. More...
#define | LPI2C_MASTER_CLOCK_FREQUENCY ((CLOCK_GetFreq(kCLOCK_Usb1PllClk) / 8) / (LPI2C_CLOCK_SOURCE_DIVIDER + 1U))
#define | LPI2C2_MASTER ((LPI2C_Type *)LPI2C2_BASE)
#define | LPI2C2_BAUDRATE 100000U

## Functions

uint32_t | eeprom_header_calc_checksum (void *pvBase, uint32_t uiNumBytes)
| Calculate a config header checksum. More...
bool | eeprom_header_read (stEEPROM_Header_t *pstHeader)
| Read an EEPROM platform configuration block. More...
bool | eeprom_header_write (const stEEPROM_Header_t *pstHeader)
| Write a platform configuration block out to the EEPROM. More...
void | InitialiseI2CMasterClock (void)
| Initialise the I2C master clock. More...
void | InitialiseI2C2 (void)
| Initialise the I2C2 device. More...

## Detailed Description

Copyright
  2020 Remsdaq Ltd.

Date
  : 8 Sep 2020

Author
  : dsmit

Definition in file platform_eeprom.c.

## Macro Definition Documentation

## ◆ LPI2C2_BAUDRATE

#define LPI2C2_BAUDRATE 100000U

Definition at line 38 of file platform_eeprom.c.

## ◆ LPI2C2_MASTER

#define LPI2C2_MASTER ((LPI2C_Type *)LPI2C2_BASE)

Definition at line 37 of file platform_eeprom.c.

## ◆ LPI2C_CLOCK_SOURCE_DIVIDER

#define LPI2C_CLOCK_SOURCE_DIVIDER (5U)

Clock divider for master lpi2c clock source.

Definition at line 34 of file platform_eeprom.c.

## ◆ LPI2C_CLOCK_SOURCE_SELECT

#define LPI2C_CLOCK_SOURCE_SELECT (0U)

Select USB1 PLL (480 MHz) as master lpi2c clock source.

Definition at line 33 of file platform_eeprom.c.

## ◆ LPI2C_MASTER_CLOCK_FREQUENCY

#define LPI2C_MASTER_CLOCK_FREQUENCY ((CLOCK_GetFreq(kCLOCK_Usb1PllClk) / 8) / (LPI2C_CLOCK_SOURCE_DIVIDER + 1U))

Definition at line 35 of file platform_eeprom.c.

## Function Documentation

## ◆ eeprom_header_calc_checksum()

uint32_t eeprom_header_calc_checksum | ( | void * | pvBase,
|  | uint32_t | uiNumBytes
| ) |  |

Calculate a config header checksum.

Parameters

  [in] | pvBase | Base address of configuration block
  [in] | uiNumBytes | Length (in bytes) of the configuration

Returns
  32-bit additive checksum value

Calculate the checksum of a platform configuration EEPROM header

Definition at line 67 of file platform_eeprom.c.

Referenced by eeprom_header_read().

## ◆ eeprom_header_read()

bool eeprom_header_read | ( | stEEPROM_Header_t * | pstHeader | ) |

Read an EEPROM platform configuration block.

Parameters

  [in] | pstHeader | Header to read bytes into

Return values

  true | All went well
  false | Problem encountered

Read a platform configuration block in from the EEPROM

Definition at line 92 of file platform_eeprom.c.

References eeprom_header_calc_checksum().

## ◆ eeprom_header_write()

bool eeprom_header_write | ( | const stEEPROM_Header_t * | pstHeader | ) |

Write a platform configuration block out to the EEPROM.

Parameters

  [in] | pstHeader | Header to read bytes from

Return values

  true | All went well
  false | Problem encountered

Write a platform configuration block out to the EEPROM

Definition at line 144 of file platform_eeprom.c.

## ◆ InitialiseI2C2()

void InitialiseI2C2 | ( | void |  | ) |

Initialise the I2C2 device.

Initialise the I2C2 device

Definition at line 171 of file platform_eeprom.c.

## ◆ InitialiseI2CMasterClock()

void InitialiseI2CMasterClock | ( | void |  | ) |

Initialise the I2C master clock.

Initialise the I2C master clock (shared by all I2C buses)

Definition at line 159 of file platform_eeprom.c.