MCPcopy Create free account
hub / github.com/apache/nuttx / uart_register

Function uart_register

drivers/serial/serial.c:2077–2136  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2075 ****************************************************************************/
2076
2077int uart_register(FAR const char *path, FAR uart_dev_t *dev)
2078{
2079#if defined(CONFIG_TTY_SIGINT) || defined(CONFIG_TTY_SIGTSTP)
2080 /* Initialize of the task that will receive SIGINT signals. */
2081
2082 dev->pid = INVALID_PROCESS_ID;
2083#endif
2084
2085#ifdef CONFIG_TTY_FORCE_PANIC
2086 dev->panic_count = 0;
2087#endif
2088
2089 /* If this UART is a serial console */
2090
2091 if (dev->isconsole)
2092 {
2093 /* Enable signals and echo by default */
2094
2095 dev->tc_lflag |= ISIG | ECHO | ICANON;
2096
2097 /* Enable \n -> \r\n translation for the console */
2098
2099 dev->tc_oflag = OPOST | ONLCR;
2100
2101 /* Convert CR to LF by default for console */
2102
2103 dev->tc_iflag |= ICRNL;
2104
2105 /* Clear escape counter */
2106
2107 dev->escape = 0;
2108 }
2109
2110 /* Initialize mutex & semaphores */
2111
2112 nxmutex_init(&dev->xmit.lock);
2113 nxmutex_init(&dev->recv.lock);
2114 nxmutex_init(&dev->closelock);
2115 nxsem_init(&dev->xmitsem, 0, 0);
2116 nxsem_init(&dev->recvsem, 0, 0);
2117
2118#ifdef CONFIG_SERIAL_TERMIOS
2119 dev->timeout = 0;
2120 dev->minread = 1;
2121#endif
2122
2123 /* Register the serial driver */
2124
2125#ifdef CONFIG_SERIAL_GDBSTUB
2126 if (uart_gdbstub_register(dev, path) == 0)
2127 {
2128 /* No need register the device if it is used by gdbstub */
2129
2130 return 0;
2131 }
2132#endif
2133
2134 sinfo("Registering %s\n", path);

Callers 15

hc_serialinitFunction · 0.85
misoc_serial_initializeFunction · 0.85
z16_serialinitFunction · 0.85
sim_uartinitFunction · 0.85
avr_serialinitFunction · 0.85
avr_serialinitFunction · 0.85
avr_serialinitFunction · 0.85
avr_serialinitFunction · 0.85
riscv_serialinitFunction · 0.85
riscv_serialinitFunction · 0.85
riscv_serialinitFunction · 0.85
riscv_serialinitFunction · 0.85

Calls 4

nxmutex_initFunction · 0.85
nxsem_initFunction · 0.85
uart_gdbstub_registerFunction · 0.85
register_driverFunction · 0.85

Tested by

no test coverage detected