enCoRe™ V CY7C643xx, enCoRe™ V LV CY7C604xx TRM, Document No. 001-32519 Rev *H
36
Supervisory ROM (SROM)
3.1.2.8
Checksum Function
The Checksum function calculates a 16-bit checksum over a
user specifiable number of blocks, within a single flash bank
starting at block zero. The BLOCKID parameter is used to
pass in the number of blocks to checksum. A BLOCKID
value of '1' calculates the checksum of only block 0, while a
BLOCKID value of '0' calculates the checksum of the entire
flash bank.
The 16-bit checksum is returned in KEY1 and KEY2. The
parameter KEY1 holds the lower 8 bits of the checksum and
the parameter KEY2 holds the upper 8 bits of the checksum.
3.1.2.9
Calibrate0 Function
This function may be executed at any time to set all calibra-
tion values. However, it is unnecessary to call this function; it
is simply documented for completeness. The calibration val-
ues are accessed using the TableRead function, which is
described in the section
TableRead Function, on page 35
.
3.1.2.10
Calibrate1 Function
While the Calibrate1 function is a completely separate func-
tion from Calibrate0, they perform the same task, which is to
transfer the calibration values stored in a special area of
flash to their appropriate registers. What is unique about
Calibrate1 is that it calculates a checksum of the calibration
data and, if that checksum is determined as invalid,
Calibrate1 causes a
hardware reset
by generating an inter-
nal reset. If this occurs, it is indicated by setting the Internal
Reset Status bit (IRESS) in the CPU_SCR1 register.
The Calibrate1 function uses SRAM to calculate a check-
sum of the calibration data. The POINTER value is used to
indicate the address of a 38-byte buffer used by this func-
tion. When the function completes, the 38 bytes are set to
00h.
An
MVI A, [expr]
and an
MVI [expr], A
instruction
are used to move data between SRAM and flash. Therefore,
the
MVI
write pointer (MVW_PP) and the
MVI
read pointer
(MVR_PP) must be specified to the same SRAM page to
control the page of RAM used for the operations.
Calibrate1 was created as a sub-function of SWBootReset
and the Calibrate1 function code was added to provide
direct access. For more information on how Calibrate1
works, see
SWBootReset Function on page 33
.
This function may be executed at any time to reset all cali-
bration values. However, it is unnecessary to call this func-
tion; it is simply documented for completeness. The
calibration values are accessed using the TableRead func-
tion, which is described in the section
3.1.2.11
WriteAndVerify Function
WriteAndVerify is the recommend function for modifying one
block of data in flash. The WriteAndVerify function works
exactly the same as the WriteBlock function except that the
flash data is verified after the Write. The execution time is
about 1 ms longer than WriteBlock (but still within the Twrite
Table 3-14. Flash Tables with Assigned Values
Table
Byte 0
Byte 1
Byte 2
Byte 3
Byte 4
Byte 5
Byte 6
Byte 7
Table 0
Silicon ID High Byte
Expected Numbers =
# Bits Used to Encode =
Max Values (including 0) =
Bits Targeted =
Reserved
Table 1
IMO 6 MHz
trim
IMO 12
MHz trim
IMO 24 MHz trim
IMO 24 MHz
USB trim (high
power)
Reserved
Table 2
Reserved
Table 3
Reserved
Table 3-15. Checksum Parameters (07h)
Name
Address
Type
Description
KEY1
0,F8h
RAM
3Ah.
KEY2
0,F9h
RAM
Stack Pointer value+3, when
SSC
is
executed.
BLOCKID 0,FAh
RAM
Number of flash blocks from which to
calculate the checksum.
Table 3-16. Calibrate0 Parameters (08h)
Name
Address
Type
Description
KEY1
0,F8h
RAM
3Ah.
KEY2
0,F9h
RAM
Stack Pointer value+3, when
SSC
is
executed.
Table 3-17. Calibrate1 Parameters (09h)
Name
Address
Type
Description
KEY1
0,F8h
RAM
3Ah.
KEY2
0,F9h
RAM
Stack Pointer value+3, when
SSC
is
executed.
POINTER
0,FBh
RAM
First of 30 SRAM addresses used by
this function.
MVR_PP
0,D4h
Register
MVI
write page pointer.
MVW_PP
0,D5h
Register
MVI
read page pointer.