Exportable version of WizziLab's modem driver.
include/cup.h@45:6a4c373e1178, 2019-02-20 (annotated)
- Committer:
- Jeej
- Date:
- Wed Feb 20 13:43:19 2019 +0000
- Revision:
- 45:6a4c373e1178
- Parent:
- 37:f5424d109c6d
- Child:
- 52:cce5347a94af
Fix typo.
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 | 37:f5424d109c6d | 20 | |
Jeej | 37:f5424d109c6d | 21 | // Delay for interface response. |
Jeej | 37:f5424d109c6d | 22 | // Should let enough time for responding to the guy that issued the command. |
Jeej | 37:f5424d109c6d | 23 | #define CUP_RESP_DELAY 100 |
Jeej | 37:f5424d109c6d | 24 | |
Jeej | 23:5553f9541759 | 25 | // CUP Command Codes |
Jeej | 23:5553f9541759 | 26 | #define CUP_CMD_UPGRADE_UPLOAD 0x10AD |
Jeej | 37:f5424d109c6d | 27 | #define CUP_CMD_UPGRADE_UPLOAD_ALT 0x10AC |
Jeej | 23:5553f9541759 | 28 | #define CUP_CMD_UPGRADE_START 0xC0D5 |
Jeej | 23:5553f9541759 | 29 | #define CUP_CMD_UPGRADE_CONFIRMED 0xC0DC |
Jeej | 23:5553f9541759 | 30 | #define CUP_CMD_UPGRADE_DONE 0xC0DD |
Jeej | 23:5553f9541759 | 31 | #define CUP_CMD_UPGRADE_FILE_START 0xF105 |
Jeej | 23:5553f9541759 | 32 | #define CUP_CMD_UPGRADE_FILE_END 0xF10E |
Jeej | 23:5553f9541759 | 33 | #define CUP_CMD_UPGRADE_FAIL 0xFA17 |
Jeej | 23:5553f9541759 | 34 | #define CUP_CMD_UPGRADE_FLASH_ERROR 0xFE44 |
Jeej | 23:5553f9541759 | 35 | |
Jeej | 35:ac940cf8ebe6 | 36 | // File Indexes |
Jeej | 35:ac940cf8ebe6 | 37 | //#define CUP_CFG_FILE_ID 0x0 |
Jeej | 35:ac940cf8ebe6 | 38 | //#define CUP_CODE_FILE_ID 0x0 |
Jeej | 35:ac940cf8ebe6 | 39 | |
Jeej | 23:5553f9541759 | 40 | // STRUCTURES |
Jeej | 23:5553f9541759 | 41 | //====================================================================== |
Jeej | 23:5553f9541759 | 42 | |
Jeej | 23:5553f9541759 | 43 | //====================================================================== |
Jeej | 23:5553f9541759 | 44 | // cup_cfg_t |
Jeej | 23:5553f9541759 | 45 | //---------------------------------------------------------------------- |
Jeej | 23:5553f9541759 | 46 | /// @brief This is the structure of the CUP Config FILE. |
Jeej | 23:5553f9541759 | 47 | /// This file _MUST_ always be located a the same place (EEPROM |
Jeej | 23:5553f9541759 | 48 | /// Origin) as BOOT/CUP access it in a hardcoded way. |
Jeej | 23:5553f9541759 | 49 | /// !! Do NOT touch this except if you're a CUP Master !! |
Jeej | 23:5553f9541759 | 50 | //====================================================================== |
Jeej | 23:5553f9541759 | 51 | TYPEDEF_STRUCT_PACKED |
Jeej | 23:5553f9541759 | 52 | { |
Jeej | 23:5553f9541759 | 53 | // The CUP Command |
Jeej | 23:5553f9541759 | 54 | u16 cmd; |
Jeej | 23:5553f9541759 | 55 | // Number of Archives to be CUP'ed |
Jeej | 23:5553f9541759 | 56 | u16 arch_nb; |
Jeej | 23:5553f9541759 | 57 | // This field has 2 meanings: |
Jeej | 23:5553f9541759 | 58 | // - when read-out it gives start address of CUP-Code file |
Jeej | 23:5553f9541759 | 59 | // - when written (for a CUP start) it gives the offset (in bytes) at |
Jeej | 23:5553f9541759 | 60 | // which the first archive is stored in CUP-Code file |
Jeej | 23:5553f9541759 | 61 | u32 src_offset; |
Jeej | 23:5553f9541759 | 62 | // CRC32 of the arch_nb concatenated archives starting at offset |
Jeej | 23:5553f9541759 | 63 | u32 signature; |
Jeej | 23:5553f9541759 | 64 | // TODO: Deciphering key |
Jeej | 23:5553f9541759 | 65 | u32 key; |
Jeej | 23:5553f9541759 | 66 | // Debug / Uart config |
Jeej | 23:5553f9541759 | 67 | u32 dbg_cfg; |
Jeej | 23:5553f9541759 | 68 | } cup_cfg_t; |
Jeej | 23:5553f9541759 | 69 | |
Jeej | 29:9c8c46206eab | 70 | //====================================================================== |
Jeej | 29:9c8c46206eab | 71 | // cup_cfg_bcast_header_t |
Jeej | 29:9c8c46206eab | 72 | //---------------------------------------------------------------------- |
Jeej | 29:9c8c46206eab | 73 | /// @brief CUP broadcast configuration header (RAM file) |
Jeej | 29:9c8c46206eab | 74 | /// !! Do NOT touch this except if you're a CUP Master !! |
Jeej | 29:9c8c46206eab | 75 | //====================================================================== |
Jeej | 29:9c8c46206eab | 76 | TYPEDEF_STRUCT_PACKED |
Jeej | 29:9c8c46206eab | 77 | { |
Jeej | 29:9c8c46206eab | 78 | /// Bitmap start offset. Will differ from the |
Jeej | 29:9c8c46206eab | 79 | /// CUP offset if the first chunk(s) are not received |
Jeej | 29:9c8c46206eab | 80 | u32 start; |
Jeej | 29:9c8c46206eab | 81 | /// Transfer length. Will differ from the CUP length |
Jeej | 29:9c8c46206eab | 82 | /// if the last chunk(s) are not received. |
Jeej | 29:9c8c46206eab | 83 | u32 len; |
Jeej | 29:9c8c46206eab | 84 | /// Transfer command / status |
Jeej | 29:9c8c46206eab | 85 | u16 cmd; |
Jeej | 29:9c8c46206eab | 86 | /// Chunk size used to generate the bitmap. |
Jeej | 29:9c8c46206eab | 87 | /// It is assumed that all chunks except the last |
Jeej | 29:9c8c46206eab | 88 | /// have the same size |
Jeej | 29:9c8c46206eab | 89 | u8 chunk; |
Jeej | 29:9c8c46206eab | 90 | /// CUP timeout in seconds |
Jeej | 29:9c8c46206eab | 91 | u8 to; |
Jeej | 29:9c8c46206eab | 92 | /// new signature (command) |
Jeej | 29:9c8c46206eab | 93 | u32 sig_new; |
Jeej | 29:9c8c46206eab | 94 | /// current signature (status) |
Jeej | 29:9c8c46206eab | 95 | u32 sig_curr; |
Jeej | 29:9c8c46206eab | 96 | /// missed |
Jeej | 29:9c8c46206eab | 97 | u16 missed; |
Jeej | 29:9c8c46206eab | 98 | // RFU |
Jeej | 29:9c8c46206eab | 99 | u8 rfu; |
Jeej | 29:9c8c46206eab | 100 | /// signature status |
Jeej | 29:9c8c46206eab | 101 | u8 crc_ok; |
Jeej | 29:9c8c46206eab | 102 | |
Jeej | 29:9c8c46206eab | 103 | } cup_cfg_bcast_header_t; |
Jeej | 29:9c8c46206eab | 104 | |
Jeej | 29:9c8c46206eab | 105 | //====================================================================== |
Jeej | 29:9c8c46206eab | 106 | // cup_cfg_bcast_t |
Jeej | 29:9c8c46206eab | 107 | //---------------------------------------------------------------------- |
Jeej | 29:9c8c46206eab | 108 | /// @brief CUP broadcast configuration (RAM file) |
Jeej | 29:9c8c46206eab | 109 | /// !! Do NOT touch this except if you're a CUP Master !! |
Jeej | 29:9c8c46206eab | 110 | //====================================================================== |
Jeej | 29:9c8c46206eab | 111 | #define CUP_STATUS_BITMAP_LEN (128) |
Jeej | 29:9c8c46206eab | 112 | TYPEDEF_STRUCT_PACKED |
Jeej | 29:9c8c46206eab | 113 | { |
Jeej | 29:9c8c46206eab | 114 | /// CUP broadcast configuration header |
Jeej | 29:9c8c46206eab | 115 | cup_cfg_bcast_header_t header; |
Jeej | 29:9c8c46206eab | 116 | /// Bitmap buffer |
Jeej | 29:9c8c46206eab | 117 | u8 bitmap[CUP_STATUS_BITMAP_LEN]; |
Jeej | 29:9c8c46206eab | 118 | |
Jeej | 29:9c8c46206eab | 119 | } cup_cfg_bcast_t; |
Jeej | 29:9c8c46206eab | 120 | |
Jeej | 23:5553f9541759 | 121 | #endif // __CUP_H__ |
Jeej | 23:5553f9541759 | 122 | /// @} |
Jeej | 23:5553f9541759 | 123 | // vim:fdm=marker:fdc=2 |