chiark / gitweb /
can reprogram santafe
[trains.git] / hostside / nmra-packets.h
index 480dac82add8a621b889307896119ab344827c6a..ea8f33d671c0bb909a3135dc1b0b91370a6daf4d 100644 (file)
@@ -34,6 +34,10 @@ NMRA(estop, Anone, {
   /* Baseline Broadcast stop Forwards(I) Emergency S9.2 B l.98- */
   CONST(0x00, 0x71);
 })
+NMRA(bstop, Anone, {
+  /* Baseline Broadcast stop Forwards(I) non-Emergency S9.2 B l.98- */
+  CONST(0x00, 0x70);
+})
 NMRA(reset, Anone, {
   /* Baseline Decoder Reset S9.2 B l.77- */
   CONST(0x00, 0x00);
@@ -70,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