Go to the documentation of this file.
73 #define XMID_FIRMWARE_UPDATE (0xF2)
75 #define FWUP_DEFAULT_SLICE_SIZE (64)
80 #define FWUP_READY (unsigned char)0x52 //'R'
81 #define FWUP_OK (unsigned char)0x53 //'S'
82 #define FWUP_CSERROR (unsigned char)0x45 //'E'
83 #define FWUP_CRITICAL (unsigned char)0x46 //'F'
84 #define FWUP_FINISHED (unsigned char)0x46 //'F'
85 #define FWUP_PAGE (unsigned char)0x50 //'P'
86 #define FWUP_HEADER (unsigned char)0x53 //'S'
87 #define FWUP_PAGESLICE (unsigned char)0x54 //'T'
88 #define FWUP_STARTED (unsigned char)0x41 //'A'
89 #define FWUP_OTHER (unsigned char)0x4F //'O'
99 return (
"FWUP_READY");
101 return (
"FWUP_HEADER");
103 return (
"FWUP_FINISHED");
105 return (
"FWUP_PAGE");
107 return (
"FWUP_PAGESLICE");
109 return (
"FWUP_STARTED");
111 return (
"FWUP_OTHER");
129 return "FWUP_CSERROR";
131 return "FWUP_CRITICAL";
135 return "FWUP_PAGESLICE";
137 return "FWUP_STARTED";
174 result = (
uint32_t)buffer[0] << 8 | buffer[1];
180 return (uint16_t)result;
207 LOG(
"Fwu: readXffHeader()\n");
210 if (globalIdTemp != 0)
247 for (
int n = 0; n < 20; n++)
317 LOG(
"Fwu: Send FWUP_OTHER\n");
330 LOG(
"Fwu: Send FWUP_FINISHED\n");
340 LOG(
"\nFwu: enterNewSection()\n");
354 LOG(
"Fwu: init()\n");
365 LOG(
"Fwu: start() --> Send FWUP_READY\n");
374 LOG(
"Fwu: start() failed\n");
406 LOG(
"Fwu: FWUP_READY in STATE_Start --> Enter new section\n");
419 LOG(
"Fwu: FWUP_READY in STATE_WaitReady --> Send header\n");
425 LOG(
"Fwu: Got %s in STATE_WaitReady --> Failed\n",
ackToString(ack));
436 LOG(
"Fwu: FWUP_READY in STATE_WaitHeaderResult --> Send first slice\n");
443 LOG(
"Fwu: Got %s in STATE_WaitHeaderResult --> Failed\n",
ackToString(ack));
456 LOG(
"Fwu: FWUP_READY in STATE_WaitSliceReady --> Send slice %d\n", thisPtr->
m_sliceCounter);
462 LOG(
"Fwu: All slices sent --> STATE_WaitPageOk\n");
468 LOG(
"Fwu: Got %s in STATE_WaitSliceReady --> Failed\n",
ackToString(ack));
479 LOG(
"Fwu: FWUP_OK in STATE_WaitPageOk --> STATE_WaitPageReady\n");
484 LOG(
"Fwu: Got %s in STATE_WaitPageOk --> Failed\n",
ackToString(ack));
498 LOG(
"Fwu: All pages sent --> Enter new section\n");
507 LOG(
"Fwu: End of file --> Firmware update done\n");
514 LOG(
"Fwu: FWUP_READY in STATE_WaitPageReady --> Send header\n");
521 LOG(
"Fwu: Got %s in STATE_WaitPageReady --> Failed\n",
ackToString(ack));
void FwUpdate_start(FwUpdate *thisPtr)
Start a firmware update.
uint32_t m_nofSlicesPerPage
void(* m_readyHandler)(FWU_Result result)
Callback function by which FwUpdate notifies the host that a firmware update has finished.
uint16_t readUint16(FwUpdate *thisPtr)
Read a uint16_t from the current position in the xff.
ROSLIB_DECL std::string command(const std::string &cmd)
uint32_t(* m_readXffData)(uint8_t *buffer, uint32_t offset, uint32_t length)
Callback function by which FwUpdate requests for xff data.
static void enterNewSection(FwUpdate *thisPtr)
Enter the next section of the xff file.
FwUpdate object definition.
static void readXffHeader(FwUpdate *thisPtr)
Read an Xff header from the current position in the xff.
void FwUpdate_init(FwUpdate *thisPtr)
Initialize a FwUpdate instance.
const char * commandToString(uint8_t command)
Helper function for converting a firmware updater command to a string.
#define FWUP_DEFAULT_SLICE_SIZE
static void sendSlice(FwUpdate *thisPtr)
Send a page slice.
void Xbus_insertChecksum(uint8_t *xbusMessage)
Inserts the correct checksum in xbus message.
void(* m_sendXbusMessage)(uint8_t const *xbusMessage)
Callback function via which FwUpdate can send xbus messages to the module.
uint8_t const * Xbus_getConstPointerToPayload(uint8_t const *xbusMessage)
Returns a const pointer to payload of an xbus message.
#define FWUP_READY
Firmware updater commands.
static void sendReady(FwUpdate *thisPtr)
Send a FWUP_READY command.
static void sendOther(FwUpdate *thisPtr)
Send a FWUP_OTHER command.
#define XMID_FIRMWARE_UPDATE
uint8_t * m_txBuffer
Memory needed by the FwUpdate. Host must allocate a block of memory of size FWU_REQUIRED_TXBUFFER_SIZ...
void Xbus_message(uint8_t *xbusMessage, uint8_t bid, uint8_t mid, uint16_t len)
Initialize a xbus message with BID, MID and Length.
static void sendHeader(FwUpdate *thisPtr)
Send a FWUP_HEADER command.
uint32_t readUint32(FwUpdate *thisPtr)
Read a uint32_t from the current position in the xff.
uint8_t readUint8(FwUpdate *thisPtr)
Read a uint8_t from the current position in the xff.
const char * ackToString(uint8_t command)
Helper function for converting a firmware updater command acknowledge to a string.
uint8_t * Xbus_getPointerToPayload(uint8_t *xbusMessage)
Returns pointer to payload of an xbus message.
static void sendFinished(FwUpdate *thisPtr)
Send a FWUP_FINISHED command.
int Xbus_getMessageId(const uint8_t *xbusMessage)
Returns xbus Message identifier.
void FwUpdate_handleXbus(FwUpdate *thisPtr, uint8_t const *xbusMessage)
Handle xbus message coming from the module.