SWD_GET_LAST_RESPONSE

The SWD_GET_LAST_RESPONSE function provides ways to get information about the last SWD_READ or SWD_WRITE scan when SWD_EXIT_ON_ERROR is disabled.

Syntax

SWD_GET_LAST_RESPONSE( ) ( INT ack )
SWD_GET_LAST_RESPONSE( ) ( INT ack, INT parityError)

Parameters

ack
The 3 bit acknowledgement returned in the last SWD scan. If no previous scan has occurred this will return OK (0b001).
parityError
This will return TRUE if the last SWD scan was a read and there was a parity error in the read data returned. Otherwise it will return FALSE.

It is a runtime error to call SWD_GET_LAST_RESPONSE when SWD_EXIT_ON_ERROR is enabled.

When SWD_GET_LAST_RESPONSE is called all outstanding requests are completed before it will return. If SWD_GET_LAST_RESPONSE is called within a HOLDOFF the HOLDOFF is temporarily disabled to allow all requests to complete before SWD_GET_LAST_RESPONSE will return.

Example

  INT id, ack, parityError;

  SWD_EXIT_ON_ERROR(FALSE);
  SWD
    SWD_READ(0, DPIDR[3..2])(id);
    SWD_GET_LAST_RESPONSE()(ack, parityError);
    PRINT("ack = ", FORMAT(ack, "%#03b"), ", parityError = ", parityError, "\n");
    SWD_WRITE(0, 0, 0);
    SWD_GET_LAST_RESPONSE()(ack);
    PRINT("ack = ", FORMAT(ack, "%#03b\n"));
  END;
ack = 0b001, parityError = 0
ack = 0b001