soc_boot.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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. #ifndef __SOC_BOOT_H
  11. #define __SOC_BOOT_H
  12. #define BOOT_INFO_SRAM_ADDR (CONFIG_SRAM_BASE_ADDRESS-0x400)
  13. /* The macro to define the mapping address of SPI1 cache for PSRAM which configured by bootloader stage */
  14. #define SOC_BOOT_PSRAM_MAPPING_ADDRESS (0x38000000)
  15. /* The total size of ROM data that range from TEXT to RODATA sections */
  16. extern uint32_t z_rom_data_size;
  17. #define SOC_BOOT_FIRMWARE_VERSION_OFFSET (0x2e8) /* The offset of firmware version table within system parameter paritition */
  18. /*!
  19. * struct boot_info_t
  20. * @brief The boot infomation that transfer from bootloader to system.
  21. */
  22. typedef struct {
  23. uint32_t mbrec_phy_addr; /* The physical address of MBREC that current system running */
  24. uint32_t param_phy_addr; /* The physical address of PARAM that current system using */
  25. uint32_t system_phy_addr; /* The physical address of SYSTEM that current using */
  26. uint32_t reboot_reason; /* Reboot reason */
  27. uint32_t nand_id_offs; /* nand id table offset */
  28. uint32_t nand_id_len; /* nand id table length */
  29. uint32_t watchdog_reboot : 1; /* The reboot event that occured from bootrom watchdog expired */
  30. uint32_t is_mirror : 1; /* The indicator of launching system is a mirror partition */
  31. uint32_t bit_res : 30; /* The indicator of launching system is a mirror partition */
  32. uint32_t reserved[3];
  33. uint32_t nor_offset; /*cur code mapping off nor offset*/
  34. uint32_t code_len; // code in psram len(nand boot/emmc boot use)
  35. uint32_t reserved0[1];
  36. uint32_t dvfs;
  37. uint32_t reserved1[2];
  38. } boot_info_t;
  39. /* @brief The function to get the address of current partition table */
  40. uint32_t soc_boot_get_part_tbl_addr(void);
  41. /* @brief The function to get the address of current firmware version */
  42. uint32_t soc_boot_get_fw_ver_addr(void);
  43. /* @brief The function to get the current boot infomation */
  44. const boot_info_t *soc_boot_get_info(void);
  45. /* @brief The function to get the reboot reason */
  46. u32_t soc_boot_get_reboot_reason(void);
  47. /* @brief The function to get the indicator of watchdog reboot */
  48. bool soc_boot_get_watchdog_is_reboot(void);
  49. /* @brief The function to get the address of nand id table */
  50. uint32_t soc_boot_get_nandid_tbl_addr(void);
  51. /* @brief return mini type */
  52. inline bool soc_boot_is_mini(void)
  53. {
  54. return (((const boot_info_t *)BOOT_INFO_SRAM_ADDR)->dvfs == 0x23185C0c) ;
  55. }
  56. #endif