At the Host level, there is not much difference between running a basic PKCP command (see Section 7.3.4.4.1.4, PKA PKCP Operations) and running a complex command, except that:
- Complex commands return a status code via PKA_SEQ_CTRL[15:8] SEQ_STATUS
register field.
- Complex commands do not support the concept of double-buffering, that is, it
is not allowed to setup the PKA_xPTR (PKA_APTR through PKA_DPTR) and
PKA_xLENGTH (PKA_ALENGTH and PKA_BLENGTH) registers with values for a
subsequent command while the current command is still executing. By starting
a complex command, the Host transfers ownership of all engines to the
Sequencer and hence should not access any register except PKA_SEQ_CTRL.
- Complex commands may be aborted by setting bit [7] of PKA_SEQ_CTRL. After
setting that bit, the Host must wait until the Sequencer acknowledges the
abort by clearing bit 7. A special HostAbort status value (0x0F) is returned
via PKA_SEQ_CTRL[15:8] SEQ_STATUS register field. Command result(s) are
undefined.
The general sequence of steps to run a complex command are as follows:
- Transfer the big numbers relevant to the command to PKA-RAM, unless they are already there as the result of a previous command.
- Setup the PKA_xPTR and PKA_xLENGTH registers as appropriate for the command.
- Start the command by writing the PKA_FUNCTION register with the applicable
command code.
- Poll for command ready: Keep reading PKA_SEQ_CTRL until bit 8 (STAT.0) is set.
Other option is to wait for the interrupt signal in PKA_STATUS[6] SEQ_READY
register bit.
- Extract the command return status from PKA_SEQ_CTRL[15:8] SEQ_STATUS register
field and verify that no errors occurred.
- Retrieve the final result (one or more big numbers) from PKA-RAM. Or continue with the next command, if the current output represents an intermediate result.