Legacy-Free Keyboard/Embedded Controller with SPI and LPC Docking Interface
8.6.1.1
CSIWRITE Function
The CSIWRITE function uses the 8051 Program Access registers to write to the CSI Host interface
(Figure 8.9). For information regarding how to activate the 8051 Program Access Interface see Section
9.2, "Flash Program Interface Decoder".
The CSIWRITE function requires two parameters ‘address’ and ‘data’, although the address argument
is not relevant during CSI Command Code cycles. Note that the address register arguments are
initialized before the data register transaction occurs.
// Declarations
HIGH_ADDR_REG = 0x7FB0;
LOW_ADDR_REG = 0x7FB1;
DATA_REG = 0x7FB2;
// 16-bit High Addr. register MMCR Address.
// 16-bit Low Addr. register MMCR Address.
// 16-bit Data register MMCR Address.
// Executable Code
void CSIWRITE(int address, int data)
{
// Load Address Registers First.
// Load High Address Register.
outportb(HIGH_ADDR_REG,
((address >> 8) & 0xFF));
outportb(LOW_ADDR_REG, (address & 0xFF));
outportb(DATA_REG, (data & 0xff));
// Load Low Address Register.
// Write Data Register Last.
};
Figure 8.9 CSIWRITE Command Function
CSIREAD Function
8.6.1.2
The CSIREAD function uses the 8051 Program Access registers to read to the CSI Host interface
(Figure 8.10). For information regarding how to activate the 8051 Program Access Interface, see Section
9.2, "Flash Program Interface Decoder".
The CSIREAD function requires one parameter ‘address’ and returns the read data value. Note that
the address parameter is not relevant during CSI Status Register read cycles.
// Declarations
HIGH_ADDR_REG = 0x7FB0;
LOW_ADDR_REG = 0x7FB1;
DATA_REG = 0x7FB2;
// 16-bit High Addr. register MMCR Address.
// 16-bit Low Addr. register MMCR Address.
// 16-bit Data register MMCR Address.
// Executable Code
int CSIREAD(int address)
{
// Load Address Registers First.
// Load High Address Register.
outportb(HIGH_ADDR_REG,
((address >> 8) & 0xFF));
outportb(LOW_ADDR_REG, (address & 0xFF));
return (inportb(DATA_REG));
// Load Low Address Register.
// Read and Return Data Register Value.
};
Figure 8.10 CSIREAD Command Function
NO_ERRORS_&_BUSY Function
8.6.1.3
The NO_ERRORS_&_BUSY function (Figure 8.11) is used in a ‘while’ loop in Figure 8.12 and
Figure 8.13 to check the CSI status register during byte program and page erase operations.
Note: The NO_ERRORS_&_BUSY function can only be used when the CSI Host interface is in the
Read Status (Idle) state (see Section 8.3.7.6, "Read Status (Idle) Mode").
The NO_ERRORS_&_BUSY function requires one parameter ‘errors’ and returns TRUE when there are
no errors and the BUSY bit is asserted or FALSE when errors have occurred or the BUSY bit is
deasserted. The ‘errors’ parameter is an integer pointer for the CSI Status register error flags.
Revision 1.1 (01-14-03)
104
SMSC LPC47N350
DATASHEET