osEepromRead osEepromRead (function)

osEepromRead, osEepromWrite

Reads or writes data in EEPRom


#include <ultra64.h>        /* os.h */
s32 osEepromRead(OSMesgQueue *mq, u8 address, u8 *buffer);
s32 osEepromWrite(OSMesgQueue *mq, u8 address, u8 *buffer);


The function osEepromRead issues a read command to EEPRom and reads 8 bytes of data from an address specified by address. The function osEepromWrite issues a write command to EEPRom and writes 8 bytes of data to an address specified by address.

The size of buffer, which is used for storing the data, must be large enough to hold nbytes of data.Note that address is an EEPROM block address. Since blocks are in units of 8 bytes, you must specify a value that is divisible by 8 for the actual address.

The returned value is 0 if the command is properly sent to the interface circuit. The returned value is -1 if the value of address is not within the proper range. If no EEPROM exists or if the interface circuit does not respond, then the returned value is 8 (CONT_NO_RESPONSE_ERROR).

"mq" is the initialized message queue associated with OS_EVENT_SI events. For details, see the osSetEventMesgfunction in the N64 Online Function Reference Manual. Since mq is used inside the function to wait for messages, the application does not need to use mq to wait for an end-of-function message.

The osEepromRead and osEepromWrite functions can only read and write data of 8 bytes (1 block). To read and write more than 8 bytes, use the osEepromLongRead and osEepromLongWrite functions.

The EEPROM command takes about 15 milliseconds to finish. To avoid a reduction in overall system performance, you need to set up a timer between calls to osEepromRead and osEepromWrite.

See Also

osContInit, osEepromProbe, osEepromLongRead, osEepromLongWrite, and osSetEventMesg

Revision History

1999/02/01 Revised entirely
1999/04/30 Changed format