FreeCalypso > hg > fc-rfcal-tools
changeset 29:d6ef94518117
autocal/l1tmops.c: rftw and me implemented
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Mon, 22 May 2017 23:50:32 +0000 |
parents | ba4b6877e227 |
children | 4cd55371d3e4 |
files | autocal/l1tmops.c |
diffstat | 1 files changed, 51 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/autocal/l1tmops.c Mon May 22 23:36:14 2017 +0000 +++ b/autocal/l1tmops.c Mon May 22 23:50:32 2017 +0000 @@ -6,6 +6,8 @@ #include <sys/types.h> #include <stdio.h> #include <stdlib.h> +#include <string.h> +#include <strings.h> #include <rvinterf/pktmux.h> #include <rvinterf/tm3.h> #include <rvinterf/l1tm.h> @@ -161,3 +163,52 @@ } return(0); } + +do_rftw(index, table, size) + u_char *table; +{ + u_char cmdpkt[MAX_RF_TABLE_SIZE + 4]; + + cmdpkt[1] = RF_TABLE_WRITE; + cmdpkt[2] = index; + bcopy(table, cmdpkt + 3, size); + l1tm_pkt_exch(cmdpkt, size + 2); + if (rvi_msg[3]) { + fprintf(stderr, "DUT error %u in response to rftw\n", + rvi_msg[3]); + exit(ERROR_TARGET); + } + if (rvi_msg_len != 6) { + fprintf(stderr, "DUT error: rftw response wrong length\n"); + exit(ERROR_TARGET); + } + if (rvi_msg[4] != index) { + fprintf(stderr, "DUT error: rftw response wrong index\n"); + exit(ERROR_TARGET); + } + return(0); +} + +misc_enable(arg) +{ + u_char cmdpkt[5]; + + cmdpkt[1] = MISC_ENABLE; + cmdpkt[2] = arg; + cmdpkt[3] = arg >> 8; + l1tm_pkt_exch(cmdpkt, 3); + if (rvi_msg[3]) { + fprintf(stderr, "DUT error %u in response to me\n", + rvi_msg[3]); + exit(ERROR_TARGET); + } + if (rvi_msg_len != 6) { + fprintf(stderr, "DUT error: me response wrong length\n"); + exit(ERROR_TARGET); + } + if (rvi_msg[4] != arg) { + fprintf(stderr, "DUT error: me response wrong index\n"); + exit(ERROR_TARGET); + } + return(0); +}