|
STX104 Reference Manual
|
/***************************************************************** / SET BANK 8254/INDEXED-ARRAY / / Call this function when changing from one bank to another. Recommend only / changing the bank when one read/writes to the 8254, since that is likely to / be read/written to the least amount compared to the indexed register array. / / Alternatively, one could check the RB bit each time an indexed register / is read or written; it will then take longer on average to read/write registers. */ void STX104_Set_Bank( int board, char bank ) { unsigned char scratch; unsigned char value; unsigned int address; address = stx104_base_address[board] + STX104_ADC_CONFIGURATION; scratch = inp( address ); if ( bank == 0 ) /* request banking to the 8254 */ { /* test for RB bit in ADC configuration register */ if ( (scratch & 0x80) == 0x80 ) { scratch = scratch & 0x0F; value = scratch | 0x30; outp( address, value ); value = scratch | 0x30; outp( address, value ); value = scratch | 0xB0; outp( address, value ); value = scratch | 0xA0; outp( address, value ); } } else { /* request banking to the indexed register array */ if ( (scratch & 0x80) == 0 ) { scratch = scratch & 0x0F; value = scratch | 0xF0; outp( address, value ); value = scratch | 0xF0; outp( address, value ); value = scratch | 0x50; outp( address, value ); value = scratch | 0xD0; outp( address, value ); } } }