Commit 4f87753d authored by Alessandro Rubini's avatar Alessandro Rubini

tests/measure_t24p.c: shrink stack use by 128 bytes

Calibration uses a lot of internal variables, and it used to overflow
even a 3kB stack (by a little amount). This patch shares a temporary
buffer between two functions, so it takes 128 bytes less of stack, and
3kB fit for the wr-nic release.

The problem must still be studied, to reduce stack use.
Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
parent 8925e7d8
......@@ -40,10 +40,11 @@ struct meas_entry {
int ahead;
};
static void purge_socket(wr_socket_t * sock)
static void purge_socket(wr_socket_t *sock, char *buf)
{
wr_sockaddr_t from;
char buf[128];
update_rx_queues();
while (ptpd_netif_recvfrom(sock, &from, buf, 128, NULL) > 0)
update_rx_queues();
......@@ -61,7 +62,7 @@ static int meas_phase_range(wr_socket_t * sock, int phase_min, int phase_max,
while (spll_shifter_busy(0)) ;
purge_socket(sock);
purge_socket(sock, buf);
i = 0;
while (setpoint <= phase_max) {
......@@ -93,7 +94,7 @@ static int meas_phase_range(wr_socket_t * sock, int phase_min, int phase_max,
setpoint += phase_step;
spll_set_phase_shift(0, setpoint);
while (spll_shifter_busy(0)) ;
purge_socket(sock);
purge_socket(sock, buf);
ts_sync.correct = 0;
i++;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment