In the code CAPACITY is compared against number of logical blocks, not
number of bytes, so should be expressed as 2GB in 512 blocks. This is how
it's done in the F4 code.
The existing HAL code had two issues:
- It used < instead of <= to compare INEPTFSAV with len32b, which meant
that data would not be written to the FIFO if there was exactly enough
room for the packet (it would require enough room plus one additional
FIFO slot). So for IN endpoints that had a FIFO size the same as the
maximum packet size, packets of maximum size could never be written.
- If the write loop went around again it would use the old len32b to check
if there was enough space, thereby missing some opportunities to write
packets that were smaller than the previous len32b.
This patch fixes these two issues.
The existing HAL code had two issues:
- It used < instead of <= to compare INEPTFSAV with len32b, which meant
that data would not be written to the FIFO if there was exactly enough
room for the packet (it would require enough room plus one additional
FIFO slot). So for IN endpoints that had a FIFO size the same as the
maximum packet size, packets of maximum size could never be written.
- If the write loop went around again it would use the old len32b to check
if there was enough space, thereby missing some opportunities to write
packets that were smaller than the previous len32b.
This patch fixes these two issues.
The existing HAL code had two issues:
- It used < instead of <= to compare INEPTFSAV with len32b, which meant
that data would not be written to the FIFO if there was exactly enough
room for the packet (it would require enough room plus one additional
FIFO slot). So for IN endpoints that had a FIFO size the same as the
maximum packet size, packets of maximum size could never be written.
- If the write loop went around again it would use the old len32b to check
if there was enough space, thereby missing some opportunities to write
packets that were smaller than the previous len32b.
This patch fixes these two issues.
64-bit integer division brings a dependency on library functions. It is
avoided here by dividing fck and baud by a common divisior. The error
is the better (1/(2*0x300)) as with 64 bit division (1/(0x300)).
This patch is originally from the MicroPython repository and due to
Tobias Badertscher <python@baerospace.ch>.
Previous to this patch the DMA was set-up and then the I2C address sent.
If the I2C address sending failed (eg no I2C device on the bus) then the
DMA was left in an inconsistent state.
This patch moves the DMA setup to after a successful sending of the I2C
address(es).
The definition of NULL is the only reason stdio.h is needed, and including
this standard header clashes with a CC3000 driver's definitions because
the latter wants to redefine built-in macros. The patch here is the
simplest way to deal with this but the proper fix is really to modify the
CC3000 driver.