app_flash - 副本 (2).c 39 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560
  1. #include "app_flash.h"
  2. #include "bsp_wdt.h"
  3. #include "exception.h"
  4. #include "system.h"
  5. #include "hal_minifds.h"
  6. #include "nrf_sdh_soc.h"
  7. #include "app_step.h"
  8. #include "nrf_pwr_mgmt.h"
  9. #include "bsp_flash.h"
  10. /*************************************
  11. *DEFINITION
  12. */
  13. #define FLASH_HEAD 0xAA5555AA
  14. #define FLASH_START_ADDR_INFOR 0x00074000UL
  15. #define FLASH_END_ADDR_INFOR 0x00076000UL
  16. #define FLASH_ADDR_INFOR_PAGENUM 2
  17. #define FLASH_START_ADDR_STEP 0x00076000UL
  18. #define FLASH_END_ADDR_STEP 0x00077FFFUL
  19. #define FLASH_ADDR_STEP_PAGENUM 2
  20. #define MaxLength(a,b) a>b?a:b
  21. typedef struct t_mflash_param_type{
  22. const char *name; //参数名字
  23. void *value; //数据指针
  24. const uint8_t length; //数据长度
  25. }mflash_param_type;
  26. #define MAX_mflash_param_LENGTH 27
  27. const mflash_param_type All_Falsh_value[MAX_mflash_param_LENGTH]={
  28. {"inforhead",&mFlash.head,4},//不可调整
  29. //{"ErrStartCnt",&mFlash.ErrStartCnt,1},
  30. {"macHost",mFlash.macHost,6},
  31. {"IsHost",&mFlash.isHost,1},
  32. {"startTime",mFlash.mStep.startTime,8},
  33. {"stepCur",mFlash.mStep.stepCur,8},
  34. {"step",mFlash.mStep.step,8},
  35. {"step_num",&mFlash.mStep.step_num,4},
  36. {"C_isConfig",&mFlash.mClient.isConfig,1},
  37. {"C_hard",&mFlash.mClient.hardVersion,4},
  38. {"C_sotf",&mFlash.mClient.sotfVersion,2},
  39. {"C_macAddr",&mFlash.mClient.macAddr,6},
  40. {"Errorflag",&mFlash.mFlashLog.Errorflag,1},
  41. {"logData",mFlash.mFlashLog.logData,50},
  42. {"PB_BR_V2E",&mFlash.mbattercb_t.preBestResult_Voltage2power,4},
  43. {"PB_BR_C2P",&mFlash.mbattercb_t.preBestResult_chargeV2P_f,4},
  44. {"PB_P_MAH",&mFlash.mbattercb_t.P_mAh,4},
  45. {"PB_KG", &mFlash.mbattercb_t.kg,4},
  46. {"PP2", &mFlash.mbattercb_t.P2,4},
  47. {"PP1", &mFlash.mbattercb_t.P1,4},
  48. {"PCAP_MAH",&mFlash.mbattercb_t.Battery_capacity_mAh,4},
  49. {"PTP4056",&mFlash.mbattercb_t.adc_tp4056_power,4},
  50. {"PINIT", &mFlash.mbattercb_t.init,1},
  51. {"PSTA", &mFlash.mbattercb_t.sta,1},
  52. {"PCV2P_INIT",&mFlash.mbattercb_t.chargeV2P_f_init,1},
  53. {"PV2P_INIT",&mFlash.mbattercb_t.Voltage2power_init,1},
  54. {"Safe_cnt",&mFlash.Safe_cnt,1},
  55. {"RestartCnt",&mFlash.RestartCnt,1}
  56. };
  57. DEFINE_MINIINF(information, FLASH_START_ADDR_INFOR, FLASH_END_ADDR_INFOR, sdflash_write, sdflash_page_erase);
  58. Flash_t mFlash={0};
  59. const uint8_t oldflashdata[] ={
  60. 0x01,0X00,0XE8,0X0E,0X69,0X6E,0X66,0X6F,0X72,0X68,0X65,0X61,0X64,0X3A,0XAA,0X55,0X55,0XAA,0X00,0X00,0X00,0X00,0X09,0X0E,0X6D,0X61,0X63,0X48,0X6F,0X73,0X74,0X3A,
  61. 0x00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X03,0X00,0X95,0X08,0X49,0X73,0X48,0X6F,0X73,0X74,0X3A,0X01,0X00,0X00,0XF7,0X12,0X73,0X74,0X61,0X72,0X74,0X54,0X69,0X6D,
  62. 0x65,0X3A,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X20,0X10,0X73,0X74,0X65,0X70,0X43,0X75,0X72,0X3A,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
  63. 0x00,0X00,0XF6,0X0D,0X73,0X74,0X65,0X70,0X3A,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0XA5,0X0D,0X73,0X74,0X65,0X70,0X5F,0X6E,0X75,0X6D,
  64. 0x3A,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X0E,0X0C,0X43,0X5F,0X69,0X73,0X43,0X6F,0X6E,0X66,0X69,0X67,0X3A,0X00,0X00,0X00,0X7B,0X0B,0X43,0X5F,0X68,0X61,
  65. 0x72,0X64,0X3A,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X98,0X09,0X43,0X5F,0X73,0X6F,0X74,0X66,0X3A,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X88,0X10,0X43,0X5F,0X6D,0X61,
  66. 0x63,0X41,0X64,0X64,0X72,0X3A,0X00,0X00,0X00,0X00,0X00,0X00,0X0C,0X00,0XDE,0X0B,0X45,0X72,0X72,0X6F,0X72,0X66,0X6C,0X61,0X67,0X3A,0X00,0X00,0X0D,0X00,0XF6,0X3A,
  67. 0x6C,0X6F,0X67,0X44,0X61,0X74,0X61,0X3A,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
  68. 0x00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X20,0X00,0X00,0XEB,0X0E,
  69. 0x50,0X42,0X5F,0X42,0X52,0X5F,0X56,0X32,0X45,0X3A,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0XE3,0X0E,0X50,0X42,0X5F,0X42,0X52,0X5F,0X43,0X32,0X50,0X3A,0X00,0X00,
  70. 0x00,0X00,0X00,0X00,0X00,0X00,0XB0,0X0D,0X50,0X42,0X5F,0X50,0X5F,0X4D,0X41,0X48,0X3A,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0XBD,0X0A,0X50,0X42,0X5F,0X4B,
  71. 0x47,0X3A,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X0C,0X08,0X50,0X50,0X32,0X3A,0X00,0X00,0X00,0X00,0X00,0X00,0X0B,0X08,0X50,0X50,0X31,0X3A,0X00,0X00,0X00,0X00,
  72. 0x00,0X00,0X93,0X0D,0X50,0X43,0X41,0X50,0X5F,0X4D,0X41,0X48,0X3A,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0XFD,0X0C,0X50,0X54,0X50,0X34,0X30,0X35,0X36,0X3A,
  73. 0x00,0X00,0X00,0X00,0X00,0X00,0XBE,0X07,0X50,0X49,0X4E,0X49,0X54,0X3A,0X00,0X3A,0X00,0X00,0X72,0X06,0X50,0X53,0X54,0X41,0X3A,0X00,0X00,0X3A,0X00,0X00,0X38,0X0C,
  74. 0x50,0X43,0X56,0X32,0X50,0X5F,0X49,0X4E,0X49,0X54,0X3A,0X00,0X19,0X00,0XF5,0X0B,0X50,0X56,0X32,0X50,0X5F,0X49,0X4E,0X49,0X54,0X3A,0X00,0X00,0X1A,0X00,0X5D,0X0A,
  75. 0x53,0X61,0X66,0X65,0X5F,0X63,0X6E,0X74,0X3A,0X00,0X00,0X00,0X00,0X00,0X44,0X0C,0X52,0X65,0X73,0X74,0X61,0X72,0X74,0X43,0X6E,0X74,0X3A,0X00,0X02,0X00,0X57,0X0E,
  76. 0x6D,0X61,0X63,0X48,0X6F,0X73,0X74,0X3A,0X4B,0X1E,0X15,0X45,0XAA,0XE1,0X00,0X20,0X08,0X00,0X51,0X0C,0X43,0X5F,0X69,0X73,0X43,0X6F,0X6E,0X66,0X69,0X67,0X3A,0X43,
  77. 0x00,0X00,0X73,0X10,0X43,0X5F,0X6D,0X61,0X63,0X41,0X64,0X64,0X72,0X3A,0XFF,0XFF,0XFF,0X94,0X96,0XC4,0X00,0X00,0X45,0X0C,0X52,0X65,0X73,0X74,0X61,0X72,0X74,0X43,
  78. 0x6E,0X74,0X3A,0X01,0X00,0X00,0XE6,0X12,0X73,0X74,0X61,0X72,0X74,0X54,0X69,0X6D,0X65,0X3A,0X00,0X00,0X01,0X81,0X66,0XCE,0X39,0X00,0X04,0X00,0X00,0X00,0X55,0X10,
  79. 0x73,0X74,0X65,0X70,0X43,0X75,0X72,0X3A,0X6C,0X03,0X00,0X00,0XAD,0X19,0X00,0X00,0X00,0X00,0X2B,0X0D,0X73,0X74,0X65,0X70,0X3A,0X6C,0X03,0X00,0X00,0XAD,0X19,0X00,
  80. 0x00,0X19,0X00,0X00,0X00,0X00,0XA6,0X0D,0X73,0X74,0X65,0X70,0X5F,0X6E,0X75,0X6D,0X3A,0X01,0X00,0X00,0X00,0X19,0X00,0X00,0X09,0X00,0X7F,0X0B,0X43,0X5F,0X68,0X61,
  81. 0x72,0X64,0X3A,0X01,0X02,0X01,0X00,0X43,0X0A,0X00,0X99,0X09,0X43,0X5F,0X73,0X6F,0X74,0X66,0X3A,0X01,0X00,0X01,0X00,0X43,0X00,0X00,0X74,0X10,0X43,0X5F,0X6D,0X61,
  82. 0x63,0X41,0X64,0X64,0X72,0X3A,0XC4,0X96,0X94,0X5F,0X18,0X87,0X00,0X00,0X12,0X10,0X73,0X74,0X65,0X70,0X43,0X75,0X72,0X3A,0X8E,0X05,0X00,0X00,0X44,0X1B,0X00,0X00,
  83. 0x00,0X00,0XE8,0X0D,0X73,0X74,0X65,0X70,0X3A,0X8E,0X05,0X00,0X00,0X44,0X1B,0X00,0X00,0X1B,0X00,0X00,0X00,0X00,0XA5,0X10,0X73,0X74,0X65,0X70,0X43,0X75,0X72,0X3A,
  84. 0xDC,0X05,0X00,0X00,0X89,0X1B,0X00,0X00,0X00,0X00,0X7B,0X0D,0X73,0X74,0X65,0X70,0X3A,0XDC,0X05,0X00,0X00,0X89,0X1B,0X00,0X00,0X1B,0X00,0X00,0X00,0X00,0XA7,0X0D,
  85. 0x73,0X74,0X65,0X70,0X5F,0X6E,0X75,0X6D,0X3A,0X02,0X00,0X00,0X00,0X1B,0X00,0X00,0X00,0X00,0XA8,0X0D,0X73,0X74,0X65,0X70,0X5F,0X6E,0X75,0X6D,0X3A,0X03,0X00,0X00,
  86. 0x00,0X1B,0X00,0X00,0X00,0X00,0XA9,0X0D,0X73,0X74,0X65,0X70,0X5F,0X6E,0X75,0X6D,0X3A,0X04,0X00,0X00,0X00,0X1B,0X00,0X00,0X00,0X00,0XAA,0X0D,0X73,0X74,0X65,0X70,
  87. 0x5F,0X6E,0X75,0X6D,0X3A,0X05,0X00,0X00,0X00,0X1B,0X00,0X00,0X00,0X00,0XAB,0X0D,0X73,0X74,0X65,0X70,0X5F,0X6E,0X75,0X6D,0X3A,0X06,0X00,0X00,0X00,0X1B,0X00,0X00,
  88. 0x00,0X00,0XAC,0X0D,0X73,0X74,0X65,0X70,0X5F,0X6E,0X75,0X6D,0X3A,0X07,0X00,0X00,0X00,0X1B,0X00,0X00,0X00,0X00,0XAD,0X0D,0X73,0X74,0X65,0X70,0X5F,0X6E,0X75,0X6D,
  89. 0x3A,0X08,0X00,0X00,0X00,0X1B,0X00,0X00,0X00,0X00,0XAE,0X0D,0X73,0X74,0X65,0X70,0X5F,0X6E,0X75,0X6D,0X3A,0X09,0X00,0X00,0X00,0X1B,0X00,0X00,0X00,0X00,0XAF,0X0D,
  90. 0x73,0X74,0X65,0X70,0X5F,0X6E,0X75,0X6D,0X3A,0X0A,0X00,0X00,0X00,0X1B,0X00,0X00,0X00,0X00,0XB0,0X0D,0X73,0X74,0X65,0X70,0X5F,0X6E,0X75,0X6D,0X3A,0X0B,0X00,0X00,
  91. 0x00,0X1B,0X00,0X00,0X00,0X00,0XB1,0X0D,0X73,0X74,0X65,0X70,0X5F,0X6E,0X75,0X6D,0X3A,0X0C,0X00,0X00,0X00,0X1B,0X00,0X00,0X00,0X00,0XB2,0X0D,0X73,0X74,0X65,0X70,
  92. 0x5F,0X6E,0X75,0X6D,0X3A,0X0D,0X00,0X00,0X00,0X1B,0X00,0X00,0X00,0X00,0XB3,0X0D,0X73,0X74,0X65,0X70,0X5F,0X6E,0X75,0X6D,0X3A,0X0E,0X00,0X00,0X00,0X1B,0X00,0X00,
  93. 0x00,0X00,0XB4,0X0D,0X73,0X74,0X65,0X70,0X5F,0X6E,0X75,0X6D,0X3A,0X0F,0X00,0X00,0X00,0X1B,0X00,0X00,0X00,0X00,0X0D,0X10,0X73,0X74,0X65,0X70,0X43,0X75,0X72,0X3A,
  94. 0xD1,0X07,0X00,0X00,0XF9,0X1C,0X00,0X00,0X00,0X00,0XE3,0X0D,0X73,0X74,0X65,0X70,0X3A,0XD1,0X07,0X00,0X00,0XF9,0X1C,0X00,0X00,0X1C,0X00,0X00,0X00,0X00,0XB5,0X0D,
  95. 0x73,0X74,0X65,0X70,0X5F,0X6E,0X75,0X6D,0X3A,0X10,0X00,0X00,0X00,0X1C,0X00,0X00,0X00,0X00,0X41,0X12,0X73,0X74,0X61,0X72,0X74,0X54,0X69,0X6D,0X65,0X3A,0X00,0X00,
  96. 0x01,0X81,0X6A,0X3D,0X21,0X00,0X04,0X00,0X00,0X00,0X17,0X10,0X73,0X74,0X65,0X70,0X43,0X75,0X72,0X3A,0XD7,0X07,0X00,0X00,0XFD,0X1C,0X00,0X00,0X00,0X00,0XED,0X0D,
  97. 0x73,0X74,0X65,0X70,0X3A,0XD7,0X07,0X00,0X00,0XFD,0X1C,0X00,0X00,0X1C,0X00,0X00,0X00,0X00,0XA6,0X0D,0X73,0X74,0X65,0X70,0X5F,0X6E,0X75,0X6D,0X3A,0X01,0X00,0X00,
  98. 0x00,0X1C,0X00,0X00,0X00,0X00,0XA7,0X0D,0X73,0X74,0X65,0X70,0X5F,0X6E,0X75,0X6D,0X3A,0X02,0X00,0X00,0X00,0X1C,0X00,0X00,0X00,0X00,0XA8,0X0D,0X73,0X74,0X65,0X70,
  99. 0x5F,0X6E,0X75,0X6D,0X3A,0X03,0X00,0X00,0X00,0X1C,0X00,0X00,0X00,0X00,0XA9,0X0D,0X73,0X74,0X65,0X70,0X5F,0X6E,0X75,0X6D,0X3A,0X04,0X00,0X00,0X00,0X1C,0X00,0X00,
  100. 0x00,0X00,0XAA,0X0D,0X73,0X74,0X65,0X70,0X5F,0X6E,0X75,0X6D,0X3A,0X05,0X00,0X00,0X00,0X1C,0X00,0X00,0X00,0X00,0XAB,0X0D,0X73,0X74,0X65,0X70,0X5F,0X6E,0X75,0X6D,
  101. 0x3A,0X06,0X00,0X00,0X00,0X1C,0X00,0X00,0X00,0X00,0XAC,0X0D,0X73,0X74,0X65,0X70,0X5F,0X6E,0X75,0X6D,0X3A,0X07,0X00,0X00,0X00,0X1C,0X00,0X00,0X00,0X00,0XAD,0X0D,
  102. 0x73,0X74,0X65,0X70,0X5F,0X6E,0X75,0X6D,0X3A,0X08,0X00,0X00,0X00,0X1C,0X00,0X00,0X00,0X00,0XAE,0X0D,0X73,0X74,0X65,0X70,0X5F,0X6E,0X75,0X6D,0X3A,0X09,0X00,0X00,
  103. 0x00,0X1C,0X00,0X00,0X00,0X00,0XAF,0X0D,0X73,0X74,0X65,0X70,0X5F,0X6E,0X75,0X6D,0X3A,0X0A,0X00,0X00,0X00,0X1C,0X00,0X00,0X00,0X00,0XB0,0X0D,0X73,0X74,0X65,0X70,
  104. 0x5F,0X6E,0X75,0X6D,0X3A,0X0B,0X00,0X00,0X00,0X1C,0X00,0X00,0X00,0X00,0XB1,0X0D,0X73,0X74,0X65,0X70,0X5F,0X6E,0X75,0X6D,0X3A,0X0C,0X00,0X00,0X00,0X1C,0X00,0X00,
  105. 0x00,0X00,0XB2,0X0D,0X73,0X74,0X65,0X70,0X5F,0X6E,0X75,0X6D,0X3A,0X0D,0X00,0X00,0X00,0X1C,0X00,0X00,0X00,0X00,0XB3,0X0D,0X73,0X74,0X65,0X70,0X5F,0X6E,0X75,0X6D,
  106. 0x3A,0X0E,0X00,0X00,0X00,0X1C,0X00,0X00,0X00,0X00,0XB4,0X0D,0X73,0X74,0X65,0X70,0X5F,0X6E,0X75,0X6D,0X3A,0X0F,0X00,0X00,0X00,0X1C,0X00,0X00,0X00,0X00,0XB5,0X0D,
  107. 0x73,0X74,0X65,0X70,0X5F,0X6E,0X75,0X6D,0X3A,0X10,0X00,0X00,0X00,0X1C,0X00,0X00,0X00,0X00,0XB6,0X0D,0X73,0X74,0X65,0X70,0X5F,0X6E,0X75,0X6D,0X3A,0X11,0X00,0X00,
  108. 0x00,0X1C,0X00,0X00,0X00,0X00,0XB7,0X0D,0X73,0X74,0X65,0X70,0X5F,0X6E,0X75,0X6D,0X3A,0X12,0X00,0X00,0X00,0X1C,0X00,0X00,0X00,0X00,0XB8,0X0D,0X73,0X74,0X65,0X70,
  109. 0x5F,0X6E,0X75,0X6D,0X3A,0X13,0X00,0X00,0X00,0X1C,0X00,0X00,0X00,0X00,0XB9,0X0D,0X73,0X74,0X65,0X70,0X5F,0X6E,0X75,0X6D,0X3A,0X14,0X00,0X00,0X00,0X1C,0X00,0X00,
  110. 0x00,0X00,0XBA,0X0D,0X73,0X74,0X65,0X70,0X5F,0X6E,0X75,0X6D,0X3A,0X15,0X00,0X00,0X00,0X1C,0X00,0X00,0X00,0X00,0XBB,0X0D,0X73,0X74,0X65,0X70,0X5F,0X6E,0X75,0X6D,
  111. 0x3A,0X16,0X00,0X00,0X00,0X1C,0X00,0X00,0X00,0X00,0XBC,0X0D,0X73,0X74,0X65,0X70,0X5F,0X6E,0X75,0X6D,0X3A,0X17,0X00,0X00,0X00,0X1C,0X00,0X00,0X00,0X00,0XBD,0X0D,
  112. 0x73,0X74,0X65,0X70,0X5F,0X6E,0X75,0X6D,0X3A,0X18,0X00,0X00,0X00,0X1C,0X00,0X00,0X00,0X00,0XBE,0X0D,0X73,0X74,0X65,0X70,0X5F,0X6E,0X75,0X6D,0X3A,0X19,0X00,0X00,
  113. 0x00,0X1C,0X00,0X00,0X00,0X00,0XBF,0X0D,0X73,0X74,0X65,0X70,0X5F,0X6E,0X75,0X6D,0X3A,0X1A,0X00,0X00,0X00,0X1C,0X00,0X00,0X00,0X00,0XB1,0X0E,0X50,0X42,0X5F,0X42,
  114. 0x52,0X5F,0X56,0X32,0X45,0X3A,0X0C,0XC2,0XB5,0X43,0X00,0X00,0X00,0X00,0X7C,0X0A,0X50,0X42,0X5F,0X4B,0X47,0X3A,0X00,0X00,0X80,0X3F,0X00,0X00,0X00,0X00,0X7A,0X08,
  115. 0x50,0X50,0X32,0X3A,0X30,0X08,0XF5,0X41,0X00,0X00,0XCA,0X08,0X50,0X50,0X31,0X3A,0XA0,0XEA,0XF4,0X41,0X00,0X00,0XBC,0X0C,0X50,0X54,0X50,0X34,0X30,0X35,0X36,0X3A,
  116. 0xA0,0XEA,0XF4,0X41,0X16,0X00,0XC1,0X07,0X50,0X49,0X4E,0X49,0X54,0X3A,0X03,0X3A,0X17,0X00,0X73,0X06,0X50,0X53,0X54,0X41,0X3A,0X01,0X03,0X3A,0X00,0X00,0X39,0X0C,
  117. 0x50,0X43,0X56,0X32,0X50,0X5F,0X49,0X4E,0X49,0X54,0X3A,0X01,0X00,0X00,0X44,0X0C,0X52,0X65,0X73,0X74,0X61,0X72,0X74,0X43,0X6E,0X74,0X3A,0X00,0X00,0X00,0X73,0X10,
  118. 0x43,0X5F,0X6D,0X61,0X63,0X41,0X64,0X64,0X72,0X3A,0XFF,0XFF,0XFF,0X94,0X96,0XC4,0X00,0X00,0X45,0X0C,0X52,0X65,0X73,0X74,0X61,0X72,0X74,0X43,0X6E,0X74,0X3A,0X01,
  119. 0x00,0X00,0X6D,0X12,0X73,0X74,0X61,0X72,0X74,0X54,0X69,0X6D,0X65,0X3A,0X00,0X00,0X01,0X81,0X6F,0X9A,0X6B,0X80,0X00,0X00,0X00,0X00,0XA5,0X0D,0X73,0X74,0X65,0X70,
  120. 0x5F,0X6E,0X75,0X6D,0X3A,0X00,0X00,0X00,0X00,0X1C,0X00,0X00,0X00,0X00,0X67,0X10,0X43,0X5F,0X6D,0X61,0X63,0X41,0X64,0X64,0X72,0X3A,0XFF,0XFF,0XFF,0XE2,0X3A,0XC6,
  121. 0x00,0X00,0X73,0X10,0X43,0X5F,0X6D,0X61,0X63,0X41,0X64,0X64,0X72,0X3A,0XFF,0XFF,0XFF,0X94,0X96,0XC4,0X00,0X00,0X67,0X10,0X43,0X5F,0X6D,0X61,0X63,0X41,0X64,0X64,
  122. 0x72,0X3A,0XFF,0XFF,0XFF,0XE2,0X3A,0XC6,0X00,0X00,0XE2,0X10,0X73,0X74,0X65,0X70,0X43,0X75,0X72,0X3A,0XD7,0X07,0X00,0X00,0XE0,0X04,0X00,0X00,0X00,0X00,0X73,0X10,
  123. 0x43,0X5F,0X6D,0X61,0X63,0X41,0X64,0X64,0X72,0X3A,0XFF,0XFF,0XFF,0X94,0X96,0XC4,0X00,0X00,0X17,0X10,0X73,0X74,0X65,0X70,0X43,0X75,0X72,0X3A,0XD7,0X07,0X00,0X00,
  124. 0xFD,0X1C,0X00,0X00,0X00,0X00,0X67,0X10,0X43,0X5F,0X6D,0X61,0X63,0X41,0X64,0X64,0X72,0X3A,0XFF,0XFF,0XFF,0XE2,0X3A,0XC6,0X00,0X00,0XE2,0X10,0X73,0X74,0X65,0X70,
  125. 0x43,0X75,0X72,0X3A,0XD7,0X07,0X00,0X00,0XE0,0X04,0X00,0X00,0X00,0X00,0X73,0X10,0X43,0X5F,0X6D,0X61,0X63,0X41,0X64,0X64,0X72,0X3A,0XFF,0XFF,0XFF,0X94,0X96,0XC4,
  126. 0x00,0X00,0X17,0X10,0X73,0X74,0X65,0X70,0X43,0X75,0X72,0X3A,0XD7,0X07,0X00,0X00,0XFD,0X1C,0X00,0X00,0X00,0X00,0XA6,0X0D,0X73,0X74,0X65,0X70,0X5F,0X6E,0X75,0X6D,
  127. 0x3A,0X01,0X00,0X00,0X00,0X1C,0X00,0X00,0X00,0X00,0X98,0X0E,0X50,0X42,0X5F,0X42,0X52,0X5F,0X56,0X32,0X45,0X3A,0X72,0X43,0XB5,0X43,0X00,0X00,0X00,0X00,0X15,0X08,
  128. 0x50,0X50,0X32,0X3A,0XC8,0X0D,0XF3,0X41,0X00,0X00,0XC6,0X08,0X50,0X50,0X31,0X3A,0XC4,0XC5,0XF1,0X41,0X00,0X00,0XB8,0X0C,0X50,0X54,0X50,0X34,0X30,0X35,0X36,0X3A,
  129. 0xC4,0XC5,0XF1,0X41,0X00,0X00,0X44,0X0C,0X52,0X65,0X73,0X74,0X61,0X72,0X74,0X43,0X6E,0X74,0X3A,0X00,0X00,0X00,0X67,0X10,0X43,0X5F,0X6D,0X61,0X63,0X41,0X64,0X64,
  130. 0x72,0X3A,0XFF,0XFF,0XFF,0XE2,0X3A,0XC6,0X00,0X00,0X45,0X0C,0X52,0X65,0X73,0X74,0X61,0X72,0X74,0X43,0X6E,0X74,0X3A,0X01,0X00,0X00,0X73,0X10,0X43,0X5F,0X6D,0X61,
  131. 0x63,0X41,0X64,0X64,0X72,0X3A,0XFF,0XFF,0XFF,0X94,0X96,0XC4,0X00,0X00,0X67,0X10,0X43,0X5F,0X6D,0X61,0X63,0X41,0X64,0X64,0X72,0X3A,0XFF,0XFF,0XFF,0XE2,0X3A,0XC6,
  132. 0x00,0X00,0X73,0X10,0X43,0X5F,0X6D,0X61,0X63,0X41,0X64,0X64,0X72,0X3A,0XFF,0XFF,0XFF,0X94,0X96,0XC4,0X00,0X00,0X67,0X10,0X43,0X5F,0X6D,0X61,0X63,0X41,0X64,0X64,
  133. 0x72,0X3A,0XFF,0XFF,0XFF,0XE2,0X3A,0XC6,0X00,0X00,0X73,0X10,0X43,0X5F,0X6D,0X61,0X63,0X41,0X64,0X64,0X72,0X3A,0XFF,0XFF,0XFF,0X94,0X96,0XC4,0X00,0X00,0X67,0X10,
  134. 0x43,0X5F,0X6D,0X61,0X63,0X41,0X64,0X64,0X72,0X3A,0XFF,0XFF,0XFF,0XE2,0X3A,0XC6,0X00,0X00,0X73,0X10,0X43,0X5F,0X6D,0X61,0X63,0X41,0X64,0X64,0X72,0X3A,0XFF,0XFF,
  135. 0xFF,0X94,0X96,0XC4,0X00,0X00,0X67,0X10,0X43,0X5F,0X6D,0X61,0X63,0X41,0X64,0X64,0X72,0X3A,0XFF,0XFF,0XFF,0XE2,0X3A,0XC6,0X00,0X00,0X73,0X10,0X43,0X5F,0X6D,0X61,
  136. 0x63,0X41,0X64,0X64,0X72,0X3A,0XFF,0XFF,0XFF,0X94,0X96,0XC4,0X00,0X00,0X67,0X10,0X43,0X5F,0X6D,0X61,0X63,0X41,0X64,0X64,0X72,0X3A,0XFF,0XFF,0XFF,0XE2,0X3A,0XC6,
  137. 0x00,0X00,0X73,0X10,0X43,0X5F,0X6D,0X61,0X63,0X41,0X64,0X64,0X72,0X3A,0XFF,0XFF,0XFF,0X94,0X96,0XC4,0X00,0X00,0X67,0X10,0X43,0X5F,0X6D,0X61,0X63,0X41,0X64,0X64,
  138. 0x72,0X3A,0XFF,0XFF,0XFF,0XE2,0X3A,0XC6,0X00,0X00,0X73,0X10,0X43,0X5F,0X6D,0X61,0X63,0X41,0X64,0X64,0X72,0X3A,0XFF,0XFF,0XFF,0X94,0X96,0XC4,0X00,0X00,0X67,0X10,
  139. 0x43,0X5F,0X6D,0X61,0X63,0X41,0X64,0X64,0X72,0X3A,0XFF,0XFF,0XFF,0XE2,0X3A,0XC6,0X00,0X00,0XA7,0X0D,0X73,0X74,0X65,0X70,0X5F,0X6E,0X75,0X6D,0X3A,0X02,0X00,0X00,
  140. 0x00,0X1C,0X00,0X00,0X00,0X00,0XA8,0X0D,0X73,0X74,0X65,0X70,0X5F,0X6E,0X75,0X6D,0X3A,0X03,0X00,0X00,0X00,0X1C,0X00,0X00,0X00,0X00,0X73,0X10,0X43,0X5F,0X6D,0X61,
  141. 0x63,0X41,0X64,0X64,0X72,0X3A,0XFF,0XFF,0XFF,0X94,0X96,0XC4,0X00,0X00,0X5F,0X12,0X73,0X74,0X61,0X72,0X74,0X54,0X69,0X6D,0X65,0X3A,0X00,0X00,0X01,0X81,0X70,0X3F,
  142. 0x37,0X00,0X04,0X00,0X00,0X00,0X18,0X10,0X73,0X74,0X65,0X70,0X43,0X75,0X72,0X3A,0XD7,0X07,0X00,0X00,0XFE,0X1C,0X00,0X00,0X00,0X00,0XEE,0X0D,0X73,0X74,0X65,0X70,
  143. 0x3A,0XD7,0X07,0X00,0X00,0XFE,0X1C,0X00,0X00,0X1C,0X00,0X00,0X00,0X00,0XA6,0X0D,0X73,0X74,0X65,0X70,0X5F,0X6E,0X75,0X6D,0X3A,0X01,0X00,0X00,0X00,0X1C,0X00,0X00,
  144. 0x00,0X00,0X74,0X10,0X43,0X5F,0X6D,0X61,0X63,0X41,0X64,0X64,0X72,0X3A,0XC4,0X96,0X94,0X5F,0X18,0X87,0X00,0X00,0X56,0X0E,0X50,0X42,0X5F,0X42,0X52,0X5F,0X56,0X32,
  145. 0x45,0X3A,0XD0,0XA4,0XB4,0X43,0X00,0X00,0X00,0X00,0X1D,0X0E,0X50,0X42,0X5F,0X42,0X52,0X5F,0X43,0X32,0X50,0X3A,0X6E,0XD0,0XB9,0X43,0X00,0X00,0X00,0X00,0XD3,0X0D,
  146. 0x50,0X42,0X5F,0X50,0X5F,0X4D,0X41,0X48,0X3A,0XD7,0X5F,0XAC,0X41,0X43,0X00,0X00,0X00,0X00,0X10,0X08,0X50,0X50,0X32,0X3A,0X40,0X93,0XF0,0X41,0X00,0X00,0X2E,0X08,
  147. 0x50,0X50,0X31,0X3A,0XD7,0X5F,0XAC,0X41,0X00,0X00,0X1A,0X0D,0X50,0X43,0X41,0X50,0X5F,0X4D,0X41,0X48,0X3A,0XDC,0XD3,0X96,0X42,0X43,0X00,0X00,0X00,0X00,0X20,0X0C,
  148. 0x50,0X54,0X50,0X34,0X30,0X35,0X36,0X3A,0XD7,0X5F,0XAC,0X41,0X18,0X00,0X38,0X0C,0X50,0X43,0X56,0X32,0X50,0X5F,0X49,0X4E,0X49,0X54,0X3A,0X00,0X00,0X00,0X44,0X0C,
  149. 0x52,0X65,0X73,0X74,0X61,0X72,0X74,0X43,0X6E,0X74,0X3A,0X00,0X00,0X00,0XA7,0X0D,0X73,0X74,0X65,0X70,0X5F,0X6E,0X75,0X6D,0X3A,0X02,0X00,0X00,0X00,0X1C,0X00,0X00,
  150. 0x00,0X00,0X45,0X0C,0X52,0X65,0X73,0X74,0X61,0X72,0X74,0X43,0X6E,0X74,0X3A,0X01,0X00,0X00,0X7B,0X0E,0X50,0X42,0X5F,0X42,0X52,0X5F,0X56,0X32,0X45,0X3A,0XFB,0X9E,
  151. 0xB4,0X43,0X00,0X00,0X00,0X00,0XA4,0X08,0X50,0X50,0X32,0X3A,0XEC,0X7B,0XF0,0X41,0X00,0X00,0X44,0X0C,0X52,0X65,0X73,0X74,0X61,0X72,0X74,0X43,0X6E,0X74,0X3A,0X00,
  152. 0x00,0X00,0X73,0X10,0X43,0X5F,0X6D,0X61,0X63,0X41,0X64,0X64,0X72,0X3A,0XFF,0XFF,0XFF,0X94,0X96,0XC4,0X00,0X00,0X45,0X0C,0X52,0X65,0X73,0X74,0X61,0X72,0X74,0X43,
  153. 0x6E,0X74,0X3A,0X01,0X00,0X00,0XA6,0X0D,0X73,0X74,0X65,0X70,0X5F,0X6E,0X75,0X6D,0X3A,0X01,0X00,0X00,0X00,0X1C,0X00,0X00,0X00,0X00,0X74,0X10,0X43,0X5F,0X6D,0X61,
  154. 0x63,0X41,0X64,0X64,0X72,0X3A,0XC4,0X96,0X94,0X5F,0X18,0X87,0X00,0X00,0XA7,0X0D,0X73,0X74,0X65,0X70,0X5F,0X6E,0X75,0X6D,0X3A,0X02,0X00,0X00,0X00,0X1C,0X00,0X00,
  155. 0x00,0X00,0XDB,0X0E,0X50,0X42,0X5F,0X42,0X52,0X5F,0X56,0X32,0X45,0X3A,0XD7,0X22,0XB4,0X43,0X00,0X00,0X00,0X00,0XA7,0X0E,0X50,0X42,0X5F,0X42,0X52,0X5F,0X43,0X32,
  156. 0x50,0X3A,0X02,0XC6,0XB9,0X43,0X00,0X00,0X00,0X00,0X7F,0X0D,0X50,0X42,0X5F,0X50,0X5F,0X4D,0X41,0X48,0X3A,0X46,0X9C,0XAC,0X41,0X43,0X00,0X00,0X11,0X00,0XBD,0X0A,
  157. 0x50,0X42,0X5F,0X4B,0X47,0X3A,0X00,0X00,0X00,0X00,0X9C,0XAC,0X00,0X00,0X2F,0X08,0X50,0X50,0X32,0X3A,0X10,0X2B,0XA7,0X41,0X00,0X00,0X74,0X08,0X50,0X50,0X31,0X3A,
  158. 0x15,0X6D,0XA6,0X41,0X00,0X00,0X31,0X0D,0X50,0X43,0X41,0X50,0X5F,0X4D,0X41,0X48,0X3A,0XBD,0X08,0X97,0X42,0X43,0X00,0X00,0X00,0X00,0X66,0X0C,0X50,0X54,0X50,0X34,
  159. 0x30,0X35,0X36,0X3A,0X15,0X6D,0XA6,0X41,0X00,0X00,0X44,0X0C,0X52,0X65,0X73,0X74,0X61,0X72,0X74,0X43,0X6E,0X74,0X3A,0X00,0X00,0X00,0X73,0X10,0X43,0X5F,0X6D,0X61,
  160. 0x63,0X41,0X64,0X64,0X72,0X3A,0XFF,0XFF,0XFF,0X94,0X96,0XC4,0X00,0X00,0X45,0X0C,0X52,0X65,0X73,0X74,0X61,0X72,0X74,0X43,0X6E,0X74,0X3A,0X01,0X00,0X00,0XC2,0X10,
  161. 0x43,0X5F,0X6D,0X61,0X63,0X41,0X64,0X64,0X72,0X3A,0XFF,0XFF,0XFF,0X0F,0X61,0XCD,0X00,0X00,0X73,0X10,0X43,0X5F,0X6D,0X61,0X63,0X41,0X64,0X64,0X72,0X3A,0XFF,0XFF,
  162. 0xFF,0X94,0X96,0XC4,0X00,0X00,0XC2,0X10,0X43,0X5F,0X6D,0X61,0X63,0X41,0X64,0X64,0X72,0X3A,0XFF,0XFF,0XFF,0X0F,0X61,0XCD,0X00,0X00,0X73,0X10,0X43,0X5F,0X6D,0X61,
  163. 0x63,0X41,0X64,0X64,0X72,0X3A,0XFF,0XFF,0XFF,0X94,0X96,0XC4,0X04,0X00,0X04,0X12,0X73,0X74,0X61,0X72,0X74,0X54,0X69,0X6D,0X65,0X3A,0X00,0X00,0X01,0X81,0X70,0X76,
  164. 0x25,0X80,0X00,0X00,0X00,0X00,0XA5,0X0D,0X73,0X74,0X65,0X70,0X5F,0X6E,0X75,0X6D,0X3A,0X00,0X00,0X00,0X00,0X1C,0X00,0X00,0X00,0X00,0XC2,0X10,0X43,0X5F,0X6D,0X61,
  165. 0x63,0X41,0X64,0X64,0X72,0X3A,0XFF,0XFF,0XFF,0X0F,0X61,0XCD,0X00,0X00,0XFE,0X10,0X73,0X74,0X65,0X70,0X43,0X75,0X72,0X3A,0XD7,0X07,0X00,0X00,0X00,0X00,0X00,0X00,
  166. 0x00,0X00,0X73,0X10,0X43,0X5F,0X6D,0X61,0X63,0X41,0X64,0X64,0X72,0X3A,0XFF,0XFF,0XFF,0X94,0X96,0XC4,0X00,0X00,0X18,0X10,0X73,0X74,0X65,0X70,0X43,0X75,0X72,0X3A,
  167. 0xD7,0X07,0X00,0X00,0XFE,0X1C,0X00,0X00,0X00,0X00,0XA6,0X0D,0X73,0X74,0X65,0X70,0X5F,0X6E,0X75,0X6D,0X3A,0X01,0X00,0X00,0X00,0X1C,0X00,0X00,0X00,0X00,0X74,0X10,
  168. 0x43,0X5F,0X6D,0X61,0X63,0X41,0X64,0X64,0X72,0X3A,0XC4,0X96,0X94,0X5F,0X18,0X87,0X00,0X00,0X02,0X0E,0X50,0X42,0X5F,0X42,0X52,0X5F,0X56,0X32,0X45,0X3A,0X40,0XE1,
  169. 0xB3,0X43,0X00,0X00,0X00,0X00,0XD1,0X0E,0X50,0X42,0X5F,0X42,0X52,0X5F,0X43,0X32,0X50,0X3A,0X67,0X8B,0XB9,0X43,0X00,0X00,0X00,0X00,0XD9,0X0D,0X50,0X42,0X5F,0X50,
  170. 0x5F,0X4D,0X41,0X48,0X3A,0X96,0XAC,0XA6,0X41,0X43,0X00,0X00,0X00,0X00,0XAD,0X08,0X50,0X50,0X32,0X3A,0X25,0X95,0XA6,0X41,0X00,0X00,0XAC,0X08,0X50,0X50,0X31,0X3A,
  171. 0x25,0X95,0XA6,0X41,0X00,0X00,0X8B,0X0D,0X50,0X43,0X41,0X50,0X5F,0X4D,0X41,0X48,0X3A,0X86,0X9A,0X96,0X42,0X43,0X00,0X00,0X00,0X00,0X9E,0X0C,0X50,0X54,0X50,0X34,
  172. 0x30,0X35,0X36,0X3A,0X25,0X95,0XA6,0X41,0X00,0X00,0X44,0X0C,0X52,0X65,0X73,0X74,0X61,0X72,0X74,0X43,0X6E,0X74,0X3A,0X00,0X00,0X00,0X73,0X10,0X43,0X5F,0X6D,0X61,
  173. 0x63,0X41,0X64,0X64,0X72,0X3A,0XFF,0XFF,0XFF,0X94,0X96,0XC4,0X00,0X00,0X45,0X0C,0X52,0X65,0X73,0X74,0X61,0X72,0X74,0X43,0X6E,0X74,0X3A,0X01,0X00,0X00,0X74,0X10,
  174. 0x43,0X5F,0X6D,0X61,0X63,0X41,0X64,0X64,0X72,0X3A,0XC4,0X96,0X94,0X5F,0X18,0X87,0X0B,0X00,0X67,0X10,0X43,0X5F,0X6D,0X61,0X63,0X41,0X64,0X64,0X72,0X3A,0XFF,0XFF,
  175. 0xFF,0XE2,0X3A,0XC6,0X05,0X00,0XE2,0X10,0X73,0X74,0X65,0X70,0X43,0X75,0X72,0X3A,0XD7,0X07,0X00,0X00,0XE0,0X04,0X00,0X00,0X06,0X00,0XB8,0X0D,0X73,0X74,0X65,0X70,
  176. 0x3A,0XD7,0X07,0X00,0X00,0XE0,0X04,0X00,0X00,0X04,0X00,0X00,0X00,0X00,0XA7,0X0D,0X73,0X74,0X65,0X70,0X5F,0X6E,0X75,0X6D,0X3A,0X02,0X00,0X00,0X00,0X04,0X00,0X00,
  177. 0x00,0X00,0XA8,0X0D,0X73,0X74,0X65,0X70,0X5F,0X6E,0X75,0X6D,0X3A,0X03,0X00,0X00,0X00,0X04,0X00,0X00,0X00,0X00,0XA9,0X0D,0X73,0X74,0X65,0X70,0X5F,0X6E,0X75,0X6D,
  178. 0x3A,0X04,0X00,0X00,0X00,0X04,0X00,0X00,0X0E,0X00,0X5B,0X0E,0X50,0X42,0X5F,0X42,0X52,0X5F,0X56,0X32,0X45,0X3A,0X60,0X02,0XCB,0X43,0X00,0X00,0X0F,0X00,0X9C,0X0E,
  179. 0x50,0X42,0X5F,0X42,0X52,0X5F,0X43,0X32,0X50,0X3A,0X05,0XA0,0XD1,0X43,0X00,0X00,0X10,0X00,0X9B,0X0D,0X50,0X42,0X5F,0X50,0X5F,0X4D,0X41,0X48,0X3A,0X1A,0XC6,0XC9,
  180. 0x42,0X43,0X00,0X00,0X12,0X00,0XA7,0X08,0X50,0X50,0X32,0X3A,0XC9,0XDC,0XB4,0X42,0X13,0X00,0X06,0X08,0X50,0X50,0X31,0X3A,0X29,0XDC,0XB4,0X42,0X14,0X00,0X6E,0X0D,
  181. 0x50,0X43,0X41,0X50,0X5F,0X4D,0X41,0X48,0X3A,0X9F,0X5B,0X9E,0X43,0X43,0X00,0X00,0X15,0X00,0XF8,0X0C,0X50,0X54,0X50,0X34,0X30,0X35,0X36,0X3A,0X29,0XDC,0XB4,0X42,
  182. 0x00,0X00,0X44,0X0C,0X52,0X65,0X73,0X74,0X61,0X72,0X74,0X43,0X6E,0X74,0X3A,0X00,0X00,0X00,0XAA,0X0D,0X73,0X74,0X65,0X70,0X5F,0X6E,0X75,0X6D,0X3A,0X05,0X00,0X00,
  183. 0x00,0X04,0X00,0X00,0X1B,0X00,0X45,0X0C,0X52,0X65,0X73,0X74,0X61,0X72,0X74,0X43,0X6E,0X74,0X3A,0X01,0X00,0X00,0XAB,0X0D,0X73,0X74,0X65,0X70,0X5F,0X6E,0X75,0X6D,
  184. 0x3A,0X06,0X00,0X00,0X00,0X04,0X00,0X00,0X00,0X00,0XAC,0X0D,0X73,0X74,0X65,0X70,0X5F,0X6E,0X75,0X6D,0X3A,0X07,0X00,0X00,0X00,0X04,0X00,0X00,0X00,0X00,0XAD,0X0D,
  185. 0x73,0X74,0X65,0X70,0X5F,0X6E,0X75,0X6D,0X3A,0X08,0X00,0X00,0X00,0X04,0X00,0X00,0X00,0X00,0XAE,0X0D,0X73,0X74,0X65,0X70,0X5F,0X6E,0X75,0X6D,0X3A,0X09,0X00,0X00,
  186. 0x00,0X04,0X00,0X00,0X00,0X00,0XAF,0X0D,0X73,0X74,0X65,0X70,0X5F,0X6E,0X75,0X6D,0X3A,0X0A,0X00,0X00,0X00,0X04,0X00,0X00,0X00,0X00,0XB0,0X0D,0X73,0X74,0X65,0X70,
  187. 0x5F,0X6E,0X75,0X6D,0X3A,0X0B,0X00,0X00,0X00,0X04,0X00,0X00,0X00,0X00,0XB1,0X0D,0X73,0X74,0X65,0X70,0X5F,0X6E,0X75,0X6D,0X3A,0X0C,0X00,0X00,0X00,0X04,0X00,0X00,
  188. 0x00,0X00,0XB2,0X0D,0X73,0X74,0X65,0X70,0X5F,0X6E,0X75,0X6D,0X3A,0X0D,0X00,0X00,0X00,0X04,0X00,0X00,0X00,0X00,0XB3,0X0D,0X73,0X74,0X65,0X70,0X5F,0X6E,0X75,0X6D,
  189. 0x3A,0X0E,0X00,0X00,0X00,0X04,0X00,0X00,0X00,0X00,0XB4,0X0D,0X73,0X74,0X65,0X70,0X5F,0X6E,0X75,0X6D,0X3A,0X0F,0X00,0X00,0X00,0X04,0X00,0X00,0X00,0X00,0XB5,0X0D,
  190. 0x73,0X74,0X65,0X70,0X5F,0X6E,0X75,0X6D,0X3A,0X10,0X00,0X00,0X00,0X04,0X00,0X00,0X00,0X00,0XB6,0X0D,0X73,0X74,0X65,0X70,0X5F,0X6E,0X75,0X6D,0X3A,0X11,0X00,0X00,
  191. 0x00,0X04,0X00,0X00,0X00,0X00,0XB7,0X0D,0X73,0X74,0X65,0X70,0X5F,0X6E,0X75,0X6D,0X3A,0X12,0X00,0X00,0X00,0X04,0X00,0X00,0X00,0X00,0XB8,0X0D,0X73,0X74,0X65,0X70,
  192. 0x5F,0X6E,0X75,0X6D,0X3A,0X13,0X00,0X00,0X00,0X04,0X00,0X00,0X00,0X00,0XB9,0X0D,0X73,0X74,0X65,0X70,0X5F,0X6E,0X75,0X6D,0X3A,0X14,0X00,0X00,0X00,0X04,0X00,0X00,
  193. 0x00,0X00,0XBA,0X0D,0X73,0X74,0X65,0X70,0X5F,0X6E,0X75,0X6D,0X3A,0X15,0X00,0X00,0X00,0X04,0X00,0X00,0X00,0X00,0XBB,0X0D,0X73,0X74,0X65,0X70,0X5F,0X6E,0X75,0X6D,
  194. 0x3A,0X16,0X00,0X00,0X00,0X04,0X00,0X00,0X00,0X00,0XBC,0X0D,0X73,0X74,0X65,0X70,0X5F,0X6E,0X75,0X6D,0X3A,0X17,0X00,0X00,0X00,0X04,0X00,0X00,0X00,0X00,0XBD,0X0D,
  195. 0x73,0X74,0X65,0X70,0X5F,0X6E,0X75,0X6D,0X3A,0X18,0X00,0X00,0X00,0X04,0X00,0X00,0X00,0X00,0XBE,0X0D,0X73,0X74,0X65,0X70,0X5F,0X6E,0X75,0X6D,0X3A,0X19,0X00,0X00,
  196. 0x00,0X04,0X00,0X00,0X00,0X00,0XBF,0X0D,0X73,0X74,0X65,0X70,0X5F,0X6E,0X75,0X6D,0X3A,0X1A,0X00,0X00,0X00,0X04,0X00,0X00,0X00,0X00,0XC0,0X0D,0X73,0X74,0X65,0X70,
  197. 0x5F,0X6E,0X75,0X6D,0X3A,0X1B,0X00,0X00,0X00,0X04,0X00,0X00,0X00,0X00,0XC1,0X0D,0X73,0X74,0X65,0X70,0X5F,0X6E,0X75,0X6D,0X3A,0X1C,0X00,0X00,0X00,0X04,0X00,0X00,
  198. 0x00,0X00,0XC2,0X0D,0X73,0X74,0X65,0X70,0X5F,0X6E,0X75,0X6D,0X3A,0X1D,0X00,0X00,0X00,0X04,0X00,0X00,0X00,0X00,0XC3,0X0D,0X73,0X74,0X65,0X70,0X5F,0X6E,0X75,0X6D,
  199. 0x3A,0X1E,0X00,0X00,0X00,0X04,0X00,0X00,0X00,0X00,0XC4,0X0D,0X73,0X74,0X65,0X70,0X5F,0X6E,0X75,0X6D,0X3A,0X1F,0X00,0X00,0X00,0X04,0X00,0X00,0X00,0X00,0XC5,0X0D,
  200. 0x73,0X74,0X65,0X70,0X5F,0X6E,0X75,0X6D,0X3A,0X20,0X00,0X00,0X00,0X04,0X00,0X00,0X00,0X00,0XC6,0X0D,0X73,0X74,0X65,0X70,0X5F,0X6E,0X75,0X6D,0X3A,0X21,0X00,0X00,
  201. 0x00,0X04,0X00,0X00,0X00,0X00,0XC7,0X0D,0X73,0X74,0X65,0X70,0X5F,0X6E,0X75,0X6D,0X3A,0X22,0X00,0X00,0X00,0X04,0X00,0X00,0X00,0X00,0XC8,0X0D,0X73,0X74,0X65,0X70,
  202. 0x5F,0X6E,0X75,0X6D,0X3A,0X23,0X00,0X00,0X00,0X04,0X00,0X00,0X00,0X00,0XC9,0X0D,0X73,0X74,0X65,0X70,0X5F,0X6E,0X75,0X6D,0X3A,0X24,0X00,0X00,0X00,0X04,0X00,0X00,
  203. 0x00,0X00,0XCA,0X0D,0X73,0X74,0X65,0X70,0X5F,0X6E,0X75,0X6D,0X3A,0X25,0X00,0X00,0X00,0X04,0X00,0X00,0X00,0X00,0XCB,0X0D,0X73,0X74,0X65,0X70,0X5F,0X6E,0X75,0X6D,
  204. 0x3A,0X26,0X00,0X00,0X00,0X04,0X00,0X00,0X00,0X00,0XCC,0X0D,0X73,0X74,0X65,0X70,0X5F,0X6E,0X75,0X6D,0X3A,0X27,0X00,0X00,0X00,0X04,0X00,0X00,0X00,0X00,0XCD,0X0D,
  205. 0x73,0X74,0X65,0X70,0X5F,0X6E,0X75,0X6D,0X3A,0X28,0X00,0X00,0X00,0X04,0X00,0X00,0X00,0X00,0XCE,0X0D,0X73,0X74,0X65,0X70,0X5F,0X6E,0X75,0X6D,0X3A,0X29,0X00,0X00,
  206. 0x00,0X04,0X00,0X00,0X00,0X00,0XCF,0X0D,0X73,0X74,0X65,0X70,0X5F,0X6E,0X75,0X6D,0X3A,0X2A,0X00,0X00,0X00,0X04,0X00,0X00,0X00,0X00,0XD0,0X0D,0X73,0X74,0X65,0X70,
  207. 0x5F,0X6E,0X75,0X6D,0X3A,0X2B,0X00,0X00,0X00,0X04,0X00,0X00,0X00,0X00,0XD1,0X0D,0X73,0X74,0X65,0X70,0X5F,0X6E,0X75,0X6D,0X3A,0X2C,0X00,0X00,0X00,0X04,0X00,0X00,
  208. 0x00,0X00,0XD2,0X0D,0X73,0X74,0X65,0X70,0X5F,0X6E,0X75,0X6D,0X3A,0X2D,0X00,0X00,0X00,0X04,0X00,0X00,0X00,0X00,0XD3,0X0D,0X73,0X74,0X65,0X70,0X5F,0X6E,0X75,0X6D,
  209. 0x3A,0X2E,0X00,0X00,0X00,0X04,0X00,0X00,0X00,0X00,0XD4,0X0D,0X73,0X74,0X65,0X70,0X5F,0X6E,0X75,0X6D,0X3A,0X2F,0X00,0X00,0X00,0X04,0X00,0X00,0X00,0X00,0XD5,0X0D,
  210. 0x73,0X74,0X65,0X70,0X5F,0X6E,0X75,0X6D,0X3A,0X30,0X00,0X00,0X00,0X04,0X00,0X00,0X00,0X00,0XD6,0X0D,0X73,0X74,0X65,0X70,0X5F,0X6E,0X75,0X6D,0X3A,0X31,0X00,0X00,
  211. 0x00,0X04,0X00,0X00,0X00,0X00,0XD7,0X0D,0X73,0X74,0X65,0X70,0X5F,0X6E,0X75,0X6D,0X3A,0X32,0X00,0X00,0X00,0X04,0X00,0X00,0X00,0X00,0XD8,0X0D,0X73,0X74,0X65,0X70,
  212. 0x5F,0X6E,0X75,0X6D,0X3A,0X33,0X00,0X00,0X00,0X04,0X00,0X00,0X00,0X00,0XD9,0X0D,0X73,0X74,0X65,0X70,0X5F,0X6E,0X75,0X6D,0X3A,0X34,0X00,0X00,0X00,0X04,0X00,0X00,
  213. 0x00,0X00,0XDA,0X0D,0X73,0X74,0X65,0X70,0X5F,0X6E,0X75,0X6D,0X3A,0X35,0X00,0X00,0X00,0X04,0X00,0X00,0X00,0X00,0XDB,0X0D,0X73,0X74,0X65,0X70,0X5F,0X6E,0X75,0X6D,
  214. 0x3A,0X36,0X00,0X00,0X00,0X04,0X00,0X00,0X00,0X00,0XDC,0X0D,0X73,0X74,0X65,0X70,0X5F,0X6E,0X75,0X6D,0X3A,0X37,0X00,0X00,0X00,0X04,0X00,0X00,0X00,0X00,0XDD,0X0D,
  215. 0x73,0X74,0X65,0X70,0X5F,0X6E,0X75,0X6D,0X3A,0X38,0X00,0X00,0X00,0X04,0X00,0X00,0X00,0X00,0XDE,0X0D,0X73,0X74,0X65,0X70,0X5F,0X6E,0X75,0X6D,0X3A,0X39,0X00,0X00,
  216. 0x00,0X04,0X00,0X00,0X00,0X00,0XDF,0X0D,0X73,0X74,0X65,0X70,0X5F,0X6E,0X75,0X6D,0X3A,0X3A,0X00,0X00,0X00,0X04,0X00,0X00,0X00,0X00,0XE0,0X0D,0X73,0X74,0X65,0X70,
  217. 0x5F,0X6E,0X75,0X6D,0X3A,0X3B,0X00,0X00,0X00,0X04,0X00,0X00,0X00,0X00,0XE1,0X0D,0X73,0X74,0X65,0X70,0X5F,0X6E,0X75,0X6D,0X3A,0X3C,0X00,0X00,0X00,0X04,0X00,0X00,
  218. 0x00,0X00,0XE2,0X0D,0X73,0X74,0X65,0X70,0X5F,0X6E,0X75,0X6D,0X3A,0X3D,0X00,0X00,0X00,0X04,0X00,0X00,0X00,0X00,0XE3,0X0D,0X73,0X74,0X65,0X70,0X5F,0X6E,0X75,0X6D,
  219. 0x3A,0X3E,0X00,0X00,0X00,0X04,0X00,0X00,0X00,0X00,0XE4,0X0D,0X73,0X74,0X65,0X70,0X5F,0X6E,0X75,0X6D,0X3A,0X3F,0X00,0X00,0X00,0X04,0X00,0X00,0X00,0X00,0XE5,0X0D,
  220. 0x73,0X74,0X65,0X70,0X5F,0X6E,0X75,0X6D,0X3A,0X40,0X00,0X00,0X00,0X04,0X00,0X00,0X00,0X00,0XE6,0X0D,0X73,0X74,0X65,0X70,0X5F,0X6E,0X75,0X6D,0X3A,0X41,0X00,0X00,
  221. 0x00,0X04,0X00,0X00,0X00,0X00,0XE7,0X0D,0X73,0X74,0X65,0X70,0X5F,0X6E,0X75,0X6D,0X3A,0X42,0X00,0X00,0X00,0X04,0X00,0X00,0X00,0X00,0XE8,0X0D,0X73,0X74,0X65,0X70,
  222. 0x5F,0X6E,0X75,0X6D,0X3A,0X43,0X00,0X00,0X00,0X04,0X00,0X00,0X07,0X00,0XE9,0X0D,0X73,0X74,0X65,0X70,0X5F,0X6E,0X75,0X6D,0X3A,0X44,0X00,0X00,0X00,0X04,0X00,0X00,
  223. };
  224. const uint8_t stepdata[] ={0x00,0X00,0X24,0XD5,0X00,0X00,0X0C,0XB7,0X00,0X00,0X0C,0XB7,0X00,0X00,0X0C,0XB7,0X00,0X00,0X0C,0XB7,0X00,0X00,0X0C,0XB7,0X00,0X00,0X0C,0XB7,0X00,0X00,0X0C,0XB7,
  225. 0x00,0X00,0X0C,0XB7,0X00,0X00,0X0C,0XB7,0X00,0X00,0X0C,0XB7,0X00,0X00,0X0C,0XB7,0X00,0X00,0X0C,0XB7,0X00,0X00,0X0C,0XB7,0X00,0X00,0X0C,0XB7,0X00,0X00,0X0C,0XB7,
  226. 0x00,0X00,0X0C,0XB7,0X00,0X00,0X0C,0XB7,0X00,0X00,0X0C,0XB7,0X00,0X00,0X0C,0XB7,0X00,0X00,0X0C,0XB7,0X00,0X00,0X0C,0XB7,0X00,0X00,0X0C,0XB7,0X00,0X00,0X0C,0XB7,
  227. 0x00,0X00,0X0C,0XB7,0X00,0X00,0X0C,0XB7,0X00,0X00,0X0C,0XB7,0X00,0X00,0X0C,0XB7,0X00,0X00,0X0C,0XB7,0X00,0X00,0X0C,0XB7,0X00,0X00,0X0C,0XB7,0X00,0X00,0X0C,0XB7,
  228. 0x00,0X00,0X0C,0XB7,0X00,0X00,0X0C,0XB7,0X00,0X00,0X0C,0XB7,0X00,0X00,0X0C,0XB7,0X00,0X00,0X0C,0XB7,0X00,0X00,0X0C,0XB7,0X00,0X00,0X0C,0XB7,0X00,0X00,0X0C,0XB7,
  229. 0x00,0X00,0X0C,0XB7,0X00,0X00,0X0C,0XB7,0X00,0X00,0X0C,0XB7,0X00,0X00,0X0C,0XB7,0X00,0X00,0X0C,0XB7,0X00,0X00,0X0C,0XB7,0X00,0X00,0X0C,0XB7,0X00,0X00,0X0C,0XB7,
  230. 0x00,0X00,0X0C,0XB7,0X00,0X00,0X0C,0XB7,0X00,0X00,0X0C,0XB7,0X00,0X00,0X0C,0XB7,0X00,0X00,0X0C,0XB7,0X00,0X00,0X0C,0XB7,0X00,0X00,0X0C,0XB7,0X00,0X00,0X0C,0XB7,
  231. 0x00,0X00,0X0C,0XB7,0X00,0X00,0X0C,0XB7,0X00,0X00,0X0C,0XB7,0X00,0X00,0X0C,0XB7,0X00,0X00,0X0C,0XB7,0X00,0X00,0X0C,0XB7,0X00,0X00,0X0C,0XB7,0X00,0X00,0X0C,0XB7,
  232. 0x00,0X00,0X0C,0XB7,0X00,0X00,0X0C,0XB7,0X00,0X00,0X0C,0XB7,0X00,0X00,0X0C,0XB7,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,};
  233. /****************************************************接口****************************************************/
  234. void Flash_Initialize(void)
  235. {
  236. uint16_t i = 0;
  237. uint8_t length =0;
  238. minfds_init(&information);
  239. //读取文件头
  240. for(i =0;i<MAX_mflash_param_LENGTH;i++){
  241. if(MINIFDS_SUCCESS == pm_get_length(&information,All_Falsh_value[i].name,strlen(All_Falsh_value[i].name),&length)){
  242. if(length == All_Falsh_value[i].length){
  243. pm_find(&information,All_Falsh_value[i].name,strlen(All_Falsh_value[i].name),(uint8_t *)All_Falsh_value[i].value,&length);
  244. }
  245. else{
  246. pm_delete(&information,All_Falsh_value[i].name,strlen(All_Falsh_value[i].name));
  247. pm_add(&information,All_Falsh_value[i].name,strlen(All_Falsh_value[i].name),(uint8_t *)All_Falsh_value[i].value,All_Falsh_value[i].length);
  248. }
  249. }
  250. }
  251. DEBUG_LOG("1111Flash head read(%04X).\n",mFlash.head);
  252. if(mFlash.head !=FLASH_HEAD){ DEBUG_LOG("Flash first init(%04X),write infomation to flash.\n",mFlash.head);
  253. Flash_DeleteAllInfor();
  254. Flash_DeleteAllStep();
  255. memset((uint8_t*)(&mFlash),0,sizeof(Flash_t));
  256. uint32_t flash_data;
  257. // for(i =0;i< sizeof(oldflashdata)/4;i++){
  258. // flash_data = ((oldflashdata[i*4+3]<<24 & 0xff000000) | (oldflashdata[i*4+2]<<16 & 0x00ff0000) | (oldflashdata[i*4+1]<<8 & 0x0000ff00) | (oldflashdata[i*4] & 0x000000ff));
  259. // uint32_t err_code = sdflash_write((uint32_t*)(FLASH_START_ADDR_INFOR+i*4), &flash_data, 1);
  260. // DEBUG_LOG("sdflash_write is %d,%d,flash_data:%d\n",err_code,sizeof(oldflashdata)/4,flash_data);
  261. // }
  262. //
  263. // for(i =0;i< sizeof(stepdata)/4;i++){
  264. // flash_data = ((stepdata[i*4+3]<<24 & 0xff000000) | (stepdata[i*4+2]<<16 & 0x00ff0000) | (stepdata[i*4+1]<<8 & 0x0000ff00) | (stepdata[i*4] & 0x000000ff));
  265. // uint32_t err_code = sdflash_write((uint32_t*)(FLASH_END_ADDR_INFOR+i*4), &flash_data, 1);
  266. //// DEBUG_LOG("sdflash_write is %d,%d,flash_data:%d\n",err_code,sizeof(oldflashdata)/4,flash_data);
  267. // }
  268. mFlash.head = FLASH_HEAD;
  269. mFlash.isHost = _IS_HOST;
  270. for(i =0;i<MAX_mflash_param_LENGTH;i++){
  271. pm_add(&information,All_Falsh_value[i].name,strlen(All_Falsh_value[i].name),(uint8_t *)All_Falsh_value[i].value,All_Falsh_value[i].length);
  272. }
  273. mFlash.head =0;
  274. for(i =0;i<MAX_mflash_param_LENGTH;i++){
  275. if(MINIFDS_SUCCESS == pm_get_length(&information,All_Falsh_value[i].name,strlen(All_Falsh_value[i].name),&length)){
  276. if(length == All_Falsh_value[i].length)
  277. {
  278. pm_find(&information,All_Falsh_value[i].name,strlen(All_Falsh_value[i].name),(uint8_t *)All_Falsh_value[i].value,&length);
  279. }
  280. }
  281. }
  282. //
  283. DEBUG_LOG("Flash head second read(%04X).\n",mFlash.head);
  284. if(mFlash.head != FLASH_HEAD){
  285. DEBUG_LOG("Flash write head fail.\n");
  286. Except_TxError(EXCEPT_FLASH,"Flash write head fail");
  287. return;
  288. }
  289. DEBUG_LOG("System reset...\n",mFlash.head);
  290. for(uint8_t i =0;i<6;i++){
  291. nrf_delay_ms(500);
  292. feed_watchdog();
  293. }
  294. NVIC_SystemReset();
  295. }
  296. DEBUG_LOG("err code :%s\n",mFlash.mFlashLog.logData);
  297. DEBUG_LOG("Flash init ok.\n");
  298. //TestHalFlashInterface();
  299. }
  300. /**
  301. @brief 设置清空flash的标志
  302. @param 无
  303. @return 无
  304. */
  305. static uint8_t FlashStep_ClearFlag =0;
  306. void flash_SetClearStepFlag(void){
  307. FlashStep_ClearFlag =1;
  308. }
  309. uint32_t flash_GetStep_StartAddress(void){
  310. return FLASH_START_ADDR_STEP;
  311. }
  312. /**
  313. @brief 存储步数
  314. @param 无
  315. @return 错误代码
  316. */
  317. uint32_t Flash_SaveStep(void)
  318. {
  319. flash_OPER_Result err_code;
  320. uint32_t flash_data;
  321. #define Max_Hour PAGE_INT_SIZE * FLASH_ADDR_STEP_PAGENUM
  322. if(mFlash.mStep.step_num < Max_Hour)
  323. {
  324. // mFlash.mStep.stepCur[0] +=1 ;
  325. uint32_t step = app_step_GetStep_L() + app_step_GetStep_R(); //获取左右鞋步数
  326. flash_data = ((step<<24 & 0xff000000) | (step<<8 & 0x00ff0000) | (step>>8 & 0x0000ff00) | (step>>24 & 0x000000ff));
  327. //清空步数的flash step内容
  328. if(1 == FlashStep_ClearFlag){
  329. if(Flash_DeleteAllStep() != ZONE_OP_SUCCESS){
  330. Except_TxError(EXCEPT_DATEStep,"clear step fail");
  331. return ZONE_ERROR_WRITE_FAIL;
  332. }
  333. mFlash.mStep.step_num = 0;
  334. FlashStep_ClearFlag = 0;
  335. }
  336. DEBUG_LOG("step %d,flash_data:%d,step_num:%d\n",step, flash_data,mFlash.mStep.step_num);
  337. err_code = sdflash_write((uint32_t*)(FLASH_START_ADDR_STEP + (mFlash.mStep.step_num * 4)), &flash_data, 1);
  338. if(err_code != FLASH_OP_SUCCESS)return ZONE_ERROR_WRITE_FAIL;
  339. mFlash.mStep.step_num++;
  340. mFlash.mStep.step[0] = mFlash.mStep.stepCur[0];
  341. mFlash.mStep.step[1] = mFlash.mStep.stepCur[1];
  342. if(Flash_SaveInfomation() != ZONE_OP_SUCCESS){
  343. Except_TxError(EXCEPT_FLASH,"save information fail");
  344. }
  345. uint8_t i=4;
  346. uint8_t length =0;
  347. for(;i<5;i++){
  348. if(MINIFDS_SUCCESS == pm_get_length(&information,All_Falsh_value[i].name,strlen(All_Falsh_value[i].name),&length)){
  349. if(length == All_Falsh_value[i].length){
  350. if(MINIFDS_SUCCESS == pm_find(&information,All_Falsh_value[i].name,strlen(All_Falsh_value[i].name),(uint8_t *)All_Falsh_value[i].value,&length))
  351. {
  352. DEBUG_LOG(">>>>>>>>%s value:%d\n",All_Falsh_value[i].name,mFlash.mStep.stepCur[0]);
  353. }
  354. }
  355. }
  356. }
  357. }
  358. else return ZONE_ERROR_WRITE_FAIL;
  359. return ZONE_OP_SUCCESS;
  360. }
  361. /**
  362. @brief 删除所有步数
  363. @param 无
  364. @return 错误代码
  365. */
  366. uint32_t Flash_DeleteAllStep(void)
  367. {
  368. uint32_t errcode = ZONE_OP_SUCCESS;
  369. uint32_t pag_addr = 0;
  370. for(uint8_t i=0;i<FLASH_ADDR_STEP_PAGENUM;i++){
  371. pag_addr = (FLASH_START_ADDR_STEP +i*FLASH_PAGE_SIZE);
  372. errcode = sdflash_page_erase(pag_addr);
  373. if(errcode != NRF_SUCCESS)
  374. return ZONE_ERROR_ERASE_FAIL;
  375. }
  376. return ZONE_OP_SUCCESS;
  377. }
  378. /**
  379. @brief 删除infromation的数据
  380. @param 无
  381. @return 错误代码
  382. */
  383. uint32_t Flash_DeleteAllInfor(void)
  384. {
  385. uint32_t errcode = ZONE_OP_SUCCESS;
  386. uint32_t pag_addr = 0;
  387. for(uint8_t i=0;i<FLASH_ADDR_INFOR_PAGENUM;i++){
  388. pag_addr = (FLASH_START_ADDR_INFOR +i*FLASH_PAGE_SIZE);
  389. errcode = sdflash_page_erase(pag_addr);
  390. if(errcode != NRF_SUCCESS)
  391. return ZONE_ERROR_ERASE_FAIL;
  392. }
  393. return ZONE_OP_SUCCESS;
  394. }
  395. /**
  396. @brief 读取一个区域中指定位置的数据
  397. @param destination_addr[in] - 读取区域的地址
  398. @param pData[in] - 指向存储的buff
  399. @param dataLen[in] - 读取的长度,单位字节
  400. @return 错误代码
  401. */
  402. uint32_t flash_Data_Read(uint32_t addr, uint32_t *pData, uint32_t dataLen){
  403. if(pData != NULL && dataLen != 0){
  404. if(addr < START_FSTORAGE_ADDR || addr >= END_FSTORAGE_ADDR){
  405. return ZONE_ERROR_ADDRESS_FAIL;
  406. }
  407. else
  408. memcpy(pData, (uint32_t*)addr, dataLen);
  409. }
  410. return ZONE_OP_SUCCESS;
  411. }
  412. /**
  413. @brief 存储基本信息
  414. @param 无
  415. @return 错误代码
  416. */
  417. uint32_t Flash_SaveInfomation(void)
  418. {
  419. char result =0;
  420. for(uint8_t i =0;i<MAX_mflash_param_LENGTH;i++){
  421. result = pm_update(&information,All_Falsh_value[i].name,strlen(All_Falsh_value[i].name),(uint8_t *)All_Falsh_value[i].value,All_Falsh_value[i].length);
  422. if(result != MINIFDS_SUCCESS){
  423. DEBUG_LOG("Flash_SaveInfomation fail name %s,result %d\r\n",All_Falsh_value[i].name,result);
  424. return ZONE_ERROR_WRITE_FAIL;
  425. }
  426. }
  427. return ZONE_OP_SUCCESS;
  428. }
  429. /**
  430. @brief 保存日志信息
  431. @param[in] id Fault identifier. See @ref NRF_FAULT_IDS.
  432. @param[in] pc The program counter of the instruction that triggered the fault, or 0 if
  433. unavailable.
  434. @param[in] info Optional additional information regarding the fault. The value of the @p id
  435. parameter dictates how to interpret this parameter. Refer to the documentation
  436. for each fault identifier (@ref NRF_FAULT_IDS and @ref APP_ERROR_FAULT_IDS) for
  437. details about interpreting @p info.
  438. @return 错误代码
  439. */
  440. uint32_t Flash_SaveLog(uint32_t id, uint32_t pc, uint32_t info)
  441. {
  442. memset((uint8_t*)(&mFlash.mFlashLog),0,sizeof(FlashLog));
  443. mFlash.mFlashLog.Errorflag =1;
  444. switch (id)
  445. {
  446. #if defined(SOFTDEVICE_PRESENT) && SOFTDEVICE_PRESENT
  447. case NRF_FAULT_ID_SD_ASSERT:
  448. memcpy(mFlash.mFlashLog.logData,"SD: ASSERTION FAILED\r\n",MaxLength(sizeof("SD: ASSERTION FAILED\r\n"),sizeof(mFlash.mFlashLog.logData)));
  449. break;
  450. case NRF_FAULT_ID_APP_MEMACC:
  451. memcpy(mFlash.mFlashLog.logData,"SD: INVALID MEMORY ACCESS\r\n",MaxLength(sizeof("SD: INVALID MEMORY ACCESS\r\n"),sizeof(mFlash.mFlashLog.logData)));
  452. break;
  453. #endif
  454. case NRF_FAULT_ID_SDK_ASSERT:
  455. {
  456. assert_info_t * p_info = (assert_info_t *)info;
  457. sprintf((char *)mFlash.mFlashLog.logData,"ASSERTION FAILED %s:%u\r\n",
  458. p_info->p_file_name,
  459. p_info->line_num);
  460. break;
  461. }
  462. case NRF_FAULT_ID_SDK_ERROR:
  463. {
  464. error_info_t * p_info = (error_info_t *)info;
  465. sprintf((char *)mFlash.mFlashLog.logData,"error:%u,%s:%u\r\n",
  466. p_info->err_code,
  467. p_info->p_file_name,
  468. p_info->line_num);
  469. DEBUG_LOG(">>>>>err code :%d,%s",p_info->err_code,mFlash.mFlashLog.logData);
  470. break;
  471. }
  472. default:
  473. sprintf((char *)mFlash.mFlashLog.logData,"UNKNOWN FAULT 0x%08X\n", pc);
  474. break;
  475. }
  476. return Flash_SaveInfomation();
  477. }
  478. /**
  479. @brief 测试halflash接口
  480. @param 无
  481. @return 无
  482. */
  483. void TestHalFlashInterface(void)
  484. {
  485. // uint2_t i;
  486. // Flash_t m_testflash;
  487. // FlashBackup_t m_testbackup;
  488. // //测试基本信息和备份信息的写入和读取
  489. // for(i=0;i<10000;i++)
  490. // {
  491. // mFlash.mStep.step_num = i;
  492. // DEBUG_LOG("Flash_SaveInfomation[%d]:%d \n",i,Flash_SaveInfomation());
  493. //
  494. // DEBUG_LOG("Flash_SaveBackup[%d]:%d \n",i,Flash_SaveBackup());
  495. // }
  496. //
  497. // DEBUG_LOG("Flash_GetInfomation[%d]:%d \n",i,Flash_GetInfomation(&m_testflash));
  498. // DEBUG_LOG("m_testflash:%d \n",m_testflash.mStep.num);
  499. //
  500. // DEBUG_LOG("Flash_GetBackup[%d]:%d \n",i,Flash_GetBackup(&m_testbackup));
  501. // DEBUG_LOG("m_testbackup:%d \n",m_testbackup.hardVersion);
  502. }