SWD_RESET_RESPONSE_COUNTERS

The SWD_RESET_RESPONSE_COUNTERS function resets the SWD counters returned by SWD_GET_RESPONSE_COUNTERS.

Syntax

SWD_RESET_RESPONSE_COUNTERS( )

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

When SWD_RESET_RESPONSE_COUNTERS is called all outstanding requests are completed before the code continues. If SWD_RESET_RESPONSE_COUNTERS is called within a HOLDOFF the HOLDOFF is temporarily disabled to allow all requests to complete before the counters are reset.

Example

CONST INT DPIDR := 0x0;
CONST INT STAT := 0x4;
INT data, id;
INT okCounter, timeoutOnWaitCounter, faultCounter, otherAcksCounter, parityErrorCounter;

SWD_EXIT_ON_ERROR(FALSE);
SWD_RESET_RESPONSE_COUNTERS();
SWD
  SWD_READ(0, DPIDR[3..2])(id);
  SWD_READ(0, STAT[3..2])(data);
  SWD_GET_RESPONSE_COUNTERS()(okCounter, timeoutOnWaitCounter, faultCounter, otherAcksCounter, parityErrorCounter);
  PRINT("okCounter = ", okCounter, ", timeoutOnWaitCounter = ", timeoutOnWaitCounter, ", faultCounter = ", 
    faultCounter, ", otherAcksCounter = ", otherAcksCounter, ", parityErrorCounter = ", parityErrorCounter, "\n");
END;

SWD_RESET_RESPONSE_COUNTERS();
SWD_READ(0, DPIDR[3..2])(id); //read in error
SWD_WRITE(0, 0, 0x5);         //write in error
SWD_GET_RESPONSE_COUNTERS()(okCounter, timeoutOnWaitCounter, faultCounter, otherAcksCounter, parityErrorCounter);
PRINT("okCounter = ", okCounter, ", timeoutOnWaitCounter = ", timeoutOnWaitCounter, ", faultCounter = ", 
  faultCounter, ", otherAcksCounter = ", otherAcksCounter, ", parityErrorCounter = ", parityErrorCounter, "\n");
okCounter = 2, timeoutOnWaitCounter = 0, faultCounter = 0, otherAcksCounter = 0, parityErrorCounter = 0
okCounter = 0, timeoutOnWaitCounter = 0, faultCounter = 0, otherAcksCounter = 2, parityErrorCounter = 0