soc_boot.c 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /*
  2. * Copyright (c) 2021 Actions Semiconductor Co., Ltd
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. */
  6. /**
  7. * @file
  8. * @brief Actions LEOPARD family boot related infomation public interfaces.
  9. */
  10. #include <kernel.h>
  11. #include <device.h>
  12. #include <string.h>
  13. #include "soc_boot.h"
  14. #include <linker/linker-defs.h>
  15. /*mbrec mem layout*/
  16. /*
  17. 0x1000000-0x1000200 //sram 1KB save boot_info(0x20) +NANDID
  18. 0x1000020-0x1000400 // NANDID
  19. */
  20. uint32_t soc_boot_get_part_tbl_addr(void)
  21. {
  22. return soc_boot_get_info()->param_phy_addr;
  23. }
  24. uint32_t soc_boot_get_fw_ver_addr(void)
  25. {
  26. return (soc_boot_get_part_tbl_addr() + SOC_BOOT_FIRMWARE_VERSION_OFFSET);
  27. }
  28. const boot_info_t *soc_boot_get_info(void)
  29. {
  30. return (const boot_info_t *)BOOT_INFO_SRAM_ADDR;
  31. }
  32. uint32_t soc_boot_get_nandid_tbl_addr(void)
  33. {
  34. const boot_info_t *p_boot_info = soc_boot_get_info();
  35. return p_boot_info->nand_id_offs;
  36. }
  37. u32_t soc_boot_get_reboot_reason(void)
  38. {
  39. const boot_info_t *p_boot_info = soc_boot_get_info();
  40. return p_boot_info->reboot_reason;
  41. }
  42. bool soc_boot_get_watchdog_is_reboot(void)
  43. {
  44. const boot_info_t *p_boot_info = soc_boot_get_info();
  45. return !!p_boot_info->watchdog_reboot;
  46. }