private int LoadLatchRow(byte arrayID, byte[] data, out string strError) { int hr = S_OK; int Params1, Params2; //Put command's parameters into SRAM buffer Params1 = (SROM_KEY1 << 0) + //KEY1 ((SROM_KEY2 + SROM_CMD_LOAD_LATCH) << 8) + //KEY2 (0x00 << 16) + //Byte number in latch from what to write (arrayID << 24); //Flash Macro ID (0 or 1) Params2 = ((data.Length - 1) << 0) + //Number of Bytes to load minus 1 (0x00 << 8) + //Pad Byte to next 4b boundary (so 1 byte is sufficient) (0x00 << 16) + //Pad Byte to next 4b boundary (0x00 << 24); //Pad Byte to next 4b boundary Programmer.DAP_WriteIO(SRAM_PARAMS_BASE + 0x00, Params1, out strError); //Write params is SRAM Programmer.DAP_WriteIO(SRAM_PARAMS_BASE + 0x04, Params2, out strError); //Write params is SRAM //Put row data into SRAM buffer for (int i = 0; i < data.Length; i += 4) { Params1 = (data[i] << 0) + (data[i + 1] << 8) + (data[i + 2] << 16) + (data[i + 3] << 24); Programmer.DAP_WriteIO(SRAM_PARAMS_BASE + 0x08 + i, Params1, out strError); //Write params is SRAM } //Call "Load Latch" SROM API unchecked { Programmer.DAP_WriteIO(CPUSS_SYSARG, SRAM_PARAMS_BASE, out strError); //Set location of parameters Programmer.DAP_WriteIO(CPUSS_SYSREQ, (int)(SROM_SYSREQ_BIT | SROM_CMD_LOAD_LATCH), out strError); //Request SROM operation } //Read status of the operation hr = PollSromStatus(SROM_SYSREQ_TIMEOUT, out strError); if (!IsSuccess(hr)) { return(hr); } return(hr); }