inertialSenseBootLoader.h
Go to the documentation of this file.
1 /*
2 MIT LICENSE
3 
4 Copyright (c) 2014-2021 Inertial Sense, Inc. - http://inertialsense.com
5 
6 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files(the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions :
7 
8 The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
9 
10 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
11 */
12 
13 #ifndef __INERTIALSENSEBOOTLOADER_H
14 #define __INERTIALSENSEBOOTLOADER_H
15 
16 #ifdef __cplusplus
17 extern "C" {
18 #endif
19 
20 #include "serialPort.h"
21 
23 #define IS_BAUD_RATE_BOOTLOADER 921600
24 
26 #define IS_BAUD_RATE_BOOTLOADER_RS232 230400
27 
29 #define IS_BAUD_RATE_BOOTLOADER_SLOW 115200
30 
32 #define IS_BAUD_RATE_BOOTLOADER_LEGACY 2000000
33 
34 #define ENABLE_BOOTLOADER_BAUD_DETECTION 1
35 #define BOOTLOADER_REFRESH_DELAY 500
36 #define BOOTLOADER_RESPONSE_DELAY 10
37 #if ENABLE_BOOTLOADER_BAUD_DETECTION
38 #define BOOTLOADER_RETRIES 30
39 #else
40 #define BOOTLOADER_RETRIES 1
41 #endif
42 
43 #ifndef BOOTLOADER_ERROR_LENGTH
44 #define BOOTLOADER_ERROR_LENGTH 512 // Set to zero to disable
45 #endif
46 
48 typedef int(*pfnBootloadProgress)(const void* obj, float percent);
49 
51 typedef void(*pfnBootloadStatus)(const void* obj, const char* infoString);
52 
53 typedef struct
54 {
55  const char* fileName; // read from this file
56  const char* bootName; // optional bootloader file
58  serial_port_t* port; // connect with this serial port
60  const void* obj; // user defined pointer
61  pfnBootloadProgress uploadProgress; // upload progress
62  pfnBootloadProgress verifyProgress; // verify progress
63  pfnBootloadStatus statusText; // receives status text for progress
64  const char* verifyFileName; // optional, writes verify file to the path if not 0
65  int numberOfDevices; // number of devices if bootloading in parallel
66  int baudRate; // baud rate to connect to
67  union
68  {
69  unsigned int bits;
70  struct
71  {
72  unsigned int enableVerify : 1; // whether to enable the verify phase
73  } bitFields;
74  } flags;
75  char bootloadEnableCmd[16];
76 
78 
91 int bootloadFile(serial_port_t* port, const char* fileName, const char* bootName,
92  const void* obj, pfnBootloadProgress uploadProgress, pfnBootloadProgress verifyProgress);
94 
106 int bootloadUpdateBootloader(serial_port_t* port, const char* fileName,
107  const void* obj, pfnBootloadProgress uploadProgress, pfnBootloadProgress verifyProgress);
109 
119 int bootloadGetBootloaderVersionFromFile(const char* bootName, int* verMajor, char* verMinor);
120 
131 int enableBootloader(serial_port_t* port, int baudRate, char* error, int errorLength, const char* bootloadEnableCmd);
132 
142 int disableBootloader(serial_port_t* port, char* error, int errorLength);
143 
144 
145 int bootloaderCycleBaudRate(int baudRate);
146 int bootloaderClosestBaudRate(int baudRate);
147 
148 
149 #ifdef __cplusplus
150 }
151 #endif
152 
153 #endif // __INERTIALSENSEBOOTLOADER_H
int bootloaderClosestBaudRate(int baudRate)
int bootloadUpdateBootloader(serial_port_t *port, const char *fileName, const void *obj, pfnBootloadProgress uploadProgress, pfnBootloadProgress verifyProgress)
int bootloaderCycleBaudRate(int baudRate)
pfnBootloadProgress uploadProgress
int bootloadGetBootloaderVersionFromFile(const char *bootName, int *verMajor, char *verMinor)
int bootloadUpdateBootloaderEx(bootload_params_t *p)
pfnBootloadStatus statusText
int enableBootloader(serial_port_t *port, int baudRate, char *error, int errorLength, const char *bootloadEnableCmd)
int(* pfnBootloadProgress)(const void *obj, float percent)
int bootloadFileEx(bootload_params_t *params)
int disableBootloader(serial_port_t *port, char *error, int errorLength)
void(* pfnBootloadStatus)(const void *obj, const char *infoString)
int bootloadFile(serial_port_t *port, const char *fileName, const char *bootName, const void *obj, pfnBootloadProgress uploadProgress, pfnBootloadProgress verifyProgress)
pfnBootloadProgress verifyProgress
#define BOOTLOADER_ERROR_LENGTH


inertial_sense_ros
Author(s):
autogenerated on Sun Feb 28 2021 03:17:57