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.
Dependents: modem_ref_helper_for_v5_3_217
alp.h@0:027760f45e2c, 2017-05-03 (annotated)
- Committer:
- Jeej
- Date:
- Wed May 03 11:29:16 2017 +0000
- Revision:
- 0:027760f45e2c
- Child:
- 1:40ead20ecb14
Exportable version of WizziLab's modem driver.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Jeej | 0:027760f45e2c | 1 | /// @copyright |
Jeej | 0:027760f45e2c | 2 | /// ========================================================================={{{ |
Jeej | 0:027760f45e2c | 3 | /// Copyright (c) 2012-2013 WizziLab / |
Jeej | 0:027760f45e2c | 4 | /// All rights reserved / |
Jeej | 0:027760f45e2c | 5 | /// / |
Jeej | 0:027760f45e2c | 6 | /// IMPORTANT: This Software may not be modified, copied or distributed unless / |
Jeej | 0:027760f45e2c | 7 | /// embedded on a WizziLab product. Other than for the foregoing purpose, this / |
Jeej | 0:027760f45e2c | 8 | /// Software and/or its documentation may not be used, reproduced, copied, / |
Jeej | 0:027760f45e2c | 9 | /// prepared derivative works of, modified, performed, distributed, displayed / |
Jeej | 0:027760f45e2c | 10 | /// or sold for any purpose. For the sole purpose of embedding this Software / |
Jeej | 0:027760f45e2c | 11 | /// on a WizziLab product, copy, modification and distribution of this / |
Jeej | 0:027760f45e2c | 12 | /// Software is granted provided that the following conditions are respected: / |
Jeej | 0:027760f45e2c | 13 | /// / |
Jeej | 0:027760f45e2c | 14 | /// * Redistributions of source code must retain the above copyright notice, / |
Jeej | 0:027760f45e2c | 15 | /// this list of conditions and the following disclaimer / |
Jeej | 0:027760f45e2c | 16 | /// / |
Jeej | 0:027760f45e2c | 17 | /// * Redistributions in binary form must reproduce the above copyright / |
Jeej | 0:027760f45e2c | 18 | /// notice, this list of conditions and the following disclaimer in the / |
Jeej | 0:027760f45e2c | 19 | /// documentation and/or other materials provided with the distribution. / |
Jeej | 0:027760f45e2c | 20 | /// / |
Jeej | 0:027760f45e2c | 21 | /// * The name of WizziLab can not be used to endorse or promote products / |
Jeej | 0:027760f45e2c | 22 | /// derived from this software without specific prior written permission. / |
Jeej | 0:027760f45e2c | 23 | /// / |
Jeej | 0:027760f45e2c | 24 | /// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS / |
Jeej | 0:027760f45e2c | 25 | /// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED / |
Jeej | 0:027760f45e2c | 26 | /// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR / |
Jeej | 0:027760f45e2c | 27 | /// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR / |
Jeej | 0:027760f45e2c | 28 | /// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, / |
Jeej | 0:027760f45e2c | 29 | /// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, / |
Jeej | 0:027760f45e2c | 30 | /// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, / |
Jeej | 0:027760f45e2c | 31 | /// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY / |
Jeej | 0:027760f45e2c | 32 | /// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING / |
Jeej | 0:027760f45e2c | 33 | /// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS / |
Jeej | 0:027760f45e2c | 34 | /// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. / |
Jeej | 0:027760f45e2c | 35 | /// WIZZILAB HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, / |
Jeej | 0:027760f45e2c | 36 | /// ENHANCEMENTS OR MODIFICATIONS. / |
Jeej | 0:027760f45e2c | 37 | /// / |
Jeej | 0:027760f45e2c | 38 | /// Should you have any questions regarding your right to use this Software, / |
Jeej | 0:027760f45e2c | 39 | /// contact WizziLab at www.wizzilab.com. / |
Jeej | 0:027760f45e2c | 40 | /// / |
Jeej | 0:027760f45e2c | 41 | /// =========================================================================}}} |
Jeej | 0:027760f45e2c | 42 | /// @endcopyright |
Jeej | 0:027760f45e2c | 43 | |
Jeej | 0:027760f45e2c | 44 | // ======================================================================= |
Jeej | 0:027760f45e2c | 45 | /// @file alp.h |
Jeej | 0:027760f45e2c | 46 | /// @brief Wizzilab's specific ALP definitions |
Jeej | 0:027760f45e2c | 47 | /// @defgroup ALP |
Jeej | 0:027760f45e2c | 48 | // ======================================================================= |
Jeej | 0:027760f45e2c | 49 | |
Jeej | 0:027760f45e2c | 50 | #ifndef __ALP_H__ |
Jeej | 0:027760f45e2c | 51 | #define __ALP_H__ |
Jeej | 0:027760f45e2c | 52 | |
Jeej | 0:027760f45e2c | 53 | // D7A spec |
Jeej | 0:027760f45e2c | 54 | #include "alp_spec.h" |
Jeej | 0:027760f45e2c | 55 | // helpers |
Jeej | 0:027760f45e2c | 56 | #include "alp_helpers.h" |
Jeej | 0:027760f45e2c | 57 | // D7AActP Substitution modes: |
Jeej | 0:027760f45e2c | 58 | // ---------------------------------------------------------------------- |
Jeej | 0:027760f45e2c | 59 | // MODE1: replace FID= actp.fid, offset=0, length=(actp.fid).length |
Jeej | 0:027760f45e2c | 60 | // MODE2: replace FID= actp.fid, offset=actp.offset, length=actp.length |
Jeej | 0:027760f45e2c | 61 | // ====================================================================== |
Jeej | 0:027760f45e2c | 62 | typedef enum { |
Jeej | 0:027760f45e2c | 63 | ACTP_SUBST_NONE = 0, |
Jeej | 0:027760f45e2c | 64 | ACTP_SUBST_MODE1, |
Jeej | 0:027760f45e2c | 65 | ACTP_SUBST_MODE2, |
Jeej | 0:027760f45e2c | 66 | } alp_actp_substitution_mode_t; |
Jeej | 0:027760f45e2c | 67 | |
Jeej | 0:027760f45e2c | 68 | typedef union { |
Jeej | 0:027760f45e2c | 69 | struct { |
Jeej | 0:027760f45e2c | 70 | u8 fid; |
Jeej | 0:027760f45e2c | 71 | u8 error; |
Jeej | 0:027760f45e2c | 72 | }; |
Jeej | 0:027760f45e2c | 73 | } alp_evt_done_evp_t; |
Jeej | 0:027760f45e2c | 74 | |
Jeej | 0:027760f45e2c | 75 | typedef enum { |
Jeej | 0:027760f45e2c | 76 | ALP_ITF_FID_COM0, |
Jeej | 0:027760f45e2c | 77 | ALP_ITF_FID_COM1, |
Jeej | 0:027760f45e2c | 78 | ALP_ITF_FID_COM2, |
Jeej | 0:027760f45e2c | 79 | ALP_ITF_FID_BLE, |
Jeej | 0:027760f45e2c | 80 | } alp_itf_fixed_fids_t; |
Jeej | 0:027760f45e2c | 81 | |
Jeej | 0:027760f45e2c | 82 | typedef enum { |
Jeej | 0:027760f45e2c | 83 | ALP_ITF_TYPE_HOST = 0x00, |
Jeej | 0:027760f45e2c | 84 | ALP_ITF_TYPE_BLE = 0xB0, |
Jeej | 0:027760f45e2c | 85 | ALP_ITF_TYPE_COM = 0xC0, |
Jeej | 0:027760f45e2c | 86 | ALP_ITF_TYPE_D7A = 0xD7, |
Jeej | 0:027760f45e2c | 87 | ALP_ITF_TYPE_LWAN = 0x10, |
Jeej | 0:027760f45e2c | 88 | } alp_itf_type_t; |
Jeej | 0:027760f45e2c | 89 | |
Jeej | 0:027760f45e2c | 90 | typedef enum { |
Jeej | 0:027760f45e2c | 91 | ALP_ROLE_ROOT = 0xFF, |
Jeej | 0:027760f45e2c | 92 | ALP_ROLE_USER = 0x38, |
Jeej | 0:027760f45e2c | 93 | ALP_ROLE_GUEST = 0x07, |
Jeej | 0:027760f45e2c | 94 | } alp_role_t; |
Jeej | 0:027760f45e2c | 95 | |
Jeej | 0:027760f45e2c | 96 | typedef enum { |
Jeej | 0:027760f45e2c | 97 | ALP_RPOL_EP_ONESHOT = 0, |
Jeej | 0:027760f45e2c | 98 | ALP_RPOL_EP_SINGLE = 1, |
Jeej | 0:027760f45e2c | 99 | ALP_RPOL_EP_REPORT = 2, |
Jeej | 0:027760f45e2c | 100 | ALP_RPOL_EP_REPORT_CHECKED = 3, |
Jeej | 0:027760f45e2c | 101 | ALP_RPOL_EP_BULK = 4, |
Jeej | 0:027760f45e2c | 102 | ALP_RPOL_GW_ONESHOT = 5, |
Jeej | 0:027760f45e2c | 103 | ALP_RPOL_GW_BULK = 6, |
Jeej | 0:027760f45e2c | 104 | ALP_RPOL_BLINK = 7, |
Jeej | 0:027760f45e2c | 105 | |
Jeej | 0:027760f45e2c | 106 | ALP_RPOL_QTY, |
Jeej | 0:027760f45e2c | 107 | } alp_rpol_t; |
Jeej | 0:027760f45e2c | 108 | |
Jeej | 0:027760f45e2c | 109 | typedef enum { |
Jeej | 0:027760f45e2c | 110 | ALP_BOFF_NONE = 0, |
Jeej | 0:027760f45e2c | 111 | ALP_BOFF_LINEAR = 1, |
Jeej | 0:027760f45e2c | 112 | ALP_BOFF_EXP = 2, |
Jeej | 0:027760f45e2c | 113 | |
Jeej | 0:027760f45e2c | 114 | ALP_BOFF_QTY |
Jeej | 0:027760f45e2c | 115 | } alp_rpol_backoff_proc_t; |
Jeej | 0:027760f45e2c | 116 | |
Jeej | 0:027760f45e2c | 117 | |
Jeej | 0:027760f45e2c | 118 | // Event parameter for ALP_EVT_URC |
Jeej | 0:027760f45e2c | 119 | typedef union { |
Jeej | 0:027760f45e2c | 120 | struct { |
Jeej | 0:027760f45e2c | 121 | u8 type; |
Jeej | 0:027760f45e2c | 122 | u8 ifid; |
Jeej | 0:027760f45e2c | 123 | u8 value; |
Jeej | 0:027760f45e2c | 124 | }; |
Jeej | 0:027760f45e2c | 125 | } alp_urc_evp_t; |
Jeej | 0:027760f45e2c | 126 | |
Jeej | 0:027760f45e2c | 127 | TYPEDEF_STRUCT_PACKED { |
Jeej | 0:027760f45e2c | 128 | u8 ifid; |
Jeej | 0:027760f45e2c | 129 | u8 report_freq; |
Jeej | 0:027760f45e2c | 130 | } alp_urc_lqual_params_t; |
Jeej | 0:027760f45e2c | 131 | |
Jeej | 0:027760f45e2c | 132 | TYPEDEF_STRUCT_PACKED { |
Jeej | 0:027760f45e2c | 133 | u8 ifid; |
Jeej | 0:027760f45e2c | 134 | u8 max_consecutive_errors; |
Jeej | 0:027760f45e2c | 135 | } alp_urc_ldown_params_t; |
Jeej | 0:027760f45e2c | 136 | |
Jeej | 0:027760f45e2c | 137 | // ALP D7 "Retry-policies" description |
Jeej | 0:027760f45e2c | 138 | // ---------------------------------------------------------------------- |
Jeej | 0:027760f45e2c | 139 | // Retry-policies (also called QoS) are defining an application level |
Jeej | 0:027760f45e2c | 140 | // set of parameters such as automatic retry in case of failure, termination |
Jeej | 0:027760f45e2c | 141 | // messaging and other implementation dependent settings. |
Jeej | 0:027760f45e2c | 142 | // ====================================================================== |
Jeej | 0:027760f45e2c | 143 | TYPEDEF_STRUCT_PACKED { |
Jeej | 0:027760f45e2c | 144 | struct { |
Jeej | 0:027760f45e2c | 145 | /// Backoff time generator for retry attempts |
Jeej | 0:027760f45e2c | 146 | u8 procedure : 4; |
Jeej | 0:027760f45e2c | 147 | /// On transmission success or at the end of the retry procedure: |
Jeej | 0:027760f45e2c | 148 | /// - if '1': a response is generated to requester (source ITF) |
Jeej | 0:027760f45e2c | 149 | /// - if '0': nothing notified to the source |
Jeej | 0:027760f45e2c | 150 | u8 respond : 1; |
Jeej | 0:027760f45e2c | 151 | /// On transmission success or at the end of the retry procedure: |
Jeej | 0:027760f45e2c | 152 | /// - if '1': Session fifo remains opened for further messaging |
Jeej | 0:027760f45e2c | 153 | /// - if '0': Session fifo is closed/released |
Jeej | 0:027760f45e2c | 154 | u8 persistant : 1; |
Jeej | 0:027760f45e2c | 155 | /// When a payload is send to an ITF that implements buffering, |
Jeej | 0:027760f45e2c | 156 | /// if 'bulk' is set the ITF should not start actual transfer until |
Jeej | 0:027760f45e2c | 157 | /// buffer is full. |
Jeej | 0:027760f45e2c | 158 | u8 bulk : 1; |
Jeej | 0:027760f45e2c | 159 | |
Jeej | 0:027760f45e2c | 160 | u8 rfu : 1; |
Jeej | 0:027760f45e2c | 161 | } meta; |
Jeej | 0:027760f45e2c | 162 | /// Number of "pushed" messages that will be internally buffered |
Jeej | 0:027760f45e2c | 163 | /// until they are successfully sent. In case of overflow, the oldest |
Jeej | 0:027760f45e2c | 164 | /// message is lost. |
Jeej | 0:027760f45e2c | 165 | u8 depth; |
Jeej | 0:027760f45e2c | 166 | /// Maximum number of retry steps |
Jeej | 0:027760f45e2c | 167 | u8 retries; |
Jeej | 0:027760f45e2c | 168 | /// Unit of time (in second) used for Backoff time calculation |
Jeej | 0:027760f45e2c | 169 | u8 slot_time; |
Jeej | 0:027760f45e2c | 170 | } alp_retry_policy_t; |
Jeej | 0:027760f45e2c | 171 | |
Jeej | 0:027760f45e2c | 172 | #define ALP_RPOL(_b,_resp,_p,_d,_r,_s,_proc) \ |
Jeej | 0:027760f45e2c | 173 | { \ |
Jeej | 0:027760f45e2c | 174 | .meta.procedure = (_proc), \ |
Jeej | 0:027760f45e2c | 175 | .meta.respond = (_resp), \ |
Jeej | 0:027760f45e2c | 176 | .meta.persistant = (_p), \ |
Jeej | 0:027760f45e2c | 177 | .meta.bulk = (_b), \ |
Jeej | 0:027760f45e2c | 178 | .depth = (_d), \ |
Jeej | 0:027760f45e2c | 179 | .retries = (_r), \ |
Jeej | 0:027760f45e2c | 180 | .slot_time = (_s) \ |
Jeej | 0:027760f45e2c | 181 | } |
Jeej | 0:027760f45e2c | 182 | |
Jeej | 0:027760f45e2c | 183 | // Basic public container for ALP payload. |
Jeej | 0:027760f45e2c | 184 | typedef struct { |
Jeej | 0:027760f45e2c | 185 | u32 len; |
Jeej | 0:027760f45e2c | 186 | u8 d[1]; |
Jeej | 0:027760f45e2c | 187 | } alp_pub_payload_t; |
Jeej | 0:027760f45e2c | 188 | |
Jeej | 0:027760f45e2c | 189 | typedef enum { |
Jeej | 0:027760f45e2c | 190 | /// Unsollicited message |
Jeej | 0:027760f45e2c | 191 | ALP_MSG_UNS, |
Jeej | 0:027760f45e2c | 192 | /// Deprecated |
Jeej | 0:027760f45e2c | 193 | ALP_MSG_ERR, |
Jeej | 0:027760f45e2c | 194 | /// Command message XXX deprecated BUT (mis)used in ALP Interfaces. |
Jeej | 0:027760f45e2c | 195 | ALP_MSG_CMD, |
Jeej | 0:027760f45e2c | 196 | /// Response message |
Jeej | 0:027760f45e2c | 197 | ALP_MSG_RES, |
Jeej | 0:027760f45e2c | 198 | /// Interface Termination message (used for TAG EOP handing) |
Jeej | 0:027760f45e2c | 199 | ALP_MSG_DONE, |
Jeej | 0:027760f45e2c | 200 | } alp_msg_t; |
Jeej | 0:027760f45e2c | 201 | |
Jeej | 0:027760f45e2c | 202 | #endif // __ALP_H__ |
Jeej | 0:027760f45e2c | 203 |