EOR - AND mask inconsistency
John Tytgat
John.Tytgat at aaug.net
Sun Feb 20 14:36:32 GMT 2005
Various RISC OS API calls uses the EOR/AND mask principle to partially
update bits of a word and/or read bits of its old value. The OSLib API
is not consistent for all these calls :
1) EOR/AND values for IN and OLD/NEW values for OUT:
E.g.
extern os_error *xosserialop_status (bits eor_mask,
bits and_mask,
bits *old_value,
bits *new_value);
extern os_error *xparallelop_write_control (bits eor_mask,
bits and_mask,
bits *old_control,
bits *new_control);
extern os_error *xportable_speed (bits eor_mask,
bits and_mask,
portable_processor_speed *old_speed,
portable_processor_speed *new_speed);
extern os_error *xportable_control (bits eor_mask,
bits and_mask,
portable_control_flags *old_control,
portable_control_flags *new_control);
2) EOR/AND values for IN but only OLD value for OUT:
E.g.
extern os_error *xos_mmu_control (bits eor_mask,
bits and_mask,
bits *old_value);
extern os_error *xhourglass_leds (bits eor_mask,
bits and_mask,
bits *old_leds);
extern os_error *xeconet_set_protection (econet_protection eor_mask,
econet_protection and_mask,
econet_protection *old_protection);
extern os_error *xcache_control (bits eor_mask,
bits and_mask,
bits *old_state);
extern os_error *xcache_cacheable (bits eor_mask,
bits and_mask,
bits *old_state);
extern os_error *xcache_updateable (bits eor_mask,
bits and_mask,
bits *old_state);
extern os_error *xcache_disruptive (bits eor_mask,
bits and_mask,
bits *old_state);
As the NEW value for OUT is easily derivable from EOR/AND values for IN and
the OLD value for OUT, this isn't a real issue.
3) EOR/AND values for IN only:
extern os_error *xbuffer_modify_flags (buffer_b b,
bits eor_mask,
bits and_mask);
But this is bad because this API doesn't allow me to read any of the
current buffer flag bits...
Could this be fixed please ?
John.
--
John Tytgat, in his comfy chair at home BASS
John.Tytgat at aaug.net ARM powered, RISC OS driven
More information about the oslib-user
mailing list