Revision fc7151bb Target/Modules/PowerManagement_1-1/Boot/main.c

View differences:

Target/Modules/PowerManagement_1-1/Boot/main.c
88 88

  
89 89
const blCallbackTable_t cbtable __attribute__ ((section ("_callback_table"))) = {
90 90
  .magicNumber = BL_MAGIC_NUMBER,
91
  .vBootloader = {BL_VERSION_ID_AMiRoBLT_Beta, BL_VERSION_MAJOR, BL_VERSION_MINOR, 0},
91
  .vBootloader = {BL_VERSION_ID_AMiRoBLT_Beta, BL_VERSION_MAJOR, BL_VERSION_MINOR, 3},
92 92
  .vSSSP = {BL_VERSION_ID_SSSP, BL_SSSP_VERSION_MAJOR, BL_SSSP_VERSION_MINOR, 0},
93 93
  .vCompiler = {BL_VERSION_ID_GCC, __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__},  // currently only GCC is supported
94 94
  .cbShutdownHibernate = blCallbackShutdownHibernate,
......
309 309
  GPIO_InitStructure.GPIO_PuPd  = GPIO_PuPd_NOPULL;
310 310
  GPIO_Init(GPIOA, &GPIO_InitStructure);
311 311
#endif
312

  
313 312
} /*** end of Init ***/
314 313

  
315 314
/*
......
545 544
} /*** end of shutdownToTransportation ***/
546 545

  
547 546
/*
548
 * Final shutdown of the system to enter deepseleep mode.
547
 * Final shutdown of the system to enter deepsleep mode.
549 548
 */
550 549
void shutdownToDeepsleep() {
551 550
  /* configure some criticpal GPIOs as input
......
604 603
  PWR_BackupAccessCmd(ENABLE);
605 604
  RTC_WriteBackupRegister(BL_RTC_BACKUP_REG, backup.raw);
606 605

  
607
  /* morse 'OK' via the LED to signal that shutodnw was successful */
606
  /* morse 'OK' via the LED to signal that shutdown was successful */
608 607
  blinkOK(1);
609 608

  
610 609
  /* reset the MCU */
......
633 632
  PWR_BackupAccessCmd(ENABLE);
634 633
  RTC_WriteBackupRegister(BL_RTC_BACKUP_REG, backup.raw);
635 634

  
636
  /* morse 'OK' via the LED to signal that shutodnw was successful */
635
  /* morse 'OK' via the LED to signal that shutdown was successful */
637 636
  blinkOK(1);
638 637

  
639 638
  /* reset the MCU */
......
648 647
 */
649 648
void configGpioForShutdown() {
650 649
  /* setup the configuration */
651
  GPIO_InitTypeDef  gpio_init;
650
  GPIO_InitTypeDef gpio_init;
652 651
  gpio_init.GPIO_Mode   = GPIO_Mode_IN;
653 652
  gpio_init.GPIO_Speed  = GPIO_Speed_50MHz;
654 653
  gpio_init.GPIO_OType  = GPIO_OType_PP;
......
1297 1296
  shutdownToTransportation();
1298 1297

  
1299 1298
  return;
1300
} /*** end of bLCallbackTransportation ***/
1299
} /*** end of blCallbackTransportation ***/
1301 1300

  
1302 1301
/*
1303 1302
 * Callback function that handles the system shutdown and enters deepsleep mode.
......
1338 1337
  shutdownToDeepsleep();
1339 1338

  
1340 1339
  return;
1341
} /*** end of bLCallbackDeepsleep ***/
1340
} /*** end of blCallbackDeepsleep ***/
1342 1341

  
1343 1342
/*
1344 1343
 * Callback function that handles the system shutdown and enters hibernate mode.
......
1378 1377
  shutdownToHibernate();
1379 1378

  
1380 1379
  return;
1381
} /*** end of bLCallbackShutdownHibernate ***/
1380
} /*** end of blCallbackShutdownHibernate ***/
1382 1381

  
1383 1382
/*
1384 1383
 * Callback function that handles the system shutdown and initializes a restart.
......
1390 1389
  RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA | RCC_AHB1Periph_GPIOB | RCC_AHB1Periph_GPIOC | RCC_AHB1Periph_GPIOD, ENABLE);
1391 1390
  RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR, ENABLE);
1392 1391

  
1393
  /* set/keep the SYS_SYNC and SYS_PD signal active */
1392
  /* set/keep the SYS_SYNC and SYS_PD signals active */
1394 1393
  GPIO_ResetBits(SYS_SYNC_N_GPIO, SYS_SYNC_N_PIN);
1395 1394
  GPIO_ResetBits(SYS_PD_N_GPIO, SYS_PD_N_PIN);
1396 1395

  
......
1423 1422
  shutdownAndRestart();
1424 1423

  
1425 1424
  return;
1426
} /*** end of bLCallbackRestart ***/
1427

  
1425
} /*** end of blCallbackRestart ***/
1428 1426

  
1429 1427
/*
1430 1428
 * Callback function that handles a system shutdown/restart request from another module.
......
1436 1434
  RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA | RCC_AHB1Periph_GPIOB | RCC_AHB1Periph_GPIOC | RCC_AHB1Periph_GPIOD, ENABLE);
1437 1435
  RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR, ENABLE);
1438 1436

  
1439
  /* set/keep the SYS_SYNC and SYS_PD signal active */
1437
  /* set/keep the SYS_SYNC and SYS_PD signals active */
1440 1438
  GPIO_ResetBits(SYS_SYNC_N_GPIO, SYS_SYNC_N_PIN);
1441 1439
  GPIO_ResetBits(SYS_PD_N_GPIO, SYS_PD_N_PIN);
1442 1440

  
......
1453 1451
  /* wait for all boards to be ready for shutdown */
1454 1452
  GPIO_SetBits(SYS_SYNC_N_GPIO, SYS_SYNC_N_PIN);
1455 1453
  if (GPIO_ReadOutputDataBit(SYS_REG_EN_GPIO, SYS_REG_EN_PIN) == Bit_SET) {
1456
    // this must skipped if the pullup voltage (VIO3.3) is not active
1454
    // this must be skipped if the pullup voltage (VIO3.3) is not active
1457 1455
    setLed(BLT_TRUE);
1458 1456
    waitForSignal(SYS_SYNC_N_GPIO, SYS_SYNC_N_PIN, Bit_SET);
1459 1457
    setLed(BLT_FALSE);
......
1510 1508
  return;
1511 1509
} /*** end of blCallbackHandleShutdownRequest ***/
1512 1510

  
1513

  
1514 1511
/*********************************** end of main.c *************************************/

Also available in: Unified diff