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

Function _match_tty_iter

components/drivers/serial/serial_tty.c:382–407  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

380INIT_PREV_EXPORT(_tty_workqueue_init);
381
382static rt_err_t _match_tty_iter(struct rt_object *obj, void *data)
383{
384 rt_device_t target = *(rt_device_t *)data;
385 rt_device_t device = rt_container_of(obj, struct rt_device, parent);
386 if (device->type == RT_Device_Class_Char)
387 {
388 lwp_tty_t tp;
389 if (rt_strncmp(obj->name, "tty"TTY_NAME_PREFIX,
390 sizeof("tty"TTY_NAME_PREFIX) - 1) == 0)
391 {
392 struct serial_tty_context *softc;
393
394 tp = rt_container_of(device, struct lwp_tty, parent);
395 softc = tty_softc(tp);
396
397 if (&softc->parent->parent == target)
398 {
399 /* matched, early return */
400 *(rt_device_t *)data = device;
401 return 1;
402 }
403 }
404 }
405
406 return RT_EOK;
407}
408
409/**
410 * @brief The default console is only a backup device with lowest priority.

Callers

nothing calls this directly

Calls 1

rt_strncmpFunction · 0.85

Tested by

no test coverage detected