Commit Graph

5 Commits

Author SHA1 Message Date
Daniel Elstner e0df15d436 sysclk-lwla: Simplify and optimize word extraction.
It turns out that all LWLA protocol responses consist either
of 32-bit units or of 32-bit units combined into 64-bit units.
Thus it makes sense to double the basic unit size for reading
from 16 bit to 32 bit.
We cannot do the same for command messages though, as those
actually do use 16-bit quantities in some places, and 32-bit
arguments are not always aligned to 32-bit boundaries.

(acquisition_state.xfer_buf_in): Change unit type to uint32_t,
and update related macros and code accordingly.
(LWLA_TO_UINT32): New macro to replace LWLA_READ32, operating
directly on 32-bit values instead of pointers to 16-bit units.
Make use of a compiler-recognized idiom for bitwise rotation
to efficiently swap the 16-bit halves of a 32-bit word.
(LWLA_TO_UINT16): New macro to replace LWLA_READ16.
(LWLA_READ64): Remove unused macro.
(LWLA_WORD_[0123]): Slightly simplify 16-bit word extraction.
2014-01-28 23:34:53 +01:00
Daniel Elstner 5413df1952 sysclk-lwla: Limit use of SR_ERR_ARG to user-supplied arguments.
The return code SR_ERR_ARG is intended for reporting unsupported
or inapplicable device configuration settings and is not a hard
error.  In order to indicate failure of internal sanity checks,
use SR_ERR_BUG instead.
2014-01-28 23:26:16 +01:00
Daniel Elstner c2066c2104 sysclk-lwla: Load bitstream files in RBF format.
Modify the bitstream loading routine to work directly with the
Raw Binary Files (.rbf) generated by Altera tools.  Previously,
a custom format was used which was basically an RBF preceded by
a 4-byte header specifying the transfer length.
2014-01-25 20:44:42 +01:00
Daniel Elstner 313c7a7da2 sysclk-lwla: Utility functions clean-up and semantic fixes.
(lwla_send_bitstream): Unref the mapped file earlier in order
to simplify the error handling.
(lwla_receive_reply): Do not treat a reply buffer length of
zero as silent no-op.  That logic was left over from an earlier
iteration, before the distinction between reply buffer size and
expected read length was introduced.
2014-01-15 21:44:59 +01:00
Daniel Elstner 5874e88d83 sysclk-lwla: Implement support for the LWLA1034. 2014-01-14 19:33:31 +01:00