Please note that there is a thin line between the lifecycle stages and the protection states and hence can be confusing.
The protection states include:
■ STATE is 0: UNKNOWN state.
■ STATE is 1: VIRGIN state.
■ STATE is 2: NORMAL state.
■ STATE is 3: SECURE state.
■ STATE is 4: DEAD state.
The lifecycle stages are controlled using four bits:
("0001") NORMAL state
("001x") SECURE WITH DEBUG state.
So, as far as the lifecycle parameter in the API is concerned, use bit shifting to set the correct lifecycle stage:
lifecycle = (1 << 0) ---> NORMAL
lifecycle = (1 << 1) ----> SECURE WITH DEBUG
lifecycle = (1 << 2) ---> SECURE
lifecycle = (1 << 3) ---> RMA (Not allowed)
Example usage for SECURE lifecycle mode:
hr = pp.PSoC6_WriteProtection(1 << 2, secureRestrict, deadRestrict, false, out m_sLastError);
Sorry about the inconvenience you faced. We will be updating the documentation to give more information about the parameters.
Please note: This API doesn't allow transition to RMA stage.