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.
Fork of d7a_1x by
Diff: include/d7a.h
- Revision:
- 71:f03727ff0f99
- Parent:
- 68:d2778c6abf1a
- Child:
- 73:3b7353741c94
diff -r 07b378285c95 -r f03727ff0f99 include/d7a.h --- a/include/d7a.h Thu Nov 03 10:56:17 2016 +0000 +++ b/include/d7a.h Wed Nov 09 10:49:58 2016 +0000 @@ -10,14 +10,19 @@ #define D7A_UID_LEN (8) -#define D7A_XCL_ENDPOINT_NO (0x01) // Normal rate -#define D7A_XCL_GATEWAY_NO (0x21) // Normal Rate - -#define D7A_XCL_ENDPOINT_LO (0x11) // Low rate -#define D7A_XCL_GATEWAY_LO (0x31) // Low Rate - -#define D7A_XCL_ENDPOINT_HI (0x41) // High rate -#define D7A_XCL_GATEWAY_HI (0x51) // High Rate +// Predefined Access classes +// Normal Rate +#define D7A_XCL_ENDPOINT_NO (0x01) +#define D7A_XCL_SUBCONTROLLER_NO (0x02) +#define D7A_XCL_GATEWAY_NO (0x21) +// Low Rate +#define D7A_XCL_ENDPOINT_LO (0x11) +#define D7A_XCL_SUBCONTROLLER_LO (0x12) +#define D7A_XCL_GATEWAY_LO (0x31) +// High Rate +#define D7A_XCL_ENDPOINT_HI (0x41) +#define D7A_XCL_SUBCONTROLLER_HI (0x42) +#define D7A_XCL_GATEWAY_HI (0x51) #define D7A_CTF_VAL(mant,exp) ((uint8_t)(mant|(exp<<5))) @@ -25,6 +30,16 @@ #define D7A_ROOT_KEY_SIZE (8) // 16 bytes max +// Predefined interface files +#define FIRST_IFT_FILE (108) + +#define D7A_ITF_ONESHOT (108) +#define D7A_ITF_SINGLE (109) +#define D7A_ITF_REPORT (110) +#define D7A_ITF_REPORT_CHECKED (111) +#define D7A_ITF_BULK (112) +#define D7A_ITF_BLINK (113) + //====================================================================== // Enums @@ -415,6 +430,108 @@ } d7a_addressee_t; +// ======================================================================= +// d7a_ctf_t +// ----------------------------------------------------------------------- +// DLL compressed time format +// ======================================================================= +typedef union +{ + // bit access fields + struct { + // Mantissa + uint8_t mant : 5; + // Exponent + uint8_t exp : 3; + } bf; + + // byte access + uint8_t byte; + +} d7a_ctf_t; + +// ======================================================================= +// d7a_qos_t +// ----------------------------------------------------------------------- +// Bitfield structure of the D7ASP Quality of Service control byte +// ======================================================================= +typedef union +{ + // bit access fields + struct { + // Response mode + uint8_t resp : 3; + // Retry mode + uint8_t retry : 3; + // Responder has to keep the ACK template (TPL status file) + uint8_t record : 1; + // Stop D7ASP on not acknowledged request + uint8_t stop_on_err : 1; + + } bf; + + // byte access + uint8_t byte; + +} d7a_qos_t; + + +// ======================================================================= +// d7a_sp_cfg_t +// ----------------------------------------------------------------------- +// Structure of the D7ASP Configuration +// ======================================================================= +TYPEDEF_STRUCT_PACKED +{ + // D7ASP QoS + d7a_qos_t qos; + // Dormant Timeout (0, no timeout) + d7a_ctf_t dorm_to; + // Addressee + d7a_addressee_t addressee; + +} d7a_sp_cfg_t; + +// ======================================================================= +// d7a_itf_t +// ----------------------------------------------------------------------- +// ALP/D7A Interface file TODO:should be in alp_d7a.h when/if it exists +// but not in alp.h as it requires D7A +// ==================================================================== +TYPEDEF_STRUCT_PACKED { + uint8_t type; + d7a_sp_cfg_t cfg; +} d7a_itf_t; + + +// ======================================================================= +// d7a_resp_t +// ----------------------------------------------------------------------- +// Enumerator of the D7ASP Response types +// ======================================================================= +typedef enum +{ + // No response requested + D7A_RESP_NO = 0, + // Get all responses in response period + D7A_RESP_ALL, + // Get at least one acknowledgement per request during response period + D7A_RESP_ANY, + // RFU + D7A_RESP_RFU_1, + // No response requested, repeat 3 times + D7A_RESP_NO_RPT, + // Get all responses in response period, only Responders having not received packets respond + D7A_RESP_ON_ERR, + // Get at least one acknowledgement per request during response period. + // Stick to a single responder when possible + D7A_RESP_PREFERRED, + // RFU + D7A_RESP_RFU_2, + +} d7a_resp_t; + + //====================================================================== // Prototypes //====================================================================== @@ -466,7 +583,7 @@ /// @param size Length of the created file /// @param alloc Maximum size of the file /// @param action Type of action to trigger -/// @param retry Index to the retry policy to use when notifying +/// @param interface File ID of the interface file to use for notifications /// @return d7a_errors_t Error code //====================================================================== d7a_errors_t d7a_create(const uint8_t file_id, @@ -474,8 +591,8 @@ d7a_fs_perm_t perm, uint32_t size, uint32_t alloc, - d7a_action_t action = D7A_ACTION_NONE, - alp_rpol_t retry = ALP_RPOL_ONESHOT); + d7a_action_t action = D7A_ACTION_NONE, + const uint8_t interface = D7A_ITF_ONESHOT); //====================================================================== // d7a_declare @@ -487,7 +604,7 @@ /// @param size Length of the created file /// @param alloc Maximum size of the file /// @param action Type of action to trigger -/// @param retry Index to the retry policy to use when notifying +/// @param interface File ID of the interface file to use for notifications /// @return d7a_errors_t Error code //====================================================================== d7a_errors_t d7a_declare(const uint8_t file_id, @@ -496,7 +613,7 @@ uint32_t size, uint32_t alloc, d7a_action_t action = D7A_ACTION_NONE, - alp_rpol_t retry = ALP_RPOL_ONESHOT); + const uint8_t interface = D7A_ITF_ONESHOT); //====================================================================== // d7a_read