MKM34Z256VLx7 Bare Metal Software Drivers  R4.1.6
Reference Manual
I/O API Specification

Overview

This section describes use of each I/O macro. All logical operations, which destination peripheral register address reg is in peripheral address space [0x4000_0000-0x4007_FFFF] are accelerated by the Bit Manipulation Engine (BME). The core platform's Bit Manipulation Engine (BME) provides hardware support for atomic read-modify-write memory operations to the peripheral address space. Supported logical operations:

Basic operations AND OR XOR Set Clear Toggle Insert Load-and-ClearLoad-and-StoreExtract
byte (8-bit) ioandbioorbioxorbiosetbioclrbiotglb iobfibiolac1b iolas1b iobfxb
halfword (16-bit)ioandhioorhioxorhiosethioclrhiotglh iobfihiolac1h iolas1h iobfxh
word (32-bit) ioandwioorwioxorwiosetwioclrwiotglw iobfiwiolac1w iolas1w iobfxw

Macros

#define ioandb(reg, val)
 Performs a bit-wise AND operation on byte (8-bit) peripheral register. More...
 
#define ioandh(reg, val)
 Performs a bit-wise AND operation on halfword (16-bit) peripheral register. More...
 
#define ioandw(reg, val)
 Performs a bit-wise AND operation on word (32-bit) peripheral register. More...
 
#define ioorb(reg, val)
 Performs a bit-wise OR operation on byte (8-bit) peripheral register. More...
 
#define ioorh(reg, val)
 Performs a bit-wise OR operation on halfword (16-bit) peripheral register. More...
 
#define ioorw(reg, val)
 Performs a bit-wise OR operation on word (32-bit) peripheral register. More...
 
#define ioxorb(reg, val)
 Performs a bit-wise XOR operation on byte (8-bit) peripheral register. More...
 
#define ioxorh(reg, val)
 Performs a bit-wise XOR operation on halfword (16-bit) peripheral register. More...
 
#define ioxorw(reg, val)
 Performs a bit-wise XOR operation on word (32-bit) peripheral register. More...
 
#define ioclrb(reg, val)
 Clear bits in a byte (8-bit) peripheral register. More...
 
#define ioclrh(reg, val)
 Clear bits in a halfword (16-bit) peripheral register. More...
 
#define ioclrw(reg, val)
 Clear bits in a word (32-bit) peripheral register. More...
 
#define iosetb(reg, val)
 Set bits in a byte (8-bit) peripheral register. More...
 
#define ioseth(reg, val)
 Set bits in a halfword (16-bit) peripheral register. More...
 
#define iosetw(reg, val)
 Set bits in a word (32-bit) peripheral register. More...
 
#define iotglb(reg, val)
 Toggle bits in a byte (8-bit) peripheral register. More...
 
#define iotglh(reg, val)
 Toggle bits in a halfword (16-bit) peripheral register. More...
 
#define iotglw(reg, val)
 Toggle bits in a word (32-bit) peripheral register. More...
 
#define iobfib(reg, shift, width, val)
 Performs a bit field insert BFI operation on byte (8-bit) peripheral register. More...
 
#define iobfih(reg, shift, width, val)
 Performs a bit field insert BFI operation on halfword (16-bit) peripheral register. More...
 
#define iobfiw(reg, shift, width, val)
 Performs a bit field insert BFI operation on word (32-bit) peripheral register. More...
 
#define iolac1b(reg, shift)
 Returns a 1-bit field of the byte (8-bit) peripheral register and clears the same bit. More...
 
#define iolac1h(reg, shift)
 Returns a 1-bit field of the halfword (16-bit) peripheral register and clears the same bit. More...
 
#define iolac1w(reg, shift)
 Returns a 1-bit field of the word (32-bit) peripheral register and cleared the same bit. More...
 
#define iolas1b(reg, shift)
 Returns a 1-bit field of the byte (8-bit) peripheral register and sets the same bit. More...
 
#define iolas1h(reg, shift)
 Returns a 1-bit field of the halfword (16-bit) peripheral register and sets the same bit. More...
 
#define iolas1w(reg, shift)
 Returns a 1-bit field of the word (32-bit) peripheral register and sets the same bit. More...
 
#define iobfxb(reg, shift, width)
 Returns a bit field of the byte (8-bit) peripheral register. More...
 
#define iobfxh(reg, shift, width)
 Returns a bit field of the halfword (16-bit) peripheral register. More...
 
#define iobfxw(reg, shift, width)
 Returns a bit field of the word (32-bit) peripheral register. More...
 

Macro Definition Documentation

#define ioandb (   reg,
  val 
)

The ioandb macro performs a bit-wise AND of the argument val and a byte (8-bit) register defined by the argument reg.

Parameters
regByte (8-bit) peripheral register.
valuint8 AND mask.
Note
Implemented as an inline macro.
#define ioandh (   reg,
  val 
)

The ioandh macro performs a bit-wise AND of the argument val and a halfword (8-bit) register defined by the argument reg.

Parameters
regHalfword (16-bit) peripheral register.
valuint16 AND mask.
Note
Implemented as an inline macro.
#define ioandw (   reg,
  val 
)

The ioandw macro performs a bit-wise AND of the argument val and a word (32-bit) register defined by the argument reg.

Parameters
regWord (32-bit) peripheral register.
valuint32 AND mask.
Note
Implemented as an inline macro.
#define ioorb (   reg,
  val 
)

The ioorb macro performs a bit-wise OR of the argument val OR a byte (8-bit) register defined by the argument reg.

Parameters
regByte (8-bit) peripheral register.
valuint8 OR mask.
Note
Implemented as an inline macro.
#define ioorh (   reg,
  val 
)

The ioorh macro performs a bit-wise OR of the argument val and a halfword (8-bit) register defined by the argument reg.

Parameters
regHalfword (16-bit) peripheral register.
valuint16 OR mask.
Note
Implemented as an inline macro.
#define ioorw (   reg,
  val 
)

The ioorw macro performs a bit-wise OR of the argument val and a word (32-bit) register defined by the argument reg.

Parameters
regWord (32-bit) peripheral register.
valuint32 OR mask.
Note
Implemented as an inline macro.
#define ioxorb (   reg,
  val 
)

The ioxorb macro performs a bit-wise XOR of the argument val XOR a byte (8-bit) register defined by the argument reg.

Parameters
regByte (8-bit) peripheral register.
valuint8 XOR mask.
Note
Implemented as an inline macro.
#define ioxorh (   reg,
  val 
)

The ioxorh macro performs a bit-wise XOR of the argument val and a halfword (8-bit) register defined by the argument reg.

Parameters
regHalfword (16-bit) peripheral register.
valuint16 XOR mask.
Note
Implemented as an inline macro.
#define ioxorw (   reg,
  val 
)

The ioxorw macro performs a bit-wise XOR of the argument val and a word (32-bit) register defined by the argument reg.

Parameters
regWord (32-bit) peripheral register.
valuint32 XOR mask.
Note
Implemented as an inline macro.
#define ioclrb (   reg,
  val 
)

The ioclrb macro clears bits, defined by argument val, in a byte (8-bit) peripheral register defined by argument reg.

Parameters
regByte (8-bit) peripheral register.
valuint8 bit mask.
Note
Implemented as an inline macro.
#define ioclrh (   reg,
  val 
)

The ioclrh macro clears bits, defined by argument val, in a halfword (16-bit) peripheral register defined by argument reg.

Parameters
regHalfword (16-bit) peripheral register.
valuint16 bit mask.
Note
Implemented as an inline macro.
#define ioclrw (   reg,
  val 
)

The ioclrw macro clears bits, defined by argument val, in a word (32-bit) peripheral register defined by argument reg.

Parameters
regWord (32-bit) peripheral register.
valuint32 bit mask.
Note
Implemented as an inline macro.
#define iosetb (   reg,
  val 
)

The iosetb macro sets bits, defined by argument val, in a byte (8-bit) peripheral register defined by argument reg.

Parameters
regByte (8-bit) peripheral register.
valuint8 bit mask.
Note
Implemented as an inline macro.
#define ioseth (   reg,
  val 
)

The ioseth macro sets bits, defined by argument val, in a halfword (16-bit) peripheral register defined by argument reg.

Parameters
regHalfword (16-bit) peripheral register.
valuint16 bit mask.
Note
Implemented as an inline macro.
#define iosetw (   reg,
  val 
)

The iosetw macro sets bits, defined by argument val, in a word (32-bit) peripheral register defined by argument reg.

Parameters
regWord (32-bit) peripheral register.
valuint32 bit mask.
Note
Implemented as an inline macro.
#define iotglb (   reg,
  val 
)

The iotglb macro toggles bits, defined by argument val, in a byte (8-bit) peripheral register defined by argument reg.

Parameters
regByte (8-bit) peripheral register.
valuint8 bit mask.
Note
Implemented as an inline macro.
#define iotglh (   reg,
  val 
)

The iotglh macro toggles bits, defined by argument val, in a halfword (16-bit) peripheral register defined by argument reg.

Parameters
regHalfword (16-bit) peripheral register.
valuint16 bit mask.
Note
Implemented as an inline macro.
#define iotglw (   reg,
  val 
)

The iotglw macro toggles bits, defined by argument val, in a word (32-bit) peripheral register defined by argument reg.

Parameters
regWord (32-bit) peripheral register.
valuint32 bit mask.
Note
Implemented as an inline macro.
#define iobfib (   reg,
  shift,
  width,
  val 
)

The iobfib macro inserts a bit field val of size width into a byte (8-bit) peripheral register defined by argument reg. The bit field is inserted into peripheral register reg starting at bit position defined by argument shift.

Parameters
regByte (8-bit) peripheral register.
shiftBit field position [0-7].
widthBit field size [1-8].
valuint8 bit field value.
Note
Implemented as an inline macro.
#define iobfih (   reg,
  shift,
  width,
  val 
)

The iobfih macro inserts a bit field val of size width into a halfword (16-bit) peripheral register defined by argument reg. The bit field is inserted into peripheral register reg starting at bit position defined by argument shift.

Parameters
regHalfword (16-bit) peripheral register.
shiftBit field position [0-15].
widthBit field size [1-16].
valuint16 bit field value.
Note
Implemented as an inline macro.
#define iobfiw (   reg,
  shift,
  width,
  val 
)

The iobfiw macro inserts a bit field val of size width into a word (32-bit) peripheral register defined by argument reg. The bit field is inserted into peripheral register reg starting at bit position defined by argument shift.

Parameters
regWord (32-bit) peripheral register.
shiftBit field position [0-31].
widthBit field size [1-16].
valuint16 bit field value.
Note
Implemented as an inline macro.
#define iolac1b (   reg,
  shift 
)

The iolac1b macro returns a right justified and zero filled 1-bit field from bit position defined by shift of a byte (8-bit) peripheral register defined by argument reg. The same bit is cleared.

Parameters
regByte (8-bit) peripheral register.
shiftBit field position [0-7].
Returns
uint8 right justified and zero filled 1-bit field value.
Note
Implemented as an inline macro.
#define iolac1h (   reg,
  shift 
)

The iolac1h macro returns a right justified and zero filled 1-bit field from bit position defined by shift of a halfword (16-bit) peripheral register defined by argument reg. The same bit is cleared.

Parameters
regHalfword (16-bit) peripheral register.
shiftBit field position [0-15].
Returns
uint8 right justified and zero filled 1-bit field value.
Note
Implemented as an inline macro.
#define iolac1w (   reg,
  shift 
)

The iolac1w macro returns a right justified and zero filled 1-bit field from bit position defined by shift of a word (32-bit) peripheral register defined by argument reg. The same bit is cleared.

Parameters
regWord (32-bit) peripheral register.
shiftBit field position [0-31].
Returns
uint8 right justified and zero filled 1-bit field value.
Note
Implemented as an inline macro.
#define iolas1b (   reg,
  shift 
)

The iolas1b macro returns a right justified and zero filled 1-bit field from bit position defined by shift of a byte (8-bit) peripheral register defined by argument reg. The same bit is set.

Parameters
regByte (8-bit) peripheral register.
shiftBit field position [0-7].
Returns
uint8 right justified and zero filled 1-bit field value.
Note
Implemented as an inline macro.
#define iolas1h (   reg,
  shift 
)

The iolas1h macro returns a right justified and zero filled 1-bit field from bit position defined by shift of a halfword (16-bit) peripheral register defined by argument reg. The same bit is set.

Parameters
regHalfword (16-bit) peripheral register.
shiftBit field position [0-15].
Returns
uint8 right justified and zero filled 1-bit field value.
Note
Implemented as an inline macro.
#define iolas1w (   reg,
  shift 
)

The iolas1w macro returns a right justified and zero filled 1-bit field from bit position defined by shift of a word (32-bit) peripheral register defined by argument reg. The same bit is set.

Parameters
regWord (32-bit) peripheral register.
shiftBit field position [0-31].
Returns
uint8 right justified and zero filled 1-bit field value.
Note
Implemented as an inline macro.
#define iobfxb (   reg,
  shift,
  width 
)

The iobfxb macro returns a bit field of size width, from bit position defined by shift, of a byte (8-bit) peripheral register defined by argument reg.

Parameters
regByte (8-bit) peripheral register.
shiftBit field position [0-7].
widthbit filed size [1-8].
Returns
uint8 right justified and zero filled bit field value.
Note
Implemented as an inline macro.
#define iobfxh (   reg,
  shift,
  width 
)

The iobfxh macro returns a bit field of size width, from bit position defined by shift, of a halfword (16-bit) peripheral register defined by argument reg.

Parameters
regHalfword (16-bit) peripheral register.
shiftBit field position [0-15].
widthbit filed size [1-16].
Returns
uint16 right justified and zero filled bit field value.
Note
Implemented as an inline macro.
#define iobfxw (   reg,
  shift,
  width 
)

The iobfxw macro returns a bit field of size width, from bit position defined by shift, of a word (32-bit) peripheral register defined by argument reg.

Parameters
regWord (32-bit) peripheral register.
shiftBit field position [0-31].
widthbit filed size [1-32].
Returns
uint32 right justified and zero filled bit field value.
Note
Implemented as an inline macro.