FreeCalypso > hg > fc-tourmaline
comparison src/cs/drivers/drv_app/sim/sim32.c @ 192:cf882d95c799
.../drv_app/sim/sim32.c: white space fixes
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sat, 30 Jan 2021 07:40:33 +0000 |
parents | b37e6c916df1 |
children |
comparison
equal
deleted
inserted
replaced
191:c1205c437943 | 192:cf882d95c799 |
---|---|
45 volatile SYS_UWORD8 ins; | 45 volatile SYS_UWORD8 ins; |
46 volatile SYS_UWORD8 rx; | 46 volatile SYS_UWORD8 rx; |
47 volatile SYS_UWORD8 nack; | 47 volatile SYS_UWORD8 nack; |
48 volatile SYS_UWORD8 nack1; | 48 volatile SYS_UWORD8 nack1; |
49 | 49 |
50 | |
51 SIM_PORT *p; | 50 SIM_PORT *p; |
52 | 51 |
53 p = &(Sim[0]); | 52 p = &(Sim[0]); |
54 | 53 |
55 p->rxParityErr = 0; | 54 p->rxParityErr = 0; |
61 conf1 = p->conf1; | 60 conf1 = p->conf1; |
62 | 61 |
63 #ifdef SIM_DEBUG_TRACE | 62 #ifdef SIM_DEBUG_TRACE |
64 if ((IQ_FrameCount - SIM_dbg_local_count) > SIM_dbg_tdma_diff) { | 63 if ((IQ_FrameCount - SIM_dbg_local_count) > SIM_dbg_tdma_diff) { |
65 SIM_dbg_tdma_diff = IQ_FrameCount - SIM_dbg_local_count; | 64 SIM_dbg_tdma_diff = IQ_FrameCount - SIM_dbg_local_count; |
66 } | 65 } |
67 SIM_dbg_local_count = IQ_FrameCount; | 66 SIM_dbg_local_count = IQ_FrameCount; |
68 #endif | 67 #endif |
69 | 68 |
70 // Check if reception parity is enable | 69 // Check if reception parity is enable |
71 if (((conf1 & SIM_CONF1_CHKPAR) && ((stat & SIM_DRX_STATRXPAR) != 0))\ | 70 if (((conf1 & SIM_CONF1_CHKPAR) && ((stat & SIM_DRX_STATRXPAR) != 0))\ |
122 p->moderx = 5; | 121 p->moderx = 5; |
123 } | 122 } |
124 } | 123 } |
125 else | 124 else |
126 { | 125 { |
127 if (p->rx_index == p->expected_data) | 126 if (p->rx_index == p->expected_data) |
128 { | 127 { |
129 p->moderx = 5; | 128 p->moderx = 5; |
130 } | 129 } |
131 } | 130 } |
132 break; | 131 break; |
133 | 132 |
134 case 3: //mode reception char by char. reception of proc char | 133 case 3: //mode reception char by char. reception of proc char |
135 if ((rx & p->hw_mask) == ins) | 134 if ((rx & p->hw_mask) == ins) |
145 p->null_received == 1; | 144 p->null_received == 1; |
146 #ifdef SIM_DEBUG_TRACE | 145 #ifdef SIM_DEBUG_TRACE |
147 SIM_dbg_null[1]++; | 146 SIM_dbg_null[1]++; |
148 #endif | 147 #endif |
149 } | 148 } |
150 | |
151 break; | 149 break; |
152 | 150 |
153 case 4: //mode reception char by char. reception of data | 151 case 4: //mode reception char by char. reception of data |
154 p->rbuf[p->rx_index++] = rx; | 152 p->rbuf[p->rx_index++] = rx; |
155 p->moderx = 3; //switch to receive proc char mode | 153 p->moderx = 3; //switch to receive proc char mode |
161 p->moderx = 5; | 159 p->moderx = 5; |
162 } | 160 } |
163 } | 161 } |
164 else | 162 else |
165 { | 163 { |
166 if (p->rx_index == p->expected_data) | 164 if (p->rx_index == p->expected_data) |
167 { | 165 { |
168 p->moderx = 5; | 166 p->moderx = 5; |
169 } | 167 } |
170 } | 168 } |
171 break; | 169 break; |
172 | 170 |
173 case 5: //mode wait for procedure character except NULL | 171 case 5: //mode wait for procedure character except NULL |
174 if ((rx != 0x60) || (p->SWcount != 0)) //treat NULL character only if arriving before SW1 SW2 | 172 if ((rx != 0x60) || (p->SWcount != 0)) //treat NULL character only if arriving before SW1 SW2 |
180 p->null_received = 1; | 178 p->null_received = 1; |
181 #ifdef SIM_DEBUG_TRACE | 179 #ifdef SIM_DEBUG_TRACE |
182 SIM_dbg_null[2]++; | 180 SIM_dbg_null[2]++; |
183 #endif | 181 #endif |
184 } | 182 } |
185 | |
186 | |
187 break; | 183 break; |
188 | 184 |
189 case 6: //give the acknowledge char | 185 case 6: //give the acknowledge char |
190 if (((rx & 0xF0) == 0x60) || ((rx & 0xF0) == 0x90)) | 186 if (((rx & 0xF0) == 0x60) || ((rx & 0xF0) == 0x90)) |
191 { | 187 { |
219 #ifdef SIM_DEBUG_TRACE | 215 #ifdef SIM_DEBUG_TRACE |
220 SIM_dbg_local_count = IQ_FrameCount; | 216 SIM_dbg_local_count = IQ_FrameCount; |
221 #endif | 217 #endif |
222 // check the transmit parity | 218 // check the transmit parity |
223 stat = p->c->stat; | 219 stat = p->c->stat; |
224 | |
225 | 220 |
226 if ((stat & SIM_STAT_TXPAR) || ((p->conf1 & SIM_CONF1_CHKPAR) == 0)) //parity disable | 221 if ((stat & SIM_STAT_TXPAR) || ((p->conf1 & SIM_CONF1_CHKPAR) == 0)) //parity disable |
227 { | 222 { |
228 if (p->xOut != (p->xIn - 1)) //if only one char transmitted (already transmitted) | 223 if (p->xOut != (p->xIn - 1)) //if only one char transmitted (already transmitted) |
229 { //just need to have confirmation of reception | 224 { //just need to have confirmation of reception |
246 else | 241 else |
247 { | 242 { |
248 p->c->tx = *(p->xOut); // transmit same char | 243 p->c->tx = *(p->xOut); // transmit same char |
249 p->txParityErr++; // count number of transmit parity errors | 244 p->txParityErr++; // count number of transmit parity errors |
250 } | 245 } |
251 | |
252 } | 246 } |
253 | 247 |
254 // Handle errors | 248 // Handle errors |
255 if ((it & SIM_IT_ITOV) && !(p->c->maskit & SIM_MASK_OV)) | 249 if ((it & SIM_IT_ITOV) && !(p->c->maskit & SIM_MASK_OV)) |
256 { | 250 { |
257 p->errorSIM = SIM_ERR_OVF; | 251 p->errorSIM = SIM_ERR_OVF; |
258 | |
259 } | 252 } |
260 if ((it & SIM_IT_WT) && !(p->c->maskit & SIM_MASK_WT)) | 253 if ((it & SIM_IT_WT) && !(p->c->maskit & SIM_MASK_WT)) |
261 { | 254 { |
262 p->errorSIM = SIM_ERR_READ; | 255 p->errorSIM = SIM_ERR_READ; |
263 } | 256 } |
308 { | 301 { |
309 (p->RemoveFunc)(); | 302 (p->RemoveFunc)(); |
310 p->errorSIM = SIM_ERR_NOCARD; | 303 p->errorSIM = SIM_ERR_NOCARD; |
311 } | 304 } |
312 } | 305 } |
313 } | 306 } |
314 #endif | 307 #endif |
315 | 308 |
316 | 309 |
317 // to force this module to be linked | 310 // to force this module to be linked |
318 SYS_UWORD16 SIM_Dummy(void) | 311 SYS_UWORD16 SIM_Dummy(void) |