boot_bsl_cmd.h 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. /* Copyright (C) 2019 RDA Technologies Limited and/or its affiliates("RDA").
  2. * All rights reserved.
  3. *
  4. * This software is supplied "AS IS" without any warranties.
  5. * RDA assumes no responsibility or liability for the use of the software,
  6. * conveys no license or title under any patent, copyright, or mask work
  7. * right to the product. RDA reserves the right to make changes in the
  8. * software without notification. RDA also make no representation or
  9. * warranty that such application will be suitable for the specified use
  10. * without further testing or modification.
  11. */
  12. #ifndef _BOOT_BSL_CMD_H_
  13. #define _BOOT_BSL_CMD_H_
  14. #include "osi_compiler.h"
  15. OSI_EXTERN_C_BEGIN
  16. #define HDLC_FLAG 0x7E
  17. #define HDLC_ESCAPE 0x7D
  18. #define HDLC_ESCAPE_MASK 0x20
  19. enum
  20. {
  21. BSL_PKT_TYPE_MIN, /* the bottom of the DL packet type range */
  22. /* Link Control */
  23. BSL_CMD_CONNECT = BSL_PKT_TYPE_MIN, /* 0x00 */
  24. /* Data Download */
  25. BSL_CMD_START_DATA, /* 0x01 the start flag of the data downloading */
  26. BSL_CMD_MIDST_DATA, /* 0x02 the midst flag of the data downloading */
  27. BSL_CMD_END_DATA, /* 0x03 the end flag of the data downloading */
  28. BSL_CMD_EXEC_DATA, /* 0x04 Execute from a certain address */
  29. /* End of Data Download command*/
  30. BSL_CMD_NORMAL_RESET, /* 0x05 Reset to normal mode */
  31. BSL_CMD_READ_FLASH, /* 0x06 Read flash content */
  32. BSL_CMD_READ_CHIP_TYPE, /* 0x07 Read chip type */
  33. BSL_CMD_READ_NVITEM, /* 0x08 Lookup a nvitem in specified area */
  34. BSL_CMD_CHANGE_BAUD, /* 0x09 Change baudrate */
  35. BSL_CMD_ERASE_FLASH, /* 0x0A Erase an area of flash */
  36. BSL_CMD_REPARTITION, /* 0x0B Repartition nand flash */
  37. BSL_CMD_READ_FLASH_TYPE, /* 0x0C Read flash type */
  38. BSL_CMD_READ_FLASH_INFO, /* 0x0D Read flash infomation */
  39. BSL_CMD_READ_SECTOR_SIZE = 0xF, /* 0x0F Read Nor flash sector size*/
  40. BSL_CMD_READ_START = 0x10, /* 0x10 Read flash start */
  41. BSL_CMD_READ_MIDST, /* 0x11 Read flash midst */
  42. BSL_CMD_READ_END, /* 0x12 Read flash end */
  43. BSL_CMD_KEEP_CHARGE = 0x13, /* keep charge */
  44. BSL_CMD_EXTTABLE = 0x14, /* 0x14 Set ExtTable */
  45. BSL_CMD_READ_FLASH_UID = 0x15, /* 0x15 Read flash UID */
  46. BSL_CMD_READ_SOFTSIM_EID = 0x16, /* 0x16 Read softSIM EID */
  47. BSL_CMD_POWER_OFF = 0x17, /* 0x17 Power Off */
  48. BSL_CMD_CHECK_ROOT = 0x19, /* 0x19 Check Root */
  49. BSL_CMD_READ_CHIP_UID = 0x1A, /* 0x1A Read Chip UID */
  50. BSL_CMD_ENABLE_WRITE_FLASH = 0x1B, /* 0x1B Enable flash */
  51. BSL_CMD_ENABLE_SECUREBOOT = 0x1C, /* 0x1C Enable secure boot */
  52. BSL_CMD_IDENTIFY_START = 0x1D, /* 0x1D Identify start */
  53. BSL_CMD_IDENTIFY_END = 0x1E, /* 0x1E Identify end */
  54. BSL_CMD_READ_CU_REF = 0x1F, /* 0x1F Read CU ref */
  55. BSL_CMD_READ_REFINFO = 0x20, /* 0x20 Read Ref Info */
  56. BSL_CMD_DISABLE_TRANSCODE = 0x21, /* 0x21 Use the non-escape function */
  57. BSL_CMD_WRITE_APR_INFO = 0x22, /* 0x22 Write pac file build time to miscdata for APR */
  58. BSL_CMD_CUST_DUMMY = 0x23, /* 0x23 Customized Dummy */
  59. BSL_CMD_READ_RF_TRANSCEIVER_TYPE = 0x24, /* 0x24 Read RF transceiver type */
  60. BSL_CMD_ENABLE_DEBUG_MODE = 0x25, /* 0x25 Enable debug mode */
  61. BSL_CMD_DDR_CHECK = 0x26, /* 0x26 DDR check */
  62. BSL_CMD_SELF_REFRESH = 0x27, /* 0x27 Self Refresh */
  63. BSL_CMD_READ_NAND_BLOCK_INFO = 0x29, /* 0x29 ReadNandBlockInfo */
  64. BSL_CMD_SET_FIRST_MODE = 0x2A, /* 0x2A Set First Mode */
  65. /* valid : 0x2B == 0xB9 */
  66. BSL_CMD_CHECK_BAUD = HDLC_FLAG, /* CheckBaud command,for internal use */
  67. BSL_CMD_END_PROCESS = 0x7F, /* 0x7F End flash process */
  68. /* End of the Command can be received by phone*/
  69. /* Start of the Command can be transmited by phone*/
  70. BSL_REP_TYPE_MIN = 0x80,
  71. BSL_REP_ACK = BSL_REP_TYPE_MIN, /* The operation acknowledge */
  72. BSL_REP_VER, /* 0x81 */
  73. /* the operation not acknowledge */
  74. /* system */
  75. BSL_REP_INVALID_CMD, /* 0x82 */
  76. BSL_REP_UNKNOW_CMD, /* 0x83 */
  77. BSL_REP_OPERATION_FAILED, /* 0x84 */
  78. /* Link Control*/
  79. BSL_REP_NOT_SUPPORT_BAUDRATE, /* 0x85 */
  80. /* Data Download */
  81. BSL_REP_DOWN_NOT_START, /* 0x86 */
  82. BSL_REP_DOWN_MULTI_START, /* 0x87 */
  83. BSL_REP_DOWN_EARLY_END, /* 0x88 */
  84. BSL_REP_DOWN_DEST_ERROR, /* 0x89 */
  85. BSL_REP_DOWN_SIZE_ERROR, /* 0x8A */
  86. BSL_REP_VERIFY_ERROR, /* 0x8B */
  87. BSL_REP_NOT_VERIFY, /* 0x8C */
  88. /* Phone Internal Error */
  89. BSL_PHONE_NOT_ENOUGH_MEMORY, /* 0x8D */
  90. BSL_PHONE_WAIT_INPUT_TIMEOUT, /* 0x8E */
  91. /* Phone Internal return value */
  92. BSL_PHONE_SUCCEED, /* 0x8F */
  93. BSL_PHONE_VALID_BAUDRATE, /* 0x90 */
  94. BSL_PHONE_REPEAT_CONTINUE, /* 0x91 */
  95. BSL_PHONE_REPEAT_BREAK, /* 0x92 */
  96. /* End of the Command can be transmited by phone*/
  97. BSL_REP_READ_FLASH, /* 0x93 */
  98. BSL_REP_READ_CHIP_TYPE, /* 0x94 */
  99. BSL_REP_READ_NVITEM, /* 0x95 */
  100. BSL_REP_INCOMPATIBLE_PARTITION, /* 0x96 */
  101. BSL_REP_UNKNOWN_DEVICE, /* 0x97 */
  102. BSL_REP_INVALID_DEVICE_SIZE, /* 0x98 */
  103. BSL_REP_ILLEGAL_SDRAM, /* 0x99 */
  104. BSL_WRONG_SDRAM_PARAMETER, /* 0x9A */
  105. BSL_REP_READ_FLASH_INFO, /* 0x9B */
  106. BSL_REP_READ_SECTOR_SIZE = 0x9C, /* 0x9C */
  107. BSL_REP_READ_FLASH_TYPE = 0x9D, /* 0x9D */
  108. BSL_REP_READ_FLASH_UID = 0x9E, /* 0x9E */
  109. BSL_REP_READ_SOFTSIM_EID = 0x9F, /* 0x9F */
  110. /* information returned from FDL when downloading fixed NV */
  111. BSL_ERROR_CHECKSUM = 0xA0,
  112. BSL_CHECKSUM_DIFF = 0xA1,
  113. BSL_WRITE_ERROR = 0xA2,
  114. BSL_CHIPID_NOT_MATCH = 0xA3,
  115. BSL_FLASH_CFG_ERROR = 0xA4,
  116. BSL_REP_DOWN_STL_SIZE_ERROR = 0xA5,
  117. BSL_REP_PHONE_IS_ROOTED = 0xA7, /* 0xA7 Phone has been rooted */
  118. BSL_REP_SEC_VERIFY_ERROR = 0xAA, /* 0xAA Security data verify error */
  119. BSL_REP_READ_CHIP_UID = 0xAB, /* 0xAB Received Chip UID */
  120. BSL_REP_NOT_ENABLE_WRITE_FLASH = 0xAC, /* 0xAC Not enable to write flash */
  121. BSL_REP_ENABLE_SECUREBOOT_ERROR = 0xAD, /* 0xAD Enable secure boot fail */
  122. BSL_REP_IDENTIFY_START = 0xAE, /* 0xAE Identify start */
  123. BSL_REP_IDENTIFY_END = 0xAF, /* 0xAF Identify end */
  124. BSL_REP_READ_CU_REF = 0xB0, /* 0xB0 Report CU ref */
  125. BSL_REP_READ_REFINFO = 0xB1, /* 0xB1 Read Ref Info */
  126. BSL_REP_CUST_DUMMY = 0xB2, /* 0xB2 Response Customized Dummy */
  127. BSL_REP_FLASH_WRITTEN_PROTECTION = 0xB3, /* 0xB3 Flash written protection */
  128. BSL_REP_FLASH_INITIALIZING_FAIL = 0xB4, /* 0xB4 Flash initializing failed */
  129. BSL_REP_RF_TRANSCEIVER_TYPE = 0xB5, /* 0xB5 RF transceiver type */
  130. BSL_REP_DDR_CHECK_ERROR = 0xB6, /* 0xB6 DDR Check error */
  131. BSL_REP_SELF_REFRESH_ERROR = 0xB7, /* 0xB7 Self Refresh error */
  132. BSL_REP_READ_NAND_BLOCK_INFO = 0xB8, /* 0xB8 Read Nand Block Info rep */
  133. BSL_REP_UNSUPPROT_COMMAND = 0xFE, /* 0xFE Software has not supported this feature */
  134. BSL_REP_LOG = 0xFF, //FDL can output some log info use this type
  135. BSL_PKT_TYPE_MAX = 0x100,
  136. BSL_UART_SEND_ERROR,
  137. BSL_REP_DECODE_ERROR, // Decode or verify received buffer error
  138. BSL_REP_INCOMPLETE_DATA, // Received buffer is not in the format we want
  139. BSL_REP_READ_ERROR,
  140. BSL_REP_TOO_MUCH_DATA,
  141. BSL_USER_CANCEL,
  142. BSL_REP_SIZE_ZERO,
  143. BSL_REP_PORT_ERROR,
  144. BSL_REP_OLD_MEMORY_REGISTER_CHANGE_ERROR, /* Old Memory: Register Changed error */
  145. BSL_REP_OLD_MEMORY_EMMC_HAS_FLAG_ERROR, /* Old Memory: EMMC has flag error */
  146. BSL_REP_OLD_MEMORY_RPMB_WRITTEN_ERROR, /* Old Memory: RPMB written error */
  147. BSL_REP_OLD_MEMORY_REGISTER_EMMC_ERROR, /* Old Memory: Register Changed & EMMC has flag error */
  148. BSL_REP_OLD_MEMORY_REGISTER_RPMB_ERROR, /* Old Memory: Register Changed & RPMB written error */
  149. BSL_REP_OLD_MEMORY_EMMC_RPMB_ERROR, /* Old Memory: EMMC has flag & RPMB written error */
  150. BSL_REP_OLD_MEMORY_REGISTER_EMMC_RPMB_ERROR, /* Old Memory: Register Changed & EMMC has flag & RPMB written error */
  151. BSL_REP_OLD_MEMORY_UNSUPPORT_ERROR, /* Old Memory: Software has not supported this feature */
  152. BSL_ERROR_CRC_CHECK,
  153. BSL_REP_CREATE_READBACK_FILE_ERROR, /* Failed to create readback file. */
  154. };
  155. OSI_EXTERN_C_END
  156. #endif