Example for updating the MTi-1's firmware. Uses a platform independent, retargetable pure C implementation of the firmware updater protocol.

Dependencies:   mbed-rtos mbed

Embed: (wiki syntax)

« Back to documentation index

fwupdate.c File Reference

fwupdate.c File Reference

Go to the source code of this file.

Functions

const char * commandToString (uint8_t command)
 Helper function for converting a firmware updater command to a string.
const char * ackToString (uint8_t command)
 Helper function for converting a firmware updater command acknowledge to a string.
uint32_t readUint32 (FwUpdate *thisPtr)
 Read a uint32_t from the current position in the xff.
uint16_t readUint16 (FwUpdate *thisPtr)
 Read a uint16_t from the current position in the xff.
uint8_t readUint8 (FwUpdate *thisPtr)
 Read a uint8_t from the current position in the xff.
static void readXffHeader (FwUpdate *thisPtr)
 Read an Xff header from the current position in the xff.
static void sendFirmwareUpdateCommand (FwUpdate *thisPtr, uint8_t *data, uint16_t length)
 Send an XMID_FIRMWARE_UPDATE xbus message.
static void sendReady (FwUpdate *thisPtr)
 Send a FWUP_READY command.
static void sendHeader (FwUpdate *thisPtr)
 Send a FWUP_HEADER command.
static void sendSlice (FwUpdate *thisPtr)
 Send a page slice.
static void sendOther (FwUpdate *thisPtr)
 Send a FWUP_OTHER command.
static void sendFinished (FwUpdate *thisPtr)
 Send a FWUP_FINISHED command.
static void enterNewSection (FwUpdate *thisPtr)
 Enter the next section of the xff file.
void FwUpdate_init (FwUpdate *thisPtr)
 Initialize a FwUpdate instance.
void FwUpdate_start (FwUpdate *thisPtr)
 Start a firmware update.
void FwUpdate_handleXbus (FwUpdate *thisPtr, struct XbusMessage *xbusMessage)
 Handle xbus message coming from the module.

Detailed Description

Copyright (C) Xsens Technologies B.V., 2015.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Definition in file fwupdate.c.


Function Documentation

const char* ackToString ( uint8_t  command )

Helper function for converting a firmware updater command acknowledge to a string.

Definition at line 64 of file fwupdate.c.

const char* commandToString ( uint8_t  command )

Helper function for converting a firmware updater command to a string.

Definition at line 46 of file fwupdate.c.

static void enterNewSection ( FwUpdate thisPtr ) [static]

Enter the next section of the xff file.

Definition at line 253 of file fwupdate.c.

void FwUpdate_handleXbus ( FwUpdate thisPtr,
struct XbusMessage xbusMessage 
)

Handle xbus message coming from the module.

Parameters:
xbusMessageThe xbus message from the module to be handled

Definition at line 300 of file fwupdate.c.

void FwUpdate_init ( FwUpdate thisPtr )

Initialize a FwUpdate instance.

Definition at line 270 of file fwupdate.c.

void FwUpdate_start ( FwUpdate thisPtr )

Start a firmware update.

Definition at line 279 of file fwupdate.c.

uint16_t readUint16 ( FwUpdate thisPtr )

Read a uint16_t from the current position in the xff.

Definition at line 104 of file fwupdate.c.

uint32_t readUint32 ( FwUpdate thisPtr )

Read a uint32_t from the current position in the xff.

Definition at line 83 of file fwupdate.c.

uint8_t readUint8 ( FwUpdate thisPtr )

Read a uint8_t from the current position in the xff.

Definition at line 125 of file fwupdate.c.

static void readXffHeader ( FwUpdate thisPtr ) [static]

Read an Xff header from the current position in the xff.

Definition at line 146 of file fwupdate.c.

static void sendFinished ( FwUpdate thisPtr ) [static]

Send a FWUP_FINISHED command.

Definition at line 243 of file fwupdate.c.

static void sendFirmwareUpdateCommand ( FwUpdate thisPtr,
uint8_t *  data,
uint16_t  length 
) [static]

Send an XMID_FIRMWARE_UPDATE xbus message.

Parameters:
dataPointer to the xbus message payload data
lengthNumber of payload bytes

Definition at line 172 of file fwupdate.c.

static void sendHeader ( FwUpdate thisPtr ) [static]

Send a FWUP_HEADER command.

Definition at line 193 of file fwupdate.c.

static void sendOther ( FwUpdate thisPtr ) [static]

Send a FWUP_OTHER command.

Definition at line 232 of file fwupdate.c.

static void sendReady ( FwUpdate thisPtr ) [static]

Send a FWUP_READY command.

Definition at line 184 of file fwupdate.c.

static void sendSlice ( FwUpdate thisPtr ) [static]

Send a page slice.

Definition at line 213 of file fwupdate.c.