eeprom_layout.h 849 B

123456789101112131415161718192021222324252627282930313233
  1. /*
  2. * (C) Copyright 2009-2016 CompuLab, Ltd.
  3. *
  4. * Authors: Nikita Kiryanov <nikita@compulab.co.il>
  5. * Igor Grinberg <grinberg@compulab.co.il>
  6. *
  7. * SPDX-License-Identifier: GPL-2.0+
  8. */
  9. #ifndef _LAYOUT_
  10. #define _LAYOUT_
  11. #define RESERVED_FIELDS NULL
  12. #define LAYOUT_VERSION_UNRECOGNIZED -1
  13. #define LAYOUT_VERSION_AUTODETECT -2
  14. struct eeprom_layout {
  15. struct eeprom_field *fields;
  16. int num_of_fields;
  17. int layout_version;
  18. unsigned char *data;
  19. int data_size;
  20. void (*print)(const struct eeprom_layout *eeprom_layout);
  21. int (*update)(struct eeprom_layout *eeprom_layout, char *field_name,
  22. char *new_data);
  23. };
  24. void eeprom_layout_setup(struct eeprom_layout *layout, unsigned char *buf,
  25. unsigned int buf_size, int layout_version);
  26. __weak void __eeprom_layout_assign(struct eeprom_layout *layout,
  27. int layout_version);
  28. #endif