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
Diff: include/alp.h
- Revision:
- 19:701d5669f2e9
- Parent:
- 1:40ead20ecb14
- Child:
- 30:74aa36420c61
diff -r a11302a76e96 -r 701d5669f2e9 include/alp.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/include/alp.h Tue Dec 12 16:03:12 2017 +0000
@@ -0,0 +1,208 @@
+/// @copyright
+/// ========================================================================={{{
+/// Copyright (c) 2012-2013 WizziLab /
+/// All rights reserved /
+/// /
+/// IMPORTANT: This Software may not be modified, copied or distributed unless /
+/// embedded on a WizziLab product. Other than for the foregoing purpose, this /
+/// Software and/or its documentation may not be used, reproduced, copied, /
+/// prepared derivative works of, modified, performed, distributed, displayed /
+/// or sold for any purpose. For the sole purpose of embedding this Software /
+/// on a WizziLab product, copy, modification and distribution of this /
+/// Software is granted provided that the following conditions are respected: /
+/// /
+/// * Redistributions of source code must retain the above copyright notice, /
+/// this list of conditions and the following disclaimer /
+/// /
+/// * Redistributions in binary form must reproduce the above copyright /
+/// notice, this list of conditions and the following disclaimer in the /
+/// documentation and/or other materials provided with the distribution. /
+/// /
+/// * The name of WizziLab can not be used to endorse or promote products /
+/// derived from this software without specific prior written permission. /
+/// /
+/// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS /
+/// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED /
+/// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR /
+/// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR /
+/// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, /
+/// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, /
+/// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, /
+/// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY /
+/// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING /
+/// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS /
+/// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /
+/// WIZZILAB HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, /
+/// ENHANCEMENTS OR MODIFICATIONS. /
+/// /
+/// Should you have any questions regarding your right to use this Software, /
+/// contact WizziLab at www.wizzilab.com. /
+/// /
+/// =========================================================================}}}
+/// @endcopyright
+
+// =======================================================================
+/// @file alp.h
+/// @brief Wizzilab's specific ALP definitions
+/// @defgroup ALP
+// =======================================================================
+
+#ifndef __ALP_H__
+#define __ALP_H__
+
+// D7A spec
+#include "alp_spec.h"
+// helpers
+#include "alp_helpers.h"
+
+// D7AActP Substitution modes:
+// ----------------------------------------------------------------------
+// MODE1: replace FID= actp.fid, offset=0, length=(actp.fid).length
+// MODE2: replace FID= actp.fid, offset=actp.offset, length=actp.length
+// ======================================================================
+typedef enum {
+ ACTP_SUBST_NONE = 0,
+ ACTP_SUBST_MODE1,
+ ACTP_SUBST_MODE2,
+} alp_actp_substitution_mode_t;
+
+typedef union {
+ struct {
+ u8 fid;
+ u8 error;
+ };
+} alp_evt_done_evp_t;
+
+typedef enum {
+ ALP_ITF_FID_COM0,
+ ALP_ITF_FID_COM1,
+ ALP_ITF_FID_COM2,
+ ALP_ITF_FID_BLE,
+} alp_itf_fixed_fids_t;
+
+typedef enum {
+ ALP_ROLE_ROOT = 0xFF,
+ ALP_ROLE_USER = 0x38,
+ ALP_ROLE_GUEST = 0x07,
+} alp_role_t;
+
+typedef enum {
+ ALP_RPOL_EP_ONESHOT = 0,
+ ALP_RPOL_EP_SINGLE = 1,
+ ALP_RPOL_EP_REPORT = 2,
+ ALP_RPOL_EP_REPORT_CHECKED = 3,
+ ALP_RPOL_EP_BULK = 4,
+ ALP_RPOL_GW_ONESHOT = 5,
+ ALP_RPOL_GW_BULK = 6,
+ ALP_RPOL_BLINK = 7,
+
+ ALP_RPOL_QTY,
+} alp_rpol_t;
+
+typedef enum {
+ ALP_BOFF_NONE = 0,
+ ALP_BOFF_LINEAR = 1,
+ ALP_BOFF_EXP = 2,
+
+ ALP_BOFF_QTY
+} alp_rpol_backoff_proc_t;
+
+
+// Event parameter for ALP_EVT_URC
+typedef union {
+ struct {
+ u8 type;
+ u8 ifid;
+ u8 value;
+ };
+} alp_urc_evp_t;
+
+TYPEDEF_STRUCT_PACKED {
+ u8 ifid;
+ u8 report_freq;
+} alp_urc_lqual_params_t;
+
+TYPEDEF_STRUCT_PACKED {
+ u8 ifid;
+ u8 max_consecutive_errors;
+} alp_urc_ldown_params_t;
+
+// ALP D7 "Retry-policies" description
+// ----------------------------------------------------------------------
+// Retry-policies (also called QoS) are defining an application level
+// set of parameters such as automatic retry in case of failure, termination
+// messaging and other implementation dependent settings.
+// ======================================================================
+TYPEDEF_STRUCT_PACKED {
+ struct {
+ /// Backoff time generator for retry attempts
+ u8 procedure : 4;
+ /// On transmission success or at the end of the retry procedure:
+ /// - if '1': a response is generated to requester (source ITF)
+ /// - if '0': nothing notified to the source
+ u8 respond : 1;
+ /// On transmission success or at the end of the retry procedure:
+ /// - if '1': Session fifo remains opened for further messaging
+ /// - if '0': Session fifo is closed/released
+ u8 persistant : 1;
+ /// When a payload is send to an ITF that implements buffering,
+ /// if 'bulk' is set the ITF should not start actual transfer until
+ /// buffer is full.
+ u8 bulk : 1;
+
+ u8 rfu : 1;
+ } meta;
+ /// Number of "pushed" messages that will be internally buffered
+ /// until they are successfully sent. In case of overflow, the oldest
+ /// message is lost.
+ u8 depth;
+ /// Maximum number of retry steps
+ u8 retries;
+ /// Unit of time (in second) used for Backoff time calculation
+ u8 slot_time;
+} alp_retry_policy_t;
+
+#define ALP_RPOL(_b,_resp,_p,_d,_r,_s,_proc) \
+ { \
+ .meta.procedure = (_proc), \
+ .meta.respond = (_resp), \
+ .meta.persistant = (_p), \
+ .meta.bulk = (_b), \
+ .depth = (_d), \
+ .retries = (_r), \
+ .slot_time = (_s) \
+ }
+
+// Basic public container for ALP payload.
+typedef struct {
+ u32 len;
+ u8 d[1];
+} alp_pub_payload_t;
+
+typedef enum {
+ /// Unsollicited message
+ ALP_MSG_UNS,
+ /// Deprecated
+ ALP_MSG_ERR,
+ /// Command message XXX deprecated BUT (mis)used in ALP Interfaces.
+ ALP_MSG_CMD,
+ /// Response message
+ ALP_MSG_RES,
+ /// Interface Termination message (used for TAG EOP handing)
+ ALP_MSG_DONE,
+} alp_msg_t;
+
+
+//======================================================================
+//======================================================================
+// D7A Interface
+//======================================================================
+//======================================================================
+
+#define ALP_D7A_ISTAT_NONE 0
+#define ALP_D7A_ISTAT_UNS (1<<0)
+#define ALP_D7A_ISTAT_RESP (1<<1)
+
+
+#endif // __ALP_H__
+