Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
Nikita Kiryanov | 37dda1c | 2016-04-16 17:55:03 +0300 | [diff] [blame] | 2 | /* |
| 3 | * (C) Copyright 2009-2016 CompuLab, Ltd. |
| 4 | * |
| 5 | * Authors: Nikita Kiryanov <nikita@compulab.co.il> |
| 6 | * Igor Grinberg <grinberg@compulab.co.il> |
Nikita Kiryanov | 37dda1c | 2016-04-16 17:55:03 +0300 | [diff] [blame] | 7 | */ |
| 8 | |
| 9 | #ifndef _LAYOUT_ |
| 10 | #define _LAYOUT_ |
| 11 | |
Marek BehĂșn | 246db75 | 2024-05-21 09:13:26 +0200 | [diff] [blame] | 12 | #include <eeprom_field.h> |
| 13 | |
Nikita Kiryanov | 37dda1c | 2016-04-16 17:55:03 +0300 | [diff] [blame] | 14 | #define RESERVED_FIELDS NULL |
| 15 | #define LAYOUT_VERSION_UNRECOGNIZED -1 |
| 16 | #define LAYOUT_VERSION_AUTODETECT -2 |
| 17 | |
| 18 | struct eeprom_layout { |
| 19 | struct eeprom_field *fields; |
| 20 | int num_of_fields; |
| 21 | int layout_version; |
| 22 | unsigned char *data; |
| 23 | int data_size; |
| 24 | void (*print)(const struct eeprom_layout *eeprom_layout); |
| 25 | int (*update)(struct eeprom_layout *eeprom_layout, char *field_name, |
| 26 | char *new_data); |
| 27 | }; |
| 28 | |
Marek BehĂșn | 246db75 | 2024-05-21 09:13:26 +0200 | [diff] [blame] | 29 | struct eeprom_field *eeprom_layout_find_field(struct eeprom_layout *layout, |
| 30 | char *field_name, bool warn); |
Nikita Kiryanov | 37dda1c | 2016-04-16 17:55:03 +0300 | [diff] [blame] | 31 | void eeprom_layout_setup(struct eeprom_layout *layout, unsigned char *buf, |
| 32 | unsigned int buf_size, int layout_version); |
| 33 | __weak void __eeprom_layout_assign(struct eeprom_layout *layout, |
| 34 | int layout_version); |
| 35 | |
| 36 | #endif |