UNPKG

flashmagic.js

Version:
31 lines (30 loc) 1.05 kB
"use strict"; var RETURN_CODES = [ 'Command is executed successfully', 'Invalid command', 'Source address is not on a word boundary', 'Destination address is not on a correct boundary', 'Source address is not mapped in the memory map', 'Destination address is not mapped in the memory map', 'Byte count is not multiple of 4 or is not a permitted value', 'Sector number is invalid', 'Sector is not blank', 'Command to prepare sector for write operation was not executed', 'Source and destination data is not same', 'Flash programming hardware interface is busy', 'Insufficient number of parameters or invalid parameter', 'Address is not on word boundary', 'Address is not mapped in the memory map', 'Command is locked', 'Unlock code is invalid', 'Invalid baud rate setting', 'Invalid stop bit setting', 'Code read protection enabled' ]; function rethrow(rc) { rc = ~~rc; if (rc) { throw new Error(RETURN_CODES[rc]); } } exports.rethrow = rethrow;