Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 28 additions & 24 deletions c/include/libsbp/bootload_macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,36 +30,40 @@
(0xff)
#define SBP_BOOTLOADER_HANDSHAKE_RESP_SBP_MAJOR_PROTOCOL_VERSION_NUMBER_SHIFT \
(8u)
#define SBP_BOOTLOADER_HANDSHAKE_RESP_SBP_MAJOR_PROTOCOL_VERSION_NUMBER_GET( \
flags) \
(((flags) >> \
SBP_BOOTLOADER_HANDSHAKE_RESP_SBP_MAJOR_PROTOCOL_VERSION_NUMBER_SHIFT) & \
SBP_BOOTLOADER_HANDSHAKE_RESP_SBP_MAJOR_PROTOCOL_VERSION_NUMBER_MASK)
#define SBP_BOOTLOADER_HANDSHAKE_RESP_SBP_MAJOR_PROTOCOL_VERSION_NUMBER_SET( \
flags, val) \
do { \
((flags) |= \
(((val) & \
(SBP_BOOTLOADER_HANDSHAKE_RESP_SBP_MAJOR_PROTOCOL_VERSION_NUMBER_MASK)) \
<< (SBP_BOOTLOADER_HANDSHAKE_RESP_SBP_MAJOR_PROTOCOL_VERSION_NUMBER_SHIFT))); \
#define SBP_BOOTLOADER_HANDSHAKE_RESP_SBP_MAJOR_PROTOCOL_VERSION_NUMBER_GET( \
flags) \
((u32)( \
((flags) >> \
SBP_BOOTLOADER_HANDSHAKE_RESP_SBP_MAJOR_PROTOCOL_VERSION_NUMBER_SHIFT) & \
SBP_BOOTLOADER_HANDSHAKE_RESP_SBP_MAJOR_PROTOCOL_VERSION_NUMBER_MASK))
#define SBP_BOOTLOADER_HANDSHAKE_RESP_SBP_MAJOR_PROTOCOL_VERSION_NUMBER_SET( \
flags, val) \
do { \
(flags) = (u32)( \
(flags) | \
(((val) & \
(SBP_BOOTLOADER_HANDSHAKE_RESP_SBP_MAJOR_PROTOCOL_VERSION_NUMBER_MASK)) \
<< (SBP_BOOTLOADER_HANDSHAKE_RESP_SBP_MAJOR_PROTOCOL_VERSION_NUMBER_SHIFT))); \
} while (0)

#define SBP_BOOTLOADER_HANDSHAKE_RESP_SBP_MINOR_PROTOCOL_VERSION_NUMBER_MASK \
(0xff)
#define SBP_BOOTLOADER_HANDSHAKE_RESP_SBP_MINOR_PROTOCOL_VERSION_NUMBER_SHIFT \
(0u)
#define SBP_BOOTLOADER_HANDSHAKE_RESP_SBP_MINOR_PROTOCOL_VERSION_NUMBER_GET( \
flags) \
(((flags) >> \
SBP_BOOTLOADER_HANDSHAKE_RESP_SBP_MINOR_PROTOCOL_VERSION_NUMBER_SHIFT) & \
SBP_BOOTLOADER_HANDSHAKE_RESP_SBP_MINOR_PROTOCOL_VERSION_NUMBER_MASK)
#define SBP_BOOTLOADER_HANDSHAKE_RESP_SBP_MINOR_PROTOCOL_VERSION_NUMBER_SET( \
flags, val) \
do { \
((flags) |= \
(((val) & \
(SBP_BOOTLOADER_HANDSHAKE_RESP_SBP_MINOR_PROTOCOL_VERSION_NUMBER_MASK)) \
<< (SBP_BOOTLOADER_HANDSHAKE_RESP_SBP_MINOR_PROTOCOL_VERSION_NUMBER_SHIFT))); \
#define SBP_BOOTLOADER_HANDSHAKE_RESP_SBP_MINOR_PROTOCOL_VERSION_NUMBER_GET( \
flags) \
((u32)( \
((flags) >> \
SBP_BOOTLOADER_HANDSHAKE_RESP_SBP_MINOR_PROTOCOL_VERSION_NUMBER_SHIFT) & \
SBP_BOOTLOADER_HANDSHAKE_RESP_SBP_MINOR_PROTOCOL_VERSION_NUMBER_MASK))
#define SBP_BOOTLOADER_HANDSHAKE_RESP_SBP_MINOR_PROTOCOL_VERSION_NUMBER_SET( \
flags, val) \
do { \
(flags) = (u32)( \
(flags) | \
(((val) & \
(SBP_BOOTLOADER_HANDSHAKE_RESP_SBP_MINOR_PROTOCOL_VERSION_NUMBER_MASK)) \
<< (SBP_BOOTLOADER_HANDSHAKE_RESP_SBP_MINOR_PROTOCOL_VERSION_NUMBER_SHIFT))); \
} while (0)

/**
Expand Down
28 changes: 14 additions & 14 deletions c/include/libsbp/ext_events_macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,26 +21,26 @@
#define SBP_MSG_EXT_EVENT 0x0101
#define SBP_EXT_EVENT_TIME_QUALITY_MASK (0x1)
#define SBP_EXT_EVENT_TIME_QUALITY_SHIFT (1u)
#define SBP_EXT_EVENT_TIME_QUALITY_GET(flags) \
(((flags) >> SBP_EXT_EVENT_TIME_QUALITY_SHIFT) & \
SBP_EXT_EVENT_TIME_QUALITY_MASK)
#define SBP_EXT_EVENT_TIME_QUALITY_SET(flags, val) \
do { \
((flags) |= (((val) & (SBP_EXT_EVENT_TIME_QUALITY_MASK)) \
<< (SBP_EXT_EVENT_TIME_QUALITY_SHIFT))); \
#define SBP_EXT_EVENT_TIME_QUALITY_GET(flags) \
((u8)(((flags) >> SBP_EXT_EVENT_TIME_QUALITY_SHIFT) & \
SBP_EXT_EVENT_TIME_QUALITY_MASK))
#define SBP_EXT_EVENT_TIME_QUALITY_SET(flags, val) \
do { \
(flags) = (u8)((flags) | (((val) & (SBP_EXT_EVENT_TIME_QUALITY_MASK)) \
<< (SBP_EXT_EVENT_TIME_QUALITY_SHIFT))); \
} while (0)

#define SBP_EXT_EVENT_TIME_QUALITY_UNKNOWN_DONT_HAVE_NAV_SOLUTION (0)
#define SBP_EXT_EVENT_TIME_QUALITY_GOOD (1)
#define SBP_EXT_EVENT_NEW_LEVEL_OF_PIN_MASK (0x1)
#define SBP_EXT_EVENT_NEW_LEVEL_OF_PIN_SHIFT (0u)
#define SBP_EXT_EVENT_NEW_LEVEL_OF_PIN_GET(flags) \
(((flags) >> SBP_EXT_EVENT_NEW_LEVEL_OF_PIN_SHIFT) & \
SBP_EXT_EVENT_NEW_LEVEL_OF_PIN_MASK)
#define SBP_EXT_EVENT_NEW_LEVEL_OF_PIN_SET(flags, val) \
do { \
((flags) |= (((val) & (SBP_EXT_EVENT_NEW_LEVEL_OF_PIN_MASK)) \
<< (SBP_EXT_EVENT_NEW_LEVEL_OF_PIN_SHIFT))); \
#define SBP_EXT_EVENT_NEW_LEVEL_OF_PIN_GET(flags) \
((u8)(((flags) >> SBP_EXT_EVENT_NEW_LEVEL_OF_PIN_SHIFT) & \
SBP_EXT_EVENT_NEW_LEVEL_OF_PIN_MASK))
#define SBP_EXT_EVENT_NEW_LEVEL_OF_PIN_SET(flags, val) \
do { \
(flags) = (u8)((flags) | (((val) & (SBP_EXT_EVENT_NEW_LEVEL_OF_PIN_MASK)) \
<< (SBP_EXT_EVENT_NEW_LEVEL_OF_PIN_SHIFT))); \
} while (0)

#define SBP_EXT_EVENT_NEW_LEVEL_OF_PIN_LOW (0)
Expand Down
74 changes: 39 additions & 35 deletions c/include/libsbp/flash_macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,14 @@
#define SBP_MSG_FLASH_PROGRAM 0x00E6
#define SBP_FLASH_PROGRAM_FLASH_TARGET_TO_READ_MASK (0x1)
#define SBP_FLASH_PROGRAM_FLASH_TARGET_TO_READ_SHIFT (0u)
#define SBP_FLASH_PROGRAM_FLASH_TARGET_TO_READ_GET(flags) \
(((flags) >> SBP_FLASH_PROGRAM_FLASH_TARGET_TO_READ_SHIFT) & \
SBP_FLASH_PROGRAM_FLASH_TARGET_TO_READ_MASK)
#define SBP_FLASH_PROGRAM_FLASH_TARGET_TO_READ_SET(flags, val) \
do { \
((flags) |= (((val) & (SBP_FLASH_PROGRAM_FLASH_TARGET_TO_READ_MASK)) \
<< (SBP_FLASH_PROGRAM_FLASH_TARGET_TO_READ_SHIFT))); \
#define SBP_FLASH_PROGRAM_FLASH_TARGET_TO_READ_GET(flags) \
((u8)(((flags) >> SBP_FLASH_PROGRAM_FLASH_TARGET_TO_READ_SHIFT) & \
SBP_FLASH_PROGRAM_FLASH_TARGET_TO_READ_MASK))
#define SBP_FLASH_PROGRAM_FLASH_TARGET_TO_READ_SET(flags, val) \
do { \
(flags) = (u8)((flags) | \
(((val) & (SBP_FLASH_PROGRAM_FLASH_TARGET_TO_READ_MASK)) \
<< (SBP_FLASH_PROGRAM_FLASH_TARGET_TO_READ_SHIFT))); \
} while (0)

#define SBP_FLASH_PROGRAM_FLASH_TARGET_TO_READ_FLASH_STM (0)
Expand Down Expand Up @@ -65,13 +66,13 @@
#define SBP_MSG_FLASH_DONE 0x00E0
#define SBP_FLASH_DONE_RESPONSE_CODE_MASK (0x7)
#define SBP_FLASH_DONE_RESPONSE_CODE_SHIFT (0u)
#define SBP_FLASH_DONE_RESPONSE_CODE_GET(flags) \
(((flags) >> SBP_FLASH_DONE_RESPONSE_CODE_SHIFT) & \
SBP_FLASH_DONE_RESPONSE_CODE_MASK)
#define SBP_FLASH_DONE_RESPONSE_CODE_SET(flags, val) \
do { \
((flags) |= (((val) & (SBP_FLASH_DONE_RESPONSE_CODE_MASK)) \
<< (SBP_FLASH_DONE_RESPONSE_CODE_SHIFT))); \
#define SBP_FLASH_DONE_RESPONSE_CODE_GET(flags) \
((u8)(((flags) >> SBP_FLASH_DONE_RESPONSE_CODE_SHIFT) & \
SBP_FLASH_DONE_RESPONSE_CODE_MASK))
#define SBP_FLASH_DONE_RESPONSE_CODE_SET(flags, val) \
do { \
(flags) = (u8)((flags) | (((val) & (SBP_FLASH_DONE_RESPONSE_CODE_MASK)) \
<< (SBP_FLASH_DONE_RESPONSE_CODE_SHIFT))); \
} while (0)

#define SBP_FLASH_DONE_RESPONSE_CODE_FLASH_OK (0)
Expand All @@ -89,13 +90,14 @@
#define SBP_MSG_FLASH_READ_REQ 0x00E7
#define SBP_FLASH_READ_REQ_FLASH_TARGET_TO_READ_MASK (0x1)
#define SBP_FLASH_READ_REQ_FLASH_TARGET_TO_READ_SHIFT (0u)
#define SBP_FLASH_READ_REQ_FLASH_TARGET_TO_READ_GET(flags) \
(((flags) >> SBP_FLASH_READ_REQ_FLASH_TARGET_TO_READ_SHIFT) & \
SBP_FLASH_READ_REQ_FLASH_TARGET_TO_READ_MASK)
#define SBP_FLASH_READ_REQ_FLASH_TARGET_TO_READ_SET(flags, val) \
do { \
((flags) |= (((val) & (SBP_FLASH_READ_REQ_FLASH_TARGET_TO_READ_MASK)) \
<< (SBP_FLASH_READ_REQ_FLASH_TARGET_TO_READ_SHIFT))); \
#define SBP_FLASH_READ_REQ_FLASH_TARGET_TO_READ_GET(flags) \
((u8)(((flags) >> SBP_FLASH_READ_REQ_FLASH_TARGET_TO_READ_SHIFT) & \
SBP_FLASH_READ_REQ_FLASH_TARGET_TO_READ_MASK))
#define SBP_FLASH_READ_REQ_FLASH_TARGET_TO_READ_SET(flags, val) \
do { \
(flags) = (u8)((flags) | \
(((val) & (SBP_FLASH_READ_REQ_FLASH_TARGET_TO_READ_MASK)) \
<< (SBP_FLASH_READ_REQ_FLASH_TARGET_TO_READ_SHIFT))); \
} while (0)

#define SBP_FLASH_READ_REQ_FLASH_TARGET_TO_READ_FLASH_STM (0)
Expand All @@ -117,13 +119,14 @@
#define SBP_MSG_FLASH_READ_RESP 0x00E1
#define SBP_FLASH_READ_RESP_FLASH_TARGET_TO_READ_MASK (0x1)
#define SBP_FLASH_READ_RESP_FLASH_TARGET_TO_READ_SHIFT (0u)
#define SBP_FLASH_READ_RESP_FLASH_TARGET_TO_READ_GET(flags) \
(((flags) >> SBP_FLASH_READ_RESP_FLASH_TARGET_TO_READ_SHIFT) & \
SBP_FLASH_READ_RESP_FLASH_TARGET_TO_READ_MASK)
#define SBP_FLASH_READ_RESP_FLASH_TARGET_TO_READ_SET(flags, val) \
do { \
((flags) |= (((val) & (SBP_FLASH_READ_RESP_FLASH_TARGET_TO_READ_MASK)) \
<< (SBP_FLASH_READ_RESP_FLASH_TARGET_TO_READ_SHIFT))); \
#define SBP_FLASH_READ_RESP_FLASH_TARGET_TO_READ_GET(flags) \
((u8)(((flags) >> SBP_FLASH_READ_RESP_FLASH_TARGET_TO_READ_SHIFT) & \
SBP_FLASH_READ_RESP_FLASH_TARGET_TO_READ_MASK))
#define SBP_FLASH_READ_RESP_FLASH_TARGET_TO_READ_SET(flags, val) \
do { \
(flags) = (u8)((flags) | \
(((val) & (SBP_FLASH_READ_RESP_FLASH_TARGET_TO_READ_MASK)) \
<< (SBP_FLASH_READ_RESP_FLASH_TARGET_TO_READ_SHIFT))); \
} while (0)

#define SBP_FLASH_READ_RESP_FLASH_TARGET_TO_READ_FLASH_STM (0)
Expand All @@ -145,13 +148,14 @@
#define SBP_MSG_FLASH_ERASE 0x00E2
#define SBP_FLASH_ERASE_FLASH_TARGET_TO_READ_MASK (0x1)
#define SBP_FLASH_ERASE_FLASH_TARGET_TO_READ_SHIFT (0u)
#define SBP_FLASH_ERASE_FLASH_TARGET_TO_READ_GET(flags) \
(((flags) >> SBP_FLASH_ERASE_FLASH_TARGET_TO_READ_SHIFT) & \
SBP_FLASH_ERASE_FLASH_TARGET_TO_READ_MASK)
#define SBP_FLASH_ERASE_FLASH_TARGET_TO_READ_SET(flags, val) \
do { \
((flags) |= (((val) & (SBP_FLASH_ERASE_FLASH_TARGET_TO_READ_MASK)) \
<< (SBP_FLASH_ERASE_FLASH_TARGET_TO_READ_SHIFT))); \
#define SBP_FLASH_ERASE_FLASH_TARGET_TO_READ_GET(flags) \
((u8)(((flags) >> SBP_FLASH_ERASE_FLASH_TARGET_TO_READ_SHIFT) & \
SBP_FLASH_ERASE_FLASH_TARGET_TO_READ_MASK))
#define SBP_FLASH_ERASE_FLASH_TARGET_TO_READ_SET(flags, val) \
do { \
(flags) = \
(u8)((flags) | (((val) & (SBP_FLASH_ERASE_FLASH_TARGET_TO_READ_MASK)) \
<< (SBP_FLASH_ERASE_FLASH_TARGET_TO_READ_SHIFT))); \
} while (0)

#define SBP_FLASH_ERASE_FLASH_TARGET_TO_READ_FLASH_STM (0)
Expand Down
20 changes: 10 additions & 10 deletions c/include/libsbp/gnss_macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@
#define SBP_GNSSSIGNAL__MASK (0xff)
#define SBP_GNSSSIGNAL__SHIFT (0u)
#define SBP_GNSSSIGNAL__GET(flags) \
(((flags) >> SBP_GNSSSIGNAL__SHIFT) & SBP_GNSSSIGNAL__MASK)
#define SBP_GNSSSIGNAL__SET(flags, val) \
do { \
((flags) |= \
(((val) & (SBP_GNSSSIGNAL__MASK)) << (SBP_GNSSSIGNAL__SHIFT))); \
((u8)(((flags) >> SBP_GNSSSIGNAL__SHIFT) & SBP_GNSSSIGNAL__MASK))
#define SBP_GNSSSIGNAL__SET(flags, val) \
do { \
(flags) = (u8)((flags) | (((val) & (SBP_GNSSSIGNAL__MASK)) \
<< (SBP_GNSSSIGNAL__SHIFT))); \
} while (0)

#define SBP_GNSSSIGNAL_GPS_L1CA (0)
Expand Down Expand Up @@ -55,11 +55,11 @@
#define SBP_GNSSSIGNALDEP__MASK (0xff)
#define SBP_GNSSSIGNALDEP__SHIFT (0u)
#define SBP_GNSSSIGNALDEP__GET(flags) \
(((flags) >> SBP_GNSSSIGNALDEP__SHIFT) & SBP_GNSSSIGNALDEP__MASK)
#define SBP_GNSSSIGNALDEP__SET(flags, val) \
do { \
((flags) |= \
(((val) & (SBP_GNSSSIGNALDEP__MASK)) << (SBP_GNSSSIGNALDEP__SHIFT))); \
((u8)(((flags) >> SBP_GNSSSIGNALDEP__SHIFT) & SBP_GNSSSIGNALDEP__MASK))
#define SBP_GNSSSIGNALDEP__SET(flags, val) \
do { \
(flags) = (u8)((flags) | (((val) & (SBP_GNSSSIGNALDEP__MASK)) \
<< (SBP_GNSSSIGNALDEP__SHIFT))); \
} while (0)

#define SBP_GNSSSIGNALDEP_GPS_L1CA (0)
Expand Down
Loading