Doxygen for tsch-asn.h
This commit is contained in:
parent
8be446d0ea
commit
68ec94e0fb
@ -48,13 +48,13 @@
|
|||||||
|
|
||||||
/************ Types ***********/
|
/************ Types ***********/
|
||||||
|
|
||||||
/* The ASN is an absolute slot number over 5 bytes. */
|
/** \brief The ASN is an absolute slot number over 5 bytes. */
|
||||||
struct tsch_asn_t {
|
struct tsch_asn_t {
|
||||||
uint32_t ls4b; /* least significant 4 bytes */
|
uint32_t ls4b; /* least significant 4 bytes */
|
||||||
uint8_t ms1b; /* most significant 1 byte */
|
uint8_t ms1b; /* most significant 1 byte */
|
||||||
};
|
};
|
||||||
|
|
||||||
/* For quick modulo operation on ASN */
|
/** \brief For quick modulo operation on ASN */
|
||||||
struct tsch_asn_divisor_t {
|
struct tsch_asn_divisor_t {
|
||||||
uint16_t val; /* Divisor value */
|
uint16_t val; /* Divisor value */
|
||||||
uint16_t asn_ms1b_remainder; /* Remainder of the operation 0x100000000 / val */
|
uint16_t asn_ms1b_remainder; /* Remainder of the operation 0x100000000 / val */
|
||||||
@ -62,37 +62,37 @@ struct tsch_asn_divisor_t {
|
|||||||
|
|
||||||
/************ Macros **********/
|
/************ Macros **********/
|
||||||
|
|
||||||
/* Initialize ASN */
|
/** \brief Initialize ASN */
|
||||||
#define TSCH_ASN_INIT(asn, ms1b_, ls4b_) do { \
|
#define TSCH_ASN_INIT(asn, ms1b_, ls4b_) do { \
|
||||||
(asn).ms1b = (ms1b_); \
|
(asn).ms1b = (ms1b_); \
|
||||||
(asn).ls4b = (ls4b_); \
|
(asn).ls4b = (ls4b_); \
|
||||||
} while(0);
|
} while(0);
|
||||||
|
|
||||||
/* Increment an ASN by inc (32 bits) */
|
/** \brief Increment an ASN by inc (32 bits) */
|
||||||
#define TSCH_ASN_INC(asn, inc) do { \
|
#define TSCH_ASN_INC(asn, inc) do { \
|
||||||
uint32_t new_ls4b = (asn).ls4b + (inc); \
|
uint32_t new_ls4b = (asn).ls4b + (inc); \
|
||||||
if(new_ls4b < (asn).ls4b) { (asn).ms1b++; } \
|
if(new_ls4b < (asn).ls4b) { (asn).ms1b++; } \
|
||||||
(asn).ls4b = new_ls4b; \
|
(asn).ls4b = new_ls4b; \
|
||||||
} while(0);
|
} while(0);
|
||||||
|
|
||||||
/* Decrement an ASN by inc (32 bits) */
|
/** \brief Decrement an ASN by inc (32 bits) */
|
||||||
#define TSCH_ASN_DEC(asn, dec) do { \
|
#define TSCH_ASN_DEC(asn, dec) do { \
|
||||||
uint32_t new_ls4b = (asn).ls4b - (dec); \
|
uint32_t new_ls4b = (asn).ls4b - (dec); \
|
||||||
if(new_ls4b > (asn).ls4b) { (asn).ms1b--; } \
|
if(new_ls4b > (asn).ls4b) { (asn).ms1b--; } \
|
||||||
(asn).ls4b = new_ls4b; \
|
(asn).ls4b = new_ls4b; \
|
||||||
} while(0);
|
} while(0);
|
||||||
|
|
||||||
/* Returns the 32-bit diff between asn1 and asn2 */
|
/** \brief Returns the 32-bit diff between asn1 and asn2 */
|
||||||
#define TSCH_ASN_DIFF(asn1, asn2) \
|
#define TSCH_ASN_DIFF(asn1, asn2) \
|
||||||
((asn1).ls4b - (asn2).ls4b)
|
((asn1).ls4b - (asn2).ls4b)
|
||||||
|
|
||||||
/* Initialize a struct asn_divisor_t */
|
/** \brief Initialize a struct asn_divisor_t */
|
||||||
#define TSCH_ASN_DIVISOR_INIT(div, val_) do { \
|
#define TSCH_ASN_DIVISOR_INIT(div, val_) do { \
|
||||||
(div).val = (val_); \
|
(div).val = (val_); \
|
||||||
(div).asn_ms1b_remainder = ((0xffffffff % (val_)) + 1) % (val_); \
|
(div).asn_ms1b_remainder = ((0xffffffff % (val_)) + 1) % (val_); \
|
||||||
} while(0);
|
} while(0);
|
||||||
|
|
||||||
/* Returns the result (16 bits) of a modulo operation on ASN,
|
/** \brief Returns the result (16 bits) of a modulo operation on ASN,
|
||||||
* with divisor being a struct asn_divisor_t */
|
* with divisor being a struct asn_divisor_t */
|
||||||
#define TSCH_ASN_MOD(asn, div) \
|
#define TSCH_ASN_MOD(asn, div) \
|
||||||
((uint16_t)((asn).ls4b % (div).val) \
|
((uint16_t)((asn).ls4b % (div).val) \
|
||||||
|
Loading…
Reference in New Issue
Block a user