|
4 | 4 | * @ingroup ports
|
5 | 5 | * @cond
|
6 | 6 | ******************************************************************************
|
7 |
| -* Last Updated for Version: 6.5.1 |
8 |
| -* Date of the Last Update: 2019-06-18 |
| 7 | +* Last updated for version 6.9.2 |
| 8 | +* Last updated on 2021-01-14 |
9 | 9 | *
|
10 | 10 | * Q u a n t u m L e a P s
|
11 | 11 | * ------------------------
|
12 | 12 | * Modern Embedded Software
|
13 | 13 | *
|
14 |
| -* Copyright (C) 2005-2019 Quantum Leaps, LLC. All rights reserved. |
| 14 | +* Copyright (C) 2005-2021 Quantum Leaps, LLC. All rights reserved. |
15 | 15 | *
|
16 | 16 | * This program is open source software: you can redistribute it and/or
|
17 | 17 | * modify it under the terms of the GNU General Public License as published
|
|
29 | 29 | * GNU General Public License for more details.
|
30 | 30 | *
|
31 | 31 | * You should have received a copy of the GNU General Public License
|
32 |
| -* along with this program. If not, see <www.gnu.org/licenses/>. |
| 32 | +* along with this program. If not, see <www.gnu.org/licenses>. |
33 | 33 | *
|
34 | 34 | * Contact information:
|
35 | 35 | * <www.state-machine.com/licensing>
|
|
47 | 47 | #define QP_IMPL /* this is QP implementation */
|
48 | 48 | #include "qf_port.h" /* QF port */
|
49 | 49 | #include "qassert.h" /* QP embedded systems-friendly assertions */
|
50 |
| -#include "qs_port.h" /* include QS port */ |
| 50 | +#include "qs_port.h" /* QS port */ |
| 51 | +#include "qs_pkg.h" /* QS package-scope interface */ |
51 | 52 |
|
52 | 53 | #include "safe_std.h" /* portable "safe" <stdio.h>/<string.h> facilities */
|
53 | 54 | #include <stdlib.h>
|
@@ -196,7 +197,7 @@ void QS_onFlush(void) {
|
196 | 197 | QS_CRIT_STAT_
|
197 | 198 |
|
198 | 199 | if (l_sock == INVALID_SOCKET) { /* socket NOT initialized? */
|
199 |
| - FPRINTF_S(stderr, "<TARGET> ERROR invalid TCP socket\n"); |
| 200 | + FPRINTF_S(stderr, "<TARGET> ERROR %s\n", "invalid TCP socket"); |
200 | 201 | return;
|
201 | 202 | }
|
202 | 203 |
|
@@ -253,7 +254,7 @@ void QS_output(void) {
|
253 | 254 | QS_CRIT_STAT_
|
254 | 255 |
|
255 | 256 | if (l_sock == INVALID_SOCKET) { /* socket NOT initialized? */
|
256 |
| - FPRINTF_S(stderr, "<TARGET> ERROR invalid TCP socket\n"); |
| 257 | + FPRINTF_S(stderr, "<TARGET> ERROR %s\n", "invalid TCP socket"); |
257 | 258 | return;
|
258 | 259 | }
|
259 | 260 |
|
@@ -293,20 +294,12 @@ void QS_output(void) {
|
293 | 294 | }
|
294 | 295 | /*..........................................................................*/
|
295 | 296 | void QS_rx_input(void) {
|
296 |
| - uint8_t buf[QS_RX_SIZE]; |
297 |
| - int status = recv(l_sock, (char *)buf, (int)sizeof(buf), 0); |
298 |
| - if (status != SOCKET_ERROR) { /* any data received? */ |
299 |
| - uint8_t *pb; |
300 |
| - int i = (int)QS_rxGetNfree(); |
301 |
| - if (i > status) { |
302 |
| - i = status; |
303 |
| - } |
304 |
| - status -= i; |
305 |
| - /* reorder the received bytes into QS-RX buffer */ |
306 |
| - for (pb = &buf[0]; i > 0; --i, ++pb) { |
307 |
| - QS_RX_PUT(*pb); |
308 |
| - } |
309 |
| - QS_rxParse(); /* parse all n-bytes of data */ |
| 297 | + int status = recv(l_sock, |
| 298 | + (char *)QS_rxPriv_.buf, (int)QS_rxPriv_.end, 0); |
| 299 | + if (status > 0) { /* any data received? */ |
| 300 | + QS_rxPriv_.tail = 0U; |
| 301 | + QS_rxPriv_.head = status; /* # bytes received */ |
| 302 | + QS_rxParse(); /* parse all received bytes */ |
310 | 303 | }
|
311 | 304 | }
|
312 | 305 |
|
0 commit comments