MCPcopy Create free account
hub / github.com/Hamlib/Hamlib / tcflush

Function tcflush

lib/termios.c:2961–3043  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2959----------------------------------------------------------*/
2960
2961int tcflush(int fd, int queue_selector)
2962{
2963 struct termios_list *index;
2964 int old_flag;
2965
2966 ENTER("tcflush");
2967
2968 index = win32_serial_find_port(fd);
2969
2970 if (!index)
2971 {
2972 LEAVE("tclflush");
2973 return (-1);
2974 }
2975
2976 old_flag = index->event_flag;
2977 /*
2978 index->event_flag &= ~EV_TXEMPTY;
2979 SetCommMask( index->hComm, index->event_flag );
2980 index->tx_happened = 1;
2981 */
2982
2983 index->tx_happened = 1;
2984
2985 switch (queue_selector)
2986 {
2987 case TCIFLUSH:
2988 if (!PurgeComm(index->hComm, PURGE_RXABORT | PURGE_RXCLEAR))
2989 {
2990 goto fail;
2991 }
2992
2993 break;
2994
2995 case TCOFLUSH:
2996 if (!PurgeComm(index->hComm, PURGE_TXABORT | PURGE_TXCLEAR))
2997 {
2998 goto fail;
2999 }
3000
3001 break;
3002
3003 case TCIOFLUSH:
3004 if (!PurgeComm(index->hComm, PURGE_TXABORT | PURGE_TXCLEAR))
3005 {
3006 goto fail;
3007 }
3008
3009 if (!PurgeComm(index->hComm, PURGE_RXABORT | PURGE_RXCLEAR))
3010 {
3011 goto fail;
3012 }
3013
3014 break;
3015
3016 default:
3017 /*
3018 set_errno( ENOTSUP );

Callers 3

serial_setupFunction · 0.85
serial_flushFunction · 0.85
finddevicesFunction · 0.85

Calls 2

win32_serial_find_portFunction · 0.85
set_errnoFunction · 0.85

Tested by

no test coverage detected