63 void resetBackoff() __attribute__((weak));
75 if (addr.
ip == 0 && addr.
port == 0) {
87 if (resetBackoff) resetBackoff();
103 #ifndef SIMULATE_UPDATE
124 #ifndef SIMULATE_UPDATE
140 #ifndef SIMULATE_UPDATE
164 #ifndef SIMULATE_UPDATE
187 if (imgNo >= FLASH_MAX_IMAGES)
return false;
193 void goldenStop() __attribute__((weak));
235 #ifndef SIMULATE_UPDATE
264 char * logLine = NULL;
268 while (logLine != NULL)
287 static char _pLogBuf[128];
295 if (len < 0)
return false;
305 if (strlen(_pLogBuf) > 0)
dbWriteString(&rpl, _pLogBuf, 128);
311 int len = strlen(_pLogBuf);
332 uint8_t msgBuf[1 + FLASH_MAX_IMAGES * 9];
338 for (
int i = 0; i < FLASH_MAX_IMAGES; ++i)
358 if (addr.
ip == 0 && addr.
port == 0) {
363 }
else if (
dbFree(cmd) == 0) {
370 #define CON_TUN_MAX_RX 16
375 char ptp[CON_TUN_MAX_RX];
376 char secLm[CON_TUN_MAX_RX];
386 #define RT_CONFIG_VERSION 1
395 if (ver != RT_CONFIG_VERSION)
bool updVerify(uint32_t imgNo, uint32_t chunkNo, uint8_t *chunk, bool *result)
Verify a chunk.
bool errHas()
Returns whether there is an error pending.
bool updWrite(uint32_t chunkNo, uint8_t *chunk)
Write a update chunk.
Defines the configuration of the LM32 SOC for the CLBv2.
void coreDumpClear()
Clears core dump information.
int rtImage()
Returns the image loaded for runtime.
bool dbReadU8(DataBuffer *buf, uint8_t *byte)
Reads an unsigned byte.
bool updUnlock()
Unlocks the golden image for writing.
uint32_t sysHwDateRev()
Returns the Hardware date revision.
Provides access to the runtime image booting.
bool dbReadString(DataBuffer *buf, char *s, int size)
Reads a string from the stream.
bool _msgPing(MsgId *id, DataBuffer *buf)
Reads an address.
bool updImgInfo(uint32_t imgNo, UpdImgInfo *imgInfo)
Retrieve image information for the specified location.
System start up and management.
bool lhFlashItNext(char *bufPtr, int bufSize)
Get the next element.
static bool dbWriteBool(DataBuffer *buf, bool boolean)
Writes a boolean.
bool dbReadU16(DataBuffer *buf, uint16_t *u)
Reads a unsigned short (16 bits unsigned) integer.
uint16_t port
Port number.
bool dbWriteI8(DataBuffer *buf, int8_t byte)
Writes a byte.
int8_t imgType
Image type.
#define DB_ERR_NONE
Indicates no error.
uint8_t * start
Start Pointer.
bool updEnd(uint32_t *chunkLostList, uint32_t *chunksCount)
Ends the update.
uint32_t lhGetLineById(uint32_t lastId, char **logLinePtr)
Returns the last log-line based on log-line ID.
static bool msgTxCurError(MsgId *id)
Invoke to reply the current global error.
Defines a DataBuffer structure.
#define E_INVARGUMENT
Generic error: invalid argument.
static uint32_t dbFree(DataBuffer *buf)
Returns the number of bytes still free in the buffer.
static uint32_t dbLength(DataBuffer *buf)
Returns the lenght of the current buffer.
Handles MCF packed messages from the higher protocol layer.
void msgSetEvtTarget(SockAddr *sockAddr)
Set the target for all events, or pass NULL to unset.
bool updStart(int imageIdx, uint32_t chunkCount)
Starts an image update.
void conTunSend(char *ptp, char *secLm32)
Send characters to PTP core and second LM32.
Combination of IP address and port.
void sysArmReset(ResetType rTyp, int imgNo)
Resets the CLB.
bool msgTxReply(MsgId *id, DataBuffer *buf)
Invoke to send a reply.
Force, reset at any point, select image, 0 - golden.
DataBuffer reads and writes data into a buffer in the same format as defined in the data Java DataOut...
void updCancel()
Aborts the update.
uint32_t swRev
Software revision.
bool msgTxError(MsgId *id, int errCode, const char *errMsg, const char *name)
Invoke to send an error response.
uint32_t fwRev
Firmware revision.
bool msgRxBufCheck(DataBuffer *buf)
Checks the received buffer, and logs an error if there is something wrong.
This modules provides console tunneling, for both PTP core and 2nd LM32.
bool dbWriteU8(DataBuffer *buf, uint8_t byte)
Writes a unsigned byte.
bool dbReadI8(DataBuffer *buf, int8_t *byte)
Reads an byte.
bool lhFlashItStart(int count)
Start the iteration through the flash entries.
bool dbReadU32(DataBuffer *buf, uint32_t *u)
Reads an 32 bits unsigned integer.
bool conTunInit(SockAddr *addr)
Initializes the console tunnel.
static void conTunDeinit()
Deinitializes the console tunnel.
SockAddr addr
the address of the sender
If defined, events will not require an acknowledge.
bool dbWriteString(DataBuffer *buf, const char *s, int max)
Writes a String as 'sort of' UTF-8 encoding, as defined in the Java DataOuput and DataInput writeUTF ...
uint32_t sysSwDateRev()
Returns the Software date revision.
bool dbReadI32(DataBuffer *buf, int32_t *i)
Reads an 32 bits signed integer.
#define ERROR(CODE,...)
Expands an error code to an error code with a description (if ERROR_W_DESCR is declared).
bool rtSetImage(int imgNo)
Sets the runtime boot image number.
#define UPD_CHUNK_SIZE
chunk size for updates, in bytes
Implements a generic logger facility.
#define DB_STR_OVERHEAD
Overhead for a String.
#define DB_BUF_INIT(PTR, LEN)
Simple buffer initialization.
uint8_t * cur
Current Pointer.
static bool msgTxReplyAck(MsgId *id)
Replies a simple ACK with no content.
static uint8_t sysImageType()
Number identifying the image type.
bool dbWriteU32(DataBuffer *buf, uint32_t u)
Writes an 32 bits unsigned integer.
Facilitates the update process.