Macros for using decorated memory accesses with the Bit Manipulation Engine available in Kinetis Cortex-M0+ devices.  
More...
Macros for using decorated memory accesses with the Bit Manipulation Engine available in Kinetis Cortex-M0+ devices. 
 | 
| file   | bme.h | 
|   | Macro definitions for the Kinetis Bit Manipulation Engine (BME) 
  | 
|   | 
 | 
| static volatile void *  | bme_bf_addr (volatile void *ptr, uintptr_t bit, uintptr_t width) | 
|   | Bit field address macro.  More...
  | 
|   | 
| static volatile uint32_t *  | bme_bitfield32 (volatile uint32_t *ptr, uint8_t bit, uint8_t width) | 
|   | Access a bitfield (32 bit load/store)  More...
  | 
|   | 
| static volatile uint16_t *  | bme_bitfield16 (volatile uint16_t *ptr, uint8_t bit, uint8_t width) | 
|   | Access a bitfield (16 bit load/store)  More...
  | 
|   | 
| static volatile uint8_t *  | bme_bitfield8 (volatile uint8_t *ptr, uint8_t bit, uint8_t width) | 
|   | Access a bitfield (8 bit load/store)  More...
  | 
|   | 
| static void  | bit_set32 (volatile uint32_t *ptr, uint8_t bit) | 
|   | Set a single bit in the 32 bit word pointed to by ptr.  More...
  | 
|   | 
| static void  | bit_set16 (volatile uint16_t *ptr, uint8_t bit) | 
|   | Set a single bit in the 16 bit word pointed to by ptr.  More...
  | 
|   | 
| static void  | bit_set8 (volatile uint8_t *ptr, uint8_t bit) | 
|   | Set a single bit in the 8 bit byte pointed to by ptr.  More...
  | 
|   | 
| static void  | bit_clear32 (volatile uint32_t *ptr, uint8_t bit) | 
|   | Clear a single bit in the 32 bit word pointed to by ptr.  More...
  | 
|   | 
| static void  | bit_clear16 (volatile uint16_t *ptr, uint8_t bit) | 
|   | Clear a single bit in the 16 bit word pointed to by ptr.  More...
  | 
|   | 
| static void  | bit_clear8 (volatile uint8_t *ptr, uint8_t bit) | 
|   | Clear a single bit in the 8 bit byte pointed to by ptr.  More...
  | 
|   | 
◆ BME_BF_MASK
      
        
          | #define BME_BF_MASK | 
          ( | 
            | 
          bit,  | 
        
        
           | 
           | 
            | 
          width  | 
        
        
           | 
          ) | 
           |    ((1 << 28) | ((bit) << 23) | (((width) - 1 ) << 19)) | 
        
      
 
Bit field extraction bitmask. 
- Parameters
 - 
  
    | bit | LSB of the bitfield within the word/halfword/byte  | 
    | width | Number of bits to extract  | 
  
   
Definition at line 49 of file bme.h.
 
 
◆ bit_clear16()
  
  
      
        
          | static void bit_clear16  | 
          ( | 
          volatile uint16_t *  | 
          ptr,  | 
         
        
           | 
           | 
          uint8_t  | 
          bit  | 
         
        
           | 
          ) | 
           |  | 
         
       
   | 
  
inlinestatic   | 
  
 
Clear a single bit in the 16 bit word pointed to by ptr. 
The effect is the same as for the following snippet:
There is a read-modify-write cycle occurring within the core, but this cycle is atomic and can not be disrupted by IRQs
- Parameters
 - 
  
    | [in] | ptr | pointer to target word  | 
    | [in] | bit | bit number within the word  | 
  
   
Definition at line 225 of file bme.h.
 
 
◆ bit_clear32()
  
  
      
        
          | static void bit_clear32  | 
          ( | 
          volatile uint32_t *  | 
          ptr,  | 
         
        
           | 
           | 
          uint8_t  | 
          bit  | 
         
        
           | 
          ) | 
           |  | 
         
       
   | 
  
inlinestatic   | 
  
 
Clear a single bit in the 32 bit word pointed to by ptr. 
The effect is the same as for the following snippet:
There is a read-modify-write cycle occurring within the core, but this cycle is atomic and can not be disrupted by IRQs
- Parameters
 - 
  
    | [in] | ptr | pointer to target word  | 
    | [in] | bit | bit number within the word  | 
  
   
Definition at line 205 of file bme.h.
 
 
◆ bit_clear8()
  
  
      
        
          | static void bit_clear8  | 
          ( | 
          volatile uint8_t *  | 
          ptr,  | 
         
        
           | 
           | 
          uint8_t  | 
          bit  | 
         
        
           | 
          ) | 
           |  | 
         
       
   | 
  
inlinestatic   | 
  
 
Clear a single bit in the 8 bit byte pointed to by ptr. 
The effect is the same as for the following snippet:
There is a read-modify-write cycle occurring within the core, but this cycle is atomic and can not be disrupted by IRQs
- Parameters
 - 
  
    | [in] | ptr | pointer to target byte  | 
    | [in] | bit | bit number within the byte  | 
  
   
Definition at line 245 of file bme.h.
 
 
◆ bit_set16()
  
  
      
        
          | static void bit_set16  | 
          ( | 
          volatile uint16_t *  | 
          ptr,  | 
         
        
           | 
           | 
          uint8_t  | 
          bit  | 
         
        
           | 
          ) | 
           |  | 
         
       
   | 
  
inlinestatic   | 
  
 
Set a single bit in the 16 bit word pointed to by ptr. 
The effect is the same as for the following snippet:
There is a read-modify-write cycle occurring within the core, but this cycle is atomic and can not be disrupted by IRQs
- Parameters
 - 
  
    | [in] | ptr | pointer to target word  | 
    | [in] | bit | bit number within the word  | 
  
   
Definition at line 165 of file bme.h.
 
 
◆ bit_set32()
  
  
      
        
          | static void bit_set32  | 
          ( | 
          volatile uint32_t *  | 
          ptr,  | 
         
        
           | 
           | 
          uint8_t  | 
          bit  | 
         
        
           | 
          ) | 
           |  | 
         
       
   | 
  
inlinestatic   | 
  
 
Set a single bit in the 32 bit word pointed to by ptr. 
The effect is the same as for the following snippet:
There is a read-modify-write cycle occurring within the core, but this cycle is atomic and can not be disrupted by IRQs
- Parameters
 - 
  
    | [in] | ptr | pointer to target word  | 
    | [in] | bit | bit number within the word  | 
  
   
Definition at line 145 of file bme.h.
 
 
◆ bit_set8()
  
  
      
        
          | static void bit_set8  | 
          ( | 
          volatile uint8_t *  | 
          ptr,  | 
         
        
           | 
           | 
          uint8_t  | 
          bit  | 
         
        
           | 
          ) | 
           |  | 
         
       
   | 
  
inlinestatic   | 
  
 
Set a single bit in the 8 bit byte pointed to by ptr. 
The effect is the same as for the following snippet:
There is a read-modify-write cycle occurring within the core, but this cycle is atomic and can not be disrupted by IRQs
- Parameters
 - 
  
    | [in] | ptr | pointer to target byte  | 
    | [in] | bit | bit number within the byte  | 
  
   
Definition at line 185 of file bme.h.
 
 
◆ 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] | ptr | Pointer to target register  | 
    | [in] | bit | Location of the LSB of the bitfield within the register  | 
    | [in] | width | Width of the the bitfield, in bits | 
  
   
- Returns
 - bitfield address as an uintptr_t 
 
Definition at line 63 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] | ptr | Pointer to target register  | 
    | [in] | bit | Location of the LSB of the bitfield within the register  | 
    | [in] | width | Width of the the bitfield, in bits | 
  
   
- Returns
 - bitfield extracted as a (modifiable) lvalue 
 
Definition at line 103 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] | ptr | Pointer to target register  | 
    | [in] | bit | Location of the LSB of the bitfield within the register  | 
    | [in] | width | Width of the the bitfield, in bits | 
  
   
- Returns
 - bitfield extracted as a (modifiable) lvalue 
 
Definition at line 83 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] | ptr | Pointer to target register  | 
    | [in] | bit | Location of the LSB of the bitfield within the register  | 
    | [in] | width | Width of the the bitfield, in bits | 
  
   
- Returns
 - bitfield extracted as a (modifiable) lvalue 
 
Definition at line 123 of file bme.h.