NetBurner 3.5.8
PDF Version
Toggle main menu visibility
StreamUpdate.h
1
/*NB_REVISION*/
2
3
/*NB_COPYRIGHT*/
4
14
15
/*
16
* The code module also contains functions to read and write the User Parameter
17
* section of onboard flash memory as a stream. They are here for compatibility
18
* with proir tools releases, but the recommended 3.x tools method is to use
19
* the application storage of the Configuration System, since it can be accessed
20
* through the Configuration Server and JSON objects.
21
*/
22
33
34
#ifndef _NB_STREAM_UP_H
35
#define _NB_STREAM_UP_H
36
37
#include <basictypes.h>
38
43
#define STREAM_UP_FAIL (0)
44
#define STREAM_UP_OK (1)
46
59
#ifndef STREAM_UPDATE_TOTAL_TIMEOUT
60
#define STREAM_UPDATE_TOTAL_TIMEOUT (55 * 60 * TICKS_PER_SECOND)
61
#endif
62
#ifndef STREAM_UPDATE_INACTIVITY_TIMEOUT
63
#define STREAM_UPDATE_INACTIVITY_TIMEOUT (20 * TICKS_PER_SECOND)
64
#endif
66
85
int
ReadBinaryApplicationCodeFromStream
(
int
fd);
86
106
int
ReadS19ApplicationCodeFromStream
(
int
fd);
107
108
// Send an application image as to an output stream in s-record S19 format
109
int
SendApplicationCodeAsS19(
int
fd);
110
111
// Exposed to allow custom updates to be used
112
int
ProcessS3(
const
char
*cp, uint32_t base_Addr, puint8_t CopyTo, uint32_t &cur_pos, uint32_t maxlen);
113
114
//=================================== USER FLASH FUNCTIONS =========================================
115
116
/*
117
* Send User Parameter Flash data as a binary output stream to the specified file
118
* descriptor.
119
*
120
* Parameters:
121
* int fd The socket file descriptor to send the data to
122
*
123
* Returns:
124
* STREAM_UP_OK The system was able to send the data
125
* STREAM_UP_FAIL The system failed to send the data
126
*
127
* See Also:
128
* int SendUserFlashToStreamAsS19(int fd);
129
* int ReadBinaryUserFlashFromStream(int fd);
130
* int ReadS19UserFlashFromStream(int fd);
131
*/
132
int
SendUserFlashToStreamAsBinary(
int
fd);
133
134
/*
135
* Send User Parameter Flash data as an ASCII s-record S19 output stream to the
136
* specified file descriptor.
137
*
138
* Parameters:
139
* int fd The socket file descriptor to send the data to
140
*
141
* Returns:
142
* STREAM_UP_OK The system was able to send the data
143
* STREAM_UP_FAIL The system failed to send the data
144
*
145
* See Also:
146
* int SendUserFlashToStreamAsBinary(int fd);
147
* int ReadBinaryUserFlashFromStream(int fd);
148
* int ReadS19UserFlashFromStream(int fd);
149
*/
150
int
SendUserFlashToStreamAsS19(
int
fd);
151
152
/*
153
* Read data from an ASCII s-record S19 input stream and store it in
154
* User Parameter Flash.
155
*
156
* Parameters:
157
* int fd The socket file descriptor to read data from
158
*
159
* Returns:
160
* STREAM_UP_OK The system was able to read the data and update flash
161
* STREAM_UP_FAIL The system failed to read or update
162
*
163
* See Also:
164
* int SendUserFlashToStreamAsS19(int fd);
165
* int SendUserFlashToStreamAsBinary(int fd);
166
* int ReadBinaryUserFlashFromStream(int fd);
167
*/
168
int
ReadS19UserFlashFromStream(
int
fd);
169
170
/*
171
* Read data from an binary input stream and store it in User Parameter Flash.
172
*
173
* Parameters:
174
* int fd The socket file descriptor to read data from
175
*
176
* Returns:
177
* STREAM_UP_OK The system was able to read the data and update flash
178
* STREAM_UP_FAIL The system failed to read or update
179
*
180
* See Also:
181
* int SendUserFlashToStreamAsS19(int fd);
182
* int SendUserFlashToStreamAsBinary(int fd);
183
* int ReadS19UserFlashFromStream(int fd);
184
*/
185
int
ReadBinaryUserFlashFromStream(
int
fd);
186
187
//=================================== UTILITY STRUCURES AND FUNCTIONS =========================================
188
189
// Structure to hold the data from a update before actually programming it in flash
190
struct
TwoPartUpdateStruct
191
{
192
uint8_t S0Record[24];
193
puint8_t pBlob;
194
uint32_t address;
195
uint32_t pgm_size;
196
int
Result;
197
198
TwoPartUpdateStruct()
199
{
200
pBlob = 0;
201
Result =
STREAM_UP_FAIL
;
202
};
203
};
204
205
/*
206
* Populates the structure with an allocated binary buffer to program into flash.
207
* Returns STREAM_UP_OK, and sets structure result to STREAM_UP_OK if successful.
208
*/
209
int
ReadTwoPartAppUdate(
int
fd, TwoPartUpdateStruct &us);
210
211
/*
212
* Take a successfully read stream update and programs the flash memory.
213
* Returns STREAM_UP_FAIL if update fails.
214
* Forces a device reboot on success.
215
* Frees any dynamically allocated memory.
216
*/
217
int
DoTwoPartAppUpdate(TwoPartUpdateStruct &us);
218
219
/*
220
* Called to abort an update and free any dynamically allocated memory
221
*/
222
void
AbortTwoPartAppUpdate(TwoPartUpdateStruct &us);
223
224
#endif
225
ReadBinaryApplicationCodeFromStream
int ReadBinaryApplicationCodeFromStream(int fd)
Read a binary application image from an input stream and program flash memory.
ReadS19ApplicationCodeFromStream
int ReadS19ApplicationCodeFromStream(int fd)
Read an ASCII application image in s-record .s19 format from an input stream and program flash memory...
STREAM_UP_FAIL
#define STREAM_UP_FAIL
Action failed.
Definition
StreamUpdate.h:43
nbrtos
include
StreamUpdate.h
Generated by
1.18.0