Datasheet

I2C Bootloader
Document Number: 001-13258 Rev. *J Page 20 of 39
BootLdrI2C_Poll() and BootLdrI2C_BootLdr_Poll()
Description:
Used when the Communication_ Service_Type parameter is set to Polled. This function gives a user
controlled entry into the I/O processing routine. If Communication_Service_Type parameter is set to
Interrupt, the function does nothing.
C Prototype:
void BootLdrI2C_Poll(void);
void BootLdrI2C_BootLdr_Poll(void);
Assembler:
lcall BootLdrI2C_Poll
lcall BootLdrI2C_BootLdr_Poll
Parameters:
None
Return Value:
None
Side Effects:
One I
2
C event is processed each time this routine is called and status variables are updated. An event
constitutes either an error condition, an I/O byte, or in certain cases, a stop condition. There are three
possible results from calling this routine:
1. No action if no data is available.
2. Reception or transmission of an address or data byte if one is available.
3. Processing of a stop ‘event’ when an external master has completed its write operation. When a stop
state is processed at the end of a write operation, only status variables are updated. If an I
2
C byte is
pending when a stop state is processed, the I2CHW_Poll function must be called again to process it.
The I2CHW_Poll() function has no effect if Communication_Service_Type is set to Interrupt. When a
start/restart condition and an address is detected on the bus the bus is stalled until the I2CHW_Poll()
function is called. If the address is NAK’ed, subsequent bytes transferred for that transaction are
ignored until another start/restart and address is detected. Otherwise, the I
2
C bus is stalled for each
data byte until the I2CHW_Poll() function is called. The I
2
C data is stalled by the I
2
C hardware until
this function is called if the Communication_Service_Type is set to Polled. For received data, the bus
is stalled at the end of the byte and before an ACK/NAK is generated by holding the SCL (clock) line
low. For transmitted data, the bus is stalled immediately after the ACK/NAK bit is generated externally.
These two functions are compatible with the following restrictions: If the Bootloader is active and can
be entered by an external application I
2
C command, the API BootLdrI2C_BootLdr_Poll() must be
used. If an I
2
C address that is not the Bootloader address is detected, this address is tested and
passed on to the foreground I
2
C interrupt process, which also tests the address. If the Bootloader is
inactive, use of the BootLdrI2C_Poll() API does not give the I
2
C address to the internal bootloader
data process routine. The address and subsequent data is instead passed directly to the foreground
routine.