8 #include "DSMAlgo_LD301_2009.hh"
10 void DSMAlgo_LD301_2009::operator()(
DSM& dsm)
84 int bbctac = dsm.channels[1] & 0x1;
85 int bbce = dsm.channels[1] >> 1 & 0x1;
86 int bbcw = dsm.channels[1] >> 2 & 0x1;
87 int bbcmb = bbctac && bbce && bbcw;
89 int bht3 = dsm.channels[3] >> 3 & 0x1;
90 int bht2 = dsm.channels[3] >> 2 & 0x1;
91 int bjp1 = dsm.channels[3] >> 8 & 0x1;
92 int bit1 = ((bht3 && (dsm.registers[8] & 0x1)) ||
93 (bht2 && bjp1 && (dsm.registers[8] & 0x2)) ||
94 (bht2 && bbcmb && (dsm.registers[8] & 0x4)));
96 int jp2 = dsm.channels[3] >> 7 & 0x1;
97 int ajp = dsm.channels[3] >> 12 & 0x1;
98 int eht4 = dsm.channels[3] >> 5 & 0x1;
99 int eht2 = dsm.channels[3] >> 4 & 0x1;
100 int ejp1 = dsm.channels[3] >> 10 & 0x1;
101 int bit2 = ((jp2 && (dsm.registers[9] & 0x1)) ||
102 (ajp && (dsm.registers[9] & 0x2)) ||
103 (eht4 && (dsm.registers[9] & 0x4)) ||
104 (eht2 && ejp1 && (dsm.registers[9] & 0x8)));
107 switch (dsm.channels[3] & 0x7) {
108 case 1: bht = 1;
break;
109 case 3: bht = 2;
break;
110 case 7: bht = 3;
break;
113 int jp1 = dsm.channels[3] >> 6 & 0x1;
114 int overlap_jp1 = jp1 && !(bjp1 || ejp1);
115 int jp1_selected = ((jp1 && (dsm.registers[10] & 0x1)) ||
116 (bjp1 && (dsm.registers[10] & 0x2)) ||
117 (ejp1 && (dsm.registers[10] & 0x4)) ||
118 (overlap_jp1 && (dsm.registers[10] & 0x8)));
120 int status = dsm.channels[4] >> 8 & 0xff;
121 int bbcdetlive = (((status & dsm.registers[6]) | ~dsm.registers[6]) & 0xff) == 0xff;
122 int bbcmblive = bbcmb && bbcdetlive;
123 int bbcpre = dsm.registers[0] | dsm.registers[1] << 12;
124 if (bbcmblive) --bbcpre;
125 int bbcmblivepre = bbcpre == 1;
127 int vpdtac = dsm.channels[1] >> 13 & 0x1;
128 int vpde = dsm.channels[1] >> 14 & 0x1;
129 int vpdw = dsm.channels[1] >> 15 & 0x1;
130 int vpdmb = vpdtac && vpde && vpdw;
131 int vpddetlive = (((status & dsm.registers[7]) | ~dsm.registers[7]) & 0xff) == 0xff;
132 int vpdmblive = vpdmb && vpddetlive;
133 int vpdpre = dsm.registers[2] | dsm.registers[3] << 12;
134 if (vpdmblive) --vpdpre;
135 int vpdmblivepre = vpdpre == 1;
137 int zdctac = dsm.channels[1] >> 6 & 0x1;
138 int zdce = dsm.channels[1] >> 7 & 0x1;
139 int zdcw = dsm.channels[1] >> 8 & 0x1;
140 int zdcmb = zdctac && zdce && zdcw;
142 int zdcefront = dsm.channels[1] >> 9 & 0x1;
143 int zdceback = dsm.channels[1] >> 10 & 0x1;
144 int zdcwfront = dsm.channels[1] >> 11 & 0x1;
145 int zdcwback = dsm.channels[1] >> 12 & 0x1;
146 int zdcpole = bbce && bbcw && zdcefront && zdceback;
147 int zdcpolw = bbce && bbcw && zdcwfront && zdcwback;
148 int zdcpol = zdcpole || zdcpolw;
150 int mtd = dsm.channels[0] & 0x1;
152 int fmssmall1 = dsm.channels[5] >> 1 & 0x1;
153 int fmslarge1 = dsm.channels[5] >> 8 & 0x1;
154 int fmssmall2 = dsm.channels[5] >> 2 & 0x1;
155 int fmslarge2 = dsm.channels[5] >> 9 & 0x1;
156 int fmsfast = fmssmall1 && fmslarge1;
157 int fmsslow = fmssmall2 && fmslarge2;
158 int fmsled = dsm.channels[4] & 0x1;
159 int fpe = dsm.channels[5] >> 14 & 0x1;
160 int fmsledfpe = fmsled || fpe;
162 int zerobias = dsm.channels[6] >> 14 & 0x1;
191 out |= jp1_selected << 6;
192 out |= bbcmblivepre << 7;
193 out |= vpdmblivepre << 8;
197 out |= fmsfast << 12;
198 out |= fmsslow << 13;
199 out |= fmsledfpe << 14;
200 out |= zerobias << 15;