1
mirror of https://github.com/DarkFlippers/unleashed-firmware.git synced 2025-12-12 12:42:30 +04:00

Revert "Merge remote-tracking branch 'OFW/gsurkov/vcp_break_support' into dev [ci skip]"

This reverts commit fc25c9fba0, reversing
changes made to 41ae5d8981.
This commit is contained in:
MX
2025-04-05 23:41:23 +03:00
parent 380402a55c
commit 4f5cba4cd1
8 changed files with 5 additions and 43 deletions

View File

@@ -35,12 +35,12 @@ typedef enum {
WorkerEvtLineCfgSet = (1 << 6), WorkerEvtLineCfgSet = (1 << 6),
WorkerEvtCtrlLineSet = (1 << 7), WorkerEvtCtrlLineSet = (1 << 7),
WorkerEvtSendBreak = (1 << 8),
} WorkerEvtFlags; } WorkerEvtFlags;
#define WORKER_ALL_RX_EVENTS \ #define WORKER_ALL_RX_EVENTS \
(WorkerEvtStop | WorkerEvtRxDone | WorkerEvtCfgChange | WorkerEvtLineCfgSet | \ (WorkerEvtStop | WorkerEvtRxDone | WorkerEvtCfgChange | WorkerEvtLineCfgSet | \
WorkerEvtCtrlLineSet | WorkerEvtCdcTxComplete | WorkerEvtSendBreak) WorkerEvtCtrlLineSet | WorkerEvtCdcTxComplete)
#define WORKER_ALL_TX_EVENTS (WorkerEvtTxStop | WorkerEvtCdcRx) #define WORKER_ALL_TX_EVENTS (WorkerEvtTxStop | WorkerEvtCdcRx)
struct UsbUartBridge { struct UsbUartBridge {
@@ -69,7 +69,6 @@ static void vcp_on_cdc_rx(void* context);
static void vcp_state_callback(void* context, uint8_t state); static void vcp_state_callback(void* context, uint8_t state);
static void vcp_on_cdc_control_line(void* context, uint8_t state); static void vcp_on_cdc_control_line(void* context, uint8_t state);
static void vcp_on_line_config(void* context, struct usb_cdc_line_coding* config); static void vcp_on_line_config(void* context, struct usb_cdc_line_coding* config);
static void vcp_on_cdc_break(void* context, uint16_t duration);
static const CdcCallbacks cdc_cb = { static const CdcCallbacks cdc_cb = {
vcp_on_cdc_tx_complete, vcp_on_cdc_tx_complete,
@@ -77,7 +76,6 @@ static const CdcCallbacks cdc_cb = {
vcp_state_callback, vcp_state_callback,
vcp_on_cdc_control_line, vcp_on_cdc_control_line,
vcp_on_line_config, vcp_on_line_config,
vcp_on_cdc_break,
}; };
/* USB UART worker */ /* USB UART worker */
@@ -289,9 +287,6 @@ static int32_t usb_uart_worker(void* context) {
if(events & WorkerEvtCtrlLineSet) { if(events & WorkerEvtCtrlLineSet) {
usb_uart_update_ctrl_lines(usb_uart); usb_uart_update_ctrl_lines(usb_uart);
} }
if(events & WorkerEvtSendBreak) {
furi_hal_serial_send_break(usb_uart->serial_handle);
}
} }
furi_hal_gpio_init(USB_USART_DE_RE_PIN, GpioModeAnalog, GpioPullNo, GpioSpeedLow); furi_hal_gpio_init(USB_USART_DE_RE_PIN, GpioModeAnalog, GpioPullNo, GpioSpeedLow);
@@ -383,12 +378,6 @@ static void vcp_on_line_config(void* context, struct usb_cdc_line_coding* config
furi_thread_flags_set(furi_thread_get_id(usb_uart->thread), WorkerEvtLineCfgSet); furi_thread_flags_set(furi_thread_get_id(usb_uart->thread), WorkerEvtLineCfgSet);
} }
static void vcp_on_cdc_break(void* context, uint16_t duration) {
UNUSED(duration);
UsbUartBridge* usb_uart = (UsbUartBridge*)context;
furi_thread_flags_set(furi_thread_get_id(usb_uart->thread), WorkerEvtSendBreak);
}
UsbUartBridge* usb_uart_enable(UsbUartConfig* cfg) { UsbUartBridge* usb_uart_enable(UsbUartConfig* cfg) {
UsbUartBridge* usb_uart = malloc(sizeof(UsbUartBridge)); UsbUartBridge* usb_uart = malloc(sizeof(UsbUartBridge));

View File

@@ -57,7 +57,6 @@ static CdcCallbacks cdc_cb = {
vcp_state_callback, vcp_state_callback,
vcp_on_cdc_control_line, vcp_on_cdc_control_line,
NULL, NULL,
NULL,
}; };
static CliVcp* vcp = NULL; static CliVcp* vcp = NULL;

View File

@@ -1460,7 +1460,6 @@ Function,+,furi_hal_serial_get_gpio_pin,const GpioPin*,"FuriHalSerialHandle*, Fu
Function,+,furi_hal_serial_init,void,"FuriHalSerialHandle*, uint32_t" Function,+,furi_hal_serial_init,void,"FuriHalSerialHandle*, uint32_t"
Function,+,furi_hal_serial_is_baud_rate_supported,_Bool,"FuriHalSerialHandle*, uint32_t" Function,+,furi_hal_serial_is_baud_rate_supported,_Bool,"FuriHalSerialHandle*, uint32_t"
Function,+,furi_hal_serial_resume,void,FuriHalSerialHandle* Function,+,furi_hal_serial_resume,void,FuriHalSerialHandle*
Function,+,furi_hal_serial_send_break,void,FuriHalSerialHandle*
Function,+,furi_hal_serial_set_br,void,"FuriHalSerialHandle*, uint32_t" Function,+,furi_hal_serial_set_br,void,"FuriHalSerialHandle*, uint32_t"
Function,+,furi_hal_serial_suspend,void,FuriHalSerialHandle* Function,+,furi_hal_serial_suspend,void,FuriHalSerialHandle*
Function,+,furi_hal_serial_tx,void,"FuriHalSerialHandle*, const uint8_t*, size_t" Function,+,furi_hal_serial_tx,void,"FuriHalSerialHandle*, const uint8_t*, size_t"
1 entry status name type params
1460 Function + furi_hal_serial_init void FuriHalSerialHandle*, uint32_t
1461 Function + furi_hal_serial_is_baud_rate_supported _Bool FuriHalSerialHandle*, uint32_t
1462 Function + furi_hal_serial_resume void FuriHalSerialHandle*
Function + furi_hal_serial_send_break void FuriHalSerialHandle*
1463 Function + furi_hal_serial_set_br void FuriHalSerialHandle*, uint32_t
1464 Function + furi_hal_serial_suspend void FuriHalSerialHandle*
1465 Function + furi_hal_serial_tx void FuriHalSerialHandle*, const uint8_t*, size_t

View File

@@ -1691,7 +1691,6 @@ Function,+,furi_hal_serial_get_gpio_pin,const GpioPin*,"FuriHalSerialHandle*, Fu
Function,+,furi_hal_serial_init,void,"FuriHalSerialHandle*, uint32_t" Function,+,furi_hal_serial_init,void,"FuriHalSerialHandle*, uint32_t"
Function,+,furi_hal_serial_is_baud_rate_supported,_Bool,"FuriHalSerialHandle*, uint32_t" Function,+,furi_hal_serial_is_baud_rate_supported,_Bool,"FuriHalSerialHandle*, uint32_t"
Function,+,furi_hal_serial_resume,void,FuriHalSerialHandle* Function,+,furi_hal_serial_resume,void,FuriHalSerialHandle*
Function,+,furi_hal_serial_send_break,void,FuriHalSerialHandle*
Function,+,furi_hal_serial_set_br,void,"FuriHalSerialHandle*, uint32_t" Function,+,furi_hal_serial_set_br,void,"FuriHalSerialHandle*, uint32_t"
Function,+,furi_hal_serial_suspend,void,FuriHalSerialHandle* Function,+,furi_hal_serial_suspend,void,FuriHalSerialHandle*
Function,+,furi_hal_serial_tx,void,"FuriHalSerialHandle*, const uint8_t*, size_t" Function,+,furi_hal_serial_tx,void,"FuriHalSerialHandle*, const uint8_t*, size_t"
1 entry status name type params
1691 Function + furi_hal_serial_init void FuriHalSerialHandle*, uint32_t
1692 Function + furi_hal_serial_is_baud_rate_supported _Bool FuriHalSerialHandle*, uint32_t
1693 Function + furi_hal_serial_resume void FuriHalSerialHandle*
Function + furi_hal_serial_send_break void FuriHalSerialHandle*
1694 Function + furi_hal_serial_set_br void FuriHalSerialHandle*, uint32_t
1695 Function + furi_hal_serial_suspend void FuriHalSerialHandle*
1696 Function + furi_hal_serial_tx void FuriHalSerialHandle*, const uint8_t*, size_t

View File

@@ -1036,13 +1036,3 @@ const GpioPin*
return furi_hal_serial_config[handle->id].gpio[direction]; return furi_hal_serial_config[handle->id].gpio[direction];
} }
void furi_hal_serial_send_break(FuriHalSerialHandle* handle) {
furi_check(handle);
if(handle->id == FuriHalSerialIdUsart) {
LL_USART_RequestBreakSending(USART1);
} else {
LL_LPUART_RequestBreakSending(LPUART1);
}
}

View File

@@ -256,12 +256,6 @@ void furi_hal_serial_dma_rx_stop(FuriHalSerialHandle* handle);
*/ */
size_t furi_hal_serial_dma_rx(FuriHalSerialHandle* handle, uint8_t* data, size_t len); size_t furi_hal_serial_dma_rx(FuriHalSerialHandle* handle, uint8_t* data, size_t len);
/** Send a break sequence (low level for the whole character duration)
*
* @param handle Serial handle
*/
void furi_hal_serial_send_break(FuriHalSerialHandle* handle);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View File

@@ -122,7 +122,7 @@ static const struct CdcConfigDescriptorSingle cdc_cfg_desc_single = {
.bFunctionLength = sizeof(struct usb_cdc_acm_desc), .bFunctionLength = sizeof(struct usb_cdc_acm_desc),
.bDescriptorType = USB_DTYPE_CS_INTERFACE, .bDescriptorType = USB_DTYPE_CS_INTERFACE,
.bDescriptorSubType = USB_DTYPE_CDC_ACM, .bDescriptorSubType = USB_DTYPE_CDC_ACM,
.bmCapabilities = USB_CDC_CAP_BRK, .bmCapabilities = 0,
}, },
.cdc_union = .cdc_union =
{ {
@@ -235,7 +235,7 @@ static const struct CdcConfigDescriptorDual
.bFunctionLength = sizeof(struct usb_cdc_acm_desc), .bFunctionLength = sizeof(struct usb_cdc_acm_desc),
.bDescriptorType = USB_DTYPE_CS_INTERFACE, .bDescriptorType = USB_DTYPE_CS_INTERFACE,
.bDescriptorSubType = USB_DTYPE_CDC_ACM, .bDescriptorSubType = USB_DTYPE_CDC_ACM,
.bmCapabilities = USB_CDC_CAP_BRK, .bmCapabilities = 0,
}, },
.cdc_union = .cdc_union =
{ {
@@ -330,7 +330,7 @@ static const struct CdcConfigDescriptorDual
.bFunctionLength = sizeof(struct usb_cdc_acm_desc), .bFunctionLength = sizeof(struct usb_cdc_acm_desc),
.bDescriptorType = USB_DTYPE_CS_INTERFACE, .bDescriptorType = USB_DTYPE_CS_INTERFACE,
.bDescriptorSubType = USB_DTYPE_CDC_ACM, .bDescriptorSubType = USB_DTYPE_CDC_ACM,
.bmCapabilities = USB_CDC_CAP_BRK, .bmCapabilities = 0,
}, },
.cdc_union = .cdc_union =
{ {
@@ -685,13 +685,6 @@ static usbd_respond cdc_control(usbd_device* dev, usbd_ctlreq* req, usbd_rqc_cal
dev->status.data_ptr = &cdc_config[if_num]; dev->status.data_ptr = &cdc_config[if_num];
dev->status.data_count = sizeof(cdc_config[0]); dev->status.data_count = sizeof(cdc_config[0]);
return usbd_ack; return usbd_ack;
case USB_CDC_SEND_BREAK:
if(callbacks[if_num] != NULL) {
if(callbacks[if_num]->break_callback != NULL) {
callbacks[if_num]->break_callback(cb_ctx[if_num], req->wValue);
}
}
return usbd_ack;
default: default:
return usbd_fail; return usbd_fail;
} }

View File

@@ -15,7 +15,6 @@ typedef struct {
void (*state_callback)(void* context, uint8_t state); void (*state_callback)(void* context, uint8_t state);
void (*ctrl_line_callback)(void* context, uint8_t state); void (*ctrl_line_callback)(void* context, uint8_t state);
void (*config_callback)(void* context, struct usb_cdc_line_coding* config); void (*config_callback)(void* context, struct usb_cdc_line_coding* config);
void (*break_callback)(void* context, uint16_t duration);
} CdcCallbacks; } CdcCallbacks;
void furi_hal_cdc_set_callbacks(uint8_t if_num, CdcCallbacks* cb, void* context); void furi_hal_cdc_set_callbacks(uint8_t if_num, CdcCallbacks* cb, void* context);