/* Program a word (16bit) in the flash device.  */
int NORFLASH_ProgramWord16(uint32_t addr, uint16_t data)
/* Program a word (16bit) in the flash device.  */
int NORFLASH_ProgramWord16(uint32_t addr, uint16_t data)
{
  int status;
  if (!flashInitialized)
  {
    status = flashInterrogate();
    if (status != NORFLASH_STATUS_OK)
      return status;
  }
  if (!NORFLASH_AddressValid(addr) ||
      !NORFLASH_AddressValid(addr + 1))
  {
    EFM_ASSERT(false);
    return NORFLASH_INVALID_ADDRESS;
  }
  if (addr & 1)
    return NORFLASH_MISALIGNED_ADDRESS;
  flashUnlockCmd();
  flashBase[0x555] = 0xA0;
  *(volatile uint16_t*) addr = data;
  return flashPoll(addr, data);
}