addded read_mask, to read masked pin register