MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / lwp_tty_register

Function lwp_tty_register

components/lwp/terminal/tty_device.c:306–337  ·  view source on GitHub ↗

register TTY device */

Source from the content-addressed store, hash-verified

304
305/* register TTY device */
306rt_err_t lwp_tty_register(lwp_tty_t terminal, const char *name)
307{
308 rt_err_t rc = -RT_ENOMEM;
309 const char *tty_name;
310 char *alloc_name;
311
312 if (terminal->t_devsw->tsw_flags & TF_NOPREFIX)
313 {
314 alloc_name = RT_NULL;
315 tty_name = name;
316 }
317 else
318 {
319 alloc_name = alloc_device_name(name);
320 tty_name = alloc_name;
321 }
322
323 if (tty_name)
324 {
325 device_setup(terminal);
326 rc = rt_device_register(&terminal->parent, tty_name, 0);
327 if (rc == RT_EOK)
328 {
329 terminal->parent.fops = &tty_file_ops;
330
331 LOG_D("%s() /dev/%s device registered", __func__, tty_name);
332 }
333
334 rt_free(alloc_name);
335 }
336 return rc;
337}
338
339static void tty_init_termios(lwp_tty_t tp)
340{

Callers 2

pts_allocFunction · 0.85

Calls 4

rt_device_registerFunction · 0.85
rt_freeFunction · 0.85
alloc_device_nameFunction · 0.70
device_setupFunction · 0.70

Tested by

no test coverage detected