14 #if (defined(SERIAL_MANAGER_NON_BLOCKING_MODE) && (SERIAL_MANAGER_NON_BLOCKING_MODE > 0U))
28 #if (defined(SERIAL_MANAGER_USE_COMMON_TASK) && (SERIAL_MANAGER_USE_COMMON_TASK > 0U))
29 #include "common_task.h"
31 #include "fsl_os_abstraction.h"
43 #if (defined(DEBUG_CONSOLE_ASSERT_DISABLE) && (DEBUG_CONSOLE_ASSERT_DISABLE > 0U))
49 #define SERIAL_EVENT_DATA_RECEIVED (1U << 0)
50 #define SERIAL_EVENT_DATA_SENT (1U << 1)
52 #define SERIAL_MANAGER_WRITE_TAG 0xAABB5754U
53 #define SERIAL_MANAGER_READ_TAG 0xBBAA5244U
55 #if (defined(SERIAL_MANAGER_NON_BLOCKING_MODE) && (SERIAL_MANAGER_NON_BLOCKING_MODE > 0U))
56 typedef enum _serial_manager_transmission_mode
58 kSerialManager_TransmissionBlocking = 0x0U,
59 kSerialManager_TransmissionNonBlocking = 0x1U,
60 } serial_manager_transmission_mode_t;
63 typedef struct _serial_manager_transfer
66 volatile uint32_t length;
67 volatile uint32_t soFar;
68 serial_manager_transmission_mode_t mode;
70 } serial_manager_transfer_t;
76 #if (defined(SERIAL_MANAGER_NON_BLOCKING_MODE) && (SERIAL_MANAGER_NON_BLOCKING_MODE > 0U))
78 serial_manager_transfer_t transfer;
81 #if (defined(SERIAL_MANAGER_NON_BLOCKING_MODE) && (SERIAL_MANAGER_NON_BLOCKING_MODE > 0U))
90 #if (defined(SERIAL_MANAGER_NON_BLOCKING_MODE) && (SERIAL_MANAGER_NON_BLOCKING_MODE > 0U))
92 typedef struct _serial_manager_read_ring_buffer
95 uint32_t ringBufferSize;
96 volatile uint32_t ringHead;
97 volatile uint32_t ringTail;
98 } serial_manager_read_ring_buffer_t;
101 #if defined(__CC_ARM)
107 #if (defined(SERIAL_MANAGER_NON_BLOCKING_MODE) && (SERIAL_MANAGER_NON_BLOCKING_MODE > 0U))
116 #if (defined(SERIAL_PORT_TYPE_UART) && (SERIAL_PORT_TYPE_UART > 0U))
119 #if (defined(SERIAL_PORT_TYPE_USBCDC) && (SERIAL_PORT_TYPE_USBCDC > 0U))
120 uint8_t usbcdcHandleBuffer[SERIAL_PORT_USB_CDC_HANDLE_SIZE];
122 #if (defined(SERIAL_PORT_TYPE_SWO) && (SERIAL_PORT_TYPE_SWO > 0U))
123 uint8_t swoHandleBuffer[SERIAL_PORT_SWO_HANDLE_SIZE];
125 #if (defined(SERIAL_PORT_TYPE_USBCDC_VIRTUAL) && (SERIAL_PORT_TYPE_USBCDC_VIRTUAL > 0U))
126 uint8_t usbcdcVirtualHandleBuffer[SERIAL_PORT_USB_VIRTUAL_HANDLE_SIZE];
129 #if (defined(SERIAL_MANAGER_NON_BLOCKING_MODE) && (SERIAL_MANAGER_NON_BLOCKING_MODE > 0U))
130 serial_manager_read_ring_buffer_t ringBuffer;
133 #if (defined(SERIAL_MANAGER_NON_BLOCKING_MODE) && (SERIAL_MANAGER_NON_BLOCKING_MODE > 0U))
135 #if defined(OSA_USED)
137 #if (defined(SERIAL_MANAGER_USE_COMMON_TASK) && (SERIAL_MANAGER_USE_COMMON_TASK > 0U))
138 common_task_message_t commontaskMsg;
140 OSA_EVENT_HANDLE_DEFINE(event);
141 OSA_TASK_HANDLE_DEFINE(taskId);
155 #if (defined(SERIAL_MANAGER_NON_BLOCKING_MODE) && (SERIAL_MANAGER_NON_BLOCKING_MODE > 0U))
156 static void SerialManager_Task(
void *param);
163 #if (defined(SERIAL_MANAGER_NON_BLOCKING_MODE) && (SERIAL_MANAGER_NON_BLOCKING_MODE > 0U))
165 #if defined(OSA_USED)
167 #if (defined(SERIAL_MANAGER_USE_COMMON_TASK) && (SERIAL_MANAGER_USE_COMMON_TASK > 0U))
184 #if (defined(SERIAL_MANAGER_NON_BLOCKING_MODE) && (SERIAL_MANAGER_NON_BLOCKING_MODE > 0U))
190 static void SerialManager_RemoveHead(
list_label_t *queue)
196 #if (defined(SERIAL_MANAGER_NON_BLOCKING_MODE) && (SERIAL_MANAGER_NON_BLOCKING_MODE > 0U))
204 if (writeHandle !=
NULL)
206 switch (handle->
type)
208 #if (defined(SERIAL_PORT_TYPE_UART) && (SERIAL_PORT_TYPE_UART > 0U))
211 writeHandle->transfer.buffer, writeHandle->transfer.length);
214 #if (defined(SERIAL_PORT_TYPE_USBCDC) && (SERIAL_PORT_TYPE_USBCDC > 0U))
217 writeHandle->transfer.buffer, writeHandle->transfer.length);
220 #if (defined(SERIAL_PORT_TYPE_SWO) && (SERIAL_PORT_TYPE_SWO > 0U))
223 writeHandle->transfer.buffer, writeHandle->transfer.length);
226 #if (defined(SERIAL_PORT_TYPE_USBCDC_VIRTUAL) && (SERIAL_PORT_TYPE_USBCDC_VIRTUAL > 0U))
229 writeHandle->transfer.buffer, writeHandle->transfer.length);
247 if (
NULL != readHandle)
249 #if (defined(SERIAL_PORT_TYPE_USBCDC) && (SERIAL_PORT_TYPE_USBCDC > 0U))
255 #if (defined(SERIAL_PORT_TYPE_USBCDC_VIRTUAL) && (SERIAL_PORT_TYPE_USBCDC_VIRTUAL > 0U))
274 #if (defined(SERIAL_PORT_TYPE_UART) && (SERIAL_PORT_TYPE_UART > 0U))
281 #if (defined(SERIAL_PORT_TYPE_USBCDC) && (SERIAL_PORT_TYPE_USBCDC > 0U))
288 #if (defined(SERIAL_PORT_TYPE_SWO) && (SERIAL_PORT_TYPE_SWO > 0U))
295 #if (defined(SERIAL_PORT_TYPE_USBCDC_VIRTUAL) && (SERIAL_PORT_TYPE_USBCDC_VIRTUAL > 0U))
315 #if (defined(SERIAL_PORT_TYPE_UART) && (SERIAL_PORT_TYPE_UART > 0U))
322 #if (defined(SERIAL_PORT_TYPE_USBCDC) && (SERIAL_PORT_TYPE_USBCDC > 0U))
329 #if (defined(SERIAL_PORT_TYPE_SWO) && (SERIAL_PORT_TYPE_SWO > 0U))
336 #if (defined(SERIAL_PORT_TYPE_USBCDC_VIRTUAL) && (SERIAL_PORT_TYPE_USBCDC_VIRTUAL > 0U))
349 #if (defined(SERIAL_MANAGER_NON_BLOCKING_MODE) && (SERIAL_MANAGER_NON_BLOCKING_MODE > 0U))
353 switch (handle->
type)
355 #if (defined(SERIAL_PORT_TYPE_UART) && (SERIAL_PORT_TYPE_UART > 0U))
360 #if (defined(SERIAL_PORT_TYPE_USBCDC) && (SERIAL_PORT_TYPE_USBCDC > 0U))
365 #if (defined(SERIAL_PORT_TYPE_SWO) && (SERIAL_PORT_TYPE_SWO > 0U))
370 #if (defined(SERIAL_PORT_TYPE_USBCDC_VIRTUAL) && (SERIAL_PORT_TYPE_USBCDC_VIRTUAL > 0U))
382 static void SerialManager_Task(
void *param)
392 #if defined(OSA_USED)
394 #if (defined(SERIAL_MANAGER_USE_COMMON_TASK) && (SERIAL_MANAGER_USE_COMMON_TASK > 0U))
396 osa_event_flags_t ev = 0;
400 if (KOSA_StatusSuccess ==
401 OSA_EventWait((osa_event_handle_t)handle->event, osaEventFlagsAll_c,
false, osaWaitForever_c, &ev))
410 while (
NULL != serialWriteHandle)
412 SerialManager_RemoveHead(&handle->completedWriteHandleHead);
413 msg.
buffer = serialWriteHandle->transfer.buffer;
414 msg.
length = serialWriteHandle->transfer.soFar;
415 serialWriteHandle->transfer.buffer =
NULL;
416 if (
NULL != serialWriteHandle->callback)
418 serialWriteHandle->callback(serialWriteHandle->callbackParam, &msg,
419 serialWriteHandle->transfer.status);
425 #if defined(OSA_USED)
427 #if (defined(SERIAL_MANAGER_USE_COMMON_TASK) && (SERIAL_MANAGER_USE_COMMON_TASK > 0U))
438 if (
NULL != serialReadHandle)
440 if (
NULL != serialReadHandle->transfer.buffer)
442 if (serialReadHandle->transfer.soFar >= serialReadHandle->transfer.length)
444 msg.
buffer = serialReadHandle->transfer.buffer;
445 msg.
length = serialReadHandle->transfer.soFar;
446 serialReadHandle->transfer.buffer =
NULL;
447 if (
NULL != serialReadHandle->callback)
449 serialReadHandle->callback(serialReadHandle->callbackParam, &msg,
450 serialReadHandle->transfer.status);
456 #if defined(OSA_USED)
458 #if (defined(SERIAL_MANAGER_USE_COMMON_TASK) && (SERIAL_MANAGER_USE_COMMON_TASK > 0U))
461 }
while (gUseRtos_c);
469 #if (defined(SERIAL_MANAGER_NON_BLOCKING_MODE) && (SERIAL_MANAGER_NON_BLOCKING_MODE > 0U))
470 static void SerialManager_TxCallback(
void *callbackParam,
477 assert(callbackParam);
484 if (
NULL != writeHandle)
486 SerialManager_RemoveHead(&handle->runningWriteHandleHead);
488 writeHandle->transfer.soFar = message->
length;
489 writeHandle->transfer.status = status;
490 if (kSerialManager_TransmissionNonBlocking == writeHandle->transfer.mode)
492 SerialManager_AddTail(&handle->completedWriteHandleHead, writeHandle);
493 #if defined(OSA_USED)
495 #if (defined(SERIAL_MANAGER_USE_COMMON_TASK) && (SERIAL_MANAGER_USE_COMMON_TASK > 0U))
496 handle->commontaskMsg.callback = SerialManager_Task;
497 handle->commontaskMsg.callbackParam = handle;
498 COMMON_TASK_post_message(&handle->commontaskMsg);
504 SerialManager_Task(handle);
509 writeHandle->transfer.buffer =
NULL;
514 static void SerialManager_RxCallback(
void *callbackParam,
519 uint32_t ringBufferLength;
522 assert(callbackParam);
529 for (uint32_t i = 0; i < message->
length; i++)
531 handle->ringBuffer.ringBuffer[handle->ringBuffer.ringHead++] = message->
buffer[i];
532 if (handle->ringBuffer.ringHead >= handle->ringBuffer.ringBufferSize)
534 handle->ringBuffer.ringHead = 0U;
536 if (handle->ringBuffer.ringHead == handle->ringBuffer.ringTail)
539 handle->ringBuffer.ringTail++;
540 if (handle->ringBuffer.ringTail >= handle->ringBuffer.ringBufferSize)
542 handle->ringBuffer.ringTail = 0U;
547 ringBufferLength = handle->ringBuffer.ringHead + handle->ringBuffer.ringBufferSize - handle->ringBuffer.ringTail;
548 ringBufferLength = ringBufferLength % handle->ringBuffer.ringBufferSize;
555 uint32_t remainLength =
557 for (uint32_t i = 0; i <
MIN(ringBufferLength, remainLength); i++)
560 handle->ringBuffer.ringBuffer[handle->ringBuffer.ringTail];
561 handle->ringBuffer.ringTail++;
563 if (handle->ringBuffer.ringTail >= handle->ringBuffer.ringBufferSize)
565 handle->ringBuffer.ringTail = 0U;
568 ringBufferLength = ringBufferLength -
MIN(ringBufferLength, remainLength);
584 #if defined(OSA_USED)
586 #if (defined(SERIAL_MANAGER_USE_COMMON_TASK) && (SERIAL_MANAGER_USE_COMMON_TASK > 0U))
587 handle->commontaskMsg.callback = SerialManager_Task;
588 handle->commontaskMsg.callbackParam = handle;
589 COMMON_TASK_post_message(&handle->commontaskMsg);
595 SerialManager_Task(handle);
601 if (0U != ringBufferLength)
604 message->
length = ringBufferLength;
611 ringBufferLength = handle->ringBuffer.ringBufferSize - 1U - ringBufferLength;
623 serial_manager_transmission_mode_t mode)
629 uint8_t isEmpty = 0U;
640 assert(!((kSerialManager_TransmissionNonBlocking == mode) && (
NULL == serialWriteHandle->callback)));
643 if (
NULL != serialWriteHandle->transfer.buffer)
648 serialWriteHandle->transfer.buffer = buffer;
649 serialWriteHandle->transfer.length = length;
650 serialWriteHandle->transfer.soFar = 0U;
651 serialWriteHandle->transfer.mode = mode;
657 SerialManager_AddTail(&handle->runningWriteHandleHead, serialWriteHandle);
665 #if (USB_CDC_SERIAL_MANAGER_RUN_NO_HOST == 1)
668 SerialManager_RemoveHead(&handle->runningWriteHandleHead);
669 serialWriteHandle->transfer.buffer = 0;
670 serialWriteHandle->transfer.length = 0;
677 if (kSerialManager_TransmissionBlocking == mode)
679 while (serialWriteHandle->transfer.length > serialWriteHandle->transfer.soFar)
681 #if defined(__GIC_PRIO_BITS)
682 if (0x13 == (__get_CPSR() & CPSR_M_Msk))
687 SerialManager_IsrFunction(handle);
697 serial_manager_transmission_mode_t mode,
698 uint32_t *receivedLength)
714 assert(!((kSerialManager_TransmissionNonBlocking == mode) && (
NULL == serialReadHandle->callback)));
717 if (
NULL != serialReadHandle->transfer.buffer)
722 serialReadHandle->transfer.buffer = buffer;
723 serialReadHandle->transfer.length = length;
724 serialReadHandle->transfer.soFar = 0U;
725 serialReadHandle->transfer.mode = mode;
727 dataLength = handle->ringBuffer.ringHead + handle->ringBuffer.ringBufferSize - handle->ringBuffer.ringTail;
728 dataLength = dataLength % handle->ringBuffer.ringBufferSize;
730 for (serialReadHandle->transfer.soFar = 0U; serialReadHandle->transfer.soFar <
MIN(dataLength, length);
731 serialReadHandle->transfer.soFar++)
733 buffer[serialReadHandle->transfer.soFar] = handle->ringBuffer.ringBuffer[handle->ringBuffer.ringTail];
734 handle->ringBuffer.ringTail++;
735 if (handle->ringBuffer.ringTail >= handle->ringBuffer.ringBufferSize)
737 handle->ringBuffer.ringTail = 0U;
741 dataLength = handle->ringBuffer.ringHead + handle->ringBuffer.ringBufferSize - handle->ringBuffer.ringTail;
742 dataLength = dataLength % handle->ringBuffer.ringBufferSize;
743 dataLength = handle->ringBuffer.ringBufferSize - 1U - dataLength;
747 if (
NULL != receivedLength)
749 *receivedLength = serialReadHandle->transfer.soFar;
750 serialReadHandle->transfer.buffer =
NULL;
755 if (serialReadHandle->transfer.soFar >= serialReadHandle->transfer.length)
757 serialReadHandle->transfer.buffer =
NULL;
759 if (kSerialManager_TransmissionNonBlocking == mode)
761 if (
NULL != serialReadHandle->callback)
765 msg.
length = serialReadHandle->transfer.soFar;
775 if (kSerialManager_TransmissionBlocking == mode)
777 while (serialReadHandle->transfer.length > serialReadHandle->transfer.soFar)
829 #if (defined(SERIAL_MANAGER_NON_BLOCKING_MODE) && (SERIAL_MANAGER_NON_BLOCKING_MODE > 0U))
830 assert(
config->ringBuffer);
831 assert(
config->ringBufferSize);
833 assert(serialHandle);
840 #if (defined(SERIAL_MANAGER_NON_BLOCKING_MODE) && (SERIAL_MANAGER_NON_BLOCKING_MODE > 0U))
842 #if defined(OSA_USED)
844 #if (defined(SERIAL_MANAGER_USE_COMMON_TASK) && (SERIAL_MANAGER_USE_COMMON_TASK > 0U))
849 if (KOSA_StatusSuccess != OSA_EventCreate((osa_event_handle_t)handle->event,
true))
854 if (KOSA_StatusSuccess != OSA_TaskCreate((osa_task_handle_t)handle->taskId, OSA_TASK(SerialManager_Task), handle))
866 #if (defined(SERIAL_MANAGER_NON_BLOCKING_MODE) && (SERIAL_MANAGER_NON_BLOCKING_MODE > 0U))
867 handle->ringBuffer.ringBuffer =
config->ringBuffer;
868 handle->ringBuffer.ringBufferSize =
config->ringBufferSize;
873 #if (defined(SERIAL_PORT_TYPE_UART) && (SERIAL_PORT_TYPE_UART > 0U))
876 #if (defined(SERIAL_MANAGER_NON_BLOCKING_MODE) && (SERIAL_MANAGER_NON_BLOCKING_MODE > 0U))
880 SerialManager_TxCallback, handle);
884 SerialManager_RxCallback, handle);
890 #if (defined(SERIAL_PORT_TYPE_USBCDC) && (SERIAL_PORT_TYPE_USBCDC > 0U))
893 #if (defined(SERIAL_MANAGER_NON_BLOCKING_MODE) && (SERIAL_MANAGER_NON_BLOCKING_MODE > 0U))
897 SerialManager_TxCallback, handle);
901 SerialManager_RxCallback, handle);
907 #if (defined(SERIAL_PORT_TYPE_SWO) && (SERIAL_PORT_TYPE_SWO > 0U))
910 #if (defined(SERIAL_MANAGER_NON_BLOCKING_MODE) && (SERIAL_MANAGER_NON_BLOCKING_MODE > 0U))
914 SerialManager_TxCallback, handle);
919 #if (defined(SERIAL_PORT_TYPE_USBCDC_VIRTUAL) && (SERIAL_PORT_TYPE_USBCDC_VIRTUAL > 0U))
922 #if (defined(SERIAL_MANAGER_NON_BLOCKING_MODE) && (SERIAL_MANAGER_NON_BLOCKING_MODE > 0U))
926 SerialManager_TxCallback, handle);
930 SerialManager_RxCallback, handle);
949 assert(serialHandle);
961 switch (handle->
type)
963 #if (defined(SERIAL_PORT_TYPE_UART) && (SERIAL_PORT_TYPE_UART > 0U))
968 #if (defined(SERIAL_PORT_TYPE_USBCDC) && (SERIAL_PORT_TYPE_USBCDC > 0U))
973 #if (defined(SERIAL_PORT_TYPE_SWO) && (SERIAL_PORT_TYPE_SWO > 0U))
978 #if (defined(SERIAL_PORT_TYPE_USBCDC_VIRTUAL) && (SERIAL_PORT_TYPE_USBCDC_VIRTUAL > 0U))
987 #if (defined(SERIAL_MANAGER_NON_BLOCKING_MODE) && (SERIAL_MANAGER_NON_BLOCKING_MODE > 0U))
989 #if defined(OSA_USED)
991 #if (defined(SERIAL_MANAGER_USE_COMMON_TASK) && (SERIAL_MANAGER_USE_COMMON_TASK > 0U))
993 OSA_EventDestroy((osa_event_handle_t)handle->event);
994 OSA_TaskDestroy((osa_task_handle_t)handle->taskId);
1010 assert(serialHandle);
1011 assert(writeHandle);
1024 #if (defined(SERIAL_MANAGER_NON_BLOCKING_MODE) && (SERIAL_MANAGER_NON_BLOCKING_MODE > 0U))
1037 assert(writeHandle);
1043 #if (defined(SERIAL_MANAGER_NON_BLOCKING_MODE) && (SERIAL_MANAGER_NON_BLOCKING_MODE > 0U))
1047 #if (defined(SERIAL_MANAGER_NON_BLOCKING_MODE) && (SERIAL_MANAGER_NON_BLOCKING_MODE > 0U))
1048 (void)SerialManager_CancelWriting(writeHandle);
1068 assert(serialHandle);
1087 #if (defined(SERIAL_MANAGER_NON_BLOCKING_MODE) && (SERIAL_MANAGER_NON_BLOCKING_MODE > 0U))
1106 #if (defined(SERIAL_MANAGER_NON_BLOCKING_MODE) && (SERIAL_MANAGER_NON_BLOCKING_MODE > 0U))
1110 #if (defined(SERIAL_MANAGER_NON_BLOCKING_MODE) && (SERIAL_MANAGER_NON_BLOCKING_MODE > 0U))
1111 (void)SerialManager_CancelReading(readHandle);
1125 #if (defined(SERIAL_MANAGER_NON_BLOCKING_MODE) && (SERIAL_MANAGER_NON_BLOCKING_MODE > 0U))
1126 return SerialManager_Write(writeHandle, buffer, length, kSerialManager_TransmissionBlocking);
1134 #if (defined(SERIAL_MANAGER_NON_BLOCKING_MODE) && (SERIAL_MANAGER_NON_BLOCKING_MODE > 0U))
1141 #if (defined(SERIAL_MANAGER_NON_BLOCKING_MODE) && (SERIAL_MANAGER_NON_BLOCKING_MODE > 0U))
1146 return SerialManager_Write(writeHandle, buffer, length, kSerialManager_TransmissionNonBlocking);
1158 uint8_t isNotUsed = 0;
1160 assert(writeHandle);
1167 if ((
NULL != serialWriteHandle->transfer.buffer) &&
1168 (kSerialManager_TransmissionBlocking == serialWriteHandle->transfer.mode))
1182 if (0U != isNotUsed)
1184 serialWriteHandle->transfer.soFar = 0;
1187 SerialManager_AddTail(&serialWriteHandle->
serialManagerHandle->completedWriteHandleHead, serialWriteHandle);
1188 #if defined(OSA_USED)
1190 #if (defined(SERIAL_MANAGER_USE_COMMON_TASK) && (SERIAL_MANAGER_USE_COMMON_TASK > 0U))
1206 #if (defined(SERIAL_PORT_TYPE_UART) && (SERIAL_PORT_TYPE_UART > 0U))
1208 (void)Serial_UartCancelWrite(
1212 #if (defined(SERIAL_PORT_TYPE_USBCDC) && (SERIAL_PORT_TYPE_USBCDC > 0U))
1214 (void)Serial_UsbCdcCancelWrite(
1218 #if (defined(SERIAL_PORT_TYPE_SWO) && (SERIAL_PORT_TYPE_SWO > 0U))
1220 (void)Serial_SwoCancelWrite(
1224 #if (defined(SERIAL_PORT_TYPE_USBCDC_VIRTUAL) && (SERIAL_PORT_TYPE_USBCDC_VIRTUAL > 0U))
1226 (void)Serial_UsbCdcVirtualCancelWrite(
1254 if ((
NULL != serialReadHandle->transfer.buffer) &&
1255 (kSerialManager_TransmissionBlocking == serialReadHandle->transfer.mode))
1261 buffer = serialReadHandle->transfer.buffer;
1262 serialReadHandle->transfer.buffer =
NULL;
1263 serialReadHandle->transfer.length = 0;
1265 msg.
length = serialReadHandle->transfer.soFar;
1270 if (
NULL != serialReadHandle->callback)
1281 uint32_t *receivedLength)
1283 assert(receivedLength);
1285 return SerialManager_Read(readHandle, buffer, length, kSerialManager_TransmissionBlocking, receivedLength);
1290 void *callbackParam)
1294 assert(writeHandle);
1300 serialWriteHandle->callbackParam = callbackParam;
1301 serialWriteHandle->callback = callback;
1308 void *callbackParam)
1318 serialReadHandle->callbackParam = callbackParam;
1319 serialReadHandle->callback = callback;
1330 assert(serialHandle);
1334 switch (handle->
type)
1336 #if (defined(SERIAL_PORT_TYPE_UART) && (SERIAL_PORT_TYPE_UART > 0U))
1341 #if (defined(SERIAL_PORT_TYPE_USBCDC) && (SERIAL_PORT_TYPE_USBCDC > 0U))
1345 #if (defined(SERIAL_PORT_TYPE_SWO) && (SERIAL_PORT_TYPE_SWO > 0U))
1349 #if (defined(SERIAL_PORT_TYPE_USBCDC_VIRTUAL) && (SERIAL_PORT_TYPE_USBCDC_VIRTUAL > 0U))
1365 assert(serialHandle);
1369 switch (handle->
type)
1371 #if (defined(SERIAL_PORT_TYPE_UART) && (SERIAL_PORT_TYPE_UART > 0U))
1376 #if (defined(SERIAL_PORT_TYPE_USBCDC) && (SERIAL_PORT_TYPE_USBCDC > 0U))
1380 #if (defined(SERIAL_PORT_TYPE_SWO) && (SERIAL_PORT_TYPE_SWO > 0U))
1384 #if (defined(SERIAL_PORT_TYPE_USBCDC_VIRTUAL) && (SERIAL_PORT_TYPE_USBCDC_VIRTUAL > 0U))