As far as the schematic it shows on one side the Teensy pin number and on the other on the MCU end shows the port and 'bit' number within the port.
Running this sketch
github.com/TeensyUser/doc/tree/master/examples/GPIO/pinList may help as it shows like this:
Code:
PIN GPIOn-BITm | GPIOn-BITm PIN
------------------|-------------------
00 -> GPIO6-03 | GPIO6-02 -> 01
01 -> GPIO6-02 | GPIO6-03 -> 00
02 -> GPIO9-04 | GPIO6-12 -> 24
03 -> GPIO9-05 | GPIO6-13 -> 25
...
> and on
github.com/TeensyUser/doc/wiki there may be added info to find
They are out of order based on supporting the historical pin function where possible. So sequential MCU Port Pins are distributed based on MCU functional support.
Note: the PORT # on the schematic IIRC are the values for LOW SPEED pin operation, but on reset the pins are placed into HIGH speed mode that shifts the port numbers upwards with an offset that will then make sense when looking at example code. The Actual Port number and association will show running the above GPIO/pinList example code.
There are other examples that may clarify the port reading of pins - this one perhaps:
Simultaneously-reading-8-GPIO-pins
I ran the pinlist program and got this:
PIN GPIOn-BITm | GPIOn-BITm PIN
------------------|-------------------
00 -> GPIO6-03 | GPIO6-02 -> 01
01 -> GPIO6-02 | GPIO6-03 -> 00
02 -> GPIO9-04 | GPIO6-12 -> 24
03 -> GPIO9-05 | GPIO6-13 -> 25
04 -> GPIO9-06 | GPIO6-16 -> 19
05 -> GPIO9-08 | GPIO6-17 -> 18
06 -> GPIO7-10 | GPIO6-18 -> 14
07 -> GPIO7-17 | GPIO6-19 -> 15
08 -> GPIO7-16 | GPIO6-20 -> 40
09 -> GPIO7-11 | GPIO6-21 -> 41
10 -> GPIO7-00 | GPIO6-22 -> 17
11 -> GPIO7-02 | GPIO6-23 -> 16
12 -> GPIO7-01 | GPIO6-24 -> 22
13 -> GPIO7-03 | GPIO6-25 -> 23
14 -> GPIO6-18 | GPIO6-26 -> 20
15 -> GPIO6-19 | GPIO6-27 -> 21
16 -> GPIO6-23 | GPIO6-28 -> 38
17 -> GPIO6-22 | GPIO6-29 -> 39
18 -> GPIO6-17 | GPIO6-30 -> 26
19 -> GPIO6-16 | GPIO6-31 -> 27
20 -> GPIO6-26 | GPIO7-00 -> 10
21 -> GPIO6-27 | GPIO7-01 -> 12
22 -> GPIO6-24 | GPIO7-02 -> 11
23 -> GPIO6-25 | GPIO7-03 -> 13
24 -> GPIO6-12 | GPIO7-10 -> 06
25 -> GPIO6-13 | GPIO7-11 -> 09
26 -> GPIO6-30 | GPIO7-12 -> 32
27 -> GPIO6-31 | GPIO7-16 -> 08
28 -> GPIO8-18 | GPIO7-17 -> 07
29 -> GPIO9-31 | GPIO7-18 -> 36
30 -> GPIO8-23 | GPIO7-19 -> 37
31 -> GPIO8-22 | GPIO7-28 -> 35
32 -> GPIO7-12 | GPIO7-29 -> 34
33 -> GPIO9-07 | GPIO8-12 -> 45
34 -> GPIO7-29 | GPIO8-13 -> 44
35 -> GPIO7-28 | GPIO8-14 -> 43
36 -> GPIO7-18 | GPIO8-15 -> 42
37 -> GPIO7-19 | GPIO8-16 -> 47
38 -> GPIO6-28 | GPIO8-17 -> 46
39 -> GPIO6-29 | GPIO8-18 -> 28
40 -> GPIO6-20 | GPIO8-22 -> 31
41 -> GPIO6-21 | GPIO8-23 -> 30
42 -> GPIO8-15 | GPIO9-04 -> 02
43 -> GPIO8-14 | GPIO9-05 -> 03
44 -> GPIO8-13 | GPIO9-06 -> 04
45 -> GPIO8-12 | GPIO9-07 -> 33
46 -> GPIO8-17 | GPIO9-08 -> 05
47 -> GPIO8-16 | GPIO9-22 -> 51
48 -> GPIO9-24 | GPIO9-24 -> 48
49 -> GPIO9-27 | GPIO9-25 -> 53
50 -> GPIO9-28 | GPIO9-26 -> 52
51 -> GPIO9-22 | GPIO9-27 -> 49
52 -> GPIO9-26 | GPIO9-28 -> 50
53 -> GPIO9-25 | GPIO9-29 -> 54
54 -> GPIO9-29 | GPIO9-31 -> 29
If I understand correctly, pin 27, for example is the left-most (highest) bit of GPIO6.
The Teensy 4.1 schematic for pin 27 shows AD_B1_15. On page 503 of the reference manual (revision 3) mentioned by KurtE *AD_B1_15 lists GPIO1_IO31...which would also be GPIO6_IO31.
So, given:
register uint32_t data = IMXRT_GPIO6_DIRECT
Pin 27 (digital) would be the 31st bit (or left-most bit) of (uint32_t)data above.
Thanks!