Alan
Here are a few of the HW macros used for i.MX RT:
// Toggle a port with a mask eg. _TOGGLE_PORT(1, PORT1_BIT3)
//
#define _TOGGLE_PORT(ref, mask) GPIO##ref##_DR_TOGGLE = (mask)
// Read from a port with a mask eg. _READ_PORT(1, (PORT1_BIT3 | PORT1_BIT0))
//
#define _READ_PORT_MASK(ref, mask) (GPIO##ref##_PSR & (mask))
// Configure outputs, including enabling clock to specified port, and then set a value to them - this device sets the value and then drives
// eg. _CONFIG_DRIVE_PORT_OUTPUT_VALUE(1, (PORT1_BIT13), (PORT1_BIT13), (PORT_SRE_SLOW | PORT_DSE_HIGH))
//
#define _CONFIG_DRIVE_PORT_OUTPUT_VALUE(ref, pins, value, chars) fnConnectGPIO(PORT##ref, pins, (IOMUXC_SW_MUX_CTL_PAD_MUX_MODE_GPIO | chars)); GPIO##ref##_DR = ((GPIO##ref##_DR & ~(pins)) | (value)); GPIO##ref##_GDIR |= (pins)
// Set from inputs to outputs and set a value to them - this is equivalent to _CONFIG_DRIVE_PORT_OUTPUT_VALUE on this device
//
#define _DRIVE_PORT_OUTPUT_VALUE(ref, pins, value) GPIO##ref##_DR = ((GPIO##ref##_DR & ~(pins)) | (value)); GPIO##ref##_GDIR |= (pins)
// Set from outputs to inputs eg. _FLOAT_PORT(1, LCD_BUS_BITS)
//
#define _FLOAT_PORT(ref, pins) GPIO##ref##_GDIR &= ~(pins)
// Set from inputs to outputs eg. _DRIVE_PORT_OUTPUT(1, LCD_BUS_BITS)
//
#define _DRIVE_PORT_OUTPUT(ref, pins) GPIO##ref##_GDIR |= (pins)
// Set and clear individual bits of a port eg. _SETBITS(1, (PORT1_BIT5 | PORT1_BIT19)) / _CLEARBITS(1, (PORT1_BIT5 | PORT1_BIT19))
//
#define _SETBITS(ref, pins) GPIO##ref##_DR_SET = (pins)
#define _CLEARBITS(ref, pins) GPIO##ref##_DR_CLEAR = (pins)
Unfortunately since the GPIO/PAD layout is different for various i.MX RT parts the routine fnConnectGPIO() needs to be called under the cover to do some dirty work during configuration. I have attached it as reference.
If you are serious about learning you can also subscribe to the uTasker developer's project (it is made available for free to educational establishments and hobby users who are serious about learning) and includes an i.MX RT and Teensy 4.0) simulation that allows the peripherals to be studied from the inside out.. including interrupt and DMA operations:
https://www.utasker.com/iMX/Teensy_4_0.html)
Good luck
Regards
Mark