From 3bf683fcddd3e4044606e2c7b7ebfb4501b47130 Mon Sep 17 00:00:00 2001 From: ian Date: Fri, 13 Jan 2006 22:11:36 +0000 Subject: [PATCH] attempt at service mode --- hostside/README | 1 + hostside/nmra-packets.h | 15 +++++++++++++++ hostside/program-cv-svc | 28 ++++++++++++++++++++++++++++ 3 files changed, 44 insertions(+) create mode 100755 hostside/program-cv-svc diff --git a/hostside/README b/hostside/README index 2c504bd..bf67f48 100644 --- a/hostside/README +++ b/hostside/README @@ -7,6 +7,7 @@ -w usleep; 0 = no usleep; default is -1 = don't repeat at all -i default is 0 = infinite; -1 means don't repeat *** the above seems wrong; -1 seems to mean infinite + *** and 0 means once ?! -f usleep; each character; default is 0 = no usleep Eg, diff --git a/hostside/nmra-packets.h b/hostside/nmra-packets.h index ac18869..6f35abb 100644 --- a/hostside/nmra-packets.h +++ b/hostside/nmra-packets.h @@ -74,6 +74,21 @@ NMRA(cvwrite, Aint(addr,0) Aint(cv,1) Abyte(value,2), { *c++= value; }) +/* + * Service mode. + */ +NMRA(svc_cvwrite, Aint(cv,0) Abyte(value,1), { + /* Service Mode Instruction for Direct Mode, Write Byte + * RP 9.2.3 E l.107- + */ + int adj; + nmra_errchk(cn, cv, cv>=1 && cv<=1024); + adj= cv - 1; + *c++= 0x7c | (adj >> 8); + *c++= adj; + *c++= value; +}) + #undef Aint #undef Abitmap #undef Abyte diff --git a/hostside/program-cv-svc b/hostside/program-cv-svc new file mode 100755 index 0000000..0e2f631 --- /dev/null +++ b/hostside/program-cv-svc @@ -0,0 +1,28 @@ +#!/bin/sh + +set -e + +if [ $# != 3 ]; then cat >&2 <