Dose anyone tell me BBB signal pin selection?

Hi, I am very beginner of BBB.
I’m planning to develop a machine and want to control it by BBB via the expansion headers (P8 & P9).
To control the machine, 2 serial outputs (TXD/RXD) and 39 IO pins are required. Is it possible?

Though I referred the BBB schematics, many processor signals of the expansion headers were already connected to eMMC or HDMI interface.
I don’t use HDMI. Is it no pobrolem to use the signals for the HDMI interface?
And which signal pin mode (mode 0 - 7) should I select?
Please tell me.

Did you check the support Wiki?