tty-top-frame
tty-top-frame is a built-in function in `C source code
'.
(tty-top-frame &optional TERMINAL)
Return the topmost terminal frame on TERMINAL.
TERMINAL can be a terminal object, a frame or nil (meaning the
selected frame's terminal). This function returns nil if TERMINAL
does not refer to a text terminal. Otherwise, it returns the
top-most frame on the text terminal.