eeprom_layout.h 849 B

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