WizziLab / modem_ref

Dependents:   modem_ref_helper

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers alp.h Source File

alp.h

Go to the documentation of this file.
00001 /// @copyright
00002 /// ========================================================================={{{
00003 /// Copyright (c) 2012-2020 WizziLab                                           /
00004 /// All rights reserved                                                        /
00005 ///                                                                            /
00006 /// Should you have any questions regarding your right to use this Software,   /
00007 /// contact WizziLab at www.wizzilab.com.                                      /
00008 /// =========================================================================}}}
00009 /// @endcopyright
00010 
00011 //  =======================================================================
00012 /// @file           alp.h
00013 /// @brief          Wizzilab's specific ALP definitions
00014 /// @defgroup       ALP
00015 //  =======================================================================
00016 
00017 #ifndef __ALP_H__
00018 #define __ALP_H__
00019 
00020 // D7A spec
00021 #include "alp_spec.h"
00022 // helpers
00023 #include "alp_helpers.h"
00024 #include "alp_payload.h"
00025 
00026 // D7AActP Substitution modes:
00027 // ----------------------------------------------------------------------
00028 // MODE1: replace FID= actp.fid, offset=0,             length=(actp.fid).length
00029 // MODE2: replace FID= actp.fid, offset=actp.offset,   length=actp.length
00030 // ======================================================================
00031 typedef enum {
00032     ACTP_SUBST_NONE = 0,
00033     ACTP_SUBST_MODE1,
00034     ACTP_SUBST_MODE2,
00035 } alp_actp_substitution_mode_t;
00036 
00037 typedef union {
00038     struct {
00039         u8 fid;
00040         u8 error;
00041     };
00042 } alp_evt_done_evp_t;
00043 
00044 typedef enum {
00045     ALP_ITF_FID_COM0,
00046     ALP_ITF_FID_COM1,
00047     ALP_ITF_FID_COM2,
00048     ALP_ITF_FID_COM_HACK_LIMIT = ALP_ITF_FID_COM2,
00049     ALP_ITF_FID_BLE,
00050 } alp_itf_fixed_fids_t;
00051 
00052 typedef enum {
00053     ALP_ROLE_ROOT       = 0xFF,
00054     ALP_ROLE_USER       = 0x38,
00055     ALP_ROLE_GUEST      = 0x07,
00056 } alp_role_t;
00057 
00058 typedef enum {
00059     ALP_RPOL_ONESHOT        = 0,
00060     ALP_RPOL_ONESHOT_RETRY  = 1,
00061     ALP_RPOL_FIFO_FAST      = 2,
00062     ALP_RPOL_FIFO_SLOW      = 3,
00063     ALP_RPOL_SINGLE_FAST    = 4,
00064     ALP_RPOL_SINGLE_SLOW    = 5,
00065     ALP_RPOL_ONESHOT_STICKY = 6,
00066     ALP_RPOL_RFU_7          = 7,
00067     ALP_RPOL_QTY,
00068 } alp_rpol_t;
00069 
00070 typedef enum {
00071     ALP_BOFF_NONE           = 0,
00072     ALP_BOFF_LINEAR         = 1,
00073     ALP_BOFF_EXP            = 2,
00074 
00075     ALP_BOFF_QTY
00076 } alp_rpol_backoff_proc_t;
00077 
00078 
00079 // Event parameter for ALP_EVT_URC
00080 typedef union {
00081     struct {
00082         u8 type;
00083         u8 ifid;
00084         u8 value;
00085     };
00086 } alp_urc_evp_t;
00087 
00088 TYPEDEF_STRUCT_PACKED {
00089     u8 ifid;
00090     u8 report_freq;
00091 } alp_urc_lqual_params_t;
00092 
00093 TYPEDEF_STRUCT_PACKED {
00094     u8 ifid;
00095     u8 max_consecutive_errors;
00096 } alp_urc_ldown_params_t;
00097 
00098 typedef enum {
00099     /// Unsollicited message
00100     ALP_MSG_UNS,
00101     /// Deprecated
00102     ALP_MSG_ERR,
00103     /// Command message XXX deprecated BUT (mis)used in ALP Interfaces.
00104     ALP_MSG_CMD,
00105     /// Response message
00106     ALP_MSG_RES,
00107     /// Interface Termination message (used for TAG EOP handing)
00108     ALP_MSG_DONE,
00109 } alp_msg_t ;
00110 
00111 
00112 //======================================================================
00113 //======================================================================
00114 //  D7A Interface
00115 //======================================================================
00116 //======================================================================
00117 
00118 #include "d7a_1x.h"
00119 
00120 //======================================================================
00121 // alp_itf_d7a_cfg_t
00122 //----------------------------------------------------------------------
00123 // @brief ALP D7A interface configuration structure
00124 //======================================================================
00125 TYPEDEF_STRUCT_PACKED
00126 {
00127     u8 type;
00128     d7a_sp_cfg_t cfg;
00129 
00130 } alp_itf_d7a_cfg_t;
00131 
00132 //======================================================================
00133 // alp_itf_lwan_cfg_t
00134 //----------------------------------------------------------------------
00135 // @brief ALP LoRaWAN interface configuration structure
00136 //======================================================================
00137 TYPEDEF_STRUCT_PACKED
00138 {
00139     u8 type;
00140 
00141 } alp_itf_lwan_cfg_t;
00142 
00143 //======================================================================
00144 // alp_itf_com_cfg_t
00145 //----------------------------------------------------------------------
00146 // @brief ALP COM interface configuration structure
00147 //======================================================================
00148 TYPEDEF_STRUCT_PACKED
00149 {
00150     u8 type;
00151     u8 com;
00152 
00153 } alp_itf_com_cfg_t;
00154 
00155 //======================================================================
00156 // alp_itf_ble_cfg_t
00157 //----------------------------------------------------------------------
00158 // @brief ALP BLE (dummy) interface configuration structure
00159 //======================================================================
00160 TYPEDEF_STRUCT_PACKED
00161 {
00162     u8 type;
00163 
00164 } alp_itf_ble_cfg_t;
00165 
00166 // XXX When declaring an interface file, use this size.
00167 #define ALP_ITF_MAX_SIZE    (sizeof(alp_itf_d7a_cfg_t)) // Biggest is d7a itf for now
00168 
00169 //======================================================================
00170 // alp_itf_cfg_t
00171 //----------------------------------------------------------------------
00172 // @brief ALP Generic interface configuration structure
00173 //======================================================================
00174 TYPEDEF_STRUCT_PACKED
00175 {
00176     u8 type;
00177 
00178 } alp_itf_cfg_t;
00179 
00180 
00181 //======================================================================
00182 // @brief ALP Generic OP structures
00183 //======================================================================
00184 TYPEDEF_STRUCT_PACKED {
00185     u8 op;
00186     u8 id;
00187 } alp_op_tag_t;
00188 
00189 TYPEDEF_STRUCT_PACKED {
00190     u8 op;
00191     u8 type;
00192     u8 length; // D7 istat length is < 64
00193     d7a_sp_res_t istat;
00194 } alp_op_istat_d7_t;
00195 
00196 TYPEDEF_STRUCT_PACKED {
00197     u8 op;
00198     u8 type;
00199     u8 length; // Always 1
00200     s8 err;
00201 } alp_op_eopistat_t;
00202 
00203 TYPEDEF_STRUCT_PACKED {
00204     u8 op;
00205     u8 id; // Action ID
00206     s8 err;
00207 } alp_op_status_t;
00208 
00209 TYPEDEF_STRUCT_PACKED {
00210     u8 op;
00211     u8 fid;
00212     u8 offset; // offset is < 64
00213     u8 length; // payload length is < 64
00214     u8 data[63];
00215 } alp_op_rsp_f_data_t;
00216 
00217 #define ALP_D7A_ISTAT_NONE  0
00218 #define ALP_D7A_ISTAT_UNS   (1<<0)
00219 #define ALP_D7A_ISTAT_RESP  (1<<1)
00220 #define ALP_D7A_ISTAT_EOP   (1<<2)
00221 
00222 
00223 //======================================================================
00224 // alp_itf_d7a_cfg_size
00225 //----------------------------------------------------------------------
00226 /// @brief  Get size of the D7A interface configuration
00227 /// @param  cfg pointer to the configuration
00228 /// @return int configuration size
00229 //======================================================================
00230 _public int alp_itf_d7a_cfg_size(u8* cfg);
00231 
00232 //======================================================================
00233 // alp_itf_size
00234 //----------------------------------------------------------------------
00235 /// @brief  Get size of the interface configuration
00236 /// @param  itf pointer to the configuration
00237 /// @return int configuration size
00238 //======================================================================
00239 _public int alp_itf_size(void* itf);
00240 
00241 
00242 #endif // __ALP_H__