NetBurner 3.5.6
PDF Version
monitor_boot.h
1/*NB_REVISION*/
2
3/*NB_COPYRIGHT*/
4
5#include <basictypes.h>
6#include <nettypes.h>
7#ifdef RT10XX_RAM
8typedef uint32_t XXH32_hash_t;
9#else
10#include <xxhash.h>
11#endif
12
13struct MonCmd_t {
14 uint32_t cmdLen;
15 uint32_t xCmdLen;
16 XXH32_hash_t cmdHash;
17 XXH32_hash_t hdrHash;
18 char cmd[];
19};
20
21struct BootLoopProt_t {
22 uint32_t loopCount;
23 uint32_t xLoopCount;
24 union {
25 uint32_t imgID_raw;
26 int32_t imgID;
27 };
28 uint32_t csum;
29};
30
31enum {
32 BootLoopProt_Off = 0x0,
33 BootLoopProt_AltMon = 0x1,
34 BootLoopProt_Fallback_Fixed = 0x2,
35 BootLoopProt_Fallback_Next = 0x3
36};
37
38struct BootCfg_t {
39 union {
40 struct {
41 uint32_t LoopTime : 5;
42 uint32_t HiccupTime : 5;
43 uint32_t ProtMode : 2;
44 uint32_t LoopSkipCfg: 1;
45 uint32_t LoopCount : 3;
46 uint32_t FuseImgID : 4;
47 uint32_t FallbackID : 4;
48 uint32_t EnBootSel : 1;
49 uint32_t OvrSerCfg : 4;
50 uint32_t DisableEth1: 1;
51 uint32_t AltEth1RMII: 1;
52 uint32_t AltEth1MDIO: 1;
53 };
54 uint32_t _fuseVal;
55 };
56 union {
57 struct {
58 bool bFAST : 1;
59 bool bNATIVE : 1;
60 bool bALT : 1;
61 bool bOverrideJumper : 1;
62 bool bLoopCountValid : 1;
63 bool bMonCmdValid : 1;
64 bool bAppHdrFail : 1;
65 bool bLoopEncountered: 1;
66 };
67 uint8_t cmdFlags;
68 };
69 bool bSkipCfgRead;
70 int32_t imgID;
71};
72
73struct BootInfo_t {
74 uint32_t cmdLen;
75 uint32_t xCmdLen;
76 XXH32_hash_t cmdHash;
77 XXH32_hash_t hdrHash;
78 BootCfg_t BootCfg;
79 MACADDRESS_48 mac0;
80 MACADDRESS_48 mac1;
81 char Msg[];
82};
83
84union BootMonMsg_t {
85 BootInfo_t up;
86 MonCmd_t down;
87};
88
89void HalWriteMonCmd(int cmdLen, const uint8_t *cmdBuf);
90void HalClearBootLoopCounter();
91
92#define Pin_BootOverride Fast_AD_B1_09
93
94extern BootLoopProt_t __BOOT_LOOP_PROT;
95extern BootMonMsg_t __BOOT_MON_CMD;
96