There is no remote side alarm if there is no remote-side ...
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: I78f43eded5ed6ffde9d86726ccee2b776a3f4675
* FIFO target level :
- The '8 * 16' makes no sense as the FIFO was 128 so this
is the "full" case and could never be that high.
- We tighten up the margin around 5 * 16 which is the "target"
level for the FIFO
* FIFO size :
We also increase the FIFO size to 256 frames. This doesn't
actually affect latency since the target level is the same,
but it allows more leeway to recover without data loss in
case something goes wrong.
* Ticks :
We don't bother using ticks ... the current algo wasn't
working (or rather not doing anything all that useful),
because the difference between USB clock and E1 clock is
tiny and measured over 1 ms, it's not meaningful.
So for the time being we just sent the nominal rate biased
with the FIFO level to keep it on target and this seems
to work fine.
It'd be nice to have a good long term estimate of the rate
to minimize the jitter, but it doesn't seem to be strictly
required for operation for now.
* Misc cleanup :
Just do all in one function instead of splitting the check
if BD needs refill and the actual refill.
This gets rid of sporadic 'TX FIFO Overflow' conditions
by properly handling the case where we have a bit too much
data.
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: Ibd3bc9080961cc56093e43ab9a824840e84c24d2
This prevents inlining of the code, and is completely
unecessary.
(1) It will be filled a bit later
(2) We don't have any meaningful feedback to provide anyway
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: I6e97bc79d1fe50950bb1f7cd71d8c428e928d4ae
In dual port mode we can't have 388 bytes wMaxPacket size, that's
too much reserved bandwidth.
So we dial that back to 292 which is the minimum we can use. We need
4 bytes for header, then 256 byte of nominal transfer size then 32
more byte for potentially one more frame than nominal to compensate
differences between E1 clock and USB clock.
We obviously need to adapt the code filling up the packets to respect
that more restricted size ...
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: I700adeb909e7955db0d15c6e2beade3d38b21e01
Currently all the users of those function just statically use port 0
only.
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: I17671be65543f5a2bf3d16ba2b5a5081eb38ebdf
No benefit to use uint8_t and for consistency with later patches,
use 'int' here too.
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: I50a76476af844acf20436b9d410cb917b723590d
Several issues :
- The reported length includes the CRC so it's minus 6 and
not minus 4. (2 for CRC, 4 for header)
- Cast length to int to make it signed so the minus works
- If the packet is empty, this would be negative (no header),
underflow, and then try to submit a giant number of frames
to the E1 hardware
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: Ib754e460290fe2e1551a0090e30a51846131d07d
Avoid hardcoded ids everywhere. This also prepares a bit for
multi-port support in the future.
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: I89c86ac6afd52dd19e3383b38c3311276a090d50
They might be used somewhere else ... just don't handle them, but
let someone else potentially do it.
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: Ie1bce4565d14d6635d4a32c2a08f64728132a75e
This way they can be used in other parts of the code more easily.
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: I565d9a43bc26b99bc385b46522e7da6a207b2412
It was pointed out that this should be 0 since we trigger
detach ourselves, we don't need a bus reset.
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: Id7051ce00863c03e3498f4bab0a7124938e197c0
Some of it was written before some of the helpers were provided
by the no2usb code and was never update. So instead of manually
setting up a bunch of stuff we make proper use of some of the provided
helpers.
Side effects:
- We recall e1_init(0,0) when enabling which happens to work
around a bug ... proper fix coming later.
- The 'dual BD' config for EP 0x81 and 0x83 is fixed. It didn't
matter before since we overwrote it anyway, but now it's used
and so needs to be correct.
- The descriptors don't have the isoc endpoints at all in the
"OFF" alt setting.
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: I33c92896acfba023abe0152d63dff3afe43b53cd
Scan over every odd E1 frame TS0 byte to check if the A-bit is set,
indicating a remote alarm. If so, set yellow LED and report via the
error flags communicated to the host by USB interrupt transfer.
Change-Id: Ic4f57cf79bd32cf75f81ef3073cb8d4a2d1857d8
Those are actually disabled right now, but since the submodule got
updated and the protocol struct/defines changed, this updates them
anyway so you can uncommend/enable them without causing a build
failure
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: I1895702eac9c6c392f24327b12f9ba3651e3249a
Not much change in e1, just a typo fix that just triggered a warning.
In usb the only relevant change is a fix in the stack code that caused
GET_INTERFACE to fail for interfaces without alt-settings
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: Idfe712f7a2173e5c5f9552f35136f1d732098139
We should use service-aliases and not the primary host name, as
that makes migration between machines hard.
Change-Id: Idd49f27c9b08c6cfd077f85276a3dedc4cf117ef
In Change-Id I319edb76dd74be6904395692ab1599fb8f1f9065 we had
changed the file naming of the firmware binaries from the somewhat
general fw_app*.bin format to icE1usb-fw*.bin, but the manual
was not updated accordingly.
Change-Id: I0cc2cd3f3f8f166b9409463fbd4b01e344cfe399
Prevent the following error (generating manuals seemed to work fine
regardless):
realpath: missing operand
Try 'realpath --help' for more information.
make: Nothing to be done for 'all'.
Change-Id: I72a62b86cba0dfd710f7e1c4c01a3c10710128d8
Instead of only relying on pkg-config, support the environment variable
and fallback path like in other Osmocom repositories too. The same
script is used in other Osmocom repositories where manuals are built
without autotools.
Related: OS#4912
Change-Id: Iecfbfc2a7588c316642aa37be637cf3c02f76ac4
AIS is an all-1 bit-pattern which is used by intermediate equipment
to indicate that the link somewhere upstream is lost.
Change-Id: Icc5a16ee44ecebe802c4cca0b6cc763a88b6cc05
So far we started on altsetting 0->1 transition, but we didn't stop
on the inverse 1->0 which typically happens when the host software
(osmo-e1d) stops.
Closes: OS#4676
Change-Id: I8e4817f68d8893ab2dc98fe93ce9a673e209ca63
This introduces a number of vendor-specific control requests for
configuration of the icE1usb from the host software.
Closes: OS#4675
Change-Id: I9d28566ba21a2a78def5e4a0ba07ecbc4a583aa9
Those clear bits are only set once at start-up and then later
explicitly. They shouldn't be stored with the user configuration
in state variables.
Change-Id: If38e86aefea7f1be4e1ff5a88860f8be593eeedc
* L2, L3 now 0805
* R6, R7 now 0402
* IC4 now ASEMB-12.000MHZ-LC-T
* RoHS state enabled again in scraper, not yet used in BOM
Change-Id: I4f1a82476ca84552efd71a47231e8b6ac02a3358
Whenever Rx is aligned, the green LED is permanently on.
Whenever Rx is not aligned, the green LED is blinking.
What's missing is to check for E1 clock ticks and turn the LED off
completely if there are no clock ticks.
Change-Id: I42d53544858dbbbae5206d9a62b08672966c9ebf
This should enable the host to detect discontinuities, and also know
when a multiframe starts.
Related: OS#4674
Change-Id: Ie0688647c56ebfc2e08de44f8ec569e1c2cd6a28
The position indicates where we are in terms of frame and multiframe.
The related code was ported over from e1-tracer.
Related: OS#4674
Change-Id: I9e59d86a2e8f4e85ca84c592438ad79966b49448