amiro-blt / Target / Source / boot.c @ 0dc9f2f9
History | View | Annotate | Download (3.815 KB)
| 1 | 69661903 | Thomas Schöpping | /************************************************************************************//** |
|---|---|---|---|
| 2 | * \file Source\boot.c
|
||
| 3 | * \brief Bootloader core module source file.
|
||
| 4 | * \ingroup Core
|
||
| 5 | * \internal
|
||
| 6 | *----------------------------------------------------------------------------------------
|
||
| 7 | * C O P Y R I G H T
|
||
| 8 | *----------------------------------------------------------------------------------------
|
||
| 9 | * Copyright (c) 2011 by Feaser http://www.feaser.com All rights reserved
|
||
| 10 | *
|
||
| 11 | *----------------------------------------------------------------------------------------
|
||
| 12 | * L I C E N S E
|
||
| 13 | *----------------------------------------------------------------------------------------
|
||
| 14 | * This file is part of OpenBLT. OpenBLT is free software: you can redistribute it and/or
|
||
| 15 | * modify it under the terms of the GNU General Public License as published by the Free
|
||
| 16 | * Software Foundation, either version 3 of the License, or (at your option) any later
|
||
| 17 | * version.
|
||
| 18 | *
|
||
| 19 | * OpenBLT is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||
| 20 | * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||
| 21 | * PURPOSE. See the GNU General Public License for more details.
|
||
| 22 | *
|
||
| 23 | * You should have received a copy of the GNU General Public License along with OpenBLT.
|
||
| 24 | * If not, see <http://www.gnu.org/licenses/>.
|
||
| 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
|
||
| 28 | * proprietary components. The exception text is included at the bottom of the license
|
||
| 29 | * file <license.html>.
|
||
| 30 | *
|
||
| 31 | * \endinternal
|
||
| 32 | ****************************************************************************************/
|
||
| 33 | |||
| 34 | /****************************************************************************************
|
||
| 35 | * Include files
|
||
| 36 | ****************************************************************************************/
|
||
| 37 | #include "boot.h" /* bootloader generic header */ |
||
| 38 | |||
| 39 | |||
| 40 | /************************************************************************************//** |
||
| 41 | ** \brief Initializes the bootloader core.
|
||
| 42 | ** \return none
|
||
| 43 | **
|
||
| 44 | ****************************************************************************************/
|
||
| 45 | void BootInit(void) |
||
| 46 | {
|
||
| 47 | /* initialize the watchdog */
|
||
| 48 | CopInit(); |
||
| 49 | /* initialize the millisecond timer */
|
||
| 50 | TimerInit(); |
||
| 51 | /* initialize the non-volatile memory driver */
|
||
| 52 | NvmInit(); |
||
| 53 | #if (BOOT_FILE_SYS_ENABLE > 0) |
||
| 54 | /* initialize the file system module */
|
||
| 55 | FileInit(); |
||
| 56 | #endif
|
||
| 57 | #if (BOOT_COM_ENABLE > 0) |
||
| 58 | /* initialize the communication module */
|
||
| 59 | ComInit(); |
||
| 60 | #endif
|
||
| 61 | #if (BOOT_GATE_ENABLE > 0) |
||
| 62 | /* initialize the gateway module */
|
||
| 63 | GateInit(); |
||
| 64 | #endif
|
||
| 65 | /* initialize the backdoor entry */
|
||
| 66 | BackDoorInit(); |
||
| 67 | } /*** end of BootInit ***/
|
||
| 68 | |||
| 69 | |||
| 70 | /************************************************************************************//** |
||
| 71 | ** \brief Task function of the bootloader core that drives the program.
|
||
| 72 | ** \return none
|
||
| 73 | **
|
||
| 74 | ****************************************************************************************/
|
||
| 75 | void BootTask(void) |
||
| 76 | {
|
||
| 77 | /* service the watchdog */
|
||
| 78 | CopService(); |
||
| 79 | /* update the millisecond timer */
|
||
| 80 | TimerUpdate(); |
||
| 81 | #if (BOOT_FILE_SYS_ENABLE > 0) |
||
| 82 | /* call worker task for updating firmware from locally attached file storage */
|
||
| 83 | FileTask(); |
||
| 84 | #endif /* BOOT_FILE_SYS_ENABLE > 0 */ |
||
| 85 | #if (BOOT_GATE_ENABLE > 0) |
||
| 86 | /* process possibly pending communication data */
|
||
| 87 | GateTask(); |
||
| 88 | #endif
|
||
| 89 | #if (BOOT_COM_ENABLE > 0) |
||
| 90 | /* process possibly pending communication data */
|
||
| 91 | ComTask(); |
||
| 92 | #endif
|
||
| 93 | /* control the backdoor */
|
||
| 94 | BackDoorCheck(); |
||
| 95 | } /*** end of BootTask ***/
|
||
| 96 | |||
| 97 | |||
| 98 | /*********************************** end of boot.c *************************************/
|