Loading...
Searching...
No Matches
Kinetis Bit Manipulation Engine (BME)

Macros for using decorated memory accesses with the Bit Manipulation Engine available in Kinetis Cortex-M0+ devices. More...

Detailed Description

Macros for using decorated memory accesses with the Bit Manipulation Engine available in Kinetis Cortex-M0+ devices.

Files

file  bme.h
 Macro definitions for the Kinetis Bit Manipulation Engine (BME)
 

Macros

#define BITBAND_FUNCTIONS_PROVIDED   0
 Tell bit.h that we provide CPU specific bit manipulation functions.
 
#define BME_AND_MASK   (1 << 26)
 AND decoration bitmask.
 
#define BME_OR_MASK   (1 << 27)
 OR decoration bitmask.
 
#define BME_XOR_MASK   (3 << 26)
 XOR decoration bitmask.
 
#define BME_LAC1_MASK(BIT)
 Load-and-clear 1 bit.
 
#define BME_LAS1_MASK(BIT)
 Load-and-set 1 bit.
 
#define BME_BF_MASK(bit, width)
 Bit field extraction bitmask.
 

Functions

static volatile void * bme_bf_addr (volatile void *ptr, uintptr_t bit, uintptr_t width)
 Bit field address macro.
 
static volatile uint32_t * bme_bitfield32 (volatile uint32_t *ptr, uint8_t bit, uint8_t width)
 Access a bitfield (32 bit load/store)
 
static volatile uint16_t * bme_bitfield16 (volatile uint16_t *ptr, uint8_t bit, uint8_t width)
 Access a bitfield (16 bit load/store)
 
static volatile uint8_t * bme_bitfield8 (volatile uint8_t *ptr, uint8_t bit, uint8_t width)
 Access a bitfield (8 bit load/store)
 

Macro Definition Documentation

◆ BITBAND_FUNCTIONS_PROVIDED

#define BITBAND_FUNCTIONS_PROVIDED   0

Tell bit.h that we provide CPU specific bit manipulation functions.

Definition at line 31 of file bme.h.

◆ BME_AND_MASK

#define BME_AND_MASK   (1 << 26)

AND decoration bitmask.

Definition at line 33 of file bme.h.

◆ BME_BF_MASK

#define BME_BF_MASK ( bit,
width )
Value:
((1 << 28) | ((bit) << 23) | (((width) - 1 ) << 19))

Bit field extraction bitmask.

Parameters
bitLSB of the bitfield within the word/halfword/byte
widthNumber of bits to extract

Definition at line 45 of file bme.h.

◆ BME_LAC1_MASK

#define BME_LAC1_MASK ( BIT)
Value:
((1 << 27) | ((BIT) << 21))

Load-and-clear 1 bit.

Definition at line 36 of file bme.h.

◆ BME_LAS1_MASK

#define BME_LAS1_MASK ( BIT)
Value:
((3 << 26) | ((BIT) << 21))

Load-and-set 1 bit.

Definition at line 37 of file bme.h.

◆ BME_OR_MASK

#define BME_OR_MASK   (1 << 27)

OR decoration bitmask.

Definition at line 34 of file bme.h.

◆ BME_XOR_MASK

#define BME_XOR_MASK   (3 << 26)

XOR decoration bitmask.

Definition at line 35 of file bme.h.

Function Documentation

◆ bme_bf_addr()

static volatile void * bme_bf_addr ( volatile void * ptr,
uintptr_t bit,
uintptr_t width )
inlinestatic

Bit field address macro.

Precondition
The target address must lie within a part of the peripheral address space 0x40000000 - 0x40070000
Parameters
[in]ptrPointer to target register
[in]bitLocation of the LSB of the bitfield within the register
[in]widthWidth of the bitfield, in bits
Returns
bitfield address as an uintptr_t

Definition at line 59 of file bme.h.

◆ bme_bitfield16()

static volatile uint16_t * bme_bitfield16 ( volatile uint16_t * ptr,
uint8_t bit,
uint8_t width )
inlinestatic

Access a bitfield (16 bit load/store)

This macro can be used both for store (*bme_bitfield16(xxx) = y) and load (y = *bme_bitfield16(ptr, bit))

Precondition
The target address must lie within a part of the peripheral address space 0x40000000 - 0x40070000
Parameters
[in]ptrPointer to target register
[in]bitLocation of the LSB of the bitfield within the register
[in]widthWidth of the bitfield, in bits
Returns
bitfield extracted as a (modifiable) lvalue

Definition at line 99 of file bme.h.

◆ bme_bitfield32()

static volatile uint32_t * bme_bitfield32 ( volatile uint32_t * ptr,
uint8_t bit,
uint8_t width )
inlinestatic

Access a bitfield (32 bit load/store)

This macro can be used both for store (*bme_bitfield32(xxx) = y) and load (y = *bme_bitfield32(ptr, bit))

Precondition
The target address must lie within a part of the peripheral address space 0x40000000 - 0x40070000
Parameters
[in]ptrPointer to target register
[in]bitLocation of the LSB of the bitfield within the register
[in]widthWidth of the bitfield, in bits
Returns
bitfield extracted as a (modifiable) lvalue

Definition at line 79 of file bme.h.

◆ bme_bitfield8()

static volatile uint8_t * bme_bitfield8 ( volatile uint8_t * ptr,
uint8_t bit,
uint8_t width )
inlinestatic

Access a bitfield (8 bit load/store)

This macro can be used both for store (*bme_bitfield8(xxx) = y) and load (y = *bme_bitfield8(ptr, bit))

Precondition
The target address must lie within a part of the peripheral address space 0x40000000 - 0x40070000
Parameters
[in]ptrPointer to target register
[in]bitLocation of the LSB of the bitfield within the register
[in]widthWidth of the bitfield, in bits
Returns
bitfield extracted as a (modifiable) lvalue

Definition at line 119 of file bme.h.