38
Rabbit
2000
Microprocessor
_WriteFlash
This
function writes exactly one sector of data from a buffer in RAM to the flash mem-
ory.
It is called from the BIOS as well as several libraries, and should be written to con-
form
to the following requirements:
•
It
should assume that the source data is located at the logical RAM address passed in
HL
.
•
It
should assume that the flash address to be written to is passed as an XMEM address
in
A:DE
.
The destination must be aligned with a flash memory sector boundary.
•
It
should check to see whether the sector being written to is an ID block. If so, it should
exit
with an error code (see below). Otherwise, it should perform the actual write oper-
ation
required by the particular flash used.
•
Interrupts
should be turned off (set the interrupt level to 3) whenever writes are occur-
ring
to the flash. Interrupts should not be turned back on until the write is complete --
an
interrupt may attempt to access a function in flash while the write is occurring and
fail.
•
It
should not return until the write operation is finished on the chip.
•
It
should return a zero in
HL
if the operation was successful, a -3 if a timeout occurred
during
the wait, or a -4 if an attempt was made to write over the ID block.
Modifications
to Dyncamic C are pending to allow use of large sector (>4096) flashes in
debugging.
To incorporate a large sectored flash into an end product, the best strategy is
have
a small sectored development board.
Summary of Contents for 2000
Page 1: ...Rabbit 2000 Microprocessor Designers Handbook Revision C...
Page 4: ...Rabbit 2000 Microprocessor...
Page 6: ...2 Rabbit 2000 Microprocesssor...
Page 12: ...8 Rabbit 2000 Microprocessor...
Page 34: ...344 Dynamic C User s Manual...
Page 36: ...34 Rabbit 2000 Microprocessor...
Page 44: ...42 Rabbit 2000 Microprocessor...