trennfix/sw: Fixed a bit beauty.
[eisenbahn.git] / trennfix / sw / mm / include / mm / mm_switch.h
index 35e14844250997029c2d5f4eb0c258c375e2b45d..561a1129afc091466a131c50bb7672f546aaca7d 100644 (file)
@@ -4,36 +4,29 @@
 #include <stdint.h>
 #include <config/hardware.h>
 
-enum mm_recstate {
-       MM_IDLE = 0,
-       MM_FIRST_FAST_SAMPLE,
-       MM_FIRST_SLOW_SAMPLE, /* If clock arrives, we stay on the fast path! */
-       MM_FAST_SAMPLE,
-       MM_FAST_WAIT_FOR_CLOCK,
-       MM_SLOW_SAMPLE_DELAY,
-       MM_SLOW_SAMPLE,
-       MM_SLOW_WAIT_FOR_CLOCK_DELAY,
-       MM_SLOW_WAIT_FOR_CLOCK,
-};
+#define MM_FLAVOR_DRIVE 0
+#define MM_FLAVOR_SWITCH 1
 
 #ifdef MM_USE_REGISTER_VARS
 
 uint8_t register shift_command  asm("r2");
 uint8_t register shift_function asm("r3");
 uint8_t register shift_address asm("r4");
-uint8_t register recstate asm("r5");
-uint8_t register bitno asm("r6");
-uint8_t register sense_last asm("r8");
-uint8_t register time_h asm("r9");
-uint8_t register time_l asm("r10");
-uint8_t register bit_val asm("r11");
+uint8_t register mm_polarity asm("r5");
+uint8_t register mm_bitno asm("r6");
+uint8_t register mm_last_was_short asm("r8");
+uint8_t register mm_time_h asm("r9");
+uint8_t register mm_time_l asm("r10");
+uint8_t register mm_bit_val asm("r11");
+uint8_t register mm_flavor asm("r14");
 
 static void inline __attribute((unused)) mm_init(void)
 {
-       bitno = 0;
-       recstate = MM_IDLE;
-       time_h = 0;
-       bit_val = 23;
+       mm_bitno = 0;
+       mm_time_h = 0;
+       mm_bit_val = 23;
+       mm_polarity = 1;
+       mm_last_was_short = 0;
 }
 
 #else