TXEN in HardwareSerial.cpp - Where is it defined?

The constructor for HardwareSerial accepts a uint8_t parameter "txen". The instantiation at the bottom of HardwareSerial.cpp passes that parameter like this:

HardwareSerial Serial(&rx_buffer, &tx_buffer, &UBRRH, &UBRRL, &UCSRA, &UCSRB, &UDR, RXEN, TXEN, RXCIE, UDRIE, U2X);

I'm trying to modify HardwareSerial so that TX is disabled by default so that I can then set it LOW in setup() to keep it from driving the FTDI chip when not plugged into USB. I'm using a custom Atmega328P PCB where the FTDI chip is supposed to be bus powered. I'll then enable TX when real data is received since I know it's plugged into USB and the FTDI chip is powered by the bus.

I could just modify at that instantiation line to hard-code TXEN to be disabled, but I've been trying to locate where that actually gets defined just to do it cleanly. I can't find it! I've dug through every file in the Arduino cores and through some logical hits in the avr/lib code. Can someone help?

Thanks in advance!

PS - I'm assuming that in doing this I can accomplish what I want and either set the TX line to INPUT or just OUTPUT/LOW to keep it from driving the FTDI with it. Does that sound right?

Also, page 196 of the datasheet (Smart | Connected | Secure | Microchip Technology) shows that the initial value of TXEN in UCSRB is "0" so I suppose for my purposes I could just comment out enabling it in Serial.begin() and move that to a new function. I'd still really like to learn where this comes from since I plan to start stepping outside the Arduino cores soon.

It's an AVR define.

From the ATMEL ATmega (basically mega48 thru 328) doc8271.pdf:

20.6 Data Transmission – The USART Transmitter
The USART Transmitter is enabled by setting the Transmit Enable (TXEN) bit in the UCSRnB

complete notes and usage are in the (20 meg pdf, over 300 pages) doc.

The USART Transmitter is enabled by setting the Transmit Enable (TXEN) bit in the UCSRnB Register.

I get that, which is done in HardwareSerial.cpp towards the bottom of begin() with the line below:

  sbi(*_ucsrb, _txen);

That _txen is a local variable to HardwareSerial that's passed in through the constructor as in my first post above. I'd like to catch where that value is coming from. The default behavior when calling Serial.begin(baud) will turn TX on with that line above because _txen == 1. I'd like to make _txen == 0 all the way back to the source but I just can't find where that is.

Ug... I think I just figured it out... and I was too thick-headed to really get what you meant. TXEN is an AVR define. TXEN is not acting as a boolean value, that's the bit location within UCSRB. If I understand correctly, I just need to change the sbi to cbi in HardwareSerial.begin() for my desired functionality (disabling TX by default).

Now you got it.

At least you aren't asking how to store hex in an integer variable.