FreeCalypso > hg > fc-tourmaline
diff src/cs/drivers/drv_app/sim/sim32.c @ 189:b37e6c916df1
../drv_app/sim/*: rm trailing white space
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sat, 30 Jan 2021 06:34:22 +0000 |
parents | 4e78acac3d88 |
children | cf882d95c799 |
line wrap: on
line diff
--- a/src/cs/drivers/drv_app/sim/sim32.c Tue Jan 19 06:10:27 2021 +0000 +++ b/src/cs/drivers/drv_app/sim/sim32.c Sat Jan 30 06:34:22 2021 +0000 @@ -15,7 +15,7 @@ #include "main/sys_types.h" #include <assert.h> -#include "inth/iq.h" +#include "inth/iq.h" #include "sim.h" @@ -33,8 +33,8 @@ /* * SIM_IntHandler * - * Read cause of SIM interrupt : - * + * Read cause of SIM interrupt : + * * if receive buffer full, read char * if transmitter empty, change direction, transmit a dummy char * @@ -42,17 +42,17 @@ void SIM_IntHandler(void) { volatile unsigned short it, i, stat, conf1; - volatile SYS_UWORD8 ins; + volatile SYS_UWORD8 ins; volatile SYS_UWORD8 rx; volatile SYS_UWORD8 nack; volatile SYS_UWORD8 nack1; - + SIM_PORT *p; p = &(Sim[0]); - p->rxParityErr = 0; + p->rxParityErr = 0; it = p->c->it; if ((it & SIM_IT_ITRX) && !(p->c->maskit & SIM_MASK_RX)) // int on reception @@ -74,21 +74,21 @@ rx = (SYS_UWORD8) (stat & 0x00FF); ins = p->xbuf[1] & p->hw_mask; nack = (~p->xbuf[1]) & p->hw_mask; - + switch (p->moderx) { case 0: //mode of normal reception without proc char (like PTS proc) p->rbuf[p->rx_index++] = rx; - break; + break; case 1: //mode wait for ACK if ((rx & p->hw_mask) == ins) { p->moderx = 2; - } + } else if ((rx & p->hw_mask) == nack) { - p->moderx = 4; + p->moderx = 4; } else if (((rx & 0xF0) == 0x60) || ((rx & 0xF0) == 0x90)) { @@ -108,9 +108,9 @@ else { p->errorSIM = SIM_ERR_ABNORMAL_CASE2; - } + } //if rx = 0x60 wait for ACK - break; + break; case 2: //mode reception by block p->rbuf[p->rx_index++] = rx; @@ -121,38 +121,38 @@ { p->moderx = 5; } - } + } else - { + { if (p->rx_index == p->expected_data) { p->moderx = 5; } } - break; - + break; + case 3: //mode reception char by char. reception of proc char if ((rx & p->hw_mask) == ins) { p->moderx = 2; - } + } else if ((rx & p->hw_mask) == nack) { - p->moderx = 4; - } //if rx = 0x60 wait for ACK + p->moderx = 4; + } //if rx = 0x60 wait for ACK else if (rx == 0x60) { p->null_received == 1; #ifdef SIM_DEBUG_TRACE SIM_dbg_null[1]++; #endif - } - + } + break; case 4: //mode reception char by char. reception of data p->rbuf[p->rx_index++] = rx; - p->moderx = 3; //switch to receive proc char mode + p->moderx = 3; //switch to receive proc char mode if(p->expected_data == 256) { @@ -162,14 +162,14 @@ } } else - { + { if (p->rx_index == p->expected_data) { p->moderx = 5; } } break; - + case 5: //mode wait for procedure character except NULL if ((rx != 0x60) || (p->SWcount != 0)) //treat NULL character only if arriving before SW1 SW2 { @@ -185,7 +185,7 @@ break; - + case 6: //give the acknowledge char if (((rx & 0xF0) == 0x60) || ((rx & 0xF0) == 0x90)) { @@ -203,7 +203,7 @@ } } else - { + { p->ack = rx; } } @@ -235,18 +235,18 @@ p->conf1 &= ~SIM_CONF1_TXRX; // return the direction p->c->conf1 = p->conf1; } - + if (p->xOut < (p->xIn - 2)) { p->xOut++; p->c->tx = *(p->xOut); // transmit - } - } + } + } } else { p->c->tx = *(p->xOut); // transmit same char - p->txParityErr++; // count number of transmit parity errors + p->txParityErr++; // count number of transmit parity errors } } @@ -255,7 +255,7 @@ if ((it & SIM_IT_ITOV) && !(p->c->maskit & SIM_MASK_OV)) { p->errorSIM = SIM_ERR_OVF; - + } if ((it & SIM_IT_WT) && !(p->c->maskit & SIM_MASK_WT)) { @@ -287,8 +287,8 @@ /* * SIM_CD_IntHandler * - * Read cause of SIM interrupt : - * + * Read cause of SIM interrupt : + * */ void SIM_CD_IntHandler(void) { @@ -297,7 +297,7 @@ p = &(Sim[0]); - p->rxParityErr = 0; + p->rxParityErr = 0; it_cd = p->c->it_cd; // SIM card insertion / extraction @@ -317,5 +317,5 @@ // to force this module to be linked SYS_UWORD16 SIM_Dummy(void) { - + }