Revision 470d0567

View differences:

Target/Demo/ARMCM3_STM32F103_DiWheelDrive_GCC/Boot/lib/STM32F10x_StdPeriph_Driver/stm32f10x_conf.h
38 38
/*#include "stm32f10x_fsmc.h"*/
39 39
#include "stm32f10x_gpio.h" /* needed for configuring the SPI and UART pins */
40 40
/*#include "stm32f10x_i2c.h"*/
41
/*#include "stm32f10x_iwdg.h"*/
41
#include "stm32f10x_iwdg.h"
42 42
#include "stm32f10x_pwr.h"
43 43
#include "stm32f10x_rcc.h" /* needed for enabling the SPI and UART peripherals */
44 44
#include "stm32f10x_rtc.h"
Target/Demo/ARMCM3_STM32F103_DiWheelDrive_GCC/Boot/main.c
23 23
* You should have received a copy of the GNU General Public License along with OpenBLT.
24 24
* If not, see <http://www.gnu.org/licenses/>.
25 25
*
26
* A special exception to the GPL is included to allow you to distribute a combined work 
27
* that includes OpenBLT without being obliged to provide the source code for any 
26
* A special exception to the GPL is included to allow you to distribute a combined work
27
* that includes OpenBLT without being obliged to provide the source code for any
28 28
* proprietary components. The exception text is included at the bottom of the license
29 29
* file <license.html>.
30
* 
30
*
31 31
* \endinternal
32 32
****************************************************************************************/
33 33

  
......
39 39
#include "stm32f10x_conf.h"                      /* STM32 peripheral drivers           */
40 40
#include "timer.h"
41 41
#include "ARMCM3_STM32/types.h"
42
#include "AMiRo/interfaces.h"
42
#include "AMiRo/amiroblt.h"
43 43
#include "AMiRo/helper.h"
44 44

  
45 45

  
......
157 157
void shutdownToHibernate(const blt_bool exec_disambiguation);
158 158
void shutdownAndRestart(const blt_bool exec_disambiguation);
159 159

  
160
volatile BlBackupRegister backup_reg;
160
volatile blBackupRegister_t backup_reg;
161 161

  
162 162
/****************************************************************************************
163 163
* Callback configuration
......
168 168
void blCallbackShutdownRestart(void);
169 169
void blCallbackHandleShutdownRequest(void);
170 170

  
171
const BlCallbackTable cbtable __attribute ((section ("_callback_table"))) = {
171
const blCallbackTable_t cbtable __attribute__ ((section ("_callback_table"))) = {
172 172
  .magicNumber = BL_MAGIC_NUMBER,
173
  .versionMajor = BL_VERSION_MAJOR,
174
  .versionMinor = BL_VERSION_MINOR,
175
  .versionHotfix = 0,
173
  .vBootloader = {BL_VERSION_ID_AMiRoBLT_Release, BL_VERSION_MAJOR, BL_VERSION_MINOR, 0},
174
  .vSSSP = {BL_VERSION_ID_SSSP, SSSP_VERSION_MAJOR, SSSP_VERSION_MINOR, 0},
175
  .vCompiler = {BL_VERSION_ID_GCC, __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__},  // currently only GCC is supported
176 176
  .cbShutdownHibernate = blCallbackShutdownHibernate,
177 177
  .cbShutdownDeepsleep = blCallbackShutdownDeepsleep,
178 178
  .cbShutdownTransportation = blCallbackShutdownTransportation,
......
189 189

  
190 190

  
191 191
/************************************************************************************//**
192
** \brief     This is the entry point for the bootloader application and is called 
192
** \brief     This is the entry point for the bootloader application and is called
193 193
**            by the reset interrupt vector after the C-startup routines executed.
194 194
** \return    Program return code.
195 195
**
......
276 276

  
277 277

  
278 278
/************************************************************************************//**
279
** \brief     Initializes the microcontroller. 
279
** \brief     Initializes the microcontroller.
280 280
** \return    none.
281 281
**
282 282
****************************************************************************************/
......
286 286
  blt_int32u pll_multiplier;
287 287
#if (BOOT_FILE_LOGGING_ENABLE > 0) && (BOOT_COM_UART_ENABLE == 0)
288 288
  GPIO_InitTypeDef  GPIO_InitStruct;
289
  USART_InitTypeDef USART_InitStruct;  
290
#endif  
289
  USART_InitTypeDef USART_InitStruct;
290
#endif
291 291

  
292 292
  /* reset the RCC clock configuration to the default reset state (for debug purpose) */
293 293
  /* set HSION bit */
......
302 302
  RCC->CFGR &= (blt_int32u)0xFF80FFFF;
303 303
  /* disable all interrupts and clear pending bits  */
304 304
  RCC->CIR = 0x009F0000;
305
  /* enable HSE */    
305
  /* enable HSE */
306 306
  RCC->CR |= ((blt_int32u)RCC_CR_HSEON);
307 307
  /* wait till HSE is ready and if Time out is reached exit */
308 308
  do
309 309
  {
310 310
    HSEStatus = RCC->CR & RCC_CR_HSERDY;
311
    StartUpCounter++;  
312
  } 
311
    StartUpCounter++;
312
  }
313 313
  while((HSEStatus == 0) && (StartUpCounter != 1500));
314 314
  /* check if time out was reached */
315 315
  if ((RCC->CR & RCC_CR_HSERDY) == RESET)
......
323 323
  FLASH->ACR &= (blt_int32u)((blt_int32u)~FLASH_ACR_LATENCY);
324 324
#if (BOOT_CPU_SYSTEM_SPEED_KHZ > 48000)
325 325
  /* configure 2 flash wait states */
326
  FLASH->ACR |= (blt_int32u)FLASH_ACR_LATENCY_2;    
327
#elif (BOOT_CPU_SYSTEM_SPEED_KHZ > 24000)  
326
  FLASH->ACR |= (blt_int32u)FLASH_ACR_LATENCY_2;
327
#elif (BOOT_CPU_SYSTEM_SPEED_KHZ > 24000)
328 328
  /* configure 1 flash wait states */
329
  FLASH->ACR |= (blt_int32u)FLASH_ACR_LATENCY_1;    
329
  FLASH->ACR |= (blt_int32u)FLASH_ACR_LATENCY_1;
330 330
#endif
331 331
  /* HCLK = SYSCLK */
332 332
  RCC->CFGR |= (blt_int32u)RCC_CFGR_HPRE_DIV1;
......
354 354
  }
355 355
  /* select PLL as system clock source */
356 356
  RCC->CFGR &= (blt_int32u)((blt_int32u)~(RCC_CFGR_SW));
357
  RCC->CFGR |= (blt_int32u)RCC_CFGR_SW_PLL;    
357
  RCC->CFGR |= (blt_int32u)RCC_CFGR_SW_PLL;
358 358
  /* wait till PLL is used as system clock source */
359 359
  while ((RCC->CFGR & (blt_int32u)RCC_CFGR_SWS) != (blt_int32u)0x08)
360 360
  {
Target/Demo/ARMCM3_STM32F103_DiWheelDrive_GCC/Boot/makefile
120 120
../../../Source/ARMCM3_STM32/flash.h \
121 121
../../../Source/ARMCM3_STM32/GCC/vectors.c \
122 122
../../../Source/ARMCM3_STM32/GCC/cstart.c \
123
../../../Source/AMiRo/interfaces.h \
123
../../../Source/AMiRo/amiroblt.h \
124 124
../../../Source/AMiRo/helper.h \
125 125
../../../Source/AMiRo/helper.c
126 126

  
Target/Demo/ARMCM3_STM32F103_LightRing_GCC/Boot/main.c
23 23
* You should have received a copy of the GNU General Public License along with OpenBLT.
24 24
* If not, see <http://www.gnu.org/licenses/>.
25 25
*
26
* A special exception to the GPL is included to allow you to distribute a combined work 
27
* that includes OpenBLT without being obliged to provide the source code for any 
26
* A special exception to the GPL is included to allow you to distribute a combined work
27
* that includes OpenBLT without being obliged to provide the source code for any
28 28
* proprietary components. The exception text is included at the bottom of the license
29 29
* file <license.html>.
30
* 
30
*
31 31
* \endinternal
32 32
****************************************************************************************/
33 33

  
......
39 39
#include "stm32f10x_conf.h"                      /* STM32 peripheral drivers           */
40 40
#include "timer.h"
41 41
#include "ARMCM3_STM32/types.h"
42
#include "AMiRo/interfaces.h"
42
#include "AMiRo/amiroblt.h"
43 43
#include "AMiRo/helper.h"
44 44

  
45 45

  
......
127 127
void shutdownToHibernate(const blt_bool exec_disambiguation);
128 128
void shutdownAndRestart(const blt_bool exec_disambiguation);
129 129

  
130
volatile BlBackupRegister backup_reg;
130
volatile blBackupRegister_t backup_reg;
131 131

  
132 132
/****************************************************************************************
133 133
* Callback configuration
......
138 138
void blCallbackShutdownRestart(void);
139 139
void blCallbackHandleShutdownRequest(void);
140 140

  
141
const BlCallbackTable cbtable __attribute__ ((section ("_callback_table"))) = {
141
const blCallbackTable_t cbtable __attribute__ ((section ("_callback_table"))) = {
142 142
  .magicNumber = BL_MAGIC_NUMBER,
143
  .versionMajor = BL_VERSION_MAJOR,
144
  .versionMinor = BL_VERSION_MINOR,
145
  .versionHotfix = 0,
143
  .vBootloader = {BL_VERSION_ID_AMiRoBLT_Release, BL_VERSION_MAJOR, BL_VERSION_MINOR, 0},
144
  .vSSSP = {BL_VERSION_ID_SSSP, SSSP_VERSION_MAJOR, SSSP_VERSION_MINOR, 0},
145
  .vCompiler = {BL_VERSION_ID_GCC, __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__},  // currently only GCC is supported
146 146
  .cbShutdownHibernate = blCallbackShutdownHibernate,
147 147
  .cbShutdownDeepsleep = blCallbackShutdownDeepsleep,
148 148
  .cbShutdownTransportation = blCallbackShutdownTransportation,
......
158 158
};
159 159

  
160 160
/************************************************************************************//**
161
** \brief     This is the entry point for the bootloader application and is called 
161
** \brief     This is the entry point for the bootloader application and is called
162 162
**            by the reset interrupt vector after the C-startup routines executed.
163 163
** \return    Program return code.
164 164
**
......
219 219

  
220 220

  
221 221
/************************************************************************************//**
222
** \brief     Initializes the microcontroller. 
222
** \brief     Initializes the microcontroller.
223 223
** \return    none.
224 224
**
225 225
****************************************************************************************/
......
229 229
  blt_int32u pll_multiplier;
230 230
#if (BOOT_FILE_LOGGING_ENABLE > 0) && (BOOT_COM_UART_ENABLE == 0) && (BOOT_GATE_UART_ENABLE == 0)
231 231
  GPIO_InitTypeDef  GPIO_InitStruct;
232
  USART_InitTypeDef USART_InitStruct;  
233
#endif  
232
  USART_InitTypeDef USART_InitStruct;
233
#endif
234 234

  
235 235
  /* reset the RCC clock configuration to the default reset state (for debug purpose) */
236 236
  /* set HSION bit */
......
245 245
  RCC->CFGR &= (blt_int32u)0xFF80FFFF;
246 246
  /* disable all interrupts and clear pending bits  */
247 247
  RCC->CIR = 0x009F0000;
248
  /* enable HSE */    
248
  /* enable HSE */
249 249
  RCC->CR |= ((blt_int32u)RCC_CR_HSEON);
250 250
  /* wait till HSE is ready and if Time out is reached exit */
251 251
  do
252 252
  {
253 253
    HSEStatus = RCC->CR & RCC_CR_HSERDY;
254
    StartUpCounter++;  
255
  } 
254
    StartUpCounter++;
255
  }
256 256
  while((HSEStatus == 0) && (StartUpCounter != 1500));
257 257
  /* check if time out was reached */
258 258
  if ((RCC->CR & RCC_CR_HSERDY) == RESET)
......
266 266
  FLASH->ACR &= (blt_int32u)((blt_int32u)~FLASH_ACR_LATENCY);
267 267
#if (BOOT_CPU_SYSTEM_SPEED_KHZ > 48000)
268 268
  /* configure 2 flash wait states */
269
  FLASH->ACR |= (blt_int32u)FLASH_ACR_LATENCY_2;    
270
#elif (BOOT_CPU_SYSTEM_SPEED_KHZ > 24000)  
269
  FLASH->ACR |= (blt_int32u)FLASH_ACR_LATENCY_2;
270
#elif (BOOT_CPU_SYSTEM_SPEED_KHZ > 24000)
271 271
  /* configure 1 flash wait states */
272
  FLASH->ACR |= (blt_int32u)FLASH_ACR_LATENCY_1;    
272
  FLASH->ACR |= (blt_int32u)FLASH_ACR_LATENCY_1;
273 273
#endif
274 274
  /* HCLK = SYSCLK */
275 275
  RCC->CFGR |= (blt_int32u)RCC_CFGR_HPRE_DIV1;
......
297 297
  }
298 298
  /* select PLL as system clock source */
299 299
  RCC->CFGR &= (blt_int32u)((blt_int32u)~(RCC_CFGR_SW));
300
  RCC->CFGR |= (blt_int32u)RCC_CFGR_SW_PLL;    
300
  RCC->CFGR |= (blt_int32u)RCC_CFGR_SW_PLL;
301 301
  /* wait till PLL is used as system clock source */
302 302
  while ((RCC->CFGR & (blt_int32u)RCC_CFGR_SWS) != (blt_int32u)0x08)
303 303
  {
......
365 365
  GPIO_InitStruct.GPIO_Mode = GPIO_Mode_IN_FLOATING;
366 366
  GPIO_InitStruct.GPIO_Pin = GPIO_Pin_3;
367 367
  GPIO_Init(GPIOA, &GPIO_InitStruct);
368
  /* configure UART communcation parameters */  
368
  /* configure UART communcation parameters */
369 369
  USART_InitStruct.USART_BaudRate = BOOT_COM_UART_BAUDRATE;
370 370
  USART_InitStruct.USART_WordLength = USART_WordLength_8b;
371 371
  USART_InitStruct.USART_StopBits = USART_StopBits_1;
Target/Demo/ARMCM3_STM32F103_LightRing_GCC/Boot/makefile
121 121
../../../Source/ARMCM3_STM32/flash.h \
122 122
../../../Source/ARMCM3_STM32/GCC/vectors.c \
123 123
../../../Source/ARMCM3_STM32/GCC/cstart.c \
124
../../../Source/AMiRo/interfaces.h \
124
../../../Source/AMiRo/amiroblt.h \
125 125
../../../Source/AMiRo/helper.h \
126 126
../../../Source/AMiRo/helper.c
127 127

  
Target/Demo/ARMCM4_STM32F405_Power_Management_GCC/Boot/main.c
23 23
* You should have received a copy of the GNU General Public License along with OpenBLT.
24 24
* If not, see <http://www.gnu.org/licenses/>.
25 25
*
26
* A special exception to the GPL is included to allow you to distribute a combined work 
27
* that includes OpenBLT without being obliged to provide the source code for any 
26
* A special exception to the GPL is included to allow you to distribute a combined work
27
* that includes OpenBLT without being obliged to provide the source code for any
28 28
* proprietary components. The exception text is included at the bottom of the license
29 29
* file <license.html>.
30
* 
30
*
31 31
* \endinternal
32 32
****************************************************************************************/
33 33

  
......
39 39
#include "stm32f4xx_conf.h"                      /* STM32 peripheral drivers           */
40 40
#include "com.h"
41 41
#include "ARMCM4_STM32/types.h"
42
#include "AMiRo/interfaces.h"
42
#include "AMiRo/amiroblt.h"
43 43
#include "AMiRo/helper.h"
44 44

  
45 45
/****************************************************************************************
......
180 180
void shutdownToHibernate();
181 181
void shutdownAndRestart();
182 182

  
183
volatile BlBackupRegister backup_reg;
183
volatile blBackupRegister_t backup_reg;
184 184

  
185 185
/****************************************************************************************
186 186
* Callback configuration
......
191 191
void blCallbackShutdownRestart(void);
192 192
void blCallbackHandleShutdownRequest(void);
193 193

  
194
const BlCallbackTable cbtable __attribute__ ((section ("_callback_table"))) = {
194
const blCallbackTable_t cbtable __attribute__ ((section ("_callback_table"))) = {
195 195
  .magicNumber = BL_MAGIC_NUMBER,
196
  .versionMajor = BL_VERSION_MAJOR,
197
  .versionMinor = BL_VERSION_MINOR,
198
  .versionHotfix = 0,
196
  .vBootloader = {BL_VERSION_ID_AMiRoBLT_Release, BL_VERSION_MAJOR, BL_VERSION_MINOR, 0},
197
  .vSSSP = {BL_VERSION_ID_SSSP, SSSP_VERSION_MAJOR, SSSP_VERSION_MINOR, 0},
198
  .vCompiler = {BL_VERSION_ID_GCC, __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__},  // currently only GCC is supported
199 199
  .cbShutdownHibernate = blCallbackShutdownHibernate,
200 200
  .cbShutdownDeepsleep = blCallbackShutdownDeepsleep,
201 201
  .cbShutdownTransportation = blCallbackShutdownTransportation,
......
211 211
};
212 212

  
213 213
/************************************************************************************//**
214
** \brief     This is the entry point for the bootloader application and is called 
214
** \brief     This is the entry point for the bootloader application and is called
215 215
**            by the reset interrupt vector after the C-startup routines executed.
216 216
** \return    none.
217 217
**
......
321 321

  
322 322

  
323 323
/************************************************************************************//**
324
** \brief     Initializes the microcontroller. 
324
** \brief     Initializes the microcontroller.
325 325
** \return    none.
326 326
**
327 327
****************************************************************************************/
......
334 334
  USART_InitTypeDef USART_InitStructure;
335 335
#elif (BOOT_COM_CAN_ENABLE > 0 || BOOT_GATE_CAN_ENABLE > 0)
336 336
  GPIO_InitTypeDef  GPIO_InitStructure;
337
#endif  
337
#endif
338 338

  
339 339
  /* initialize the system and its clocks */
340 340
  SystemInit();
......
399 399
  RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA, ENABLE);
400 400
  /* select alternate function for the CAN pins */
401 401
  GPIO_PinAFConfig(GPIOA, GPIO_PinSource11, GPIO_AF_CAN1);
402
  GPIO_PinAFConfig(GPIOA, GPIO_PinSource12, GPIO_AF_CAN1); 
402
  GPIO_PinAFConfig(GPIOA, GPIO_PinSource12, GPIO_AF_CAN1);
403 403
  /* configure CAN RX and TX pins */
404 404
  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_11;
405 405
  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
......
413 413
  GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
414 414
  GPIO_InitStructure.GPIO_PuPd  = GPIO_PuPd_NOPULL;
415 415
  GPIO_Init(GPIOA, &GPIO_InitStructure);
416
#endif  
416
#endif
417 417

  
418 418
} /*** end of Init ***/
419 419

  
......
632 632
  IWDG_ReloadCounter();
633 633

  
634 634
  /* write some information to the backup register */
635
  BlBackupRegister backup;
635
  blBackupRegister_t backup;
636 636
  backup.shutdown_pri_reason = BL_SHUTDOWN_PRI_RSN_TRANSPORT;
637 637
  backup.shutdown_sec_reason = BL_SHUTDOWN_SEC_RSN_UNKNOWN;
638 638
  backup.wakeup_pri_reason = BL_WAKEUP_PRI_RSN_UNKNOWN;
......
668 668
   */
669 669

  
670 670
  /* write some information to the backup register */
671
  BlBackupRegister backup;
671
  blBackupRegister_t backup;
672 672
  backup.shutdown_pri_reason = BL_SHUTDOWN_PRI_RSN_DEEPSLEEP;
673 673
  backup.shutdown_sec_reason = BL_SHUTDOWN_SEC_RSN_UNKNOWN;
674 674
  backup.wakeup_pri_reason = BL_WAKEUP_PRI_RSN_UNKNOWN;
......
701 701
  systemPowerDown();
702 702

  
703 703
  /* write some information to the backup register */
704
  BlBackupRegister backup;
704
  blBackupRegister_t backup;
705 705
  backup.shutdown_pri_reason = BL_SHUTDOWN_PRI_RSN_HIBERNATE;
706 706
  backup.shutdown_sec_reason = BL_SHUTDOWN_SEC_RSN_UNKNOWN;
707 707
  backup.wakeup_pri_reason = BL_WAKEUP_PRI_RSN_UNKNOWN;
......
730 730
  systemPowerDown();
731 731

  
732 732
  /* write some information to the backup register */
733
  BlBackupRegister backup;
733
  blBackupRegister_t backup;
734 734
  backup.shutdown_pri_reason = BL_SHUTDOWN_PRI_RSN_RESTART;
735 735
  backup.shutdown_sec_reason = BL_SHUTDOWN_SEC_RSN_UNKNOWN;
736 736
  backup.wakeup_pri_reason = BL_WAKEUP_PRI_RSN_UNKNOWN;
Target/Demo/ARMCM4_STM32F405_Power_Management_GCC/Boot/makefile
139 139
../../../Source/ARMCM4_STM32/timer.h \
140 140
../../../Source/ARMCM4_STM32/GCC/vectors.c \
141 141
../../../Source/ARMCM4_STM32/GCC/cstart.c \
142
../../../Source/AMiRo/interfaces.h \
142
../../../Source/AMiRo/amiroblt.h \
143 143
../../../Source/AMiRo/helper.h \
144 144
../../../Source/AMiRo/helper.c
145 145

  
Target/Source/AMiRo/amiroblt.h
1
/**
2
 * @file    interfaces.h
3
 * @brief   Interfaces to access and interpret information of the bootloader by an operating system.
4
 *
5
 * @addtogroup  AMiRo-BLT
6
 * @details     Data structures and constants to interfere with the bootloader form an operating system.
7
 * @{
8
 */
9

  
10
#ifndef _AMIROBLT_H_
11
#define _AMIROBLT_H_
12

  
13
#include <stdint.h>
14

  
15
/*============================================================================*/
16
/**
17
 * @defgroup  AMiRo-BLT-IF AMiRo Bootloader Interface
18
 * @details   This interface can be used to interface the AMiRo bootloader from an operating system.
19
 *
20
 * @{
21
 */
22
/*============================================================================*/
23

  
24
/*============================================================================*/
25
/**
26
 * @name    Callback Table
27
 * @details The callback table is a static struct, located in the MCUs flash memory (ROM) with offset @ref BL_CALLBACK_TABLE_OFFSET .
28
 *          It contains version information and a bunch of callback function pointers.
29
 */
30
///@{
31

  
32
/**
33
 * @brief   The offset from the flash memory base address to where the @ref blCallbackTable_t struct is stored.
34
 * @note    This offset must correspond with the @p _callback_table section in file @p memory.x of the bootloader.
35
 */
36
#define BL_CALLBACK_TABLE_OFFSET                  0x000001C0u
37

  
38
/**
39
 * @brief   The memory address where the @ref blCallbackTable_t struct is located in flash memory.
40
 * @note    This adress must correspond with the @p _callback_table section in file @p memory.x of the bootloader.
41
 * @deprecated  The @ref BL_CALLBACK_TABLE_OFFSET macro must be used for new software.
42
 */
43
#define BL_CALLBACK_TABLE_ADDRESS                 ((blCallbackTable_t*)(0x08000000u + BL_CALLBACK_TABLE_OFFSET))
44

  
45
/**
46
 * @brief   The major version number of the bootloader.
47
 */
48
#define BL_VERSION_MAJOR                          1
49

  
50
/**
51
 * @brief   The minor version number of the bootloader.
52
 */
53
#define BL_VERSION_MINOR                          0
54

  
55
/**
56
 * @brief   The major version number of the implemented SSSP (Startup & Shutdown Synchronization Protocol).
57
 */
58
#define SSSP_VERSION_MAJOR                        1
59

  
60
/**
61
 * @brief   The minor version number of the implemented SSSP (Startup & Shutdown Synchronization Protocol).
62
 */
63
#define SSSP_VERSION_MINOR                        1
64

  
65
/**
66
 * @brief   A struct to define a version in a generic way.
67
 */
68
struct blVersion_t {
69
  const uint8_t identifier;   /**< The identifier can be used if the version can be ambiguous.  */
70
  const uint8_t major;        /**< Major version number.                                        */
71
  const uint8_t minor;        /**< Minor version number.                                        */
72
  const uint8_t patch;        /**< Patch level number.                                          */
73
} __attribute__((packed));
74

  
75
/**
76
 * @brief   Synonym for simplified access.
77
 */
78
typedef struct blVersion_t blVersion_t;
79

  
80
/**
81
 * @brief   An enum that defines possible values for the 'identifier' member of the @p blVersion_t struct.
82
 * @note    The values must be in (unsigned) 8 bit integer range.
83
 */
84
enum blVersionIdentifier_t {
85
  BL_VERSION_ID_UNKNOWN                   = 0x00u,  /**< Unknown identifier                                       */
86
  BL_VERSION_ID_NA                        = 0xFFu,  /**< Identifier not applicable                                */
87
  BL_VERSION_ID_AMiRoBLT_PreAlpha         = 0x01u,  /**< AMiRo-BLT pre-alpha identifier.                          */
88
  BL_VERSION_ID_AMiRoBLT_Alpha            = 0x02u,  /**< AMiRo-BLT alpha version identifier.                      */
89
  BL_VERSION_ID_AMiRoBLT_Beta             = 0x03u,  /**< AMiRo-BLT beta version identifier.                       */
90
  BL_VERSION_ID_AMiRoBLT_ReleaseCandidate = 0x04u,  /**< AMiRo-BLT release candidate (RC) identifier.             */
91
  BL_VERSION_ID_AMiRoBLT_Release          = 0x05u,  /**< AMiRo-BLT release version identifier.                    */
92
  BL_VERSION_ID_SSSP                      = 0x01u,  /**< Startup & Shutdown Synchronization Protocol identifier.  */
93
  BL_VERSION_ID_GCC                       = 0x01u,  /**< Gnu Compiler Collection identifier.                      */
94
};
95

  
96
/**
97
 * @brief   A magic number to detect whether the callback table exists.
98
 * @details The magic number can be interpreted as four character string "A-BL".
99
 *          The according hexadecimal values are 0x41, 0x2D, 0x42, and 0x4C.
100
 *          The according 32 bit integer is 0x412D424C.
101
 */
102
#define BL_MAGIC_NUMBER                           ((uint32_t)(('A'<<24) | ('-'<<16) | ('B'<<8) | ('L'<<0)))
103

  
104
/**
105
 * @brief   This struct contains information about the bootloader version and pointers to several callback function.
106
 *          It is located at the constant address @ref BL_CALLBACK_TABLE_OFFSET in the flash memory.
107
 * @note    Sicne the actual implementations of the callback functions are optional, the pointers must be checked not to be @p NULL before use!
108
 */
109
struct blCallbackTable_t {
110
  const uint32_t magicNumber;                     /**< A magic number that can be used for sanity checks. @sa BL_MAGIC_NUMBER.            */
111
  const blVersion_t vBootloader;                  /**< Version information about the bootloader.                                          */
112
  const blVersion_t vSSSP;                        /**< Version information about the Startup & Shutdown Synchronization Protocol (SSSP).  */
113
  const blVersion_t vCompiler;                    /**< Version information about the used compiler.                                       */
114
  /**
115
   * @brief   Callback function pointer to enter hibernate mode.
116
   * @details In hibernate mode, the system enters maximum power-saving mode, but will wake up periodically in order to read some sensors.
117
   */
118
  void (*const cbShutdownHibernate)(void);
119
  /**
120
   * @brief   Callback function pointer to enter deepsleep mode.
121
   * @details In deepsleep mode, the system enters maximum power-saving mode, but basic sensors (e.g. charging plug) can wake the system.
122
   */
123
  void (*const cbShutdownDeepsleep)(void);
124
  /**
125
   * @brief   Callback function pointer to enter transportation mode.
126
   * @details In transportation mode, the system enters maximum power-saving mode and all wakeup signals are deactivated.
127
   *          Thus, the only way to reactivate the system will be a hard reset.
128
   */
129
  void (*const cbShutdownTransportation)(void);   /**< Callback function pointer to enter transportation mode. */
130
  /**
131
   * @brief   Callback function pointer to restart the system.
132
   */
133
  void (*const cbShutdownRestart)(void);
134
  /**
135
   * @brief   Callback function pointer to handle a shutdown request from another module.
136
   * @details Depending on the result of the disambiguation procedure, the module will enter the requested low-power mode.
137
   */
138
  void (*const cbHandleShutdownRequest)(void);
139
  void (*const cb5)(void);                        /**< Reserved but currently unused callback function pointer. */
140
  void (*const cb6)(void);                        /**< Reserved but currently unused callback function pointer. */
141
  void (*const cb7)(void);                        /**< Reserved but currently unused callback function pointer. */
142
  void (*const cb8)(void);                        /**< Reserved but currently unused callback function pointer. */
143
  void (*const cb9)(void);                        /**< Reserved but currently unused callback function pointer. */
144
  void (*const cb10)(void);                       /**< Reserved but currently unused callback function pointer. */
145
  void (*const cb11)(void);                       /**< Reserved but currently unused callback function pointer. */
146
} __attribute__((__packed__));
147

  
148
/**
149
 * @brief Synonym for simplified access.
150
 */
151
typedef struct blCallbackTable_t blCallbackTable_t;
152

  
153
///@}
154
/*============================================================================*/
155

  
156
/*============================================================================*/
157
/**
158
 * @name    Backup Register
159
 * @details For the STM32F4 MCU (PowerManagement), the backup register contains additional information about the last shutdown and wakeup of the system.
160
 */
161
///@{
162

  
163
/**
164
 * @brief   Number of the RTC backup register in which some persistent information is stored.
165
 * @note    In the RTC section of the STM32F4 reference manual, the RTC backup registers are named @p RTC_BKPxR, where x is the register number.
166
 */
167
#define BL_RTC_BACKUP_REG                         0
168

  
169
/**
170
 * @brief   This union is used for interpretation of the content of the backup register.
171
 */
172
union blBackupRegister_t {
173
  /**
174
   * @brief The raw data of the register.
175
   */
176
  uint32_t raw;
177

  
178
  /**
179
   * @brief A struct to interpret the content of the register.
180
   */
181
  struct {
182
    /**
183
     * @brief The primary reason for the last system shutdown.
184
     * @note  The content of this member is enum-like.
185
     * @sa    BL_SHUTDOWN_PRI_RSN_UNKNOWN, BL_SHUTDOWN_PRI_RSN_HIBERNATE, BL_SHUTDOWN_PRI_RSN_DEEPSLEEP, BL_SHUTDOWN_PRI_RSN_TRANSPORT, BL_SHUTDOWN_PRI_RSN_RESTART
186
     */
187
    uint8_t shutdown_pri_reason;
188

  
189
    /**
190
     * @brief The secondary reason for the last system shutdown.
191
     * @note  The content of this member is enum-like.
192
     * @sa    BL_SHUTDOWN_SEC_RSN_UNKNOWN
193
     */
194
    uint8_t shutdown_sec_reason;
195

  
196
    /**
197
     * @brief The primary reason for the last system wakeup.
198
     * @note  The content of this member is bitmask-like.
199
     * @sa    BL_WAKEUP_PRI_RSN_UNKNOWN, BL_WAKEUP_PRI_RSN_LPWRRST, BL_WAKEUP_PRI_RSN_WWDGRST, BL_WAKEUP_PRI_RSN_IWDGRST, BL_WAKEUP_PRI_RSN_SFTRST, BL_WAKEUP_PRI_RSN_PORRST, BL_WAKEUP_PRI_RSN_PINRST, BL_WAKEUP_PRI_RSN_BORRST, BL_WAKEUP_PRI_RSN_WKUP
200
     */
201
    uint8_t wakeup_pri_reason;
202

  
203
    /**
204
     * @brief The secondary reason for the last system wakeup.
205
     * @note  The content of this member is bitmask-like.
206
     * @sa    BL_WAKEUP_SEC_RSN_UNKNOWN, BL_WAKEUP_SEC_RSN_UART, BL_WAKEUP_SEC_RSN_PWRPLUG, BL_WAKEUP_SEC_RSN_VSYSHIGH, BL_WAKEUP_SEC_RSN_VSYSLOW, BL_WAKEUP_SEC_RSN_TOUCH, BL_WAKEUP_SEC_RSN_ACCEL, BL_WAKEUP_SEC_RSN_RSVD
207
     */
208
    uint8_t wakeup_sec_reason;
209
  } __attribute__((__packed__));
210
};
211

  
212
/**
213
 * @brief   Synonym for simplified access.
214
 */
215
typedef union blBackupRegister_t blBackupRegister_t;
216

  
217
/**
218
 * @brief   An enum defining identifiers for possible reasons for system shutdown.
219
 * @note    The values must be in (unsigned) 8 bit integer range.
220
 */
221
enum blShutdownReason_t {
222
  /**
223
   * @brief The reason was not set or the register was reset.
224
   */
225
  BL_SHUTDOWN_PRI_RSN_UNKNOWN   = 0x00u,
226

  
227
  /**
228
   * @brief The system was shut down to enter hibernate mode.
229
   */
230
  BL_SHUTDOWN_PRI_RSN_HIBERNATE = 0x01u,
231

  
232
  /**
233
   * @brief The system was shut down to enter deepsleep mode.
234
   */
235
  BL_SHUTDOWN_PRI_RSN_DEEPSLEEP = 0x02u,
236

  
237
  /**
238
   * @brief The system was shut down to enter transportation mode.
239
   */
240
  BL_SHUTDOWN_PRI_RSN_TRANSPORT = 0x03u,
241

  
242
  /**
243
   * @brief The system was shut down to restart.
244
   */
245
  BL_SHUTDOWN_PRI_RSN_RESTART   = 0x04u,
246

  
247
  /**
248
   * @brief   The default shutdown mode.
249
   * @details This mode is used, if the shutdown sequence was triggered by another module than the PowerManagement.
250
   */
251
  BL_SHUTDOWN_PRI_RSN_DEFAULT   = BL_SHUTDOWN_PRI_RSN_DEEPSLEEP,
252

  
253
  /**
254
   * @brief The reason was not set or the regsiter was reset.
255
   */
256
  BL_SHUTDOWN_SEC_RSN_UNKNOWN   = 0x00u,
257
};
258

  
259
/**
260
 * @brief   An enum defining identifiers for possible reasons for system wakeup.
261
 * @note    The values must be in (unsigned) 8 bit integer range.
262
 */
263
enum blWakeupReason_t {
264
  /**
265
   * @brief The reason could not be determined.
266
   */
267
  BL_WAKEUP_PRI_RSN_UNKNOWN    = 0x00u,
268

  
269
  /**
270
   * @brief The system was reset because of the low-power management configuration.
271
   */
272
  BL_WAKEUP_PRI_RSN_LPWRRST    = 0x01u,
273

  
274
  /**
275
   * @brief The system was woken by the window watchdog.
276
   */
277
  BL_WAKEUP_PRI_RSN_WWDGRST    = 0x02u,
278

  
279
  /**
280
   * @brief The system was woken by the independant watchdog.
281
   */
282
  BL_WAKEUP_PRI_RSN_IWDGRST    = 0x04u,
283

  
284
  /**
285
   * @brief The system was reset by software.
286
   */
287
  BL_WAKEUP_PRI_RSN_SFTRST     = 0x08u,
288

  
289
  /**
290
   * @brief The system was woken by a power-on/power-down reset.
291
   */
292
  BL_WAKEUP_PRI_RSN_PORRST     = 0x10u,
293

  
294
  /**
295
   * @brief The system was reset via the NRST pin.
296
   */
297
  BL_WAKEUP_PRI_RSN_PINRST     = 0x20u,
298

  
299
  /**
300
   * @brief The system was woken by a power-on/power-down, or a brownout reset.
301
   */
302
  BL_WAKEUP_PRI_RSN_BORRST     = 0x40u,
303

  
304
  /**
305
   * @brief The system was woken via the WKUP pin.
306
   */
307
  BL_WAKEUP_PRI_RSN_WKUP       = 0x80u,
308

  
309
  /**
310
   * @brief The reason could not be determined.
311
   */
312
  BL_WAKEUP_SEC_RSN_UNKNOWN    = 0x00u,
313

  
314
  /**
315
   * @brief The WKUP pin was triggered by the UART signal.
316
   */
317
  BL_WAKEUP_SEC_RSN_UART       = 0x01u,
318

  
319
  /**
320
   * @brief The WKUP pin was triggered by plugging in a power plug.
321
   */
322
  BL_WAKEUP_SEC_RSN_PWRPLUG    = 0x02u,
323

  
324
  /**
325
   * @brief The internal ADC detected a system voltage higher than the configured threshold.
326
   * @note  Usually the threshold is set to 9V.
327
   */
328
  BL_WAKEUP_SEC_RSN_VSYSHIGH   = 0x04u,
329

  
330
  /**
331
   * @brief The internal ADC detected a system voltage lower than the configured threshold.
332
   */
333
  BL_WAKEUP_SEC_RSN_VSYSLOW    = 0x08u,
334

  
335
  /**
336
   * @brief The WKUP pin was triggered by an interrupt from the touch sensors.
337
   */
338
  BL_WAKEUP_SEC_RSN_TOUCH      = 0x10u,
339

  
340
  /**
341
   * @brief The WKUP pin was triggered by an interrupt from the accelerometer.
342
   */
343
  BL_WAKEUP_SEC_RSN_ACCEL      = 0x20u,
344

  
345
  /**
346
   * @brief Reserved value that must not be used right now, but might become valid in a future version.
347
   */
348
  BL_WAKEUP_SEC_RSN_RSVD       = 0xC0u,
349
};
350

  
351
///@}
352

  
353
/** @} */
354

  
355
#endif // _AMIROBLT_H_
356

  
357
/** @} */
Target/Source/AMiRo/interfaces.h
1
/**
2
 * @file    interfaces.h
3
 * @brief   Interfaces to access and interpret information of the bootloader by an operating system.
4
 *
5
 * @addtogroup  AMiRo-BLT
6
 * @details     Data structures and constants to interfere with the bootloader form an operating system.
7
 * @{
8
 */
9

  
10
#ifndef BL_INTERFACES_H
11
#define BL_INTERFACES_H
12

  
13
#include <stdint.h>
14

  
15
/*===========================================================================*/
16
/**
17
 * @defgroup  AMiRo-BLT-IF Bootloader Interface
18
 * @details   This interface can be used to interface the AMiRo bootloader from an operating system.
19
 *
20
 * @{
21
 */
22
/*===========================================================================*/
23

  
24
/*===========================================================================*/
25
/**
26
 * @name    Callback Table
27
 * @details The callback table is a static struct, located at address @ref BL_CALLBACK_TABLE_ADDRESS in the MCUs flash memory (ROM).
28
 *          It contains version information and a bunch of callback function pointers.
29
 */
30
///@{
31

  
32
/**
33
 * @brief   The memory address where the @ref BlCallbackTable struct is located in flash memory.
34
 * @note    This address must correspond with the @p _callback_table section in file @p memory.x of the bootloader.
35
 */
36
#define BL_CALLBACK_TABLE_ADDRESS                 (uint32_t)(0x08000000u + 0x01C0u)
37

  
38
/**
39
 * @brief   A magic number to detect whether the callback table exists.
40
 */
41
#define BL_MAGIC_NUMBER                           ((uint32_t)0xFF669900u)
42

  
43
/**
44
 * @brief   The major version number of the bootloader.
45
 */
46
#define BL_VERSION_MAJOR                          0
47

  
48
/**
49
 * @brief   The minor version number of the bootloader.
50
 */
51
#define BL_VERSION_MINOR                          3
52

  
53
/**
54
 * @brief   The major version number of the implemented SSSP (Startup & Synchronization Protocol).
55
 */
56
#define SSSP_VERSION_MAJOR                        1
57

  
58
/**
59
 * @brief   The minor version number of the implemented SSSP (Startup & Synchronization Protocol).
60
 */
61
#define SSSP_VERSION_MINOR                        1
62

  
63
/**
64
 * @brief   This struct contains information about the bootloader version and pointers to several callback function.
65
 *          It is located at the constant address @ref BL_CALLBACK_TABLE_ADDRESS in the flash memory.
66
 * @note    Sicne the actual implementations of the callback functions are optional, the pointers must be checked not to be @p NULL before use!
67
 */
68
struct BlCallbackTable {
69
  const uint32_t magicNumber;                     /**< A magic number that can be used for sanity checks. @sa BL_MAGIC_NUMBER */
70
  const uint32_t versionMajor;                    /**< The major version number of the bootloader. @sa BL_VERSION_MAJOR */
71
  const uint32_t versionMinor;                    /**< The minor version number of the bootloader. @sa BL_VERSION_MINOR */
72
  const uint32_t versionHotfix;                   /**< The hotfix indicator of the bootloader. */
73
  /**
74
   * @brief   Callback function pointer to enter hibernate mode.
75
   * @details In hibernate mode, the system enters maximum power-saving mode, but will wake up periodically in order to read some sensors.
76
   */
77
  void (*const cbShutdownHibernate)(void);
78
  /**
79
   * @brief   Callback function pointer to enter deepsleep mode.
80
   * @details In deepsleep mode, the system enters maximum power-saving mode, but basic sensors (e.g. charging plug) can wake the system.
81
   */
82
  void (*const cbShutdownDeepsleep)(void);
83
  /**
84
   * @brief   Callback function pointer to enter transportation mode.
85
   * @details In transportation mode, the system enters maximum power-saving mode and all wakeup signals are deactivated.
86
   *          Thus, the only way to reactivate the system will be a hard reset.
87
   */
88
  void (*const cbShutdownTransportation)(void);   /**< Callback function pointer to enter transportation mode. */
89
  /**
90
   * @brief   Callback function pointer to restart the system.
91
   */
92
  void (*const cbShutdownRestart)(void);
93
  /**
94
   * @brief   Callback function pointer to handle a shutdown request from another module.
95
   * @details Depending on the result of the disambiguation procedure, the module will enter the requested low-power mode.
96
   */
97
  void (*const cbHandleShutdownRequest)(void);
98
  void (*const cb5)(void);                        /**< Reserved but currently unused callback function pointer. */
99
  void (*const cb6)(void);                        /**< Reserved but currently unused callback function pointer. */
100
  void (*const cb7)(void);                        /**< Reserved but currently unused callback function pointer. */
101
  void (*const cb8)(void);                        /**< Reserved but currently unused callback function pointer. */
102
  void (*const cb9)(void);                        /**< Reserved but currently unused callback function pointer. */
103
  void (*const cb10)(void);                       /**< Reserved but currently unused callback function pointer. */
104
  void (*const cb11)(void);                       /**< Reserved but currently unused callback function pointer. */
105
};
106

  
107
/**
108
 * @brief Synonym for simplified access.
109
 */
110
typedef struct BlCallbackTable BlCallbackTable;
111

  
112
///@}
113
/*===========================================================================*/
114

  
115
/*===========================================================================*/
116
/**
117
 * @name    Backup Register
118
 * @details For the STM32F4 MCU (PowerManagement), the backup register contains additional information about the last shutdown and wakeup of the system.
119
 */
120
///@{
121

  
122
/**
123
 * @brief   Number of the RTC backup register in which some persistent information is stored.
124
 * @note    In the RTC section of the STM32F4 reference manual, the RTC backup registers are named @p RTC_BKPxR, where x is the register number.
125
 */
126
#define BL_RTC_BACKUP_REG                         0
127

  
128
/**
129
 * @brief   This union is used for interpretation of the content of the backup register.
130
 */
131
union BlBackupRegister {
132
  /**
133
   * @brief The raw data of the register.
134
   */
135
  uint32_t raw;
136

  
137
  /**
138
   * @brief A struct to interpret the content of the register.
139
   */
140
  struct {
141
    /**
142
     * @brief The primary reason for the last system shutdown.
143
     * @note  The content of this member is enum-like.
144
     * @sa    BL_SHUTDOWN_PRI_RSN_UNKNOWN, BL_SHUTDOWN_PRI_RSN_HIBERNATE, BL_SHUTDOWN_PRI_RSN_DEEPSLEEP, BL_SHUTDOWN_PRI_RSN_TRANSPORT, BL_SHUTDOWN_PRI_RSN_RESTART
145
     */
146
    uint8_t shutdown_pri_reason;
147

  
148
    /**
149
     * @brief The secondary reason for the last system shutdown.
150
     * @note  The content of this member is enum-like.
151
     * @sa    BL_SHUTDOWN_SEC_RSN_UNKNOWN
152
     */
153
    uint8_t shutdown_sec_reason;
154

  
155
    /**
156
     * @brief The primary reason for the last system wakeup.
157
     * @note  The content of this member is bitmask-like.
158
     * @sa    BL_WAKEUP_PRI_RSN_UNKNOWN, BL_WAKEUP_PRI_RSN_LPWRRST, BL_WAKEUP_PRI_RSN_WWDGRST, BL_WAKEUP_PRI_RSN_IWDGRST, BL_WAKEUP_PRI_RSN_SFTRST, BL_WAKEUP_PRI_RSN_PORRST, BL_WAKEUP_PRI_RSN_PINRST, BL_WAKEUP_PRI_RSN_BORRST, BL_WAKEUP_PRI_RSN_WKUP
159
     */
160
    uint8_t wakeup_pri_reason;
161

  
162
    /**
163
     * @brief The secondary reason for the last system wakeup.
164
     * @note  The content of this member is bitmask-like.
165
     * @sa    BL_WAKEUP_SEC_RSN_UNKNOWN, BL_WAKEUP_SEC_RSN_UART, BL_WAKEUP_SEC_RSN_PWRPLUG, BL_WAKEUP_SEC_RSN_VSYSHIGH, BL_WAKEUP_SEC_RSN_VSYSLOW, BL_WAKEUP_SEC_RSN_TOUCH, BL_WAKEUP_SEC_RSN_ACCEL, BL_WAKEUP_SEC_RSN_RSVD
166
     */
167
    uint8_t wakeup_sec_reason;
168
  };
169
};
170
typedef union BlBackupRegister BlBackupRegister;
171

  
172
/**
173
 * @brief The reason was not set or the register was reset.
174
 */
175
#define BL_SHUTDOWN_PRI_RSN_UNKNOWN               0x00u
176

  
177
/**
178
 * @brief The system was shut down to enter hibernate mode.
179
 */
180
#define BL_SHUTDOWN_PRI_RSN_HIBERNATE             0x01u
181

  
182
/**
183
 * @brief The system was shut down to enter deepsleep mode.
184
 */
185
#define BL_SHUTDOWN_PRI_RSN_DEEPSLEEP             0x02u
186

  
187
/**
188
 * @brief The system was shut down to enter transportation mode.
189
 */
190
#define BL_SHUTDOWN_PRI_RSN_TRANSPORT             0x03u
191

  
192
/**
193
 * @brief The system was shut down to restart.
194
 */
195
#define BL_SHUTDOWN_PRI_RSN_RESTART               0x04u
196

  
197
/**
198
 * @brief   The default shutdown mode.
199
 * @details This mode is used, if the shutdown sequence was triggered by another module than the PowerManagement.
200
 */
201
#define BL_SHUTDOWN_PRI_RSN_DEFAULT               BL_SHUTDOWN_PRI_RSN_DEEPSLEEP
202

  
203

  
204

  
205
/**
206
 * @brief The reason was not set or the regsiter was reset.
207
 */
208
#define BL_SHUTDOWN_SEC_RSN_UNKNOWN               0x00u
209

  
210

  
211

  
212
/**
213
 * @brief The reason could not be determined.
214
 */
215
#define BL_WAKEUP_PRI_RSN_UNKNOWN                 0x00u
216

  
217
/**
218
 * @brief The system was reset because of the low-power management configuration.
219
 */
220
#define BL_WAKEUP_PRI_RSN_LPWRRST                 0x01u
221

  
222
/**
223
 * @brief The system was woken by the window watchdog.
224
 */
225
#define BL_WAKEUP_PRI_RSN_WWDGRST                 0x02u
226

  
227
/**
228
 * @brief The system was woken by the independant watchdog.
229
 */
230
#define BL_WAKEUP_PRI_RSN_IWDGRST                 0x04u
231

  
232
/**
233
 * @brief The system was reset by software.
234
 */
235
#define BL_WAKEUP_PRI_RSN_SFTRST                  0x08u
236

  
237
/**
238
 * @brief The system was woken by a power-on/power-down reset.
239
 */
240
#define BL_WAKEUP_PRI_RSN_PORRST                  0x10u
241

  
242
/**
243
 * @brief The system was reset via the NRST pin.
244
 */
245
#define BL_WAKEUP_PRI_RSN_PINRST                  0x20u
246

  
247
/**
248
 * @brief The system was woken by a power-on/power-down, or a brownout reset.
249
 */
250
#define BL_WAKEUP_PRI_RSN_BORRST                  0x40u
251

  
252
/**
253
 * @brief The system was woken via the WKUP pin.
254
 */
255
#define BL_WAKEUP_PRI_RSN_WKUP                    0x80u
256

  
257

  
258

  
259
/**
260
 * @brief The reason could not be determined.
261
 */
262
#define BL_WAKEUP_SEC_RSN_UNKNOWN                 0x00u
263

  
264
/**
265
 * @brief The WKUP pin was triggered by the UART signal.
266
 */
267
#define BL_WAKEUP_SEC_RSN_UART                    0x01u
268

  
269
/**
270
 * @brief The WKUP pin was triggered by plugging in a power plug.
271
 */
272
#define BL_WAKEUP_SEC_RSN_PWRPLUG                 0x02u
273

  
274
/**
275
 * @brief The internal ADC detected a system voltage higher than the configured threshold.
276
 * @note  Usually the threshold is set to 9V.
277
 */
278
#define BL_WAKEUP_SEC_RSN_VSYSHIGH                0x04u
279

  
280
/**
281
 * @brief The internal ADC detected a system voltage lower than the configured threshold.
282
 */
283
#define BL_WAKEUP_SEC_RSN_VSYSLOW                 0x08u
284

  
285
/**
286
 * @brief The WKUP pin was triggered by an interrupt from the touch sensors.
287
 */
288
#define BL_WAKEUP_SEC_RSN_TOUCH                   0x10u
289

  
290
/**
291
 * @brief The WKUP pin was triggered by an interrupt from the accelerometer.
292
 */
293
#define BL_WAKEUP_SEC_RSN_ACCEL                   0x20u
294

  
295
/**
296
 * @brief Reserved value that must not be used right now, but might become valid in a future version.
297
 */
298
#define BL_WAKEUP_SEC_RSN_RSVD                    0xC0u
299

  
300
///@}
301

  
302
/** @} */
303

  
304
#endif // BL_INTERFACES_H
305

  
306
/** @} */
Target/Source/ARMCM3_STM32/can.c
379 379
  blt_int8u  length = 0;
380 380

  
381 381
  static blt_int8u readData[BOOT_COM_RX_MAX_DATA];
382
  static receivedLen = 0;
383
  static lastLen = 0;
384
  static toReceive = 0;
382
  static blt_int8u receivedLen = 0;
383
  static blt_int8u lastLen = 0;
384
  static blt_int8u toReceive = 0;
385 385
  blt_int8u canData[8];
386 386
  blt_int8u restLen;
387 387
  blt_int8u canLength;
Target/Source/ARMCM4_STM32/can.c
455 455
  blt_int8u  length = 0;
456 456

  
457 457
  static blt_int8u readData[BOOT_COM_RX_MAX_DATA];
458
  static receivedLen = 0;
459
  static lastLen = 0;
460
  static toReceive = 0;
458
  static blt_int8u receivedLen = 0;
459
  static blt_int8u lastLen = 0;
460
  static blt_int8u toReceive = 0;
461 461
  blt_int8u canData[8];
462 462
  blt_int8u restLen;
463 463
  blt_int8u canLength;
Target/Source/com.h
137 137
blt_bool        ComIsConnected(void);
138 138
#if (BOOTLOADER_OF_MAIN_DEVICE > 0)
139 139
blt_bool        ComWasConnectedToMain(void);
140
void            ComTransmitPacketDirect(blt_int8u *data, blt_int8u len);
140 141
#endif /* BOOTLOADER_OF_MAIN_DEVICE > 0 */
141 142

  
142 143
#endif /* BOOT_COM_ENABLE > 0 */

Also available in: Unified diff