Skip to content

Commit

Permalink
Added PURGE_DATA
Browse files Browse the repository at this point in the history
  • Loading branch information
igittigitt authored Jan 17, 2017
1 parent 0ce029b commit 11d8364
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion serial/serbridge.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 11d8364

Please sign in to comment.