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 alp.h Source File

alp.h

Go to the documentation of this file.
00001 /// @copyright
00002 /// ========================================================================={{{
00003 /// Copyright (c) 2012-2013 WizziLab                                           /
00004 /// All rights reserved                                                        /
00005 ///                                                                            /
00006 /// IMPORTANT: This Software may not be modified, copied or distributed unless /
00007 /// embedded on a WizziLab product. Other than for the foregoing purpose, this /
00008 /// Software and/or its documentation may not be used, reproduced, copied,     /
00009 /// prepared derivative works of, modified, performed, distributed, displayed  /
00010 /// or sold for any purpose. For the sole purpose of embedding this Software   /
00011 /// on a WizziLab product, copy, modification and distribution of this         /
00012 /// Software is granted provided that the following conditions are respected:  /
00013 ///                                                                            /
00014 /// *  Redistributions of source code must retain the above copyright notice,  /
00015 ///    this list of conditions and the following disclaimer                    /
00016 ///                                                                            /
00017 /// *  Redistributions in binary form must reproduce the above copyright       /
00018 ///    notice, this list of conditions and the following disclaimer in the     /
00019 ///    documentation and/or other materials provided with the distribution.    /
00020 ///                                                                            /
00021 /// *  The name of WizziLab can not be used to endorse or promote products     /
00022 ///    derived from this software without specific prior written permission.   /
00023 ///                                                                            /
00024 /// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS        /
00025 /// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED  /
00026 /// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR /
00027 /// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR          /
00028 /// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,      /
00029 /// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,        /
00030 /// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,            /
00031 /// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY     /
00032 /// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING    /
00033 /// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS         /
00034 /// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.               /
00035 /// WIZZILAB HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES,       /
00036 /// ENHANCEMENTS OR MODIFICATIONS.                                             /
00037 ///                                                                            /
00038 /// Should you have any questions regarding your right to use this Software,   /
00039 /// contact WizziLab at www.wizzilab.com.                                      /
00040 ///                                                                            /
00041 /// =========================================================================}}}
00042 /// @endcopyright
00043 
00044 //  =======================================================================
00045 /// @file           alp.h
00046 /// @brief          Wizzilab's specific ALP definitions
00047 /// @defgroup       ALP
00048 //  =======================================================================
00049 
00050 #ifndef __ALP_H__
00051 #define __ALP_H__
00052 
00053 // D7A spec
00054 #include "alp_spec.h"
00055 // helpers
00056 #include "alp_helpers.h"
00057 
00058 // ALP_EVT_ITF_READY/CLOSED Event-param builder/splitter
00059 #define ALP_ITF_EVP(itf,err)    (evt_param_t)(int)(((u8)err << 8)|((u8)itf))
00060 #define ALP_ITF_EVP2ITF(evp)    ((evp) & 0xFF)
00061 #define ALP_ITF_EVP2ERR(evp)    ((evp >> 8) & 0xFF)
00062 
00063 // D7AActP Substitution modes:
00064 // ----------------------------------------------------------------------
00065 // MODE1: replace FID= actp.fid, offset=0,             length=(actp.fid).length
00066 // MODE2: replace FID= actp.fid, offset=actp.offset,   length=actp.length
00067 // ======================================================================
00068 typedef enum {
00069     ACTP_SUBST_NONE = 0,
00070     ACTP_SUBST_MODE1,
00071     ACTP_SUBST_MODE2,
00072 } alp_actp_substitution_mode_t;
00073 
00074 typedef union {
00075     struct {
00076         u8 fid;
00077         u8 error;
00078     };
00079 } alp_evt_done_evp_t;
00080 
00081 typedef enum {
00082     ALP_ITF_FID_COM0,
00083     ALP_ITF_FID_COM1,
00084     ALP_ITF_FID_COM2,
00085     ALP_ITF_FID_COM_HACK_LIMIT = ALP_ITF_FID_COM2,
00086     ALP_ITF_FID_BLE,
00087 } alp_itf_fixed_fids_t;
00088 
00089 typedef enum {
00090     ALP_ROLE_ROOT       = 0xFF,
00091     ALP_ROLE_USER       = 0x38,
00092     ALP_ROLE_GUEST      = 0x07,
00093 } alp_role_t;
00094 
00095 typedef enum {
00096     ALP_RPOL_ONESHOT        = 0,
00097     ALP_RPOL_ONESHOT_RETRY  = 1,
00098     ALP_RPOL_FIFO_FAST      = 2,
00099     ALP_RPOL_FIFO_SLOW      = 3,
00100     ALP_RPOL_SINGLE_FAST    = 4,
00101     ALP_RPOL_SINGLE_SLOW    = 5,
00102     ALP_RPOL_ONESHOT_STICKY = 6,
00103     ALP_RPOL_RFU_7          = 7,
00104     ALP_RPOL_QTY,
00105 } alp_rpol_t;
00106 
00107 typedef enum {
00108     ALP_BOFF_NONE           = 0,
00109     ALP_BOFF_LINEAR         = 1,
00110     ALP_BOFF_EXP            = 2,
00111 
00112     ALP_BOFF_QTY
00113 } alp_rpol_backoff_proc_t;
00114 
00115 
00116 // Event parameter for ALP_EVT_URC
00117 typedef union {
00118     struct {
00119         u8 type;
00120         u8 ifid;
00121         u8 value;
00122     };
00123 } alp_urc_evp_t;
00124 
00125 TYPEDEF_STRUCT_PACKED {
00126     u8 ifid;
00127     u8 report_freq;
00128 } alp_urc_lqual_params_t;
00129 
00130 TYPEDEF_STRUCT_PACKED {
00131     u8 ifid;
00132     u8 max_consecutive_errors;
00133 } alp_urc_ldown_params_t;
00134 
00135 // ALP D7 "Retry-policies" description
00136 // ----------------------------------------------------------------------
00137 // Retry-policies (also called QoS) are defining an application level
00138 // set of parameters such as automatic retry in case of failure, termination
00139 // messaging and other implementation dependent settings.
00140 // ======================================================================
00141 TYPEDEF_STRUCT_PACKED {
00142     /// Select between background of foreground tasks, 
00143     /// - if '1': Session fifo remains opened for further messaging
00144     /// - if '0': Session fifo is closed/released
00145     /// Replaces the "persistant flag" ("background" = "persistant").
00146     /// Note : In the D7A stack, the BG fifos have lower priority.
00147     /// This field could be extended to be a priority level
00148     u8 bg;
00149     /// Number of "pushed" messages that will be internally buffered
00150     /// until they are successfully sent. In case of overflow, the oldest
00151     /// message is lost.
00152     u8 depth;
00153     /// Maximum number of retry steps
00154     u8 retries;
00155     /// Minimum unit of time (in second) used for Backoff time calculation
00156     u8 slot_min;
00157     /// Maximum unit of time (in second) used for Backoff time calculation
00158     u8 slot_max;
00159 } alp_retry_policy_t;
00160 
00161 #define ALP_RPOL(_bg,_d,_r,_min,_max) \
00162         { \
00163             .bg         = (_bg), \
00164             .depth      = (_d), \
00165             .retries    = (_r), \
00166             .slot_min   = (_min), \
00167             .slot_max   = (_max), \
00168         }
00169 
00170 // Basic public container for ALP payload.
00171 typedef struct {
00172     u32             len;
00173     u8              d[1];
00174 } alp_pub_payload_t;
00175 
00176 typedef enum {
00177     /// Unsollicited message
00178     ALP_MSG_UNS,
00179     /// Deprecated
00180     ALP_MSG_ERR,
00181     /// Command message XXX deprecated BUT (mis)used in ALP Interfaces.
00182     ALP_MSG_CMD,
00183     /// Response message
00184     ALP_MSG_RES,
00185     /// Interface Termination message (used for TAG EOP handing)
00186     ALP_MSG_DONE,
00187 } alp_msg_t ;
00188 
00189 
00190 //======================================================================
00191 //======================================================================
00192 //  D7A Interface
00193 //======================================================================
00194 //======================================================================
00195 
00196 #include "d7a_1x.h"
00197 
00198 //======================================================================
00199 // alp_itf_d7a_cfg_t
00200 //----------------------------------------------------------------------
00201 // @brief ALP D7A interface configuration structure
00202 //======================================================================
00203 TYPEDEF_STRUCT_PACKED 
00204 {
00205     u8 type;
00206     d7a_sp_cfg_t cfg;
00207 
00208 } alp_itf_d7a_cfg_t;
00209 
00210 #define ALP_D7A_ISTAT_NONE  0
00211 #define ALP_D7A_ISTAT_UNS   (1<<0)
00212 #define ALP_D7A_ISTAT_RESP  (1<<1)
00213 #define ALP_D7A_ISTAT_EOP   (1<<2)
00214 
00215 #endif // __ALP_H__