lists.osmocom.org
Sign In Sign Up
Manage this list Sign In Sign Up

Keyboard Shortcuts

Thread View

  • j: Next unread message
  • k: Previous unread message
  • j a: Jump to all threads
  • j l: Jump to MailingList overview

gerrit-log

Thread Start a new thread
Download
Threads by month
  • ----- 2026 -----
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2025 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2024 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2023 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2022 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
gerrit-log@lists.osmocom.org

April 2024

  • 1 participants
  • 1128 discussions
[S] Change in osmo-e1d[master]: Update ice1usb_proto.h
by tnt 30 Apr '24

30 Apr '24
tnt has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-e1d/+/36688?usp=email ) Change subject: Update ice1usb_proto.h ...................................................................... Update ice1usb_proto.h Signed-off-by: Sylvain Munaut <tnt(a)246tNt.com> Change-Id: I8e041b3d94723eba9d3d30b9f03815d46dacf995 --- M src/ice1usb_proto.h 1 file changed, 17 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-e1d refs/changes/88/36688/1 diff --git a/src/ice1usb_proto.h b/src/ice1usb_proto.h index 54b91ab..ee1c307 100644 --- a/src/ice1usb_proto.h +++ b/src/ice1usb_proto.h @@ -16,8 +16,14 @@ /*! returns a bit-mask of optional device capabilities (see enum e1usb_dev_capability) */ #define ICE1USB_DEV_GET_CAPABILITIES 0x01 + +/*! returns a string describing the firmware version */ #define ICE1USB_DEV_GET_FW_BUILD 0x02 +/*! performs an I2C register access (read/write depends on direction) */ +#define ICE1USB_DEV_I2C_REG_ACCESS 0x10 + + enum e1usb_dev_capability { /*! Does this board have a GPS-DO */ ICE1USB_DEV_CAP_GPSDO, @@ -137,6 +143,7 @@ #define ICE1USB_ERR_F_ALIGN_ERR 0x01 #define ICE1USB_ERR_F_LOS 0x02 #define ICE1USB_ERR_F_RAI 0x04 +#define ICE1USB_ERR_F_AIS 0x08 struct ice1usb_irq_err { /* 16-bit little-endian counters */ -- To view, visit https://gerrit.osmocom.org/c/osmo-e1d/+/36688?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-e1d Gerrit-Branch: master Gerrit-Change-Id: I8e041b3d94723eba9d3d30b9f03815d46dacf995 Gerrit-Change-Number: 36688 Gerrit-PatchSet: 1 Gerrit-Owner: tnt <tnt(a)246tNt.com> Gerrit-MessageType: newchange
1 0
0 0
[M] Change in osmo-e1d[master]: iCE1usb: Add support to configure CRC4 mode for TX/RX
by tnt 30 Apr '24

30 Apr '24
Attention is currently required from: laforge, tnt. Hello Jenkins Builder, laforge, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/c/osmo-e1d/+/36653?usp=email to look at the new patch set (#3). The following approvals got outdated and were removed: Code-Review+1 by laforge, Verified+1 by Jenkins Builder Change subject: iCE1usb: Add support to configure CRC4 mode for TX/RX ...................................................................... iCE1usb: Add support to configure CRC4 mode for TX/RX Signed-off-by: Sylvain Munaut <tnt(a)246tNt.com> Change-Id: I9b627a9617af4ae9ed98214d672c7d0391f801eb --- M src/e1d.h M src/usb.c M src/vty.c 3 files changed, 82 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/osmo-e1d refs/changes/53/36653/3 -- To view, visit https://gerrit.osmocom.org/c/osmo-e1d/+/36653?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-e1d Gerrit-Branch: master Gerrit-Change-Id: I9b627a9617af4ae9ed98214d672c7d0391f801eb Gerrit-Change-Number: 36653 Gerrit-PatchSet: 3 Gerrit-Owner: tnt <tnt(a)246tNt.com> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Attention: laforge <laforge(a)osmocom.org> Gerrit-Attention: tnt <tnt(a)246tNt.com> Gerrit-MessageType: newpatchset
1 0
0 0
[S] Change in osmo-e1d[master]: iCE1usb: Transmit LOS events to clients
by tnt 30 Apr '24

30 Apr '24
tnt has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-e1d/+/36689?usp=email ) Change subject: iCE1usb: Transmit LOS events to clients ...................................................................... iCE1usb: Transmit LOS events to clients Signed-off-by: Sylvain Munaut <tnt(a)246tNt.com> Change-Id: I8822d24c25f8ba0bb70e9f717ca04dbf0e656e71 --- M src/usb.c 1 file changed, 17 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/osmo-e1d refs/changes/89/36689/1 diff --git a/src/usb.c b/src/usb.c index 3b77b94..e4ba6c0 100644 --- a/src/usb.c +++ b/src/usb.c @@ -410,8 +410,14 @@ if ((errcnt->flags & ICE1USB_ERR_F_LOS) != (last->flags & ICE1USB_ERR_F_LOS)) { LOGPLI(line, DE1D, LOGL_ERROR, "Rx Clock %s\n", errcnt->flags & ICE1USB_ERR_F_LOS ? "LOST" : "REGAINED"); - if (errcnt->flags & ICE1USB_ERR_F_LOS) + if (errcnt->flags & ICE1USB_ERR_F_LOS) { line_ctr_add(line, LINE_CTR_LOS, 1); + osmo_e1dp_server_event(line->intf->e1d->srv, E1DP_EVT_LOS_ON, + line->intf->id, line->id, 0, NULL, 0); + } else { + osmo_e1dp_server_event(line->intf->e1d->srv, E1DP_EVT_LOS_OFF, + line->intf->id, line->id, 0, NULL, 0); + } } if ((errcnt->flags & ICE1USB_ERR_F_RAI) != (last->flags & ICE1USB_ERR_F_RAI)) { -- To view, visit https://gerrit.osmocom.org/c/osmo-e1d/+/36689?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-e1d Gerrit-Branch: master Gerrit-Change-Id: I8822d24c25f8ba0bb70e9f717ca04dbf0e656e71 Gerrit-Change-Number: 36689 Gerrit-PatchSet: 1 Gerrit-Owner: tnt <tnt(a)246tNt.com> Gerrit-MessageType: newchange
1 0
0 0
[M] Change in osmo-e1-hardware[master]: fw: Update the helpers in misc.{c,h} for the new tick measurement hw
by tnt 30 Apr '24

30 Apr '24
tnt has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-e1-hardware/+/36680?usp=email ) Change subject: fw: Update the helpers in misc.{c,h} for the new tick measurement hw ...................................................................... fw: Update the helpers in misc.{c,h} for the new tick measurement hw Signed-off-by: Sylvain Munaut <tnt(a)246tNt.com> Change-Id: Ia881fead7a40f773969a016db05bea0a1fa1604f --- M firmware/ice40-riscv/e1-tracer/misc.c M firmware/ice40-riscv/e1-tracer/misc.h M firmware/ice40-riscv/icE1usb/misc.c M firmware/ice40-riscv/icE1usb/misc.h 4 files changed, 53 insertions(+), 14 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-e1-hardware refs/changes/80/36680/1 diff --git a/firmware/ice40-riscv/e1-tracer/misc.c b/firmware/ice40-riscv/e1-tracer/misc.c index c2e0763..6f5c88a 100644 --- a/firmware/ice40-riscv/e1-tracer/misc.c +++ b/firmware/ice40-riscv/e1-tracer/misc.c @@ -15,10 +15,11 @@ struct misc { uint32_t warmboot; uint32_t _rsvd0[3];; - struct { - uint16_t rx; - uint16_t _rsvd1; - } e1_tick[2]; + union { + uint32_t e1_tick_sel; + uint16_t e1_tick[2]; + }; + uint32_t _rsvd1; struct { uint32_t _rsvd2; uint32_t now; @@ -29,10 +30,15 @@ void -e1_tick_read(uint16_t *ticks) +e1_tick_sel(int type) { - ticks[0] = misc_regs->e1_tick[0].rx; - ticks[1] = misc_regs->e1_tick[1].rx; + misc_regs->e1_tick_sel = (type << 16) | type; +} + +uint16_t +e1_tick_read(int port) +{ + return misc_regs->e1_tick[port]; } diff --git a/firmware/ice40-riscv/e1-tracer/misc.h b/firmware/ice40-riscv/e1-tracer/misc.h index 42dfe51..2944743 100644 --- a/firmware/ice40-riscv/e1-tracer/misc.h +++ b/firmware/ice40-riscv/e1-tracer/misc.h @@ -10,6 +10,14 @@ #include <stdbool.h> #include <stdint.h> -void e1_tick_read(uint16_t *ticks); +enum e1_tick_type { + TICK_TX = 0, + TICK_RX_PULSE = 1, + TICK_RX_SAMPLE = 2, + TICK_RX_ONE = 3, +}; + +void e1_tick_sel(int type); +uint16_t e1_tick_read(int port); void reboot(int fw); diff --git a/firmware/ice40-riscv/icE1usb/misc.c b/firmware/ice40-riscv/icE1usb/misc.c index b8419aa..1445580 100644 --- a/firmware/ice40-riscv/icE1usb/misc.c +++ b/firmware/ice40-riscv/icE1usb/misc.c @@ -21,11 +21,12 @@ uint8_t _rsvd; } gpio; uint32_t e1_led; - uint32_t _rsvd; - struct { - uint16_t rx; - uint16_t tx; - } e1_tick[2]; + uint32_t _rsvd0; + union { + uint32_t e1_tick_sel; + uint16_t e1_tick[2]; + }; + uint32_t _rsvd1; struct { uint32_t pps; uint32_t now; @@ -116,10 +117,16 @@ } +void +e1_tick_sel(int type) +{ + misc_regs->e1_tick_sel = (type << 16) | type; +} + uint16_t e1_tick_read(int port) { - return misc_regs->e1_tick[port].tx; + return misc_regs->e1_tick[port]; } diff --git a/firmware/ice40-riscv/icE1usb/misc.h b/firmware/ice40-riscv/icE1usb/misc.h index b72793f..ca99951 100644 --- a/firmware/ice40-riscv/icE1usb/misc.h +++ b/firmware/ice40-riscv/icE1usb/misc.h @@ -34,6 +34,14 @@ void e1_led_pause(void); void e1_led_set(bool enable, uint8_t cfg); +enum e1_tick_type { + TICK_TX = 0, + TICK_RX_PULSE = 1, + TICK_RX_SAMPLE = 2, + TICK_RX_ONE = 3, +}; + +void e1_tick_sel(int type); uint16_t e1_tick_read(int port); bool time_elapsed(uint32_t ref, unsigned int tick); -- To view, visit https://gerrit.osmocom.org/c/osmo-e1-hardware/+/36680?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-e1-hardware Gerrit-Branch: master Gerrit-Change-Id: Ia881fead7a40f773969a016db05bea0a1fa1604f Gerrit-Change-Number: 36680 Gerrit-PatchSet: 1 Gerrit-Owner: tnt <tnt(a)246tNt.com> Gerrit-MessageType: newchange
1 0
0 0
[S] Change in osmo-e1-hardware[master]: icE1usb fw: Always define NUM_E1_PORTS in Makefile
by tnt 30 Apr '24

30 Apr '24
tnt has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-e1-hardware/+/36681?usp=email ) Change subject: icE1usb fw: Always define NUM_E1_PORTS in Makefile ...................................................................... icE1usb fw: Always define NUM_E1_PORTS in Makefile So that it's available without having to include the USB include ... Signed-off-by: Sylvain Munaut <tnt(a)246tNt.com> Change-Id: I0b434cef7a662c19e5f48072285c013e8c02e254 --- M firmware/ice40-riscv/icE1usb/Makefile M firmware/ice40-riscv/icE1usb/usb_desc_ids.h 2 files changed, 14 insertions(+), 4 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-e1-hardware refs/changes/81/36681/1 diff --git a/firmware/ice40-riscv/icE1usb/Makefile b/firmware/ice40-riscv/icE1usb/Makefile index f385408..5fcd1f7 100644 --- a/firmware/ice40-riscv/icE1usb/Makefile +++ b/firmware/ice40-riscv/icE1usb/Makefile @@ -19,6 +19,8 @@ ifeq ($(SINGLE_CHANNEL),1) CFLAGS += -DNUM_E1_PORTS=1 +else +CFLAGS += -DNUM_E1_PORTS=2 endif NO2USB_FW_VERSION=0 diff --git a/firmware/ice40-riscv/icE1usb/usb_desc_ids.h b/firmware/ice40-riscv/icE1usb/usb_desc_ids.h index df0331e..b9a7032 100644 --- a/firmware/ice40-riscv/icE1usb/usb_desc_ids.h +++ b/firmware/ice40-riscv/icE1usb/usb_desc_ids.h @@ -7,10 +7,6 @@ #pragma once -#ifndef NUM_E1_PORTS -# define NUM_E1_PORTS 2 -#endif - #define USB_INTF_E1(p) (0 + (p)) #define USB_INTF_GPS_CDC_CTL (NUM_E1_PORTS + 0) #define USB_INTF_GPS_CDC_DATA (NUM_E1_PORTS + 1) -- To view, visit https://gerrit.osmocom.org/c/osmo-e1-hardware/+/36681?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-e1-hardware Gerrit-Branch: master Gerrit-Change-Id: I0b434cef7a662c19e5f48072285c013e8c02e254 Gerrit-Change-Number: 36681 Gerrit-PatchSet: 1 Gerrit-Owner: tnt <tnt(a)246tNt.com> Gerrit-MessageType: newchange
1 0
0 0
[M] Change in osmo-e1-hardware[master]: gateware: Rework the low-level line state monitoring ticks
by tnt 30 Apr '24

30 Apr '24
tnt has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-e1-hardware/+/36679?usp=email ) Change subject: gateware: Rework the low-level line state monitoring ticks ...................................................................... gateware: Rework the low-level line state monitoring ticks The 'tick' system was meant to allow the firmware to monitor the low level state of the line, beyong just "not aligned", but it was never really useful in the present state. Now we have more tick source available (but only one can be measured at the same time). More specifically, the firmware can monitor the presence/absence of raw pulses (LOS condition), it can also monitor the number of '1' pulses to detect an AIS signals, or simply the rate of RX pulses (to tune the local oscillator to incoming signal rate). Signed-off-by: Sylvain Munaut <tnt(a)246tNt.com> Change-Id: I31fa8a717a26643f1b6ca5644bee1d8c41a2512e --- M gateware/common/rtl/soc_base.v M gateware/cores/no2e1 M gateware/e1-tracer/doc/mem-map.md M gateware/e1-tracer/rtl/misc.v M gateware/e1-tracer/rtl/top.v M gateware/icE1usb-proto/doc/mem-map.md M gateware/icE1usb-proto/rtl/misc.v M gateware/icE1usb-proto/rtl/top.v M gateware/icE1usb/doc/mem-map.md M gateware/icE1usb/rtl/misc.v M gateware/icE1usb/rtl/top.v 11 files changed, 176 insertions(+), 65 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-e1-hardware refs/changes/79/36679/1 diff --git a/gateware/common/rtl/soc_base.v b/gateware/common/rtl/soc_base.v index 25c4af8..be7766a 100644 --- a/gateware/common/rtl/soc_base.v +++ b/gateware/common/rtl/soc_base.v @@ -72,9 +72,8 @@ input wire [ WB_N -1:0] wb_m_ack, // Ticks - output wire [E1_N-1:0] tick_e1_rx, - output wire [E1_N-1:0] tick_e1_tx, - output wire tick_usb_sof, + output wire [4*E1_N-1:0] tick_e1, + output wire tick_usb_sof, // Clock / Reset input wire clk_sys, @@ -502,8 +501,7 @@ .wb_cyc (wb_cyc[7]), .wb_ack (wb_ack[7]), .irq (), - .tick_rx (tick_e1_rx), - .tick_tx (tick_e1_tx), + .mon_tick (tick_e1), .clk (clk_sys), .rst (rst_sys) ); diff --git a/gateware/cores/no2e1 b/gateware/cores/no2e1 index 9a11118..82040f1 160000 --- a/gateware/cores/no2e1 +++ b/gateware/cores/no2e1 @@ -1 +1 @@ -Subproject commit 9a1111855cb265a6271a8a43fd3809e7ad6ac040 +Subproject commit 82040f15ec54a6e22d9ad72cdcd72af37f3961dd diff --git a/gateware/e1-tracer/doc/mem-map.md b/gateware/e1-tracer/doc/mem-map.md index 06cfad0..aa79948 100644 --- a/gateware/e1-tracer/doc/mem-map.md +++ b/gateware/e1-tracer/doc/mem-map.md @@ -156,21 +156,43 @@ Write to this register with bit 2 set will trigger a FPGA reload of the selected image. -#### E1 tick channel 0/1 (Read Only, addr `0x04` / `0x05`) +#### E1 tick source select (Write Only, addr `0x04`) ```text ,-----------------------------------------------------------------------------------------------, |31|30|29|28|27|26|25|24|23|22|21|20|19|18|17|16|15|14|13|12|11|10| 9| 8| 7| 6| 5| 4| 3| 2| 1| 0| |-----------------------------------------------------------------------------------------------| -| / | rx_tick | +| / |ts[1]| / |ts[0]| '-----------------------------------------------------------------------------------------------' - * [15:0] - rx_tick + * [17:16] - ts[1] : Tick Source for channel 1 + * [ 1: 0] - ts[0] : Tick Source for channel 0 ``` -An internal counter is incremented at every bit received by the corresponding E1 channel. That -counter value is then captured at every USB Start-of-Frame packet and the last captured value -made available here. +Selects the tick source for the counters below for each E1 channel. +Available sources are : + +* `0`: (reserved) +* `1`: (reserved) +* `2`: RX Sample, for every bit received +* `3`: RX One, for every `1` bit received + +#### E1 tick counters (Read Only, addr `0x04`) + +```text +,-----------------------------------------------------------------------------------------------, +|31|30|29|28|27|26|25|24|23|22|21|20|19|18|17|16|15|14|13|12|11|10| 9| 8| 7| 6| 5| 4| 3| 2| 1| 0| +|-----------------------------------------------------------------------------------------------| +| chan[1] | chan[0] | +'-----------------------------------------------------------------------------------------------' + + * [31:16] - chan[1] : Tick counter for channel 1 + * [15: 0] - chan[0] : Tick counter for channel 0 +``` + +An internal counter is incremented at every E1 tick (tick source selected above) for each E1 +channel. That counter value is then captured at every USB Start-of-Frame packet and the last +captured value made available here. #### Time (Read Only, addr `0x07`) diff --git a/gateware/e1-tracer/rtl/misc.v b/gateware/e1-tracer/rtl/misc.v index e39a787..5d1c1f4 100644 --- a/gateware/e1-tracer/rtl/misc.v +++ b/gateware/e1-tracer/rtl/misc.v @@ -16,7 +16,7 @@ input wire btn, // Ticks - input wire [1:0] tick_e1_rx, + input wire [7:0] tick_e1, input wire tick_usb_sof, // Reset request @@ -43,9 +43,13 @@ // Bus wire bus_clr; reg bus_we_boot; + reg bus_we_tick_sel; // Counters - wire [15:0] cap_e1_rx[0:1]; + reg [1:0] tick_e1_sel[0:1]; + wire [1:0] tick_e1_mux; + + wire [15:0] cap_e1[0:1]; wire [31:0] cnt_time; // Boot @@ -64,10 +68,13 @@ // Write enables always @(posedge clk) - if (bus_clr | ~wb_we) - bus_we_boot <= 1'b0; - else - bus_we_boot <= wb_addr == 4'h0; + if (bus_clr | ~wb_we) begin + bus_we_boot <= 1'b0; + bus_we_tick_sel <= 1'b0; + end else begin + bus_we_boot <= wb_addr == 4'h0; + bus_we_tick_sel <= wb_addr == 4'h4; + end // Read mux always @(posedge clk) @@ -75,8 +82,7 @@ wb_rdata <= 32'h00000000; else case (wb_addr[3:0]) - 4'h4: wb_rdata <= { 16'h000, cap_e1_rx[0] }; - 4'h5: wb_rdata <= { 16'h000, cap_e1_rx[1] }; + 4'h4: wb_rdata <= { cap_e1[1], cap_e1[0] }; 4'h7: wb_rdata <= cnt_time; default: wb_rdata <= 32'hxxxxxxxx; endcase @@ -86,12 +92,21 @@ // -------- // E1 ticks + always @(posedge clk) + if (bus_we_tick_sel) begin + tick_e1_sel[1] <= wb_wdata[17:16]; + tick_e1_sel[0] <= wb_wdata[ 1: 0]; + end + + assign tick_e1_mux[0] = tick_e1[{1'b0, tick_e1_sel[0]}]; + assign tick_e1_mux[1] = tick_e1[{1'b1, tick_e1_sel[1]}]; + capcnt #( .W(16) ) e1_cnt_I[1:0] ( .cnt_cur (), - .cnt_cap ({cap_e1_rx[1], cap_e1_rx[0] }), - .inc ({tick_e1_rx[1], tick_e1_rx[0]}), + .cnt_cap ({ cap_e1[1], cap_e1[0] }), + .inc ({ tick_e1_mux[1], tick_e1_mux[0] }), .cap (tick_usb_sof), .clk (clk), .rst (rst) diff --git a/gateware/e1-tracer/rtl/top.v b/gateware/e1-tracer/rtl/top.v index 0e76c5a..8e1d67b 100644 --- a/gateware/e1-tracer/rtl/top.v +++ b/gateware/e1-tracer/rtl/top.v @@ -80,7 +80,7 @@ wire [(WB_N*32)-1:0] wb_rdata_flat; // Ticks - wire [1:0] tick_e1_rx; + wire [7:0] tick_e1; wire tick_usb_sof; // Clocks / Reset @@ -136,7 +136,7 @@ .wb_m_we (wb_we), .wb_m_cyc (wb_cyc), .wb_m_ack (wb_ack), - .tick_e1_rx (tick_e1_rx), + .tick_e1 (tick_e1), .tick_usb_sof (tick_usb_sof), .clk_sys (clk_sys), .rst_sys (rst_sys), @@ -167,7 +167,7 @@ misc misc_I ( .btn (btn), - .tick_e1_rx (tick_e1_rx), + .tick_e1 (tick_e1), .tick_usb_sof (tick_usb_sof), .rst_req (rst_req), .wb_addr (wb_addr[7:0]), diff --git a/gateware/icE1usb-proto/doc/mem-map.md b/gateware/icE1usb-proto/doc/mem-map.md index d8f9cba..b326619 100644 --- a/gateware/icE1usb-proto/doc/mem-map.md +++ b/gateware/icE1usb-proto/doc/mem-map.md @@ -156,20 +156,39 @@ Write to this register with bit 2 set will trigger a FPGA reload of the selected image. -#### E1 tick channel 0 (Read Only, addr `0x04`) +#### E1 tick source select (Write Only, addr `0x04`) ```text ,-----------------------------------------------------------------------------------------------, |31|30|29|28|27|26|25|24|23|22|21|20|19|18|17|16|15|14|13|12|11|10| 9| 8| 7| 6| 5| 4| 3| 2| 1| 0| |-----------------------------------------------------------------------------------------------| -| tx_tick | rx_tick | +| / | tss | '-----------------------------------------------------------------------------------------------' - * [31:16] - tx_tick - * [15: 0] - rx_tick + * [ 1: 0] - tss : Tick Source Select ``` -An internal counter is incremented at every bit received/transmitted by the corresponding E1 +Selects the tick source for the counters below. +Available sources are : + +* `0`: TX tick, for every bit sent +* `1`: RX Pulse, for every detected pulse on the input +* `2`: RX Sample, for every bit received +* `3`: RX One, for every `1` bit received + +#### E1 tick counters (Read Only, addr `0x04`) + +```text +,-----------------------------------------------------------------------------------------------, +|31|30|29|28|27|26|25|24|23|22|21|20|19|18|17|16|15|14|13|12|11|10| 9| 8| 7| 6| 5| 4| 3| 2| 1| 0| +|-----------------------------------------------------------------------------------------------| +| / | tick_cnt | +'-----------------------------------------------------------------------------------------------' + + * [15: 0] - tick_cnt : Tick counter value +``` + +An internal counter is incremented at every E1 tick (tick source selected above) for each E1 channel. That counter value is then captured at every USB Start-of-Frame packet and the last captured value made available here. diff --git a/gateware/icE1usb-proto/rtl/misc.v b/gateware/icE1usb-proto/rtl/misc.v index 8ff14d9..68ac624 100644 --- a/gateware/icE1usb-proto/rtl/misc.v +++ b/gateware/icE1usb-proto/rtl/misc.v @@ -26,9 +26,8 @@ input wire btn, // Ticks - input wire tick_e1_rx, - input wire tick_e1_tx, - input wire tick_usb_sof, + input wire [3:0] tick_e1, + input wire tick_usb_sof, // Reset request output wire rst_req, @@ -52,12 +51,15 @@ // Bus wire bus_clr; reg bus_we_boot; + reg bus_we_tick_sel; reg [ 1:0] bus_we_pdm_clk; reg [ 2:0] bus_we_pdm_e1; // Counters - wire [15:0] cap_e1_rx; - wire [15:0] cap_e1_tx; + reg [1:0] tick_e1_sel; + wire tick_e1_mux; + + wire [15:0] cap_e1; wire [31:0] cnt_time; // PDM @@ -82,6 +84,7 @@ always @(posedge clk) if (bus_clr | ~wb_we) begin bus_we_boot <= 1'b0; + bus_we_tick_sel <= 1'b0; bus_we_pdm_clk[0] <= 1'b0; bus_we_pdm_clk[1] <= 1'b0; bus_we_pdm_e1[0] <= 1'b0; @@ -89,6 +92,7 @@ bus_we_pdm_e1[2] <= 1'b0; end else begin bus_we_boot <= wb_addr == 4'h0; + bus_we_tick_sel <= wb_addr == 4'h4; bus_we_pdm_clk[0] <= wb_addr == 4'h8; bus_we_pdm_clk[1] <= wb_addr == 4'h9; bus_we_pdm_e1[0] <= wb_addr == 4'ha; @@ -102,7 +106,7 @@ wb_rdata <= 32'h00000000; else case (wb_addr[3:0]) - 4'h4: wb_rdata <= { cap_e1_tx, cap_e1_rx }; + 4'h4: wb_rdata <= { 16'h0000, cap_e1 }; 4'h7: wb_rdata <= cnt_time; `ifdef WITH_PDM_READBACK 4'h8: wb_rdata <= { pdm_clk[0][12], 19'h00000, pdm_clk[0][11:0] }; @@ -119,12 +123,18 @@ // -------- // E1 ticks + always @(posedge clk) + if (bus_we_tick_sel) + tick_e1_sel <= wb_wdata[1:0]; + + assign tick_e1_mux = tick_e1[tick_e1_sel]; + capcnt #( .W(16) - ) e1_cnt_I[1:0] ( + ) e1_cnt_I ( .cnt_cur (), - .cnt_cap ({cap_e1_tx, cap_e1_rx }), - .inc ({tick_e1_tx, tick_e1_rx}), + .cnt_cap (cap_e1), + .inc (tick_e1_mux), .cap (tick_usb_sof), .clk (clk), .rst (rst) diff --git a/gateware/icE1usb-proto/rtl/top.v b/gateware/icE1usb-proto/rtl/top.v index 7cefeac..40eaf5c 100644 --- a/gateware/icE1usb-proto/rtl/top.v +++ b/gateware/icE1usb-proto/rtl/top.v @@ -78,8 +78,7 @@ wire [(WB_N*32)-1:0] wb_rdata_flat; // Ticks - wire tick_e1_rx; - wire tick_e1_tx; + wire [3:0] tick_e1; wire tick_usb_sof; // Clocks / Reset @@ -135,8 +134,7 @@ .wb_m_we (wb_we), .wb_m_cyc (wb_cyc), .wb_m_ack (wb_ack), - .tick_e1_rx (tick_e1_rx), - .tick_e1_tx (tick_e1_tx), + .tick_e1 (tick_e1), .tick_usb_sof (tick_usb_sof), .clk_sys (clk_sys), .rst_sys (rst_sys), @@ -172,8 +170,7 @@ .clk_tune_hi (clk_tune_hi), .clk_tune_lo (clk_tune_lo), .btn (btn), - .tick_e1_rx (tick_e1_rx), - .tick_e1_tx (tick_e1_tx), + .tick_e1 (tick_e1), .tick_usb_sof (tick_usb_sof), .rst_req (rst_req), .wb_addr (wb_addr[7:0]), diff --git a/gateware/icE1usb/doc/mem-map.md b/gateware/icE1usb/doc/mem-map.md index 75d7b69..395a577 100644 --- a/gateware/icE1usb/doc/mem-map.md +++ b/gateware/icE1usb/doc/mem-map.md @@ -206,20 +206,41 @@ * `10`: Slow blink * `11`: Fast blink -#### E1 tick channel 0/1 (Read Only, addr `0x04-0x05`) +#### E1 tick source select (Write Only, addr `0x04`) ```text ,-----------------------------------------------------------------------------------------------, |31|30|29|28|27|26|25|24|23|22|21|20|19|18|17|16|15|14|13|12|11|10| 9| 8| 7| 6| 5| 4| 3| 2| 1| 0| |-----------------------------------------------------------------------------------------------| -| tx_tick | rx_tick | +| / |ts[1]| / |ts[0]| '-----------------------------------------------------------------------------------------------' - * [31:16] - tx_tick - * [15: 0] - rx_tick + * [17:16] - ts[1] : Tick Source for channel 1 + * [ 1: 0] - ts[0] : Tick Source for channel 0 ``` -An internal counter is incremented at every bit received/transmitted by the corresponding E1 +Selects the tick source for the counters below for each E1 channel. +Available sources are : + +* `0`: TX tick, for every bit sent +* `1`: RX Pulse, for every detected pulse on the input +* `2`: RX Sample, for every bit received +* `3`: RX One, for every `1` bit received + +#### E1 tick counters (Read Only, addr `0x04`) + +```text +,-----------------------------------------------------------------------------------------------, +|31|30|29|28|27|26|25|24|23|22|21|20|19|18|17|16|15|14|13|12|11|10| 9| 8| 7| 6| 5| 4| 3| 2| 1| 0| +|-----------------------------------------------------------------------------------------------| +| chan[1] | chan[0] | +'-----------------------------------------------------------------------------------------------' + + * [31:16] - chan[1] : Tick counter for channel 1 + * [15: 0] - chan[0] : Tick counter for channel 0 +``` + +An internal counter is incremented at every E1 tick (tick source selected above) for each E1 channel. That counter value is then captured at every USB Start-of-Frame packet and the last captured value made available here. diff --git a/gateware/icE1usb/rtl/misc.v b/gateware/icE1usb/rtl/misc.v index 7aaa068..347412c 100644 --- a/gateware/icE1usb/rtl/misc.v +++ b/gateware/icE1usb/rtl/misc.v @@ -37,8 +37,7 @@ input wire btn_stb, // Ticks - input wire [ 1:0] tick_e1_rx, - input wire [ 1:0] tick_e1_tx, + input wire [ 7:0] tick_e1, input wire tick_usb_sof, // Reset request @@ -67,6 +66,7 @@ reg bus_we_boot; reg bus_we_gpio; reg bus_we_led; + reg bus_we_tick_sel; reg [ 1:0] bus_we_pdm_clk; reg [ 1:0] bus_we_pdm_e1; @@ -83,8 +83,10 @@ wire gps_pps_r; // Counters - wire [15:0] cap_e1_rx[0:1]; - wire [15:0] cap_e1_tx[0:1]; + reg [1:0] tick_e1_sel[0:1]; + wire [1:0] tick_e1_mux; + + wire [15:0] cap_e1[0:1]; wire [31:0] cap_gps; wire [31:0] cnt_time; @@ -112,6 +114,7 @@ bus_we_boot <= 1'b0; bus_we_gpio <= 1'b0; bus_we_led <= 1'b0; + bus_we_tick_sel <= 1'b0; bus_we_pdm_clk[0] <= 1'b0; bus_we_pdm_clk[1] <= 1'b0; bus_we_pdm_e1[0] <= 1'b0; @@ -120,6 +123,7 @@ bus_we_boot <= wb_addr == 4'h0; bus_we_gpio <= wb_addr == 4'h1; bus_we_led <= wb_addr == 4'h2; + bus_we_tick_sel <= wb_addr == 4'h4; bus_we_pdm_clk[0] <= wb_addr == 4'h8; bus_we_pdm_clk[1] <= wb_addr == 4'h9; bus_we_pdm_e1[0] <= wb_addr == 4'ha; @@ -134,8 +138,7 @@ case (wb_addr[3:0]) 4'h1: wb_rdata <= { 12'h000, gpio_in, 4'h0, gpio_oe, 4'h0, gpio_out }; 4'h2: wb_rdata <= { 22'h000000, e1_led_active, e1_led }; - 4'h4: wb_rdata <= { cap_e1_tx[0], cap_e1_rx[0] }; - 4'h5: wb_rdata <= { cap_e1_tx[1], cap_e1_rx[1] }; + 4'h4: wb_rdata <= { cap_e1[1], cap_e1[0] }; 4'h6: wb_rdata <= cap_gps; 4'h7: wb_rdata <= cnt_time; `ifdef WITH_PDM_READBACK @@ -229,12 +232,21 @@ // -------- // E1 ticks + always @(posedge clk) + if (bus_we_tick_sel) begin + tick_e1_sel[1] <= wb_wdata[17:16]; + tick_e1_sel[0] <= wb_wdata[ 1: 0]; + end + + assign tick_e1_mux[0] = tick_e1[{1'b0, tick_e1_sel[0]}]; + assign tick_e1_mux[1] = tick_e1[{1'b1, tick_e1_sel[1]}]; + capcnt #( .W(16) - ) e1_cnt_I[3:0] ( + ) e1_cnt_I[1:0] ( .cnt_cur (), - .cnt_cap ({cap_e1_tx[1], cap_e1_rx[1], cap_e1_tx[0], cap_e1_rx[0] }), - .inc ({tick_e1_tx[1], tick_e1_rx[1], tick_e1_tx[0], tick_e1_rx[0]}), + .cnt_cap ({ cap_e1[1], cap_e1[0] }), + .inc ({ tick_e1_mux[1], tick_e1_mux[0] }), .cap (tick_usb_sof), .clk (clk), .rst (rst) diff --git a/gateware/icE1usb/rtl/top.v b/gateware/icE1usb/rtl/top.v index a2b8979..472c1ff 100644 --- a/gateware/icE1usb/rtl/top.v +++ b/gateware/icE1usb/rtl/top.v @@ -99,8 +99,7 @@ wire [(WB_N*32)-1:0] wb_rdata_flat; // Ticks - wire [1:0] tick_e1_rx; - wire [1:0] tick_e1_tx; + wire [7:0] tick_e1; wire tick_usb_sof; // I2C @@ -182,8 +181,7 @@ .wb_m_we (wb_we), .wb_m_cyc (wb_cyc), .wb_m_ack (wb_ack), - .tick_e1_rx (tick_e1_rx), - .tick_e1_tx (tick_e1_tx), + .tick_e1 (tick_e1), .tick_usb_sof (tick_usb_sof), .clk_sys (clk_sys), .rst_sys (rst_sys), @@ -255,8 +253,7 @@ .e1_led_active (e1_led_active), .btn_val (btn_val), .btn_stb (btn_stb), - .tick_e1_rx (tick_e1_rx), - .tick_e1_tx (tick_e1_tx), + .tick_e1 (tick_e1), .tick_usb_sof (tick_usb_sof), .rst_req (rst_req), .wb_addr (wb_addr[7:0]), -- To view, visit https://gerrit.osmocom.org/c/osmo-e1-hardware/+/36679?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-e1-hardware Gerrit-Branch: master Gerrit-Change-Id: I31fa8a717a26643f1b6ca5644bee1d8c41a2512e Gerrit-Change-Number: 36679 Gerrit-PatchSet: 1 Gerrit-Owner: tnt <tnt(a)246tNt.com> Gerrit-MessageType: newchange
1 0
0 0
[S] Change in osmo-e1-hardware[master]: icE1usb fw: Use NUM_E1_PORTS in e1.c
by tnt 30 Apr '24

30 Apr '24
tnt has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-e1-hardware/+/36683?usp=email ) Change subject: icE1usb fw: Use NUM_E1_PORTS in e1.c ...................................................................... icE1usb fw: Use NUM_E1_PORTS in e1.c Signed-off-by: Sylvain Munaut <tnt(a)246tNt.com> Change-Id: Id69b4429a67ccb8834fee26b83839539a5ad8b31 --- M firmware/ice40-riscv/icE1usb/e1.c 1 file changed, 13 insertions(+), 3 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-e1-hardware refs/changes/83/36683/1 diff --git a/firmware/ice40-riscv/icE1usb/e1.c b/firmware/ice40-riscv/icE1usb/e1.c index bfc042e..5e4fa33 100644 --- a/firmware/ice40-riscv/icE1usb/e1.c +++ b/firmware/ice40-riscv/icE1usb/e1.c @@ -263,13 +263,13 @@ struct e1_error_count errors; }; -static struct e1_state g_e1[2]; +static struct e1_state g_e1[NUM_E1_PORTS]; static volatile struct e1_core * _get_regs(int port) { - if ((port < 0) || (port > 1)) + if ((port < 0) || (port >= NUM_E1_PORTS)) panic("_get_regs invalid port %d", port); return &e1_regs_base[port]; } @@ -277,7 +277,7 @@ static struct e1_state * _get_state(int port) { - if ((port < 0) || (port > 1)) + if ((port < 0) || (port >= NUM_E1_PORTS)) panic("_get_state invalid port %d", port); return &g_e1[port]; } -- To view, visit https://gerrit.osmocom.org/c/osmo-e1-hardware/+/36683?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-e1-hardware Gerrit-Branch: master Gerrit-Change-Id: Id69b4429a67ccb8834fee26b83839539a5ad8b31 Gerrit-Change-Number: 36683 Gerrit-PatchSet: 1 Gerrit-Owner: tnt <tnt(a)246tNt.com> Gerrit-MessageType: newchange
1 0
0 0
[S] Change in osmo-e1-hardware[master]: icE1usb fw: Fix some formatting (tab vs space)
by tnt 30 Apr '24

30 Apr '24
tnt has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-e1-hardware/+/36682?usp=email ) Change subject: icE1usb fw: Fix some formatting (tab vs space) ...................................................................... icE1usb fw: Fix some formatting (tab vs space) Signed-off-by: Sylvain Munaut <tnt(a)246tNt.com> Change-Id: Id47025320e65a27fc46e9204e050c57d108dab56 --- M firmware/ice40-riscv/icE1usb/usb_e1.c 1 file changed, 12 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-e1-hardware refs/changes/82/36682/1 diff --git a/firmware/ice40-riscv/icE1usb/usb_e1.c b/firmware/ice40-riscv/icE1usb/usb_e1.c index 11c7401..18d8516 100644 --- a/firmware/ice40-riscv/icE1usb/usb_e1.c +++ b/firmware/ice40-riscv/icE1usb/usb_e1.c @@ -434,8 +434,8 @@ static struct usb_fn_drv _e1_drv = { .set_conf = _e1_set_conf, - .set_intf = _e1_set_intf, - .get_intf = _e1_get_intf, + .set_intf = _e1_set_intf, + .get_intf = _e1_get_intf, .ctrl_req = _e1_ctrl_req, }; -- To view, visit https://gerrit.osmocom.org/c/osmo-e1-hardware/+/36682?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-e1-hardware Gerrit-Branch: master Gerrit-Change-Id: Id47025320e65a27fc46e9204e050c57d108dab56 Gerrit-Change-Number: 36682 Gerrit-PatchSet: 1 Gerrit-Owner: tnt <tnt(a)246tNt.com> Gerrit-MessageType: newchange
1 0
0 0
[M] Change in osmo-e1-hardware[master]: icE1usb fw: Implement E1 line monitor task
by tnt 30 Apr '24

30 Apr '24
tnt has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-e1-hardware/+/36684?usp=email ) Change subject: icE1usb fw: Implement E1 line monitor task ...................................................................... icE1usb fw: Implement E1 line monitor task The results are not used yet, just collected ... Signed-off-by: Sylvain Munaut <tnt(a)246tNt.com> Change-Id: Id310b65b7cd83c3bbae90ecd4a82b09a3989d91f --- M firmware/ice40-riscv/icE1usb/e1.c M firmware/ice40-riscv/icE1usb/e1.h M firmware/ice40-riscv/icE1usb/usb_e1.c 3 files changed, 72 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-e1-hardware refs/changes/84/36684/1 diff --git a/firmware/ice40-riscv/icE1usb/e1.c b/firmware/ice40-riscv/icE1usb/e1.c index 5e4fa33..1582cec 100644 --- a/firmware/ice40-riscv/icE1usb/e1.c +++ b/firmware/ice40-riscv/icE1usb/e1.c @@ -16,6 +16,7 @@ #include "dma.h" #include "led.h" // FIXME +#include "misc.h" #include "utils.h" @@ -260,6 +261,14 @@ enum e1_pipe_state state; } tx; + struct { + uint16_t rx_pulse; + uint16_t rx_sample; + uint16_t rx_one; + + uint16_t _val; + } linemon; + struct e1_error_count errors; }; @@ -696,6 +705,53 @@ } void +e1_linemon_update(void) +{ + static int cycle = -1; + + /* Initial boot */ + if (cycle == -1) { + e1_tick_sel(TICK_RX_PULSE); + cycle = 0; + return; + } + + /* Current cycle ? */ + switch (cycle) { + /* Read initial values */ + case 0: + case 2: + case 4: + for (int port=0; port<NUM_E1_PORTS; port++) + g_e1[port].linemon._val = e1_tick_read(port); + break; + + /* Actual reading */ + case 1: + for (int port=0; port<NUM_E1_PORTS; port++) + g_e1[port].linemon.rx_pulse = e1_tick_read(port) - g_e1[port].linemon._val; + e1_tick_sel(TICK_RX_SAMPLE); + break; + + case 3: + for (int port=0; port<NUM_E1_PORTS; port++) + g_e1[port].linemon.rx_sample = e1_tick_read(port) - g_e1[port].linemon._val; + e1_tick_sel(TICK_RX_ONE); + break; + + case 5: + for (int port=0; port<NUM_E1_PORTS; port++) + g_e1[port].linemon.rx_one = e1_tick_read(port) - g_e1[port].linemon._val; + e1_tick_sel(TICK_RX_PULSE); + break; + } + + /* Next cycle */ + if (++cycle == 6) + cycle = 0; +} + +void e1_debug_print(int port, bool data) { volatile struct e1_core *e1_regs = _get_regs(port); @@ -706,6 +762,8 @@ printf("CSR: Rx %04x / Tx %04x\n", e1_regs->rx.csr, e1_regs->tx.csr); printf("InF: Rx %d / Tx %d\n", e1->rx.in_flight, e1->tx.in_flight); printf("Sta: Rx %d / Tx %d\n", e1->rx.state, e1->tx.state); + printf("Tck: P %d / S %d / O %d\n", + e1->linemon.rx_pulse, e1->linemon.rx_sample, e1->linemon.rx_one); e1f_debug(&e1->rx.fifo, "Rx FIFO"); e1f_debug(&e1->tx.fifo, "Tx FIFO"); diff --git a/firmware/ice40-riscv/icE1usb/e1.h b/firmware/ice40-riscv/icE1usb/e1.h index 0ed43c4..883e1ec 100644 --- a/firmware/ice40-riscv/icE1usb/e1.h +++ b/firmware/ice40-riscv/icE1usb/e1.h @@ -15,6 +15,7 @@ void e1_stop(int port); void e1_poll(int port); +void e1_linemon_update(void); void e1_debug_print(int port, bool data); void e1_rx_config(int port, uint16_t cr); diff --git a/firmware/ice40-riscv/icE1usb/usb_e1.c b/firmware/ice40-riscv/icE1usb/usb_e1.c index 18d8516..843aeef 100644 --- a/firmware/ice40-riscv/icE1usb/usb_e1.c +++ b/firmware/ice40-riscv/icE1usb/usb_e1.c @@ -433,6 +433,7 @@ static struct usb_fn_drv _e1_drv = { + .sof = e1_linemon_update, .set_conf = _e1_set_conf, .set_intf = _e1_set_intf, .get_intf = _e1_get_intf, -- To view, visit https://gerrit.osmocom.org/c/osmo-e1-hardware/+/36684?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-e1-hardware Gerrit-Branch: master Gerrit-Change-Id: Id310b65b7cd83c3bbae90ecd4a82b09a3989d91f Gerrit-Change-Number: 36684 Gerrit-PatchSet: 1 Gerrit-Owner: tnt <tnt(a)246tNt.com> Gerrit-MessageType: newchange
1 0
0 0
[S] Change in osmo-e1-hardware[master]: icE1usb fw: Add AIS error flag and fill it along with LOS from linemon
by tnt 30 Apr '24

30 Apr '24
tnt has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-e1-hardware/+/36685?usp=email ) Change subject: icE1usb fw: Add AIS error flag and fill it along with LOS from linemon ...................................................................... icE1usb fw: Add AIS error flag and fill it along with LOS from linemon Now that we monitor low level line status, we can fill in a proper LOS signal along with the newly introduced AIS flag Signed-off-by: Sylvain Munaut <tnt(a)246tNt.com> Change-Id: Ied28b6b3da74f6a63a007fae889b571cc2c1e835 --- M firmware/ice40-riscv/icE1usb/e1.c M firmware/ice40-riscv/icE1usb/e1.h M firmware/ice40-riscv/icE1usb/ice1usb_proto.h 3 files changed, 46 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-e1-hardware refs/changes/85/36685/1 diff --git a/firmware/ice40-riscv/icE1usb/e1.c b/firmware/ice40-riscv/icE1usb/e1.c index 1582cec..6baee16 100644 --- a/firmware/ice40-riscv/icE1usb/e1.c +++ b/firmware/ice40-riscv/icE1usb/e1.c @@ -565,12 +565,18 @@ if (e1_regs->rx.csr & E1_RX_SR_ALIGNED) { e1_platform_led_set(port, E1P_LED_GREEN, E1P_LED_ST_ON); led_color(0, 48, 0); - e1->errors.flags &= ~(E1_ERR_F_LOS|E1_ERR_F_ALIGN_ERR); + e1->errors.flags &= ~( + E1_ERR_F_LOS | + E1_ERR_F_AIS | + E1_ERR_F_RAI | + E1_ERR_F_ALIGN_ERR + ); } else { e1_platform_led_set(port, E1P_LED_GREEN, E1P_LED_ST_BLINK); e1_platform_led_set(port, E1P_LED_YELLOW, E1P_LED_ST_OFF); led_color(48, 0, 0); - e1->errors.flags |= E1_ERR_F_ALIGN_ERR; + e1->errors.flags |= E1_ERR_F_ALIGN_ERR; + e1->errors.flags &= ~E1_ERR_F_RAI; /* TODO: completely off if rx tick counter not incrementing */ } @@ -748,7 +754,30 @@ /* Next cycle */ if (++cycle == 6) + { + /* We did one full cycle of data, update our local flags */ + for (int port=0; port<NUM_E1_PORTS; port++) + { + struct e1_state *e1 = _get_state(port); + if (e1->linemon.rx_pulse < 16) { + /* No pulse ? -> LOS */ + e1->errors.flags |= E1_ERR_F_LOS; + e1->errors.flags &= ~E1_ERR_F_AIS; + } else { + /* We have "some" pulses, so somone is talking */ + e1->errors.flags &= ~E1_ERR_F_LOS; + + /* If it's mostly ones, consider it AIS */ + if (e1->linemon.rx_one > 2040) + e1->errors.flags |= E1_ERR_F_AIS; + else + e1->errors.flags &= ~E1_ERR_F_AIS; + } + } + + /* Start over */ cycle = 0; + } } void diff --git a/firmware/ice40-riscv/icE1usb/e1.h b/firmware/ice40-riscv/icE1usb/e1.h index 883e1ec..1e8e747 100644 --- a/firmware/ice40-riscv/icE1usb/e1.h +++ b/firmware/ice40-riscv/icE1usb/e1.h @@ -35,6 +35,7 @@ #define E1_ERR_F_ALIGN_ERR 0x01 #define E1_ERR_F_LOS 0x02 #define E1_ERR_F_RAI 0x04 +#define E1_ERR_F_AIS 0x08 struct e1_error_count { uint16_t crc; diff --git a/firmware/ice40-riscv/icE1usb/ice1usb_proto.h b/firmware/ice40-riscv/icE1usb/ice1usb_proto.h index 8cf8439..8bc8fbb 100644 --- a/firmware/ice40-riscv/icE1usb/ice1usb_proto.h +++ b/firmware/ice40-riscv/icE1usb/ice1usb_proto.h @@ -143,6 +143,7 @@ #define ICE1USB_ERR_F_ALIGN_ERR 0x01 #define ICE1USB_ERR_F_LOS 0x02 #define ICE1USB_ERR_F_RAI 0x04 +#define ICE1USB_ERR_F_AIS 0x08 struct ice1usb_irq_err { /* 16-bit little-endian counters */ -- To view, visit https://gerrit.osmocom.org/c/osmo-e1-hardware/+/36685?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-e1-hardware Gerrit-Branch: master Gerrit-Change-Id: Ied28b6b3da74f6a63a007fae889b571cc2c1e835 Gerrit-Change-Number: 36685 Gerrit-PatchSet: 1 Gerrit-Owner: tnt <tnt(a)246tNt.com> Gerrit-MessageType: newchange
1 0
0 0
  • ← Newer
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • ...
  • 113
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.