RKH
Definition library

Files

file  rkhdef.h
 Defines constants and macros.
 

Macros

#define RKH_BIT(bit)   (1u << (bit))
 Create bit mask with single, specified bit set. More...
 
#define RKH_BIT_MASK(bit_mask, bit_shift)    ((bit_mask) << (bit_shift))
 Shift a bit mask. More...
 
#define RKH_BIT_IS_SET(val, mask)
 Determine if specified bit(s) in a value are set. More...
 
#define RKH_BIT_IS_CLR(val, mask)
 Determine if specified bit(s) in a value are clear. More...
 
#define RKH_BIT_IS_SET_ANY(val, mask)    ((((val) & (mask)) == 0u) ? (RKH_NO) : (RKH_YES))
 Determine if any specified bit(s) in a value are set. More...
 
#define RKH_BIT_IS_CLR_ANY(val, mask)    ((((val) & (mask)) == (mask)) ? (RKH_NO) : (RKH_YES))
 Determine if any specified bit(s) in a value are clear. More...
 
#define RKH_BIT08(bit)   ((rui8_t)((rui8_t) 1u << (bit)))
 Create bit mask of specified bit size with single, specified bit set. More...
 
#define RKH_BIT16(bit)   ((rui16_t)((rui16_t) 1u << (bit)))
 Create bit mask of specified bit size with single, specified bit set. More...
 
#define RKH_BIT32(bit)   ((rui32_t)((rui32_t) 1u << (bit)))
 Create bit mask of specified bit size with single, specified bit set. More...
 
#define RKH_BIT_MASK_08(bit_mask, bit_shift)    ((rui8_t)((rui8_t)(bit_mask) << (bit_shift)))
 Shift a bit mask of specified bit size. More...
 
#define RKH_BIT_MASK_16(bit_mask, bit_shift)    ((rui16_t)((rui16_t)(bit_mask) << (bit_shift)))
 Shift a bit mask of specified bit size. More...
 
#define RKH_BIT_MASK_32(bit_mask, bit_shift)    ((rui32_t)((rui32_t)(bit_mask) << (bit_shift)))
 Shift a bit mask of specified bit size. More...
 
#define RKH_BIT_SET_08(val, mask)    ((val) = (rui8_t)(((rui8_t)(val)) | ((rui8_t)(mask))))
 Set specified bit(s) in a value of specified bit size. More...
 
#define RKH_BIT_SET_16(val, mask)    ((val) = (rui16_t)(((rui16_t)(val)) | ((rui16_t)(mask))))
 Set specified bit(s) in a value of specified bit size. More...
 
#define RKH_BIT_SET_32(val, mask)    ((val) = (rui32_t)(((rui32_t)(val)) | ((rui32_t)(mask))))
 Set specified bit(s) in a value of specified bit size. More...
 
#define RKH_BIT_CLR_08(val, mask)    ((val) = (rui8_t)(((rui8_t)(val)) & ((rui8_t) ~(mask))))
 Clear specified bit(s) in a value of specified bit size. More...
 
#define RKH_BIT_CLR_16(val, mask)    ((val) = (rui16_t)(((rui16_t)(val)) & ((rui16_t) ~(mask))))
 Clear specified bit(s) in a value of specified bit size. More...
 
#define RKH_BIT_CLR_32(val, mask)    ((val) = (rui32_t)(((rui32_t)(val)) & ((rui32_t) ~(mask))))
 Clear specified bit(s) in a value of specified bit size. More...
 
#define RKH_FALSE   0u
 Standard define.
 
#define RKH_TRUE   1u
 Standard define.
 
#define RKH_NO   0u
 Standard define.
 
#define RKH_YES   1u
 Standard define.
 
#define RKH_DISABLED   0u
 Standard define.
 
#define RKH_ENABLED   1u
 Standard define.
 
#define RKH_INACTIVE   0u
 Standard define.
 
#define RKH_ACTIVE   1u
 Standard define.
 
#define RKH_INVALID   0u
 Standard define.
 
#define RKH_VALID   1u
 Standard define.
 
#define RKH_OFF   0u
 Standard define.
 
#define RKH_ON   1u
 Standard define.
 
#define RKH_CLR   0u
 Standard define.
 
#define RKH_SET   1u
 Standard define.
 
#define RKH_FAIL   0u
 Standard define.
 
#define RKH_OK   1u
 Standard define.
 

Detailed Description

Macro Definition Documentation

◆ RKH_BIT

#define RKH_BIT (   bit)    (1u << (bit))

Create bit mask with single, specified bit set.

Parameters
[in]bitBit number of bit to set.
Returns
Bit mask with single, specified bit set.

Definition at line 88 of file rkhdef.h.

◆ RKH_BIT08

#define RKH_BIT08 (   bit)    ((rui8_t)((rui8_t) 1u << (bit)))

Create bit mask of specified bit size with single, specified bit set.

Parameters
[in]bitBit number of bit to set.
Returns
Bit mask with single, specified bit set.

Definition at line 101 of file rkhdef.h.

◆ RKH_BIT_MASK

#define RKH_BIT_MASK (   bit_mask,
  bit_shift 
)     ((bit_mask) << (bit_shift))

Shift a bit mask.

Parameters
[in]bit_maskBit mask to shift.
[in]bit_shiftNumber of bit positions to left-shift bit mask.
Returns
Shifted bit mask.

Definition at line 118 of file rkhdef.h.

◆ RKH_BIT_MASK_08

#define RKH_BIT_MASK_08 (   bit_mask,
  bit_shift 
)     ((rui8_t)((rui8_t)(bit_mask) << (bit_shift)))

Shift a bit mask of specified bit size.

Parameters
[in]bit_maskBit mask to shift.
[in]bit_shiftNumber of bit positions to left-shift bit mask.
Returns
Shifted bit mask.

Definition at line 133 of file rkhdef.h.

◆ RKH_BIT_SET_08

#define RKH_BIT_SET_08 (   val,
  mask 
)     ((val) = (rui8_t)(((rui8_t)(val)) | ((rui8_t)(mask))))

Set specified bit(s) in a value of specified bit size.

Parameters
[in]valValue to modify by setting specified bit(s).
[in]maskMask of bits to set.
Returns
Modified value with specified bit(s) set.

Definition at line 153 of file rkhdef.h.

◆ RKH_BIT_CLR_08

#define RKH_BIT_CLR_08 (   val,
  mask 
)     ((val) = (rui8_t)(((rui8_t)(val)) & ((rui8_t) ~(mask))))

Clear specified bit(s) in a value of specified bit size.

Parameters
[in]valValue to modify by clearing specified bit(s).
[in]maskMask of bits to clear.
Returns
Modified value with specified bit(s) clear.

Definition at line 173 of file rkhdef.h.

◆ RKH_BIT_IS_SET

#define RKH_BIT_IS_SET (   val,
  mask 
)
Value:
((((mask) != 0u) && \
(((val) & (mask)) == (mask))) ? (RKH_YES) : (RKH_NO))
#define RKH_NO
Standard define.
Definition: rkhdef.h:259
#define RKH_YES
Standard define.
Definition: rkhdef.h:260

Determine if specified bit(s) in a value are set.

Parameters
[in]valValue to check for specified bit(s) set.
[in]maskMask of bits to check if set.
Returns
RKH_YES, if ALL specified bit(s) are set in value. RKH_NO, if ALL specified bit(s) are NOT set in value.

Definition at line 194 of file rkhdef.h.

◆ RKH_BIT_IS_CLR

#define RKH_BIT_IS_CLR (   val,
  mask 
)
Value:
((((mask) != 0u) && \
(((val) & (mask)) == 0u)) ? (RKH_YES) : (RKH_NO))

Determine if specified bit(s) in a value are clear.

Parameters
[in]valValue to check for specified bit(s) clear.
[in]maskMask of bits to check if clear.
Returns
RKH_YES, if ALL specified bit(s) are clear in value. RKH_NO, if ALL specified bit(s) are NOT clear in value.

Definition at line 211 of file rkhdef.h.

◆ RKH_BIT_IS_SET_ANY

#define RKH_BIT_IS_SET_ANY (   val,
  mask 
)     ((((val) & (mask)) == 0u) ? (RKH_NO) : (RKH_YES))

Determine if any specified bit(s) in a value are set.

Parameters
[in]valValue to check for specified bit(s) set.
[in]maskMask of bits to check if set.
Returns
RKH_YES, if ALL specified bit(s) are set in value. RKH_NO, if ALL specified bit(s) are NOT set in value.

Definition at line 228 of file rkhdef.h.

◆ RKH_BIT_IS_CLR_ANY

#define RKH_BIT_IS_CLR_ANY (   val,
  mask 
)     ((((val) & (mask)) == (mask)) ? (RKH_NO) : (RKH_YES))

Determine if any specified bit(s) in a value are clear.

Parameters
[in]valValue to check for specified bit(s) clear.
[in]maskMask of bits to check if clear.
Returns
RKH_YES, if ALL specified bit(s) are clear in value. RKH_NO, if ALL specified bit(s) are NOT clear in value.

Definition at line 244 of file rkhdef.h.

◆ RKH_BIT16

#define RKH_BIT16 (   bit)    ((rui16_t)((rui16_t) 1u << (bit)))

Create bit mask of specified bit size with single, specified bit set.

Parameters
[in]bitBit number of bit to set.
Returns
Bit mask with single, specified bit set.

Definition at line 102 of file rkhdef.h.

◆ RKH_BIT32

#define RKH_BIT32 (   bit)    ((rui32_t)((rui32_t) 1u << (bit)))

Create bit mask of specified bit size with single, specified bit set.

Parameters
[in]bitBit number of bit to set.
Returns
Bit mask with single, specified bit set.

Definition at line 103 of file rkhdef.h.

◆ RKH_BIT_MASK_16

#define RKH_BIT_MASK_16 (   bit_mask,
  bit_shift 
)     ((rui16_t)((rui16_t)(bit_mask) << (bit_shift)))

Shift a bit mask of specified bit size.

Parameters
[in]bit_maskBit mask to shift.
[in]bit_shiftNumber of bit positions to left-shift bit mask.
Returns
Shifted bit mask.

Definition at line 135 of file rkhdef.h.

◆ RKH_BIT_MASK_32

#define RKH_BIT_MASK_32 (   bit_mask,
  bit_shift 
)     ((rui32_t)((rui32_t)(bit_mask) << (bit_shift)))

Shift a bit mask of specified bit size.

Parameters
[in]bit_maskBit mask to shift.
[in]bit_shiftNumber of bit positions to left-shift bit mask.
Returns
Shifted bit mask.

Definition at line 137 of file rkhdef.h.

◆ RKH_BIT_SET_16

#define RKH_BIT_SET_16 (   val,
  mask 
)     ((val) = (rui16_t)(((rui16_t)(val)) | ((rui16_t)(mask))))

Set specified bit(s) in a value of specified bit size.

Parameters
[in]valValue to modify by setting specified bit(s).
[in]maskMask of bits to set.
Returns
Modified value with specified bit(s) set.

Definition at line 155 of file rkhdef.h.

◆ RKH_BIT_SET_32

#define RKH_BIT_SET_32 (   val,
  mask 
)     ((val) = (rui32_t)(((rui32_t)(val)) | ((rui32_t)(mask))))

Set specified bit(s) in a value of specified bit size.

Parameters
[in]valValue to modify by setting specified bit(s).
[in]maskMask of bits to set.
Returns
Modified value with specified bit(s) set.

Definition at line 157 of file rkhdef.h.

◆ RKH_BIT_CLR_16

#define RKH_BIT_CLR_16 (   val,
  mask 
)     ((val) = (rui16_t)(((rui16_t)(val)) & ((rui16_t) ~(mask))))

Clear specified bit(s) in a value of specified bit size.

Parameters
[in]valValue to modify by clearing specified bit(s).
[in]maskMask of bits to clear.
Returns
Modified value with specified bit(s) clear.

Definition at line 175 of file rkhdef.h.

◆ RKH_BIT_CLR_32

#define RKH_BIT_CLR_32 (   val,
  mask 
)     ((val) = (rui32_t)(((rui32_t)(val)) & ((rui32_t) ~(mask))))

Clear specified bit(s) in a value of specified bit size.

Parameters
[in]valValue to modify by clearing specified bit(s).
[in]maskMask of bits to clear.
Returns
Modified value with specified bit(s) clear.

Definition at line 177 of file rkhdef.h.