# HG changeset patch # User Mychaela Falconia # Date 1510858805 0 # Node ID 095ffce023d4888950d6fc13363bda12a57f567a # Parent 20ed7a320b12578b0e992a74ffe7a4fed8b47d45 etmsync: l1tmops module compiles and links into fc-tmsync diff -r 20ed7a320b12 -r 095ffce023d4 rvinterf/etmsync/Makefile --- a/rvinterf/etmsync/Makefile Thu Nov 16 18:43:52 2017 +0000 +++ b/rvinterf/etmsync/Makefile Thu Nov 16 19:00:05 2017 +0000 @@ -14,8 +14,8 @@ MEMDUMP_OBJS= connect.o interf.o launchrvif.o memdump.o memops.o -TMSYNC_OBJS= cl_des.o connect.o dispatch.o interf.o launchrvif.o memcmd.o \ - memops.o pirimei.o tmscmdtab.o tmsmain.o +TMSYNC_OBJS= cl_des.o connect.o dispatch.o interf.o l1tmops.o launchrvif.o \ + memcmd.o memops.o pirimei.o tmscmdtab.o tmsmain.o all: ${PROGS} diff -r 20ed7a320b12 -r 095ffce023d4 rvinterf/etmsync/l1tmops.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rvinterf/etmsync/l1tmops.c Thu Nov 16 19:00:05 2017 +0000 @@ -0,0 +1,88 @@ +/* + * In this module we implement the functions that access the L1TM operations + * which we are going to use in fc-tmsync and fc-readcal. + */ + +#include +#include +#include +#include +#include +#include "pktmux.h" +#include "tm3.h" +#include "l1tm.h" +#include "exitcodes.h" + +extern u_char rvi_msg[]; +extern int rvi_msg_len; + +do_tms(arg) +{ + u_char cmdpkt[5]; + + cmdpkt[1] = TM_MODE_SET; + cmdpkt[2] = arg; + cmdpkt[3] = arg >> 8; + etm_pkt_exch(cmdpkt, 3); + if (rvi_msg[3]) { + fprintf(stderr, "target error %u in response to tms\n", + rvi_msg[3]); + exit(ERROR_TARGET); + } + if (rvi_msg_len != 5) { + fprintf(stderr, "target error: tms response wrong length\n"); + exit(ERROR_TARGET); + } + return(0); +} + +do_rfpw(index, value) +{ + u_char cmdpkt[7]; + + cmdpkt[1] = RF_PARAM_WRITE; + cmdpkt[2] = index; + cmdpkt[3] = index >> 8; + cmdpkt[4] = value; + cmdpkt[5] = value >> 8; + etm_pkt_exch(cmdpkt, 5); + if (rvi_msg[3]) { + fprintf(stderr, "target error %u in response to rfpw\n", + rvi_msg[3]); + exit(ERROR_TARGET); + } + if (rvi_msg_len != 6) { + fprintf(stderr, "target error: rfpw response wrong length\n"); + exit(ERROR_TARGET); + } + if (rvi_msg[4] != index) { + fprintf(stderr, "target error: rfpw response wrong index\n"); + exit(ERROR_TARGET); + } + return(0); +} + +do_rftr(index, table, size) + u_char *table; +{ + u_char cmdpkt[4]; + + cmdpkt[1] = RF_TABLE_READ; + cmdpkt[2] = index; + etm_pkt_exch(cmdpkt, 2); + if (rvi_msg[3]) { + fprintf(stderr, "target error %u in response to rftr\n", + rvi_msg[3]); + exit(ERROR_TARGET); + } + if (rvi_msg_len < size + 6) { + fprintf(stderr, "target error: rftr response too short\n"); + exit(ERROR_TARGET); + } + if (rvi_msg[4] != index) { + fprintf(stderr, "target error: rftr response wrong index\n"); + exit(ERROR_TARGET); + } + bcopy(rvi_msg + 5, table, size); + return(0); +}