Added PURGE_DATA

pull/249/head
Oliver 8 years ago committed by GitHub
parent 0ce029b16a
commit 11d8364164
  1. 13
      serial/serbridge.c

@ -44,6 +44,8 @@ serbridgeConnData connData[MAX_CONN];
#define SetDataSize 2 // Set data size
#define SetParity 3 // Set parity
#define SetControl 5 // Set control lines
#define PurgeData 12 // Flush FIFO buffer(s)
#define PURGE_TX 2
#define BRK_REQ 4 // request current BREAK state
#define BRK_ON 5 // set BREAK (TX-line to LOW)
#define BRK_OFF 6 // reset BREAK
@ -54,7 +56,7 @@ serbridgeConnData connData[MAX_CONN];
// telnet state machine states
enum { TN_normal, TN_iac, TN_will, TN_start, TN_end, TN_comPort, TN_setControl, TN_setBaud,
TN_setDataSize, TN_setParity };
TN_setDataSize, TN_setParity, TN_purgeData };
static char tn_baudCnt;
static uint32_t tn_baud; // shared across all sockets, thus possible race condition
static uint8_t tn_break = 0; // 0=BREAK-OFF, 1=BREAK-ON
@ -114,9 +116,18 @@ telnetUnwrap(serbridgeConnData *conn, uint8_t *inBuf, int len)
case SetDataSize: state = TN_setDataSize; break;
case SetParity: state = TN_setParity; break;
case SetBaud: state = TN_setBaud; tn_baudCnt = 0; tn_baud = 0; break;
case PrugeData: state = TN_purgeData; break;
default: state = TN_end; break;
}
break;
case TN_purgeData: // purge FIFO-buffers
switch (c) {
case PURGE_TX:
// TODO: flush TX buffer
break;
}
state = TN_end;
break;
case TN_setControl: // switch control line and delay a tad
switch (c) {
case DTR_ON:

Loading…
Cancel
Save