Lines Matching refs:obj
173 cyhal_uart_t* obj = (cyhal_uart_t*)_cyhal_uart_irq_obj; in _cyhal_uart_irq_handler() local
176 uint32_t txMasked = Cy_SCB_GetTxInterruptStatusMasked(obj->base); in _cyhal_uart_irq_handler()
177 uint32_t rxMasked = Cy_SCB_GetRxInterruptStatusMasked(obj->base); in _cyhal_uart_irq_handler()
180 Cy_SCB_UART_Interrupt(obj->base, &(obj->context)); in _cyhal_uart_irq_handler()
187 Cy_SCB_ClearTxInterrupt(obj->base, CY_SCB_UART_TX_OVERFLOW); in _cyhal_uart_irq_handler()
189 if (NULL != obj->context.cbEvents) in _cyhal_uart_irq_handler()
191 obj->context.cbEvents(CY_SCB_UART_TRANSMIT_ERR_EVENT); in _cyhal_uart_irq_handler()
200 Cy_SCB_ClearTxInterrupt(obj->base, CY_SCB_UART_TX_UNDERFLOW); in _cyhal_uart_irq_handler()
202 if (NULL != obj->context.cbEvents) in _cyhal_uart_irq_handler()
204 obj->context.cbEvents(CY_SCB_UART_TRANSMIT_ERR_EVENT); in _cyhal_uart_irq_handler()
213 if (NULL != obj->context.cbEvents) in _cyhal_uart_irq_handler()
216 obj->context.cbEvents(CYHAL_UART_IRQ_TX_FIFO >> 1u); in _cyhal_uart_irq_handler()
223 Cy_SCB_ClearTxInterrupt(obj->base, CY_SCB_UART_TX_DONE); in _cyhal_uart_irq_handler()
224 … Cy_SCB_SetTxInterruptMask(obj->base, Cy_SCB_GetTxInterruptMask(obj->base) | CY_SCB_UART_TX_DONE); in _cyhal_uart_irq_handler()
232 Cy_SCB_ClearRxInterrupt(obj->base, CY_SCB_RX_INTR_UNDERFLOW); in _cyhal_uart_irq_handler()
234 if (NULL != obj->context.cbEvents) in _cyhal_uart_irq_handler()
236 obj->context.cbEvents(CY_SCB_UART_RECEIVE_ERR_EVENT); in _cyhal_uart_irq_handler()
245 if (NULL != obj->context.cbEvents) in _cyhal_uart_irq_handler()
248 obj->context.cbEvents(CYHAL_UART_IRQ_RX_FIFO >> 1u); in _cyhal_uart_irq_handler()
279 cy_rslt_t _cyhal_uart_dma_write_async(cyhal_uart_t *obj);
285 cyhal_uart_t* obj = (cyhal_uart_t*)arg; in _cyhal_uart_dma_handler_tx() local
286 CY_ASSERT(CYHAL_ASYNC_DMA == obj->async_mode); in _cyhal_uart_dma_handler_tx()
288 if(obj->async_tx_length > 0) in _cyhal_uart_dma_handler_tx()
291 _cyhal_uart_dma_write_async(obj); in _cyhal_uart_dma_handler_tx()
295 obj->async_tx_buff = NULL; in _cyhal_uart_dma_handler_tx()
297 … if(obj->user_fifo_level != ((SCB_TX_FIFO_CTRL(obj->base) & SCB_TX_FIFO_CTRL_TRIGGER_LEVEL_Msk))) in _cyhal_uart_dma_handler_tx()
299 …_cyhal_scb_set_fifo_level(obj->base, (cyhal_scb_fifo_type_t)CYHAL_UART_FIFO_TX, obj->user_fifo_lev… in _cyhal_uart_dma_handler_tx()
302 if(0 == (CYHAL_UART_IRQ_TX_FIFO & ((cyhal_uart_event_t)obj->irq_cause))) in _cyhal_uart_dma_handler_tx()
304 …Cy_SCB_SetTxInterruptMask(obj->base, Cy_SCB_GetTxInterruptMask(obj->base) & ~CY_SCB_TX_INTR_LEVEL); in _cyhal_uart_dma_handler_tx()
307 if(0 != ((cyhal_uart_event_t)obj->irq_cause & CYHAL_UART_IRQ_TX_TRANSMIT_IN_FIFO)) in _cyhal_uart_dma_handler_tx()
309 … cyhal_uart_event_callback_t callback = (cyhal_uart_event_callback_t)obj->callback_data.callback; in _cyhal_uart_dma_handler_tx()
312 callback(obj->callback_data.callback_arg, CYHAL_UART_IRQ_TX_TRANSMIT_IN_FIFO); in _cyhal_uart_dma_handler_tx()
318 cy_rslt_t _cyhal_uart_dma_read_async(cyhal_uart_t *obj);
324 cyhal_uart_t* obj = (cyhal_uart_t*)arg; in _cyhal_uart_dma_handler_rx() local
325 CY_ASSERT(CYHAL_ASYNC_DMA == obj->async_mode); in _cyhal_uart_dma_handler_rx()
327 if(obj->async_rx_length > 0) in _cyhal_uart_dma_handler_rx()
330 _cyhal_uart_dma_read_async(obj); in _cyhal_uart_dma_handler_rx()
334 obj->async_rx_buff = NULL; in _cyhal_uart_dma_handler_rx()
336 … if(obj->user_fifo_level != ((SCB_RX_FIFO_CTRL(obj->base) & SCB_RX_FIFO_CTRL_TRIGGER_LEVEL_Msk))) in _cyhal_uart_dma_handler_rx()
338 …_cyhal_scb_set_fifo_level(obj->base, (cyhal_scb_fifo_type_t)CYHAL_UART_FIFO_RX, obj->user_fifo_lev… in _cyhal_uart_dma_handler_rx()
341 if(0 != ((cyhal_uart_event_t)obj->irq_cause & CYHAL_UART_IRQ_RX_DONE)) in _cyhal_uart_dma_handler_rx()
343 … cyhal_uart_event_callback_t callback = (cyhal_uart_event_callback_t)obj->callback_data.callback; in _cyhal_uart_dma_handler_rx()
346 callback(obj->callback_data.callback_arg, CYHAL_UART_IRQ_RX_DONE); in _cyhal_uart_dma_handler_rx()
377 cyhal_uart_t *obj = (cyhal_uart_t*)_cyhal_uart_irq_obj; in _cyhal_uart_cb_wrapper() local
378 cyhal_uart_event_t anded_events = (cyhal_uart_event_t)(obj->irq_cause & hal_event); in _cyhal_uart_cb_wrapper()
381 … cyhal_uart_event_callback_t callback = (cyhal_uart_event_callback_t) obj->callback_data.callback; in _cyhal_uart_cb_wrapper()
382 callback(obj->callback_data.callback_arg, anded_events); in _cyhal_uart_cb_wrapper()
388 cyhal_uart_t *obj = (cyhal_uart_t*)obj_ptr; in _cyhal_uart_pm_callback_instance() local
393 GPIO_PRT_Type *txport = obj->pin_tx != NC ? CYHAL_GET_PORTADDR(obj->pin_tx) : NULL; in _cyhal_uart_pm_callback_instance()
394 …GPIO_PRT_Type *rtsport = ((obj->pin_rts != NC) && obj->rts_enabled) ? CYHAL_GET_PORTADDR(obj->pin_… in _cyhal_uart_pm_callback_instance()
395 uint8_t txpin = (uint8_t)CYHAL_GET_PIN(obj->pin_tx); in _cyhal_uart_pm_callback_instance()
396 uint8_t rtspin = (uint8_t)CYHAL_GET_PIN(obj->pin_rts); in _cyhal_uart_pm_callback_instance()
409 …0UL == (CY_SCB_UART_TRANSMIT_ACTIVE & Cy_SCB_UART_GetTransmitStatus(obj->base, &(obj->context)))) … in _cyhal_uart_pm_callback_instance()
410 … (0UL == (CY_SCB_UART_RECEIVE_ACTIVE & Cy_SCB_UART_GetReceiveStatus (obj->base, &(obj->context)))) in _cyhal_uart_pm_callback_instance()
412 & (obj->async_rx_buff == NULL) & (obj->async_tx_buff == NULL)) in _cyhal_uart_pm_callback_instance()
421 if (Cy_SCB_UART_IsTxComplete(obj->base)) in _cyhal_uart_pm_callback_instance()
423 if (0UL == Cy_SCB_UART_GetNumInRxFifo(obj->base)) in _cyhal_uart_pm_callback_instance()
435 cyhal_uart_set_baud(obj, obj->baud_rate, NULL); in _cyhal_uart_pm_callback_instance()
439 Cy_GPIO_SetHSIOM(rtsport, rtspin, obj->saved_rts_hsiom); in _cyhal_uart_pm_callback_instance()
448 obj->saved_rts_hsiom = Cy_GPIO_GetHSIOM(rtsport, rtspin); in _cyhal_uart_pm_callback_instance()
462 …0UL == (CY_SCB_UART_TRANSMIT_ACTIVE & Cy_SCB_UART_GetTransmitStatus(obj->base, &(obj->context)))) … in _cyhal_uart_pm_callback_instance()
463 … (0UL == (CY_SCB_UART_RECEIVE_ACTIVE & Cy_SCB_UART_GetReceiveStatus (obj->base, &(obj->context)))) in _cyhal_uart_pm_callback_instance()
465 & (obj->async_rx_buff == NULL) & (obj->async_tx_buff == NULL)) in _cyhal_uart_pm_callback_instance()
474 if (Cy_SCB_UART_IsTxComplete(obj->base)) in _cyhal_uart_pm_callback_instance()
476 if (0UL == Cy_SCB_UART_GetNumInRxFifo(obj->base)) in _cyhal_uart_pm_callback_instance()
487 obj->saved_tx_hsiom = Cy_GPIO_GetHSIOM(txport, txpin); in _cyhal_uart_pm_callback_instance()
493 obj->saved_rts_hsiom = Cy_GPIO_GetHSIOM(rtsport, rtspin); in _cyhal_uart_pm_callback_instance()
498 Cy_SCB_UART_Disable(obj->base, &(obj->context)); in _cyhal_uart_pm_callback_instance()
509 Cy_SCB_UART_Enable(obj->base); in _cyhal_uart_pm_callback_instance()
512 Cy_GPIO_SetHSIOM(txport, txpin, obj->saved_tx_hsiom); in _cyhal_uart_pm_callback_instance()
516 Cy_GPIO_SetHSIOM(rtsport, rtspin, obj->saved_rts_hsiom); in _cyhal_uart_pm_callback_instance()
607 static cy_rslt_t _cyhal_uart_setup_resources(cyhal_uart_t *obj, cyhal_gpio_t tx, cyhal_gpio_t rx, c… in _cyhal_uart_setup_resources() argument
613 obj->resource.type = CYHAL_RSC_INVALID; in _cyhal_uart_setup_resources()
614 obj->is_clock_owned = false; in _cyhal_uart_setup_resources()
615 obj->pin_rx = CYHAL_NC_PIN_VALUE; in _cyhal_uart_setup_resources()
616 obj->pin_tx = CYHAL_NC_PIN_VALUE; in _cyhal_uart_setup_resources()
617 obj->pin_cts = CYHAL_NC_PIN_VALUE; in _cyhal_uart_setup_resources()
618 obj->pin_rts = CYHAL_NC_PIN_VALUE; in _cyhal_uart_setup_resources()
684 obj->resource = uart_rsc; in _cyhal_uart_setup_resources()
692 obj->pin_tx = tx; in _cyhal_uart_setup_resources()
702 obj->pin_rx = rx; in _cyhal_uart_setup_resources()
712 obj->cts_enabled = true; in _cyhal_uart_setup_resources()
713 obj->pin_cts = cts; in _cyhal_uart_setup_resources()
723 obj->rts_enabled = true; in _cyhal_uart_setup_resources()
724 obj->pin_rts = rts; in _cyhal_uart_setup_resources()
732 …result = _cyhal_utils_allocate_clock(&(obj->clock), &obj->resource, CYHAL_CLOCK_BLOCK_PERIPHERAL_1… in _cyhal_uart_setup_resources()
733 obj->is_clock_owned = (CY_RSLT_SUCCESS == result); in _cyhal_uart_setup_resources()
737 obj->is_clock_owned = false; in _cyhal_uart_setup_resources()
738 obj->clock = *clk; in _cyhal_uart_setup_resources()
745 _cyhal_scb_get_clock_index(obj->resource.block_num), &(obj->clock)); in _cyhal_uart_setup_resources()
751 static cy_rslt_t _cyhal_uart_init_hw(cyhal_uart_t *obj) in _cyhal_uart_init_hw() argument
753 uint8_t scb_arr_index = _cyhal_scb_get_block_index(obj->resource.block_num); in _cyhal_uart_init_hw()
754 obj->base = _CYHAL_SCB_BASE_ADDRESSES[scb_arr_index]; in _cyhal_uart_init_hw()
758 if(obj->is_clock_owned == true) in _cyhal_uart_init_hw()
760 cyhal_uart_set_baud(obj, CYHAL_UART_DEFAULT_BAUD, NULL); in _cyhal_uart_init_hw()
765 Cy_SCB_EnableClock(obj->base, cyhal_clock_get_frequency(&(obj->clock)), false); in _cyhal_uart_init_hw()
769 cy_rslt_t result = (cy_rslt_t) Cy_SCB_UART_Init(obj->base, &(obj->config), &(obj->context)); in _cyhal_uart_init_hw()
773 obj->callback_data.callback = NULL; in _cyhal_uart_init_hw()
774 obj->callback_data.callback_arg = NULL; in _cyhal_uart_init_hw()
775 obj->irq_cause = CYHAL_UART_IRQ_NONE; in _cyhal_uart_init_hw()
778 … Cy_SCB_RegisterInterruptCallback(obj->base, _cyhal_irq_cb[_CYHAL_SCB_IRQ_N[scb_arr_index]]); in _cyhal_uart_init_hw()
779 Cy_SCB_EnableInterrupt(obj->base); in _cyhal_uart_init_hw()
785 …_cyhal_scb_update_instance_data(obj->resource.block_num, (void*)obj, &_cyhal_uart_pm_callback_inst… in _cyhal_uart_init_hw()
787 Cy_SCB_UART_Enable(obj->base); in _cyhal_uart_init_hw()
793 cy_rslt_t cyhal_uart_init(cyhal_uart_t *obj, cyhal_gpio_t tx, cyhal_gpio_t rx, cyhal_gpio_t cts, cy… in cyhal_uart_init() argument
796 CY_ASSERT(NULL != obj); in cyhal_uart_init()
797 memset(obj, 0, sizeof(cyhal_uart_t)); in cyhal_uart_init()
799 obj->dc_configured = false; in cyhal_uart_init()
801 obj->async_mode = CYHAL_ASYNC_SW; in cyhal_uart_init()
803 obj->dma_tx.resource.type = CYHAL_RSC_INVALID; in cyhal_uart_init()
804 obj->dma_rx.resource.type = CYHAL_RSC_INVALID; in cyhal_uart_init()
806 obj->baud_rate = CYHAL_UART_DEFAULT_BAUD; in cyhal_uart_init()
807 cy_rslt_t result = _cyhal_uart_setup_resources(obj, tx, rx, cts, rts, clk); in cyhal_uart_init()
811 obj->config = _cyhal_uart_default_config; in cyhal_uart_init()
812 obj->config.enableCts = obj->cts_enabled; in cyhal_uart_init()
816 obj->config.dataWidth = cfg->data_bits; in cyhal_uart_init()
817 obj->config.stopBits = _cyhal_uart_convert_stopbits((uint8_t)cfg->stop_bits); in cyhal_uart_init()
818 obj->config.parity = _cyhal_uart_convert_parity(cfg->parity); in cyhal_uart_init()
821 result = _cyhal_uart_init_hw(obj); in cyhal_uart_init()
828 cyhal_uart_config_software_buffer(obj, cfg->rx_buffer, cfg->rx_buffer_size); in cyhal_uart_init()
833 if (obj->is_clock_owned) in cyhal_uart_init()
835 result = cyhal_uart_set_baud(obj, obj->baud_rate, NULL); in cyhal_uart_init()
841 obj->user_fifo_level = (Cy_SCB_GetFifoSize(obj->base) / 2); in cyhal_uart_init()
847 cyhal_uart_free(obj); in cyhal_uart_init()
852 cy_rslt_t cyhal_uart_init_cfg(cyhal_uart_t *obj, const cyhal_uart_configurator_t *cfg) in cyhal_uart_init_cfg() argument
854 CY_ASSERT(NULL != obj); in cyhal_uart_init_cfg()
857 memset(obj, 0, sizeof(cyhal_uart_t)); in cyhal_uart_init_cfg()
859 obj->resource = *cfg->resource; in cyhal_uart_init_cfg()
860 obj->clock = *cfg->clock; in cyhal_uart_init_cfg()
861 obj->is_clock_owned = false; in cyhal_uart_init_cfg()
862 obj->pin_tx = cfg->gpios.pin_tx; in cyhal_uart_init_cfg()
863 obj->pin_rts = cfg->gpios.pin_rts; in cyhal_uart_init_cfg()
864 obj->pin_cts = cfg->gpios.pin_cts; in cyhal_uart_init_cfg()
865 obj->dc_configured = true; in cyhal_uart_init_cfg()
866 obj->cts_enabled = cfg->config->enableCts; in cyhal_uart_init_cfg()
867 obj->rts_enabled = (NC != cfg->gpios.pin_rts); in cyhal_uart_init_cfg()
869 obj->async_mode = CYHAL_ASYNC_SW; in cyhal_uart_init_cfg()
870 obj->dma_tx.resource.type = CYHAL_RSC_INVALID; in cyhal_uart_init_cfg()
871 obj->dma_rx.resource.type = CYHAL_RSC_INVALID; in cyhal_uart_init_cfg()
874 obj->config = *cfg->config; in cyhal_uart_init_cfg()
875 cy_rslt_t result = _cyhal_uart_init_hw(obj); in cyhal_uart_init_cfg()
881 obj->user_fifo_level = (Cy_SCB_GetFifoSize(obj->base) / 2); in cyhal_uart_init_cfg()
888 void cyhal_uart_free(cyhal_uart_t *obj) in cyhal_uart_free() argument
890 CY_ASSERT(NULL != obj); in cyhal_uart_free()
892 if (NULL != obj->base) in cyhal_uart_free()
894 Cy_SCB_UART_Disable(obj->base, &obj->context); in cyhal_uart_free()
895 Cy_SCB_UART_DeInit(obj->base); in cyhal_uart_free()
896 obj->base = NULL; in cyhal_uart_free()
899 if (obj->resource.type != CYHAL_RSC_INVALID) in cyhal_uart_free()
901 uint8_t scb_arr_index = _cyhal_scb_get_block_index(obj->resource.block_num); in cyhal_uart_free()
905 _cyhal_scb_update_instance_data(obj->resource.block_num, NULL, NULL); in cyhal_uart_free()
907 if (false == obj->dc_configured) in cyhal_uart_free()
909 …t_t rsc_to_free = { CYHAL_RSC_SCB, _cyhal_scb_get_block_index(obj->resource.block_num), obj->resou… in cyhal_uart_free()
913 obj->resource.type = CYHAL_RSC_INVALID; in cyhal_uart_free()
916 if (false == obj->dc_configured) in cyhal_uart_free()
918 _cyhal_utils_release_if_used(&(obj->pin_rx)); in cyhal_uart_free()
919 _cyhal_utils_release_if_used(&(obj->pin_tx)); in cyhal_uart_free()
920 _cyhal_utils_release_if_used(&(obj->pin_rts)); in cyhal_uart_free()
921 _cyhal_utils_release_if_used(&(obj->pin_cts)); in cyhal_uart_free()
923 if (obj->is_clock_owned) in cyhal_uart_free()
925 cyhal_clock_free(&(obj->clock)); in cyhal_uart_free()
930 if(obj->async_mode == CYHAL_ASYNC_DMA) in cyhal_uart_free()
932 if(CYHAL_RSC_INVALID != obj->dma_tx.resource.type) in cyhal_uart_free()
934 cyhal_dma_free(&obj->dma_tx); in cyhal_uart_free()
935 obj->dma_tx.resource.type = CYHAL_RSC_INVALID; in cyhal_uart_free()
937 if(CYHAL_RSC_INVALID != obj->dma_rx.resource.type) in cyhal_uart_free()
939 cyhal_dma_free(&obj->dma_rx); in cyhal_uart_free()
940 obj->dma_rx.resource.type = CYHAL_RSC_INVALID; in cyhal_uart_free()
946 cy_rslt_t cyhal_uart_set_baud(cyhal_uart_t *obj, uint32_t baudrate, uint32_t *actualbaud) in cyhal_uart_set_baud() argument
949 if( obj->baud_rate != baudrate) in cyhal_uart_set_baud()
951 obj->baud_rate = baudrate; in cyhal_uart_set_baud()
954 if (obj->is_clock_owned) in cyhal_uart_set_baud()
960 Cy_SCB_UART_Disable(obj->base, NULL); in cyhal_uart_set_baud()
961 status = cyhal_clock_set_enabled(&(obj->clock), false, false); in cyhal_uart_set_baud()
964 Cy_SCB_UART_Enable(obj->base); in cyhal_uart_set_baud()
968 oversample_value = _cyhal_uart_best_oversample(&(obj->resource), baudrate); in cyhal_uart_set_baud()
969 obj->config.oversample = oversample_value; in cyhal_uart_set_baud()
971 divider = _cyhal_utils_divider_value(&(obj->resource), baudrate * oversample_value, 0); in cyhal_uart_set_baud()
973 if( !_cyhal_clock_is_divider_valid(&(obj->resource),divider)) in cyhal_uart_set_baud()
975 Cy_SCB_UART_Enable(obj->base); in cyhal_uart_set_baud()
982 status = _cyhal_utils_peri_pclk_set_freq(0, &(obj->clock), baudrate, oversample_value); in cyhal_uart_set_baud()
984 status = cyhal_clock_set_divider(&(obj->clock), divider); in cyhal_uart_set_baud()
988 cyhal_clock_set_enabled(&(obj->clock), true, false); in cyhal_uart_set_baud()
989 Cy_SCB_UART_Enable(obj->base); in cyhal_uart_set_baud()
993 calculated_baud = _cyhal_uart_actual_baud(&(obj->resource), divider, oversample_value); in cyhal_uart_set_baud()
1001 status = cyhal_clock_set_enabled(&(obj->clock), true, false); in cyhal_uart_set_baud()
1005 uint32_t mem_width = (obj->config.dataWidth <= CY_SCB_BYTE_WIDTH) in cyhal_uart_set_baud()
1012 SCB_CTRL(obj->base) = _BOOL2FLD(SCB_CTRL_ADDR_ACCEPT, obj->config.acceptAddrInFifo) | in cyhal_uart_set_baud()
1017 SCB_CTRL(obj->base) = _BOOL2FLD(SCB_CTRL_ADDR_ACCEPT, obj->config.acceptAddrInFifo) | in cyhal_uart_set_baud()
1018 _BOOL2FLD(SCB_CTRL_BYTE_MODE, (obj->config.dataWidth <= CY_SCB_BYTE_WIDTH)) | in cyhal_uart_set_baud()
1023 Cy_SCB_UART_Enable(obj->base); in cyhal_uart_set_baud()
1034 cy_rslt_t cyhal_uart_configure(cyhal_uart_t *obj, const cyhal_uart_cfg_t *cfg) in cyhal_uart_configure() argument
1036 CY_ASSERT(NULL != obj); in cyhal_uart_configure()
1038 Cy_SCB_UART_Disable(obj->base, NULL); in cyhal_uart_configure()
1039 obj->config.dataWidth = cfg->data_bits; in cyhal_uart_configure()
1040 obj->config.stopBits = _cyhal_uart_convert_stopbits((uint8_t)cfg->stop_bits); in cyhal_uart_configure()
1041 obj->config.parity = _cyhal_uart_convert_parity(cfg->parity); in cyhal_uart_configure()
1042 obj->config.enableCts = obj->cts_enabled; in cyhal_uart_configure()
1044 Cy_SCB_UART_Init(obj->base, &(obj->config), NULL); in cyhal_uart_configure()
1045 Cy_SCB_UART_Enable(obj->base); in cyhal_uart_configure()
1049 cy_rslt_t cyhal_uart_getc(cyhal_uart_t *obj, uint8_t *value, uint32_t timeout) in cyhal_uart_getc() argument
1054 uint32_t read_value = Cy_SCB_UART_Get(obj->base); in cyhal_uart_getc()
1070 read_value = Cy_SCB_UART_Get(obj->base); in cyhal_uart_getc()
1076 cy_rslt_t cyhal_uart_putc(cyhal_uart_t *obj, uint32_t value) in cyhal_uart_putc() argument
1084 count = Cy_SCB_UART_Put(obj->base, value); in cyhal_uart_putc()
1090 uint32_t cyhal_uart_readable(cyhal_uart_t *obj) in cyhal_uart_readable() argument
1092 uint32_t number_available = Cy_SCB_UART_GetNumInRxFifo(obj->base); in cyhal_uart_readable()
1093 if(obj->context.rxRingBuf != NULL) in cyhal_uart_readable()
1095 number_available += Cy_SCB_UART_GetNumInRingBuffer(obj->base, &(obj->context)); in cyhal_uart_readable()
1100 uint32_t cyhal_uart_writable(cyhal_uart_t *obj) in cyhal_uart_writable() argument
1102 return Cy_SCB_GetFifoSize(obj->base) - Cy_SCB_GetNumInTxFifo(obj->base); in cyhal_uart_writable()
1105 cy_rslt_t cyhal_uart_clear(cyhal_uart_t *obj) in cyhal_uart_clear() argument
1107 Cy_SCB_UART_ClearRxFifo(obj->base); in cyhal_uart_clear()
1108 Cy_SCB_UART_ClearTxFifo(obj->base); in cyhal_uart_clear()
1110 if(obj->context.rxRingBuf != NULL) in cyhal_uart_clear()
1112 Cy_SCB_UART_ClearRingBuffer(obj->base, &(obj->context)); in cyhal_uart_clear()
1118 cy_rslt_t cyhal_uart_enable_flow_control(cyhal_uart_t *obj, bool enable_cts, bool enable_rts) in cyhal_uart_enable_flow_control() argument
1122 if (obj->pin_cts != NC) in cyhal_uart_enable_flow_control()
1124 if (enable_cts && (false == obj->cts_enabled)) in cyhal_uart_enable_flow_control()
1126 …e_pin_mapping_t *cts_map = _CYHAL_SCB_FIND_MAP_BLOCK(obj->pin_cts, cyhal_pin_map_scb_uart_cts, &ob… in cyhal_uart_enable_flow_control()
1127 if (false == obj->dc_configured) in cyhal_uart_enable_flow_control()
1137 Cy_SCB_UART_EnableCts(obj->base); in cyhal_uart_enable_flow_control()
1138 obj->cts_enabled = true; in cyhal_uart_enable_flow_control()
1143 if (false == obj->dc_configured) in cyhal_uart_enable_flow_control()
1145 _cyhal_utils_disconnect_and_free(obj->pin_cts); in cyhal_uart_enable_flow_control()
1149 result = cyhal_disconnect_pin(obj->pin_cts); in cyhal_uart_enable_flow_control()
1153 Cy_SCB_UART_DisableCts(obj->base); in cyhal_uart_enable_flow_control()
1154 obj->cts_enabled = false; in cyhal_uart_enable_flow_control()
1159 if ((CY_RSLT_SUCCESS == result) && (obj->pin_rts != NC)) in cyhal_uart_enable_flow_control()
1161 if (enable_rts && (false == obj->rts_enabled)) in cyhal_uart_enable_flow_control()
1163 …e_pin_mapping_t *rts_map = _CYHAL_SCB_FIND_MAP_BLOCK(obj->pin_rts, cyhal_pin_map_scb_uart_rts, &ob… in cyhal_uart_enable_flow_control()
1164 if (false == obj->dc_configured) in cyhal_uart_enable_flow_control()
1172 obj->rts_enabled = (CY_RSLT_SUCCESS == result); in cyhal_uart_enable_flow_control()
1176 if (false == obj->dc_configured) in cyhal_uart_enable_flow_control()
1178 _cyhal_utils_disconnect_and_free(obj->pin_rts); in cyhal_uart_enable_flow_control()
1182 result = cyhal_disconnect_pin(obj->pin_rts); in cyhal_uart_enable_flow_control()
1186 obj->rts_enabled = false; in cyhal_uart_enable_flow_control()
1194 cy_rslt_t cyhal_uart_write(cyhal_uart_t *obj, void *tx, size_t *tx_length) in cyhal_uart_write() argument
1199 *tx_length = Cy_SCB_UART_PutArray(obj->base, tx, *tx_length); in cyhal_uart_write()
1204 cy_rslt_t cyhal_uart_read(cyhal_uart_t *obj, void *rx, size_t *rx_length) in cyhal_uart_read() argument
1209 *rx_length = Cy_SCB_UART_GetArray(obj->base, rx, *rx_length); in cyhal_uart_read()
1213 cy_rslt_t cyhal_uart_set_async_mode(cyhal_uart_t *obj, cyhal_async_mode_t mode, uint8_t dma_priorit… in cyhal_uart_set_async_mode() argument
1215 CY_ASSERT(NULL != obj); in cyhal_uart_set_async_mode()
1221 if((obj->async_tx_buff != NULL) || (obj->async_rx_buff != NULL)) in cyhal_uart_set_async_mode()
1232 if (obj->context.rxRingBuf != NULL) in cyhal_uart_set_async_mode()
1239 if(CYHAL_RSC_INVALID == obj->dma_tx.resource.type && obj->pin_tx != CYHAL_NC_PIN_VALUE) in cyhal_uart_set_async_mode()
1242 cyhal_uart_disable_output(obj, CYHAL_UART_OUTPUT_TRIGGER_TX_FIFO_LEVEL_REACHED); in cyhal_uart_set_async_mode()
1243 … cyhal_uart_enable_output(obj, CYHAL_UART_OUTPUT_TRIGGER_TX_FIFO_LEVEL_REACHED, &source_tx); in cyhal_uart_set_async_mode()
1250 …result = cyhal_dma_init_adv(&(obj->dma_tx), &dma_src_tx, NULL, NULL, dma_priority, CYHAL_DMA_DIREC… in cyhal_uart_set_async_mode()
1252 cyhal_dma_register_callback(&(obj->dma_tx), &_cyhal_uart_dma_handler_tx, obj); in cyhal_uart_set_async_mode()
1255 if(CYHAL_RSC_INVALID == obj->dma_rx.resource.type && obj->pin_rx != CYHAL_NC_PIN_VALUE) in cyhal_uart_set_async_mode()
1258 cyhal_uart_disable_output(obj, CYHAL_UART_OUTPUT_TRIGGER_RX_FIFO_LEVEL_REACHED); in cyhal_uart_set_async_mode()
1259 … cyhal_uart_enable_output(obj, CYHAL_UART_OUTPUT_TRIGGER_RX_FIFO_LEVEL_REACHED, &source_rx); in cyhal_uart_set_async_mode()
1266 …cyhal_dma_init_adv(&(obj->dma_rx), &dma_src_rx, NULL, NULL, dma_priority, CYHAL_DMA_DIRECTION_PERI… in cyhal_uart_set_async_mode()
1268 cyhal_dma_register_callback(&(obj->dma_rx), &_cyhal_uart_dma_handler_rx, obj); in cyhal_uart_set_async_mode()
1272 Cy_SCB_UART_SetRtsFifoLevel(obj->base, Cy_SCB_GetFifoSize(obj->base) - 1); in cyhal_uart_set_async_mode()
1275 CY_UNUSED_PARAMETER(obj); in cyhal_uart_set_async_mode()
1284 if(CYHAL_RSC_INVALID != obj->dma_tx.resource.type) in cyhal_uart_set_async_mode()
1286 cyhal_dma_free(&obj->dma_tx); in cyhal_uart_set_async_mode()
1287 obj->dma_tx.resource.type = CYHAL_RSC_INVALID; in cyhal_uart_set_async_mode()
1289 if(CYHAL_RSC_INVALID != obj->dma_rx.resource.type) in cyhal_uart_set_async_mode()
1291 cyhal_dma_free(&obj->dma_rx); in cyhal_uart_set_async_mode()
1292 obj->dma_rx.resource.type = CYHAL_RSC_INVALID; in cyhal_uart_set_async_mode()
1296 Cy_SCB_UART_SetRtsFifoLevel(obj->base, _cyhal_uart_default_config.rtsRxFifoLevel); in cyhal_uart_set_async_mode()
1303 obj->async_mode = mode; in cyhal_uart_set_async_mode()
1310 cy_rslt_t _cyhal_uart_dma_write_async(cyhal_uart_t *obj) in _cyhal_uart_dma_write_async() argument
1312 if(cyhal_dma_is_busy(&(obj->dma_tx))) in _cyhal_uart_dma_write_async()
1317 CY_ASSERT(NULL != obj->async_tx_buff); in _cyhal_uart_dma_write_async()
1320 uint32_t length = obj->async_tx_length; in _cyhal_uart_dma_write_async()
1321 if(length >= Cy_SCB_GetFifoSize(obj->base)) in _cyhal_uart_dma_write_async()
1323 length = (Cy_SCB_GetFifoSize(obj->base) / 2); in _cyhal_uart_dma_write_async()
1326 uint32_t mem_width = (obj->config.dataWidth <= CY_SCB_BYTE_WIDTH) ? 8 : 16; in _cyhal_uart_dma_write_async()
1329 .src_addr = (uint32_t)obj->async_tx_buff, in _cyhal_uart_dma_write_async()
1331 .dst_addr = (uint32_t)&obj->base->TX_FIFO_WR, in _cyhal_uart_dma_write_async()
1341 obj->async_tx_buff = ((length * (mem_width / 8)) + (char*)obj->async_tx_buff); in _cyhal_uart_dma_write_async()
1342 obj->async_tx_length -= length; in _cyhal_uart_dma_write_async()
1346 …cy_rslt_t result = cyhal_uart_set_fifo_level(obj, CYHAL_UART_FIFO_TX, Cy_SCB_GetFifoSize(obj->base… in _cyhal_uart_dma_write_async()
1349 …cyhal_dma_enable_event(&(obj->dma_tx), CYHAL_DMA_TRANSFER_COMPLETE, CYHAL_DMA_PRIORITY_DEFAULT, tr… in _cyhal_uart_dma_write_async()
1351 obj->dma_tx.descriptor_config.dw.retrigger = CY_DMA_WAIT_FOR_REACT; in _cyhal_uart_dma_write_async()
1353 result = cyhal_dma_configure(&(obj->dma_tx), &dma_config); in _cyhal_uart_dma_write_async()
1357 result = cyhal_dma_enable(&(obj->dma_tx)); in _cyhal_uart_dma_write_async()
1363 cy_rslt_t cyhal_uart_write_async(cyhal_uart_t *obj, void *tx, size_t length) in cyhal_uart_write_async() argument
1370 if(obj->async_mode == CYHAL_ASYNC_DMA) in cyhal_uart_write_async()
1373 obj->async_tx_buff = tx; in cyhal_uart_write_async()
1374 obj->async_tx_length = length; in cyhal_uart_write_async()
1375 result = _cyhal_uart_dma_write_async(obj); in cyhal_uart_write_async()
1381 result = Cy_SCB_UART_Transmit(obj->base, tx, length, &(obj->context)); in cyhal_uart_write_async()
1387 cy_rslt_t _cyhal_uart_dma_read_async(cyhal_uart_t *obj) in _cyhal_uart_dma_read_async() argument
1389 if(cyhal_dma_is_busy(&(obj->dma_rx))) in _cyhal_uart_dma_read_async()
1394 CY_ASSERT(NULL != obj->async_rx_buff); in _cyhal_uart_dma_read_async()
1397 uint32_t length = obj->async_rx_length; in _cyhal_uart_dma_read_async()
1398 if(length >= Cy_SCB_GetFifoSize(obj->base)) in _cyhal_uart_dma_read_async()
1400 length = (Cy_SCB_GetFifoSize(obj->base) / 2); in _cyhal_uart_dma_read_async()
1403 uint32_t mem_width = (obj->config.dataWidth <= CY_SCB_BYTE_WIDTH) ? 8 : 16; in _cyhal_uart_dma_read_async()
1406 .src_addr = (uint32_t)(&(obj->base->RX_FIFO_RD)), in _cyhal_uart_dma_read_async()
1408 .dst_addr = (uint32_t)obj->async_rx_buff, in _cyhal_uart_dma_read_async()
1418 obj->async_rx_buff = ((length * (mem_width / 8)) + (char*)obj->async_rx_buff); in _cyhal_uart_dma_read_async()
1419 obj->async_rx_length -= length; in _cyhal_uart_dma_read_async()
1424 …result = _cyhal_scb_set_fifo_level(obj->base, (cyhal_scb_fifo_type_t)CYHAL_UART_FIFO_RX, length - … in _cyhal_uart_dma_read_async()
1427 …cyhal_dma_enable_event(&(obj->dma_rx), CYHAL_DMA_TRANSFER_COMPLETE, CYHAL_DMA_PRIORITY_DEFAULT, tr… in _cyhal_uart_dma_read_async()
1429 obj->dma_tx.descriptor_config.dw.retrigger = CY_DMA_WAIT_FOR_REACT; in _cyhal_uart_dma_read_async()
1431 result = cyhal_dma_configure(&(obj->dma_rx), &dma_config); in _cyhal_uart_dma_read_async()
1435 result = cyhal_dma_enable(&(obj->dma_rx)); in _cyhal_uart_dma_read_async()
1442 cy_rslt_t cyhal_uart_read_async(cyhal_uart_t *obj, void *rx, size_t length) in cyhal_uart_read_async() argument
1449 if(obj->async_mode == CYHAL_ASYNC_DMA) in cyhal_uart_read_async()
1452 obj->async_rx_buff = rx; in cyhal_uart_read_async()
1453 obj->async_rx_length = length; in cyhal_uart_read_async()
1456 result = _cyhal_uart_dma_read_async(obj); in cyhal_uart_read_async()
1461 result = Cy_SCB_UART_Receive(obj->base, rx, length, &(obj->context)); in cyhal_uart_read_async()
1466 bool cyhal_uart_is_tx_active(cyhal_uart_t *obj) in cyhal_uart_is_tx_active() argument
1468 …return (0UL != (obj->context.txStatus & CY_SCB_UART_TRANSMIT_ACTIVE)) || !Cy_SCB_IsTxComplete(obj-… in cyhal_uart_is_tx_active()
1470 || (obj->async_tx_buff != NULL) in cyhal_uart_is_tx_active()
1475 bool cyhal_uart_is_rx_active(cyhal_uart_t *obj) in cyhal_uart_is_rx_active() argument
1477 return (0UL != (obj->context.rxStatus & CY_SCB_UART_RECEIVE_ACTIVE)) in cyhal_uart_is_rx_active()
1479 || (obj->async_rx_buff != NULL) in cyhal_uart_is_rx_active()
1484 cy_rslt_t cyhal_uart_write_abort(cyhal_uart_t *obj) in cyhal_uart_write_abort() argument
1487 if(obj->async_mode == CYHAL_ASYNC_DMA && (obj->async_tx_buff != NULL)) in cyhal_uart_write_abort()
1490 obj->async_tx_buff = NULL; in cyhal_uart_write_abort()
1491 …cyhal_dma_enable_event(&(obj->dma_tx), CYHAL_DMA_TRANSFER_COMPLETE, CYHAL_DMA_PRIORITY_DEFAULT, fa… in cyhal_uart_write_abort()
1492 cyhal_dma_disable(&(obj->dma_tx)); in cyhal_uart_write_abort()
1494 Cy_SCB_UART_ClearTxFifo(obj->base); in cyhal_uart_write_abort()
1499 Cy_SCB_UART_AbortTransmit(obj->base, &(obj->context)); in cyhal_uart_write_abort()
1504 cy_rslt_t cyhal_uart_read_abort(cyhal_uart_t *obj) in cyhal_uart_read_abort() argument
1507 if(obj->async_mode == CYHAL_ASYNC_DMA && (obj->async_rx_buff != NULL)) in cyhal_uart_read_abort()
1510 obj->async_rx_buff = NULL; in cyhal_uart_read_abort()
1511 …cyhal_dma_enable_event(&(obj->dma_rx), CYHAL_DMA_TRANSFER_COMPLETE, CYHAL_DMA_PRIORITY_DEFAULT, fa… in cyhal_uart_read_abort()
1512 cyhal_dma_disable(&(obj->dma_rx)); in cyhal_uart_read_abort()
1518 Cy_SCB_UART_AbortReceive(obj->base, &(obj->context)); in cyhal_uart_read_abort()
1523 void cyhal_uart_register_callback(cyhal_uart_t *obj, cyhal_uart_event_callback_t callback, void *ca… in cyhal_uart_register_callback() argument
1526 obj->callback_data.callback = (cy_israddress) callback; in cyhal_uart_register_callback()
1527 obj->callback_data.callback_arg = callback_arg; in cyhal_uart_register_callback()
1529 Cy_SCB_UART_RegisterCallback(obj->base, _cyhal_uart_cb_wrapper, &(obj->context)); in cyhal_uart_register_callback()
1531 obj->irq_cause = CYHAL_UART_IRQ_NONE; in cyhal_uart_register_callback()
1534 void cyhal_uart_enable_event(cyhal_uart_t *obj, cyhal_uart_event_t event, uint8_t intr_priority, bo… in cyhal_uart_enable_event() argument
1536 uint8_t scb_arr_index = _cyhal_scb_get_block_index(obj->resource.block_num); in cyhal_uart_enable_event()
1538 Cy_SCB_DisableInterrupt(obj->base); in cyhal_uart_enable_event()
1546 obj->irq_cause |= event; in cyhal_uart_enable_event()
1549 Cy_SCB_ClearTxInterrupt(obj->base, CY_SCB_UART_TX_EMPTY); in cyhal_uart_enable_event()
1550 … Cy_SCB_SetTxInterruptMask(obj->base, Cy_SCB_GetTxInterruptMask(obj->base) | CY_SCB_UART_TX_EMPTY); in cyhal_uart_enable_event()
1554 Cy_SCB_ClearTxInterrupt(obj->base, CY_SCB_UART_TX_DONE); in cyhal_uart_enable_event()
1555 … Cy_SCB_SetTxInterruptMask(obj->base, Cy_SCB_GetTxInterruptMask(obj->base) | CY_SCB_UART_TX_DONE); in cyhal_uart_enable_event()
1561 if(obj->config.uartMode == CY_SCB_UART_STANDARD) in cyhal_uart_enable_event()
1563 … Cy_SCB_ClearTxInterrupt(obj->base, (CY_SCB_UART_TX_OVERFLOW | CY_SCB_UART_TRANSMIT_ERR)); in cyhal_uart_enable_event()
1564 …Cy_SCB_SetTxInterruptMask(obj->base, Cy_SCB_GetTxInterruptMask(obj->base) | (CY_SCB_UART_TX_OVERFL… in cyhal_uart_enable_event()
1567 else if(obj->config.uartMode == CY_SCB_UART_SMARTCARD) in cyhal_uart_enable_event()
1569 …Cy_SCB_ClearTxInterrupt(obj->base, (CY_SCB_UART_TX_OVERFLOW | CY_SCB_TX_INTR_UART_NACK | CY_SCB_TX… in cyhal_uart_enable_event()
1570 …Cy_SCB_SetTxInterruptMask(obj->base, Cy_SCB_GetTxInterruptMask(obj->base) | (CY_SCB_UART_TX_OVERFL… in cyhal_uart_enable_event()
1575 …Cy_SCB_ClearTxInterrupt(obj->base, (CY_SCB_UART_TX_OVERFLOW | CY_SCB_TX_INTR_UART_ARB_LOST | CY_SC… in cyhal_uart_enable_event()
1576 …Cy_SCB_SetTxInterruptMask(obj->base, Cy_SCB_GetTxInterruptMask(obj->base) | (CY_SCB_UART_TX_OVERFL… in cyhal_uart_enable_event()
1581 Cy_SCB_ClearTxInterrupt(obj->base, CY_SCB_UART_TX_TRIGGER); in cyhal_uart_enable_event()
1582 …Cy_SCB_SetTxInterruptMask(obj->base, Cy_SCB_GetTxInterruptMask(obj->base) | CY_SCB_UART_TX_TRIGGER… in cyhal_uart_enable_event()
1587 Cy_SCB_ClearRxInterrupt(obj->base, CY_SCB_UART_RX_NOT_EMPTY); in cyhal_uart_enable_event()
1588 …Cy_SCB_SetRxInterruptMask(obj->base, Cy_SCB_GetRxInterruptMask(obj->base) | CY_SCB_UART_RX_NOT_EMP… in cyhal_uart_enable_event()
1593 Cy_SCB_ClearRxInterrupt(obj->base, CY_SCB_UART_RECEIVE_ERR); in cyhal_uart_enable_event()
1594 …Cy_SCB_SetRxInterruptMask(obj->base, Cy_SCB_GetRxInterruptMask(obj->base) | CY_SCB_UART_RECEIVE_ER… in cyhal_uart_enable_event()
1598 Cy_SCB_ClearRxInterrupt(obj->base, CY_SCB_UART_RX_TRIGGER); in cyhal_uart_enable_event()
1599 …Cy_SCB_SetRxInterruptMask(obj->base, Cy_SCB_GetRxInterruptMask(obj->base) | CY_SCB_UART_RX_TRIGGER… in cyhal_uart_enable_event()
1604 obj->irq_cause &= ~event; in cyhal_uart_enable_event()
1607 …Cy_SCB_SetTxInterruptMask(obj->base, Cy_SCB_GetTxInterruptMask(obj->base) & ~CY_SCB_UART_TX_EMPTY); in cyhal_uart_enable_event()
1611 … Cy_SCB_SetTxInterruptMask(obj->base, Cy_SCB_GetTxInterruptMask(obj->base) & ~CY_SCB_UART_TX_DONE); in cyhal_uart_enable_event()
1615 …Cy_SCB_SetTxInterruptMask(obj->base, Cy_SCB_GetTxInterruptMask(obj->base) & ~(CY_SCB_UART_TX_OVERF… in cyhal_uart_enable_event()
1619 …Cy_SCB_SetTxInterruptMask(obj->base, Cy_SCB_GetTxInterruptMask(obj->base) & ~CY_SCB_UART_TX_TRIGGE… in cyhal_uart_enable_event()
1624 …Cy_SCB_SetRxInterruptMask(obj->base, Cy_SCB_GetRxInterruptMask(obj->base) & ~CY_SCB_UART_RX_NOT_EM… in cyhal_uart_enable_event()
1628 …Cy_SCB_SetRxInterruptMask(obj->base, Cy_SCB_GetRxInterruptMask(obj->base) & ~CY_SCB_UART_RECEIVE_E… in cyhal_uart_enable_event()
1632 …Cy_SCB_SetRxInterruptMask(obj->base, Cy_SCB_GetRxInterruptMask(obj->base) & ~CY_SCB_UART_RX_TRIGGE… in cyhal_uart_enable_event()
1651 Cy_SCB_ClearRxInterrupt(obj->base, CY_SCB_RX_INTR_MASK); in cyhal_uart_enable_event()
1652 Cy_SCB_ClearTxInterrupt(obj->base, CY_SCB_TX_INTR_MASK); in cyhal_uart_enable_event()
1653 … Cy_SCB_SetRxInterruptMask(obj->base, Cy_SCB_GetRxInterruptMask(obj->base) & ~CY_SCB_RX_INTR_MASK); in cyhal_uart_enable_event()
1654 … Cy_SCB_SetTxInterruptMask(obj->base, Cy_SCB_GetTxInterruptMask(obj->base) & ~CY_SCB_TX_INTR_MASK); in cyhal_uart_enable_event()
1661 Cy_SCB_RegisterInterruptCallback(obj->base, _cyhal_irq_cb[_CYHAL_SCB_IRQ_N[scb_arr_index]]); in cyhal_uart_enable_event()
1662 Cy_SCB_EnableInterrupt(obj->base); in cyhal_uart_enable_event()
1666 cy_rslt_t cyhal_uart_set_fifo_level(cyhal_uart_t *obj, cyhal_uart_fifo_type_t type, uint16_t level) in cyhal_uart_set_fifo_level() argument
1668 cy_rslt_t result = _cyhal_scb_set_fifo_level(obj->base, (cyhal_scb_fifo_type_t)type, level); in cyhal_uart_set_fifo_level()
1673 obj->user_fifo_level = level; in cyhal_uart_set_fifo_level()
1679 cy_rslt_t cyhal_uart_enable_output(cyhal_uart_t *obj, cyhal_uart_output_t output, cyhal_source_t *s… in cyhal_uart_enable_output() argument
1681 return _cyhal_scb_enable_output(obj->resource, (cyhal_scb_output_t)output, source); in cyhal_uart_enable_output()
1684 cy_rslt_t cyhal_uart_disable_output(cyhal_uart_t *obj, cyhal_uart_output_t output) in cyhal_uart_disable_output() argument
1686 CY_UNUSED_PARAMETER(obj); in cyhal_uart_disable_output()
1690 cy_rslt_t cyhal_uart_config_software_buffer(cyhal_uart_t *obj, uint8_t *rx_buffer, uint32_t rx_buff… in cyhal_uart_config_software_buffer() argument
1693 CY_ASSERT(NULL != obj); in cyhal_uart_config_software_buffer()
1697 if(obj->async_mode == CYHAL_ASYNC_DMA) in cyhal_uart_config_software_buffer()
1705 Cy_SCB_UART_StartRingBuffer(obj->base, rx_buffer, rx_buffer_size, &(obj->context)); in cyhal_uart_config_software_buffer()