Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
include/cup.h@23:5553f9541759, 2018-01-31 (annotated)
- Committer:
- Jeej
- Date:
- Wed Jan 31 11:34:16 2018 +0000
- Revision:
- 23:5553f9541759
- Child:
- 29:9c8c46206eab
Added cup file.
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| Jeej | 23:5553f9541759 | 1 | /// @copyright |
| Jeej | 23:5553f9541759 | 2 | /// ========================================================================={{{ |
| Jeej | 23:5553f9541759 | 3 | /// Copyright (c) 2012-2013 WizziLab / |
| Jeej | 23:5553f9541759 | 4 | /// All rights reserved / |
| Jeej | 23:5553f9541759 | 5 | /// =========================================================================}}} |
| Jeej | 23:5553f9541759 | 6 | /// @endcopyright |
| Jeej | 23:5553f9541759 | 7 | |
| Jeej | 23:5553f9541759 | 8 | // ======================================================================= |
| Jeej | 23:5553f9541759 | 9 | /// @file cup.h |
| Jeej | 23:5553f9541759 | 10 | /// @brief Code Upgrade public header |
| Jeej | 23:5553f9541759 | 11 | // ======================================================================= |
| Jeej | 23:5553f9541759 | 12 | |
| Jeej | 23:5553f9541759 | 13 | #ifndef __CUP_H__ |
| Jeej | 23:5553f9541759 | 14 | #define __CUP_H__ |
| Jeej | 23:5553f9541759 | 15 | |
| Jeej | 23:5553f9541759 | 16 | |
| Jeej | 23:5553f9541759 | 17 | // Delay between a (Valid) START and actual reboot. |
| Jeej | 23:5553f9541759 | 18 | // Should let enough time for responding to the guy that started the CUP. |
| Jeej | 23:5553f9541759 | 19 | #define CUP_REBOOT_DELAY 600 |
| Jeej | 23:5553f9541759 | 20 | // CUP Command Codes |
| Jeej | 23:5553f9541759 | 21 | #define CUP_CMD_UPGRADE_UPLOAD 0x10AD |
| Jeej | 23:5553f9541759 | 22 | #define CUP_CMD_UPGRADE_START 0xC0D5 |
| Jeej | 23:5553f9541759 | 23 | #define CUP_CMD_UPGRADE_CONFIRMED 0xC0DC |
| Jeej | 23:5553f9541759 | 24 | #define CUP_CMD_UPGRADE_DONE 0xC0DD |
| Jeej | 23:5553f9541759 | 25 | #define CUP_CMD_UPGRADE_FILE_START 0xF105 |
| Jeej | 23:5553f9541759 | 26 | #define CUP_CMD_UPGRADE_FILE_END 0xF10E |
| Jeej | 23:5553f9541759 | 27 | #define CUP_CMD_UPGRADE_FAIL 0xFA17 |
| Jeej | 23:5553f9541759 | 28 | #define CUP_CMD_UPGRADE_FLASH_ERROR 0xFE44 |
| Jeej | 23:5553f9541759 | 29 | |
| Jeej | 23:5553f9541759 | 30 | // STRUCTURES |
| Jeej | 23:5553f9541759 | 31 | //====================================================================== |
| Jeej | 23:5553f9541759 | 32 | |
| Jeej | 23:5553f9541759 | 33 | //====================================================================== |
| Jeej | 23:5553f9541759 | 34 | // cup_cfg_t |
| Jeej | 23:5553f9541759 | 35 | //---------------------------------------------------------------------- |
| Jeej | 23:5553f9541759 | 36 | /// @brief This is the structure of the CUP Config FILE. |
| Jeej | 23:5553f9541759 | 37 | /// This file _MUST_ always be located a the same place (EEPROM |
| Jeej | 23:5553f9541759 | 38 | /// Origin) as BOOT/CUP access it in a hardcoded way. |
| Jeej | 23:5553f9541759 | 39 | /// !! Do NOT touch this except if you're a CUP Master !! |
| Jeej | 23:5553f9541759 | 40 | //====================================================================== |
| Jeej | 23:5553f9541759 | 41 | TYPEDEF_STRUCT_PACKED |
| Jeej | 23:5553f9541759 | 42 | { |
| Jeej | 23:5553f9541759 | 43 | // The CUP Command |
| Jeej | 23:5553f9541759 | 44 | u16 cmd; |
| Jeej | 23:5553f9541759 | 45 | // Number of Archives to be CUP'ed |
| Jeej | 23:5553f9541759 | 46 | u16 arch_nb; |
| Jeej | 23:5553f9541759 | 47 | // This field has 2 meanings: |
| Jeej | 23:5553f9541759 | 48 | // - when read-out it gives start address of CUP-Code file |
| Jeej | 23:5553f9541759 | 49 | // - when written (for a CUP start) it gives the offset (in bytes) at |
| Jeej | 23:5553f9541759 | 50 | // which the first archive is stored in CUP-Code file |
| Jeej | 23:5553f9541759 | 51 | u32 src_offset; |
| Jeej | 23:5553f9541759 | 52 | // CRC32 of the arch_nb concatenated archives starting at offset |
| Jeej | 23:5553f9541759 | 53 | u32 signature; |
| Jeej | 23:5553f9541759 | 54 | // TODO: Deciphering key |
| Jeej | 23:5553f9541759 | 55 | u32 key; |
| Jeej | 23:5553f9541759 | 56 | // Debug / Uart config |
| Jeej | 23:5553f9541759 | 57 | u32 dbg_cfg; |
| Jeej | 23:5553f9541759 | 58 | } cup_cfg_t; |
| Jeej | 23:5553f9541759 | 59 | |
| Jeej | 23:5553f9541759 | 60 | #endif // __CUP_H__ |
| Jeej | 23:5553f9541759 | 61 | /// @} |
| Jeej | 23:5553f9541759 | 62 | // vim:fdm=marker:fdc=2 |