plat_nv_storage.h 709 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /*
  2. * Copyright 2021 NXP
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. *
  6. */
  7. #ifndef PLAT_NV_STRG_H
  8. #define PLAT_NV_STRG_H
  9. #define DEFAULT_SET_VALUE 0xA1
  10. #define READY_TO_WRITE_VALUE 0xFF
  11. #ifndef NV_STORAGE_BASE_ADDR
  12. #define NV_STORAGE_BASE_ADDR DEFAULT_NV_STORAGE_BASE_ADDR
  13. #endif
  14. typedef struct {
  15. uint8_t warm_rst_flag;
  16. uint8_t wdt_rst_flag;
  17. uint8_t dummy[2];
  18. } nv_app_data_t;
  19. /*below enum and above structure should be in-sync. */
  20. enum app_data_offset {
  21. WARM_RESET_FLAG_OFFSET,
  22. WDT_RESET_FLAG_OFFSET,
  23. APP_DATA_MAX_OFFSET,
  24. };
  25. int read_nv_app_data(void);
  26. int wr_nv_app_data(int data_offset,
  27. uint8_t *data,
  28. int data_size);
  29. const nv_app_data_t *get_nv_data(void);
  30. #endif /* PLAT_NV_STRG_H */