Skip to content

Commit

Permalink
Add support for parity bit in FreeRTOS UART driver through ioctl. (#537)
Browse files Browse the repository at this point in the history
  • Loading branch information
bakerstu authored May 4, 2021
1 parent 873d99c commit 4504507
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
8 changes: 7 additions & 1 deletion include/freertos/tc_ioctl.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,13 @@
/** Magic number for this driver's ioctl calls */
#define TERMIOS_IOC_MAGIC ('T')

#define TCSBRK IO(TERMIOS_IOC_MAGIC, 9)
#define TCSBRK IO(TERMIOS_IOC_MAGIC, 9)

#define TCPARNONE IO(TERMIOS_IOC_MAGIC, 0xF0)
#define TCPARODD IO(TERMIOS_IOC_MAGIC, 0xF1)
#define TCPAREVEN IO(TERMIOS_IOC_MAGIC, 0xF2)
#define TCPARONE IO(TERMIOS_IOC_MAGIC, 0xF3)
#define TCPARZERO IO(TERMIOS_IOC_MAGIC, 0xF4)

#endif // _FREERTOS_TC_IOCTL_H_

15 changes: 15 additions & 0 deletions src/freertos_drivers/ti/CC32xxUart.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,21 @@ int CC32xxUart::ioctl(File *file, unsigned long int key, unsigned long data)
MAP_UARTBreakCtl(base, false);
MAP_UtilsDelay(12 * 26);
break;
case TCPARNONE:
MAP_UARTParityModeSet(base, UART_CONFIG_PAR_NONE);
break;
case TCPARODD:
MAP_UARTParityModeSet(base, UART_CONFIG_PAR_ODD);
break;
case TCPAREVEN:
MAP_UARTParityModeSet(base, UART_CONFIG_PAR_EVEN);
break;
case TCPARONE:
MAP_UARTParityModeSet(base, UART_CONFIG_PAR_ONE);
break;
case TCPARZERO:
MAP_UARTParityModeSet(base, UART_CONFIG_PAR_ZERO);
break;
}

return 0;
Expand Down

0 comments on commit 4504507

Please sign in to comment.