view autocal/l1meas.c @ 47:e86779d5445c

autocal: preparations for receiving auto stats and rfe completion
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 27 May 2017 06:46:17 +0000
parents 98abe6bd2042
children 201f27bd8dca
line wrap: on
line source

/*
 * In this module we are going to implement the functions for making
 * measurements on the DUT via L1TM.
 */

#include <sys/types.h>
#include <stdio.h>
#include <stdlib.h>
#include <rvinterf/pktmux.h>
#include <rvinterf/tm3.h>
#include <rvinterf/l1tm.h>
#include <rvinterf/exitcodes.h>

extern u_char rvi_msg[];
extern int rvi_msg_len;

do_scw(index, value)
{
	u_char cmdpkt[7];

	cmdpkt[1] = STATS_CONFIG_WRITE;
	cmdpkt[2] = index;
	cmdpkt[3] = index >> 8;
	cmdpkt[4] = value;
	cmdpkt[5] = value >> 8;
	l1tm_pkt_exch(cmdpkt, 5);
	if (rvi_msg[3]) {
		fprintf(stderr, "DUT error %u in response to scw\n",
			rvi_msg[3]);
		exit(ERROR_TARGET);
	}
	if (rvi_msg_len != 6) {
		fprintf(stderr, "DUT error: scw response wrong length\n");
		exit(ERROR_TARGET);
	}
	if (rvi_msg[4] != index) {
		fprintf(stderr, "DUT error: scw response wrong index\n");
		exit(ERROR_TARGET);
	}
	return(0);
}