Page MenuHomeFreeBSD

Add support for mark/space parity in TTY for UART
Needs ReviewPublic

Authored by smaryus_gmail.com on Apr 26 2019, 8:58 AM.
Tags
None
Referenced Files
Unknown Object (File)
Nov 30 2025, 4:39 AM
Unknown Object (File)
Nov 19 2025, 3:21 PM
Unknown Object (File)
Nov 18 2025, 11:18 AM
Unknown Object (File)
Nov 17 2025, 9:46 PM
Unknown Object (File)
Nov 17 2025, 7:58 PM
Unknown Object (File)
Nov 13 2025, 5:46 AM
Unknown Object (File)
Nov 10 2025, 4:31 AM
Unknown Object (File)
Oct 25 2025, 12:30 AM
Subscribers
None
This revision needs review, but there are no reviewers specified.

Details

Reviewers
None
Summary

Add support to configure mark/space parity for uart tty.

This is blocked by https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=237576 To work parity errors must work correctly in UART.

Test Plan
  1. Build kernel and configure UART like into the sample code.
struct termios tio;
 tcgetattr(fd, &tio);
 cfmakeraw(&tio);
 tio.c_cflag |= CMSPAR;
 tio.c_cflag |= PARODD;         // select space parity so that only address byte causes error
 tio.c_cflag |= PARENB;         // enable parity generation
 tio.c_cflag |= CSIZE | CS8;
 tio.c_iflag |= INPCK;          // enable parity checking
 tio.c_iflag |= PARMRK;         // enable in-band marking 
 tio.c_iflag &= ~IGNPAR;         // make sure input parity errors are not ignored

tcsetattr(fd, TCSANOW, &tio);
  1. Send data on UART with the mark space. This will generate an parity error inside UART and TTY will send 0xff + 0x00 + the_received_byte.

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped