chiark / gitweb /
can reprogram santafe
[trains.git] / hostside / nmra-packets.h
index ac18869c1d36250845333f37fb0890bee310dfdf..ea8f33d671c0bb909a3135dc1b0b91370a6daf4d 100644 (file)
@@ -74,6 +74,36 @@ 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;
+})
+NMRA(svc_factoryreset, Anone, {
+  /* Service Mode Instruction for Decoder Factory Reset
+   * RP 9.2.3 E l.279-
+   * (See also Packet Sequence for Physical Register Addressing
+   * RP 9.2.3 E l.166-)
+   */
+  CONST(0x7f, 0x08);
+})
+NMRA(svc_pagepreset, Anone, {
+  /* Service Mode Page Preset Instruction
+   * RP 9.2.3 E l.90-91
+   * used in various packet sequences.
+   */
+  CONST(0x7d, 0x01);
+})
+     
 #undef Aint
 #undef Abitmap
 #undef Abyte