• No results found

Function $34: data registers

In document RMI4 Intrfacing Guide.pdf (Page 104-108)

10. FUNCTION $34: FLASH MEMORY MANAGEMENT

10.3. Function $34: data registers

Function $34’s data registers specify block numbers, report block data, and control all aspects of flash update operations.

Name 7 6 5 4 3 2 1 0

F34_Flash_Data0 BlockNum 7:0

F34_Flash_Data1 BlockNum 15:8

F34_Flash_Data2.* Block Data

F34_Flash_Data3 Program

Enabled Flash Status Flash Command

Figure 72. Function $34 data registers

10.3.1. F34_Flash_Data0,1: Block Number registers

The Block Number registers are used to specify which Flash Block is accessed by flash commands. These registers should be written with a block number prior to issuing any of the following commands:

• Read Firmware Block

• Write Firmware Block

• Read Configuration Block

• Write Configuration Block

The Block Number registers automatically increment after each operation.

10.3.2. F34_Flash_Data2.*: Block Data registers

The Block Data registers are used to read or write the data for a block. F34_Flash_Data2 is a replicated register (see section 2.3.6 for a definition of these registers). Each implementation has at least one of these registers, but the exact count is implementation-specific. The value obtained from the

F34_Flash_Query3,4 ‘block size’ registers represents the exact number of F34_Flash_Data2 registers (number of registers = n, where n is Block Size).

The Block Data registers must be written with data prior to a block write operation. At the completion of a block read operation, the Block Data registers contain the results of the read operation.

Prior to executing an Erase All, Erase Configuration or Enable Flash Programming operation, the first two registers must be written with the Bootloader ID, which acts as a key to enable the operation.

10.3.3. F34_Flash_Data3: Flash control/status register

This register is used to control all aspects of flash update operation.

Name 7 6 5 4 3 2 1 0

F34_Flash_Data3 Program

Enabled Flash Status Flash Command

Figure 73. Function $34 control/status register

Copyright © 2007–2011 Synaptics Incorporated. All Rights Reserved. 105

Flash Command (F34_Flash_Data3, bits 3:0)

When this field is written the requested operation is performed. This field is not writable while the previous operation is still in progress – this field is only writable when the current value is $0.

When a requested operation is completed this field is set back to $0 by the device and a Function $34 interrupt is asserted. All commands that can be used to read, erase, or

program the flash can only be issued when the device is in a ‘Flash Programming Enabled’

state.

Table 5. Function $34 Flash command values

Value Meaning Available in UI

Mode?

There are no Function $34 commands in process and the device is ready to receive a Function $34 command.

Flash Command $01: Reserved.

Flash Command $02: Write Firmware Block.

This command is issued after a Block Number is written to the Block Number registers and the data block is written to the Block Data registers. This command actually writes the block into the UI Firmware space. The UI Firmware space must have first been erased with command $03 prior to writing the firmware blocks. An attempt to write to a non-erased firmware block will result in an error 5 – “Block Not Erased”.

Flash Command $03: Erase All.

This command clears both the UI Firmware space and the Configuration space. Use it before programming (writing) the new image with command $02. Because an existing configuration is likely invalid for a new firmware revision, this command also clears the configuration area, which should be programmed with the new configuration associated with the new firmware revision.

Important: Prior to executing this command, the host must write the Bootloader ID to the Block Data registers as a “key value” to reduce the possibility of an accidental erasure.

106 Copyright © 2007–2011 Synaptics Incorporated. All Rights Reserved.

Flash Command $04: Write Lockdown Block.

This command writes the lockdown blocks. It is anticipated that the number of blocks to be written to lock a device down will be very small (about three blocks in total). The number of blocks is defined by the image file itself. For information about the RMI4 image file, see the RMI4 Bootloader Procedures application note (PN: 506-000221-01).

This command is only processed if the Unlocked bit is in the ‘1’ (unlocked) state. The lockdown information can’t be erased once it is written. The lockdown operation is a one-time affair. The changes caused by the lockdown operation will not take effect until the device is either reset or an ‘Enable Flash Programming’ command is issued.

The actual lockdown operation is performed after the final lockdown block is written and before the status code is returned. Lockdown blocks written before the final lockdown block may report “success” as they buffer the lockdown information.

When the final block is written, the device will report the overall success or failure based on the following table:

Table 6

State Result code

Unlocked, and lockdown data is valid 0 (“Success”)

Unlocked, but lockdown data is invalid 2 (“Flash Programming Not Enabled / Bad Command”)

Unlocked, but block number is invalid 3 (“Invalid Block Number”) Locked, and block number is valid 4 (“Block Not Erased”) Locked, but block number is not valid 3 (“Invalid Block Number”) The response depends on the bootloader’s current lockdown state when it receives the command, and the state of the block number and the lockdown data itself.

Flash Command $05: Read Configuration Block.

This command reads a block of data from the configuration space and places it into the Block Data registers to be read by the host. This command is issued after a block number is written to the Block Number register. After the command has completed, the block read data is available to be read from the Block Data registers.

Flash Command $06: Write Configuration Block.

This command is issued after a block number is written to the Block Number register and the data block is written to the Block Data registers. This command actually writes the block into the Configuration space.

The Configuration space must have first been erased with command $07 prior to writing the firmware blocks. An attempt to write to a non-erased configuration block will result in an error 5 – “Block Not Erased”.

Copyright © 2007–2011 Synaptics Incorporated. All Rights Reserved. 107

Flash Command $07: Erase Configuration.

This command clears the Configuration space. It should be used prior to programming (writing) the new configuration, one block at a time, with command $06.

Important: Prior to executing this command, the host must write the Bootloader ID to the Block Data registers as a “key value” to reduce the possibility of an accidental erasure.

Flash Command $0F: Enable Flash Programming.

The Enable Flash Programming command is used to initiate flash programming operations.

Prior to the execution of this command the only Function $34 registers that are functional are the query registers and the command register in which only this command is supported.

As a side-effect of this command, the Function $01 Interrupt Enable (F01_RMI_Ctrl1) register is forced to disable all interrupts except for the Function $34 interrupt, which is forced enabled.

When flash programming is complete, the host must issue an RMI Reset command to put the device back into normal operating mode.

Important: Prior to executing this command, the host must write the Bootloader ID to the Block Data registers as a “key value” to reduce the possibility of accidentally entering Flash Programming mode.

Attempts to execute this command when Flash Programming mode is already enabled are treated as a no-operation and always return Success.

Flash Status (F34_Flash_Data3, bits 6:4)

This field, at the completion of a flash operation, indicates the success or failure of the operation. Writes to this field are ignored.

Table 7. Function $34 Flash Status values

Value Meaning

0 Success

1 Reserved

2 Flash Programming Not Enabled/Bad Command 3 Invalid Block Number

This read-only bit indicates that flash programming has been enabled by an Enable Flash Programming command, or automatically due to a Flash CRC error during boot. If a CRC error is detected, the Function $01 Flash Prog field (F01_RMI_Data0, bit 6) is set and the specific cause of the error can be found in the Function $01 Status Code (F01_RMI_Data0, bits 3:0). This bit is set to ‘1’ for Bootloader mode, and ‘0’ (the default) for UI mode.

108 Copyright © 2007–2011 Synaptics Incorporated. All Rights Reserved.

When this bit is set, only a very small subset of the RMI interface is available:

the Function $34 registers and the Function $01 registers required to manage the Function

$34 interrupt. See section 10.1.2 for more information. This bit is cleared only when a Function $01 Reset command is executed.

10.3.4. Function $34: interrupt source

Function $34 is associated with a single interrupt request source, called the Flash interrupt request. Any product that includes Function $34 allocates a Flash interrupt request bit in the Interrupt Status register (see section 3.3.2), and a Flash interrupt enable bit in the Interrupt Enable register (see section 3.2.2). The position of the Flash interrupt bits in those registers is product-specific; consult the product-specific documentation to determine their location.

In document RMI4 Intrfacing Guide.pdf (Page 104-108)