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

Function rt_hw_leuart_register

bsp/efm32/drv_leuart.c:729–756  ·  view source on GitHub ↗

/ * @brief * Register LEUART device * * @details * * @note * * @param[in] device * Pointer to device descriptor * * @param[in] name * Device name * * @param[in] flag * Configuration flags * * @param[in] leuart * Pointer to LEUART device descriptor * * @return * Error code ******************************************************************************/

Source from the content-addressed store, hash-verified

727* Error code
728******************************************************************************/
729rt_err_t rt_hw_leuart_register(
730 rt_device_t device,
731 const char *name,
732 rt_uint32_t flag,
733 struct efm32_leuart_device_t *leuart)
734{
735 RT_ASSERT(device != RT_NULL);
736
737 if ((flag & RT_DEVICE_FLAG_DMA_RX) ||
738 (flag & RT_DEVICE_FLAG_INT_TX))
739 {
740 RT_ASSERT(0);
741 }
742
743 device->type = RT_Device_Class_Char;
744 device->rx_indicate = RT_NULL;
745 device->tx_complete = RT_NULL;
746 device->init = rt_leuart_init;
747 device->open = rt_leuart_open;
748 device->close = rt_leuart_close;
749 device->read = rt_leuart_read;
750 device->write = rt_leuart_write;
751 device->control = rt_leuart_control;
752 device->user_data = leuart;
753
754 /* register a character device */
755 return rt_device_register(device, name, RT_DEVICE_FLAG_RDWR | flag);
756}
757
758/***************************************************************************//**
759* @brief

Callers 1

rt_hw_leuart_initFunction · 0.85

Calls 1

rt_device_registerFunction · 0.85

Tested by

no test coverage detected