WizziLab / modem_ref_v5_3_217

Dependents:   modem_ref_helper_for_v5_3_217

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers cup.h Source File

cup.h

Go to the documentation of this file.
00001 /// @copyright
00002 /// ========================================================================={{{
00003 /// Copyright (c) 2012-2013 WizziLab                                           /
00004 /// All rights reserved                                                        /
00005 /// =========================================================================}}}
00006 /// @endcopyright
00007 
00008 //  =======================================================================
00009 /// @file           cup.h
00010 /// @brief          Code Upgrade public header 
00011 //  =======================================================================
00012 
00013 #ifndef __CUP_H__
00014 #define __CUP_H__
00015 
00016 
00017 // Delay between a (Valid) START and actual reboot.
00018 // Should let enough time for responding to the guy that started the CUP.
00019 #define CUP_REBOOT_DELAY            600
00020 
00021 // Delay for interface response.
00022 // Should let enough time for responding to the guy that issued the command.
00023 #define CUP_RESP_DELAY              100
00024 
00025 // CUP Command Codes
00026 #define CUP_CMD_UPGRADE_UPLOAD      0x10AD
00027 #define CUP_CMD_UPGRADE_UPLOAD_ALT  0x10AC
00028 #define CUP_CMD_UPGRADE_START       0xC0D5
00029 #define CUP_CMD_UPGRADE_CONFIRMED   0xC0DC
00030 #define CUP_CMD_UPGRADE_DONE        0xC0DD
00031 #define CUP_CMD_UPGRADE_FILE_START  0xF105
00032 #define CUP_CMD_UPGRADE_FILE_END    0xF10E
00033 #define CUP_CMD_UPGRADE_FAIL        0xFA17
00034 #define CUP_CMD_UPGRADE_FLASH_ERROR 0xFE44
00035 
00036 // File Indexes
00037 //#define CUP_CFG_FILE_ID             0x0
00038 //#define CUP_CODE_FILE_ID            0x0
00039 
00040 // STRUCTURES
00041 //======================================================================
00042 
00043 //======================================================================
00044 // cup_cfg_t
00045 //----------------------------------------------------------------------
00046 /// @brief  This is the structure of the CUP Config FILE.
00047 ///         This file _MUST_ always be located a the same place (EEPROM
00048 ///         Origin) as BOOT/CUP access it in a hardcoded way.
00049 /// !! Do NOT touch this except if you're a CUP Master !!
00050 //======================================================================
00051 TYPEDEF_STRUCT_PACKED
00052 {
00053     // The CUP Command
00054     u16 cmd;
00055     // Number of Archives to be CUP'ed
00056     u16 arch_nb;
00057     // This field has 2 meanings:
00058     // - when read-out it gives start address of CUP-Code file
00059     // - when written (for a CUP start) it gives the offset (in bytes) at
00060     //   which the first archive is stored in CUP-Code file
00061     u32 src_offset;
00062     // CRC32 of the arch_nb concatenated archives starting at offset
00063     u32 signature;
00064     // TODO: Deciphering key
00065     u32 key;
00066     // Debug / Uart config
00067     u32 dbg_cfg;
00068 } cup_cfg_t;
00069 
00070 //======================================================================
00071 // cup_cfg_bcast_header_t
00072 //----------------------------------------------------------------------
00073 /// @brief CUP broadcast configuration header (RAM file)
00074 /// !! Do NOT touch this except if you're a CUP Master !!
00075 //======================================================================
00076 TYPEDEF_STRUCT_PACKED
00077 {
00078     /// Bitmap start offset. Will differ from the
00079     /// CUP offset if the first chunk(s) are not received
00080     u32 start;
00081     /// Transfer length. Will differ from the CUP length 
00082     /// if the last chunk(s) are not received.
00083     u32 len;
00084     /// Transfer command / status
00085     u16 cmd;
00086     /// Chunk size used to generate the bitmap.
00087     /// It is assumed that all chunks except the last 
00088     /// have the same size
00089     u8  chunk;
00090     /// CUP timeout in seconds
00091     u8  to;
00092     /// new signature (command)
00093     u32 sig_new;
00094     /// current signature (status)
00095     u32 sig_curr;
00096     /// missed
00097     u16 missed;
00098     // RFU
00099     u8  rfu;
00100     /// signature status
00101     u8  crc_ok;
00102 
00103 } cup_cfg_bcast_header_t;
00104 
00105 //======================================================================
00106 // cup_cfg_bcast_t
00107 //----------------------------------------------------------------------
00108 /// @brief CUP broadcast configuration (RAM file)
00109 /// !! Do NOT touch this except if you're a CUP Master !!
00110 //======================================================================
00111 #define CUP_STATUS_BITMAP_LEN       (200)
00112 TYPEDEF_STRUCT_PACKED
00113 {
00114     /// CUP broadcast configuration header
00115     cup_cfg_bcast_header_t header;
00116     /// Bitmap buffer
00117     u8  bitmap[CUP_STATUS_BITMAP_LEN];
00118 
00119 } cup_cfg_bcast_t;
00120 
00121 #endif // __CUP_H__
00122 /// @}
00123 // vim:fdm=marker:fdc=2