1 /* SPDX-License-Identifier: GPL-2.0+ */ 2 /* 3 * (C) Copyright 2013 4 * Corscience GmbH & Co. KG, <www.corscience.de> 5 * Andreas Bießmann <andreas.biessmann@corscience.de> 6 */ 7 #ifndef TRICORDER_EEPROM_H_ 8 #define TRICORDER_EEPROM_H_ 9 10 #include <linux/compiler.h> 11 12 #define TRICORDER_EEPROM_MAGIC 0xc2a94f52 13 #define TRICORDER_EEPROM_VERSION 1 14 15 #define TRICORDER_BOARD_NAME_LENGTH 12 16 #define TRICORDER_BOARD_VERSION_LENGTH 4 17 #define TRICORDER_BOARD_SERIAL_LENGTH 12 18 #define TRICORDER_INTERFACE_VERSION_LENGTH 4 19 20 struct tricorder_eeprom { 21 uint32_t magic; 22 uint16_t length; 23 uint16_t version; 24 char board_name[TRICORDER_BOARD_NAME_LENGTH]; 25 char board_version[TRICORDER_BOARD_VERSION_LENGTH]; 26 char board_serial[TRICORDER_BOARD_SERIAL_LENGTH]; 27 char interface_version[TRICORDER_INTERFACE_VERSION_LENGTH]; 28 uint32_t crc32; 29 } __packed; 30 31 #define TRICORDER_EEPROM_SIZE sizeof(struct tricorder_eeprom) 32 #define TRICORDER_EEPROM_CRC_SIZE (TRICORDER_EEPROM_SIZE - \ 33 sizeof(uint32_t)) 34 35 /** 36 * @brief read eeprom information from a specific eeprom address 37 */ 38 int tricorder_get_eeprom(int addr, struct tricorder_eeprom *eeprom); 39 40 #endif /* TRICORDER_EEPROM_H_ */ 41