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 -----
  • December
  • 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

  • 1 participants
  • 97203 discussions
Change in osmo-e1-hardware[master]: icE1usb fw: Distinguish between E1 FIFO init and reset
by tnt 12 Jan '22

12 Jan '22
tnt has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-e1-hardware/+/26851 ) Change subject: icE1usb fw: Distinguish between E1 FIFO init and reset ...................................................................... icE1usb fw: Distinguish between E1 FIFO init and reset Currently it's called 'reset' but really it's the init because it sets up the memory allocation and such. We rename that to e1f_init and introduce a true e1f_reset that only clears the fifo and resets the pointers Signed-off-by: Sylvain Munaut <tnt(a)246tNt.com> Change-Id: I425c38e93fb235d5c5fc6f3a5027ac49cf3466d9 --- M firmware/ice40-riscv/icE1usb/e1.c 1 file changed, 11 insertions(+), 4 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-e1-hardware refs/changes/51/26851/1 diff --git a/firmware/ice40-riscv/icE1usb/e1.c b/firmware/ice40-riscv/icE1usb/e1.c index ed3e13f..1b6d978 100644 --- a/firmware/ice40-riscv/icE1usb/e1.c +++ b/firmware/ice40-riscv/icE1usb/e1.c @@ -58,13 +58,20 @@ /* Utils */ static void -e1f_reset(struct e1_fifo *fifo, unsigned int base, unsigned int len) +e1f_init(struct e1_fifo *fifo, unsigned int base, unsigned int len) { memset(fifo, 0x00, sizeof(struct e1_fifo)); fifo->base = base; fifo->mask = len - 1; } +static void +e1f_reset(struct e1_fifo *fifo) +{ + fifo->wptr[0] = fifo->wptr[1] = 0; + fifo->rptr[0] = fifo->rptr[1] = 0; +} + static unsigned int e1f_allocd_frames(struct e1_fifo *fifo) { @@ -282,9 +289,9 @@ /* Global state init */ memset(e1, 0x00, sizeof(struct e1_state)); - /* Reset FIFOs */ - e1f_reset(&e1->rx.fifo, (512 * port) + 0, 256); - e1f_reset(&e1->tx.fifo, (512 * port) + 256, 256); + /* Initialize FIFOs */ + e1f_init(&e1->rx.fifo, (512 * port) + 0, 256); + e1f_init(&e1->tx.fifo, (512 * port) + 256, 256); /* Enable Rx */ e1->rx.cr = E1_RX_CR_ENABLE | (rx_cr & RXCR_PERMITTED); -- To view, visit https://gerrit.osmocom.org/c/osmo-e1-hardware/+/26851 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: I425c38e93fb235d5c5fc6f3a5027ac49cf3466d9 Gerrit-Change-Number: 26851 Gerrit-PatchSet: 1 Gerrit-Owner: tnt <tnt(a)246tNt.com> Gerrit-CC: Jenkins Builder Gerrit-MessageType: newchange
2 2
0 0
Change in osmo-e1-hardware[master]: icE1usb fw: Update LED status even in E1 FSM is in IDLE state
by tnt 12 Jan '22

12 Jan '22
tnt has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-e1-hardware/+/26852 ) Change subject: icE1usb fw: Update LED status even in E1 FSM is in IDLE state ...................................................................... icE1usb fw: Update LED status even in E1 FSM is in IDLE state Signed-off-by: Sylvain Munaut <tnt(a)246tNt.com> Change-Id: I82b867c4886c9f34ff685764424d3db9a8303789 --- M firmware/ice40-riscv/icE1usb/e1.c 1 file changed, 4 insertions(+), 4 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-e1-hardware refs/changes/52/26852/1 diff --git a/firmware/ice40-riscv/icE1usb/e1.c b/firmware/ice40-riscv/icE1usb/e1.c index 1b6d978..09bc6d2 100644 --- a/firmware/ice40-riscv/icE1usb/e1.c +++ b/firmware/ice40-riscv/icE1usb/e1.c @@ -444,10 +444,6 @@ uint32_t bd; unsigned int ofs; - /* Active ? */ - if ((e1->rx.state == IDLE) && (e1->tx.state == IDLE)) - return; - /* HACK: LED link status */ if (e1_regs->rx.csr & E1_RX_SR_ALIGNED) { e1_platform_led_set(port, E1P_LED_GREEN, E1P_LED_ST_ON); @@ -461,6 +457,10 @@ /* TODO: completely off if rx tick counter not incrementing */ } + /* Active ? */ + if ((e1->rx.state == IDLE) && (e1->tx.state == IDLE)) + return; + /* Recover any done TX BD */ while ( (bd = e1_regs->tx.bd) & E1_BD_VALID ) { e1f_multiframe_read_discard(&e1->tx.fifo); -- To view, visit https://gerrit.osmocom.org/c/osmo-e1-hardware/+/26852 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: I82b867c4886c9f34ff685764424d3db9a8303789 Gerrit-Change-Number: 26852 Gerrit-PatchSet: 1 Gerrit-Owner: tnt <tnt(a)246tNt.com> Gerrit-CC: Jenkins Builder Gerrit-MessageType: newchange
2 2
0 0
Change in osmo-e1-hardware[master]: icE1usb fw: Don't prefill feedback
by tnt 12 Jan '22

12 Jan '22
tnt has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-e1-hardware/+/26842 ) Change subject: icE1usb fw: Don't prefill feedback ...................................................................... icE1usb fw: Don't prefill feedback 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(a)246tNt.com> Change-Id: I6e97bc79d1fe50950bb1f7cd71d8c428e928d4ae --- M firmware/ice40-riscv/icE1usb/usb_e1.c 1 file changed, 0 insertions(+), 3 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-e1-hardware refs/changes/42/26842/1 diff --git a/firmware/ice40-riscv/icE1usb/usb_e1.c b/firmware/ice40-riscv/icE1usb/usb_e1.c index a18ebe4..032eec8 100644 --- a/firmware/ice40-riscv/icE1usb/usb_e1.c +++ b/firmware/ice40-riscv/icE1usb/usb_e1.c @@ -323,9 +323,6 @@ ep_regs->bd[0].csr = USB_BD_STATE_RDY_DATA | USB_BD_LEN(292); ep_regs->bd[1].csr = USB_BD_STATE_RDY_DATA | USB_BD_LEN(292); - /* EP Feedback: Pre-fill */ - _usb_fill_feedback_ep(port); - break; } -- To view, visit https://gerrit.osmocom.org/c/osmo-e1-hardware/+/26842 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: I6e97bc79d1fe50950bb1f7cd71d8c428e928d4ae Gerrit-Change-Number: 26842 Gerrit-PatchSet: 1 Gerrit-Owner: tnt <tnt(a)246tNt.com> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-MessageType: newchange
2 3
0 0
Change in osmo-e1-hardware[master]: icE1usb fw: Better flow regulation mechanism
by tnt 12 Jan '22

12 Jan '22
tnt has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-e1-hardware/+/26843 ) Change subject: icE1usb fw: Better flow regulation mechanism ...................................................................... icE1usb fw: Better flow regulation mechanism * 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(a)246tNt.com> Change-Id: Ibd3bc9080961cc56093e43ab9a824840e84c24d2 --- M firmware/ice40-riscv/icE1usb/e1.c M firmware/ice40-riscv/icE1usb/usb_e1.c 2 files changed, 19 insertions(+), 29 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-e1-hardware refs/changes/43/26843/1 diff --git a/firmware/ice40-riscv/icE1usb/e1.c b/firmware/ice40-riscv/icE1usb/e1.c index 6a87c12..f25e7c1 100644 --- a/firmware/ice40-riscv/icE1usb/e1.c +++ b/firmware/ice40-riscv/icE1usb/e1.c @@ -273,8 +273,8 @@ memset(e1, 0x00, sizeof(struct e1_state)); /* Reset FIFOs */ - e1f_reset(&e1->rx.fifo, (256 * port) + 0, 128); - e1f_reset(&e1->tx.fifo, (256 * port) + 128, 128); + e1f_reset(&e1->rx.fifo, (512 * port) + 0, 256); + e1f_reset(&e1->tx.fifo, (512 * port) + 256, 256); /* Enable Rx */ e1->rx.cr = E1_RX_CR_ENABLE | rx_cr; diff --git a/firmware/ice40-riscv/icE1usb/usb_e1.c b/firmware/ice40-riscv/icE1usb/usb_e1.c index 032eec8..08b192b 100644 --- a/firmware/ice40-riscv/icE1usb/usb_e1.c +++ b/firmware/ice40-riscv/icE1usb/usb_e1.c @@ -74,30 +74,25 @@ static void _usb_fill_feedback_ep(int port) { - static uint16_t ticks_prev = 0; - uint16_t ticks; - uint32_t val = 8192; - unsigned int level; - volatile struct usb_ep *ep_regs; + volatile struct usb_ep *ep_regs = _get_ep_regs(USB_EP_E1_FB(port)); - /* Compute real E1 tick count (with safety against bad values) */ - ticks = e1_tick_read(port); - val = (ticks - ticks_prev) & 0xffff; - ticks_prev = ticks; - if ((val < 7168) | (val > 9216)) - val = 8192; + /* Always ensure we're ready to send */ + if ((ep_regs->bd[0].csr & USB_BD_STATE_MSK) != USB_BD_STATE_RDY_DATA) + { + uint32_t val = 8192; - /* Bias depending on TX fifo level */ - level = e1_tx_level(port); - if (level < (3 * 16)) - val += 256; - else if (level > (8 * 16)) - val -= 256; + /* Add instant bias depending on TX fifo level */ + unsigned int level = e1_tx_level(port); - /* Prepare buffer */ - ep_regs = _get_ep_regs(USB_EP_E1_FB(port)); - usb_data_write(ep_regs->bd[0].ptr, &val, 4); - ep_regs->bd[0].csr = USB_BD_STATE_RDY_DATA | USB_BD_LEN(3); + if (level < (4 * 16)) + val += 256; + else if (level > (6 * 16)) + val -= 256; + + /* Fill buffer and submit it */ + usb_data_write(ep_regs->bd[0].ptr, &val, 4); + ep_regs->bd[0].csr = USB_BD_STATE_RDY_DATA | USB_BD_LEN(3); + } } @@ -212,12 +207,7 @@ } /* Feedback endpoint */ - ep_regs = _get_ep_regs(USB_EP_E1_FB(port)); - - if ((ep_regs->bd[0].csr & USB_BD_STATE_MSK) != USB_BD_STATE_RDY_DATA) - { - _usb_fill_feedback_ep(port); - } + _usb_fill_feedback_ep(port); } static enum usb_fnd_resp -- To view, visit https://gerrit.osmocom.org/c/osmo-e1-hardware/+/26843 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: Ibd3bc9080961cc56093e43ab9a824840e84c24d2 Gerrit-Change-Number: 26843 Gerrit-PatchSet: 1 Gerrit-Owner: tnt <tnt(a)246tNt.com> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-MessageType: newchange
2 5
0 0
Change in osmo-e1-hardware[master]: icE1usb fw: Disable the yellow led if LOS
by tnt 12 Jan '22

12 Jan '22
tnt has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-e1-hardware/+/26844 ) Change subject: icE1usb fw: Disable the yellow led if LOS ...................................................................... icE1usb fw: Disable the yellow led if LOS There is no remote side alarm if there is no remote-side ... Signed-off-by: Sylvain Munaut <tnt(a)246tNt.com> Change-Id: I78f43eded5ed6ffde9d86726ccee2b776a3f4675 --- M firmware/ice40-riscv/icE1usb/e1.c 1 file changed, 1 insertion(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-e1-hardware refs/changes/44/26844/1 diff --git a/firmware/ice40-riscv/icE1usb/e1.c b/firmware/ice40-riscv/icE1usb/e1.c index f25e7c1..af59f14 100644 --- a/firmware/ice40-riscv/icE1usb/e1.c +++ b/firmware/ice40-riscv/icE1usb/e1.c @@ -448,6 +448,7 @@ e1->errors.flags &= ~(E1_ERR_F_LOS|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; /* TODO: completely off if rx tick counter not incrementing */ -- To view, visit https://gerrit.osmocom.org/c/osmo-e1-hardware/+/26844 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: I78f43eded5ed6ffde9d86726ccee2b776a3f4675 Gerrit-Change-Number: 26844 Gerrit-PatchSet: 1 Gerrit-Owner: tnt <tnt(a)246tNt.com> Gerrit-MessageType: newchange
2 2
0 0
Change in osmo-e1-hardware[master]: icE1usb fw: Update list of debug commands
by tnt 12 Jan '22

12 Jan '22
tnt has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-e1-hardware/+/26845 ) Change subject: icE1usb fw: Update list of debug commands ...................................................................... icE1usb fw: Update list of debug commands Signed-off-by: Sylvain Munaut <tnt(a)246tNt.com> Change-Id: I25c3d1db5d9ffae1cf4de83aed89b6394d032dd8 --- M firmware/ice40-riscv/icE1usb/fw_app.c 1 file changed, 17 insertions(+), 9 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-e1-hardware refs/changes/45/26845/1 diff --git a/firmware/ice40-riscv/icE1usb/fw_app.c b/firmware/ice40-riscv/icE1usb/fw_app.c index 55218b8..f531d08 100644 --- a/firmware/ice40-riscv/icE1usb/fw_app.c +++ b/firmware/ice40-riscv/icE1usb/fw_app.c @@ -117,32 +117,40 @@ cmd = getchar_nowait(); if (cmd >= 0) { - if (cmd > 32 && cmd < 127) { + if (cmd > 32 && cmd < 127) putchar(cmd); - putchar('\r'); - putchar('\n'); - } + putchar('\r'); + putchar('\n'); switch (cmd) { - case 'p': - usb_debug_print(); - break; case 'b': boot_dfu(); break; - case 'o': + case 'p': + panic("Test panic"); + break; + case 'q': e1_debug_print(0, false); break; - case 'O': + case 'Q': e1_debug_print(0, true); break; + case 'w': + e1_debug_print(1, false); + break; + case 'W': + e1_debug_print(1, true); + break; case 'c': usb_connect(); break; case 'd': usb_disconnect(); break; + case 'u': + usb_debug_print(); + break; default: break; } -- To view, visit https://gerrit.osmocom.org/c/osmo-e1-hardware/+/26845 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: I25c3d1db5d9ffae1cf4de83aed89b6394d032dd8 Gerrit-Change-Number: 26845 Gerrit-PatchSet: 1 Gerrit-Owner: tnt <tnt(a)246tNt.com> Gerrit-MessageType: newchange
2 2
0 0
Change in osmo-e1-hardware[master]: icE1usb fw: Warn in case of unused variables
by tnt 12 Jan '22

12 Jan '22
tnt has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-e1-hardware/+/26846 ) Change subject: icE1usb fw: Warn in case of unused variables ...................................................................... icE1usb fw: Warn in case of unused variables Helps spot left overs from cleanups Signed-off-by: Sylvain Munaut <tnt(a)246tNt.com> Change-Id: Ib5a0b24bace3b9566d974382c90f4153734fc3f3 --- M firmware/ice40-riscv/icE1usb/Makefile 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/osmo-e1-hardware refs/changes/46/26846/1 diff --git a/firmware/ice40-riscv/icE1usb/Makefile b/firmware/ice40-riscv/icE1usb/Makefile index a8d18c9..b2f85d1 100644 --- a/firmware/ice40-riscv/icE1usb/Makefile +++ b/firmware/ice40-riscv/icE1usb/Makefile @@ -14,7 +14,7 @@ TARGET = $(GITVER) BOARD_DEFINE=BOARD_$(shell echo $(BOARD) | tr a-z\- A-Z_) -CFLAGS=-Wall -Wextra -Wno-unused -Os -march=rv32i -mabi=ilp32 -ffreestanding -flto -nostartfiles -fomit-frame-pointer -Wl,--gc-section --specs=nano.specs -D$(BOARD_DEFINE) -I. -I../common +CFLAGS=-Wall -Wextra -Wno-unused-parameter -Os -march=rv32i -mabi=ilp32 -ffreestanding -flto -nostartfiles -fomit-frame-pointer -Wl,--gc-section --specs=nano.specs -D$(BOARD_DEFINE) -I. -I../common NO2USB_FW_VERSION=0 include ../../../gateware/cores/no2usb/fw/fw.mk -- To view, visit https://gerrit.osmocom.org/c/osmo-e1-hardware/+/26846 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: Ib5a0b24bace3b9566d974382c90f4153734fc3f3 Gerrit-Change-Number: 26846 Gerrit-PatchSet: 1 Gerrit-Owner: tnt <tnt(a)246tNt.com> Gerrit-MessageType: newchange
2 2
0 0
Change in osmo-e1-hardware[master]: icE1usb fw: Tweak descriptors in preparation for dual port support
by tnt 12 Jan '22

12 Jan '22
tnt has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-e1-hardware/+/26840 ) Change subject: icE1usb fw: Tweak descriptors in preparation for dual port support ...................................................................... icE1usb fw: Tweak descriptors in preparation for dual port support 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(a)246tNt.com> Change-Id: I700adeb909e7955db0d15c6e2beade3d38b21e01 --- M firmware/ice40-riscv/icE1usb/usb_desc_app.c M firmware/ice40-riscv/icE1usb/usb_e1.c 2 files changed, 11 insertions(+), 13 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-e1-hardware refs/changes/40/26840/1 diff --git a/firmware/ice40-riscv/icE1usb/usb_desc_app.c b/firmware/ice40-riscv/icE1usb/usb_desc_app.c index ec01854..663be0b 100644 --- a/firmware/ice40-riscv/icE1usb/usb_desc_app.c +++ b/firmware/ice40-riscv/icE1usb/usb_desc_app.c @@ -90,7 +90,7 @@ .bEndpointAddress = USB_EP_E1_INT(0), .bmAttributes = 0x03, .wMaxPacketSize = 10, - .bInterval = 3, + .bInterval = 4, /* every 4 ms */ }, }, .on = { @@ -110,7 +110,7 @@ .bDescriptorType = USB_DT_EP, .bEndpointAddress = USB_EP_E1_IN(0), .bmAttributes = 0x05, - .wMaxPacketSize = 388, + .wMaxPacketSize = 292, .bInterval = 1, }, .ep_data_out = { @@ -118,7 +118,7 @@ .bDescriptorType = USB_DT_EP, .bEndpointAddress = USB_EP_E1_OUT(0), .bmAttributes = 0x05, - .wMaxPacketSize = 388, + .wMaxPacketSize = 292, .bInterval = 1, }, .ep_fb = { @@ -126,8 +126,8 @@ .bDescriptorType = USB_DT_EP, .bEndpointAddress = USB_EP_E1_FB(0), .bmAttributes = 0x11, - .wMaxPacketSize = 8, - .bInterval = 3, + .wMaxPacketSize = 3, + .bInterval = 3, /* every 2^(3-1) = 4 ms */ }, .ep_interrupt = { .bLength = sizeof(struct usb_ep_desc), @@ -135,7 +135,7 @@ .bEndpointAddress = USB_EP_E1_INT(0), .bmAttributes = 0x03, .wMaxPacketSize = 10, - .bInterval = 3, + .bInterval = 4, /* every 4 ms */ }, }, }, diff --git a/firmware/ice40-riscv/icE1usb/usb_e1.c b/firmware/ice40-riscv/icE1usb/usb_e1.c index 8e78ffa..75811c2 100644 --- a/firmware/ice40-riscv/icE1usb/usb_e1.c +++ b/firmware/ice40-riscv/icE1usb/usb_e1.c @@ -128,10 +128,8 @@ /* Get some data from E1 */ int n = e1_rx_level(0); - if (n > 64) - n = 12; - else if (n > 32) - n = 10; + if (n > 32) + n = 9; else if (n > 8) n = 8; else if (!n) @@ -177,7 +175,7 @@ refill: /* Refill it */ - ep_regs->bd[bdi].csr = USB_BD_STATE_RDY_DATA | USB_BD_LEN(388); + ep_regs->bd[bdi].csr = USB_BD_STATE_RDY_DATA | USB_BD_LEN(292); /* Next BDI */ bdi ^= 1; @@ -282,8 +280,8 @@ /* EP OUT: Queue two buffers */ ep_regs = _get_ep_regs(USB_EP_E1_FB(0)); - ep_regs->bd[0].csr = USB_BD_STATE_RDY_DATA | USB_BD_LEN(388); - ep_regs->bd[1].csr = USB_BD_STATE_RDY_DATA | USB_BD_LEN(388); + ep_regs->bd[0].csr = USB_BD_STATE_RDY_DATA | USB_BD_LEN(292); + ep_regs->bd[1].csr = USB_BD_STATE_RDY_DATA | USB_BD_LEN(292); /* EP Feedback: Pre-fill */ _usb_fill_feedback_ep(); -- To view, visit https://gerrit.osmocom.org/c/osmo-e1-hardware/+/26840 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: I700adeb909e7955db0d15c6e2beade3d38b21e01 Gerrit-Change-Number: 26840 Gerrit-PatchSet: 1 Gerrit-Owner: tnt <tnt(a)246tNt.com> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-MessageType: newchange
2 3
0 0
Change in osmo-e1-hardware[master]: icE1usb fw: Add multi-port support in USB code
by tnt 12 Jan '22

12 Jan '22
tnt has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-e1-hardware/+/26841 ) Change subject: icE1usb fw: Add multi-port support in USB code ...................................................................... icE1usb fw: Add multi-port support in USB code Signed-off-by: Sylvain Munaut <tnt(a)246tNt.com> Change-Id: I134410b542461c34339baa8d9120a5c86fc35d46 --- M firmware/ice40-riscv/icE1usb/fw_app.c M firmware/ice40-riscv/icE1usb/usb_desc_app.c M firmware/ice40-riscv/icE1usb/usb_desc_ids.h M firmware/ice40-riscv/icE1usb/usb_e1.c M firmware/ice40-riscv/icE1usb/usb_e1.h M firmware/ice40-riscv/icE1usb/usb_str_app.txt 6 files changed, 225 insertions(+), 82 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-e1-hardware refs/changes/41/26841/1 diff --git a/firmware/ice40-riscv/icE1usb/fw_app.c b/firmware/ice40-riscv/icE1usb/fw_app.c index 3340f4a..55218b8 100644 --- a/firmware/ice40-riscv/icE1usb/fw_app.c +++ b/firmware/ice40-riscv/icE1usb/fw_app.c @@ -102,6 +102,7 @@ /* Start */ e1_init(0, 0, 0); + e1_init(1, 0, 0); led_state(true); usb_connect(); @@ -151,7 +152,9 @@ usb_poll(); /* E1 poll */ - e1_poll(0); - usb_e1_run(); + for (int port=0; port<2; port++) { + e1_poll(port); + usb_e1_run(port); + } } } diff --git a/firmware/ice40-riscv/icE1usb/usb_desc_app.c b/firmware/ice40-riscv/icE1usb/usb_desc_app.c index 663be0b..22a81d3 100644 --- a/firmware/ice40-riscv/icE1usb/usb_desc_app.c +++ b/firmware/ice40-riscv/icE1usb/usb_desc_app.c @@ -39,7 +39,7 @@ struct usb_ep_desc ep_fb; struct usb_ep_desc ep_interrupt; } __attribute__ ((packed)) on; - } __attribute__ ((packed)) e1; + } __attribute__ ((packed)) e1[2]; /* CDC */ #if 0 @@ -71,7 +71,7 @@ .bmAttributes = 0x80, .bMaxPower = 0x32, /* 100 mA */ }, - .e1 = { + .e1[0] = { .off = { .intf = { .bLength = sizeof(struct usb_intf_desc), @@ -103,7 +103,7 @@ .bInterfaceClass = 0xff, .bInterfaceSubClass = 0xe1, .bInterfaceProtocol = 0x00, - .iInterface = 5, + .iInterface = 6, }, .ep_data_in = { .bLength = sizeof(struct usb_ep_desc), @@ -139,6 +139,74 @@ }, }, }, + .e1[1] = { + .off = { + .intf = { + .bLength = sizeof(struct usb_intf_desc), + .bDescriptorType = USB_DT_INTF, + .bInterfaceNumber = USB_INTF_E1(1), + .bAlternateSetting = 0, + .bNumEndpoints = 1, + .bInterfaceClass = 0xff, + .bInterfaceSubClass = 0xe1, + .bInterfaceProtocol = 0x00, + .iInterface = 7, + }, + .ep_interrupt = { + .bLength = sizeof(struct usb_ep_desc), + .bDescriptorType = USB_DT_EP, + .bEndpointAddress = USB_EP_E1_INT(1), + .bmAttributes = 0x03, + .wMaxPacketSize = 10, + .bInterval = 4, /* every 4 ms */ + }, + }, + .on = { + .intf = { + .bLength = sizeof(struct usb_intf_desc), + .bDescriptorType = USB_DT_INTF, + .bInterfaceNumber = USB_INTF_E1(1), + .bAlternateSetting = 1, + .bNumEndpoints = 4, + .bInterfaceClass = 0xff, + .bInterfaceSubClass = 0xe1, + .bInterfaceProtocol = 0x00, + .iInterface = 8, + }, + .ep_data_in = { + .bLength = sizeof(struct usb_ep_desc), + .bDescriptorType = USB_DT_EP, + .bEndpointAddress = USB_EP_E1_IN(1), + .bmAttributes = 0x05, + .wMaxPacketSize = 292, + .bInterval = 1, + }, + .ep_data_out = { + .bLength = sizeof(struct usb_ep_desc), + .bDescriptorType = USB_DT_EP, + .bEndpointAddress = USB_EP_E1_OUT(1), + .bmAttributes = 0x05, + .wMaxPacketSize = 292, + .bInterval = 1, + }, + .ep_fb = { + .bLength = sizeof(struct usb_ep_desc), + .bDescriptorType = USB_DT_EP, + .bEndpointAddress = USB_EP_E1_FB(1), + .bmAttributes = 0x11, + .wMaxPacketSize = 3, + .bInterval = 3, /* every 2^(3-1) = 4 ms */ + }, + .ep_interrupt = { + .bLength = sizeof(struct usb_ep_desc), + .bDescriptorType = USB_DT_EP, + .bEndpointAddress = USB_EP_E1_INT(1), + .bmAttributes = 0x03, + .wMaxPacketSize = 10, + .bInterval = 4, /* every 4 ms */ + }, + }, + }, #if 0 .cdc = { .intf_ctl = { @@ -150,7 +218,7 @@ .bInterfaceClass = USB_CLS_CDC_CONTROL, .bInterfaceSubClass = USB_CDC_SCLS_ACM, .bInterfaceProtocol = 0x00, - .iInterface = 6, + .iInterface = 9, }, .cdc_hdr = { .bLength = sizeof(struct usb_cdc_hdr_desc), @@ -188,7 +256,7 @@ .bInterfaceClass = USB_CLS_CDC_DATA, .bInterfaceSubClass = 0x00, .bInterfaceProtocol = 0x00, - .iInterface = 7, + .iInterface = 10, }, .ep_data_out = { .bLength = sizeof(struct usb_ep_desc), @@ -218,7 +286,7 @@ .bInterfaceClass = 0xfe, .bInterfaceSubClass = 0x01, .bInterfaceProtocol = 0x01, - .iInterface = 8, + .iInterface = 11, }, .func = { .bLength = sizeof(struct usb_dfu_func_desc), diff --git a/firmware/ice40-riscv/icE1usb/usb_desc_ids.h b/firmware/ice40-riscv/icE1usb/usb_desc_ids.h index 2247f84..00dbb34 100644 --- a/firmware/ice40-riscv/icE1usb/usb_desc_ids.h +++ b/firmware/ice40-riscv/icE1usb/usb_desc_ids.h @@ -8,8 +8,8 @@ #pragma once #define USB_INTF_E1(p) (0 + (p)) -#define USB_INTF_DFU 1 -#define USB_INTF_NUM 2 +#define USB_INTF_DFU 2 +#define USB_INTF_NUM 3 #define USB_EP_E1_IN(p) (0x82 + (3 * (p))) #define USB_EP_E1_OUT(p) (0x01 + (3 * (p))) diff --git a/firmware/ice40-riscv/icE1usb/usb_e1.c b/firmware/ice40-riscv/icE1usb/usb_e1.c index 75811c2..a18ebe4 100644 --- a/firmware/ice40-riscv/icE1usb/usb_e1.c +++ b/firmware/ice40-riscv/icE1usb/usb_e1.c @@ -16,17 +16,20 @@ #include "e1.h" #include "misc.h" #include "usb_desc_ids.h" +#include "utils.h" #include "ice1usb_proto.h" -struct { +struct usb_e1_state { bool running; /* are we running (transceiving USB data)? */ int out_bdi; /* buffer descriptor index for OUT EP */ int in_bdi; /* buffer descriptor index for IN EP */ struct ice1usb_tx_config tx_cfg; struct ice1usb_rx_config rx_cfg; struct e1_error_count last_err; -} g_usb_e1; +}; + +static struct usb_e1_state g_usb_e1[2]; /* default configuration at power-up */ static const struct ice1usb_tx_config tx_cfg_default = { @@ -47,8 +50,29 @@ return (ep & 0x80) ? &usb_ep_regs[ep & 0x1f].in : &usb_ep_regs[ep & 0x1f].out; } +static struct usb_e1_state * +_get_state(int port) +{ + if ((port < 0) || (port > 1)) + panic("_get_state invalid port %d", port); + return &g_usb_e1[port]; +} + +static int +_ifnum2port(uint8_t bInterfaceNumber) +{ + switch (bInterfaceNumber) { + case USB_INTF_E1(0): return 0; + case USB_INTF_E1(1): return 1; + default: + /* Don't panic since this will be handled as USB STALL */ + return -1; + } +} + + static void -_usb_fill_feedback_ep(void) +_usb_fill_feedback_ep(int port) { static uint16_t ticks_prev = 0; uint16_t ticks; @@ -57,41 +81,42 @@ volatile struct usb_ep *ep_regs; /* Compute real E1 tick count (with safety against bad values) */ - ticks = e1_tick_read(0); + ticks = e1_tick_read(port); val = (ticks - ticks_prev) & 0xffff; ticks_prev = ticks; if ((val < 7168) | (val > 9216)) val = 8192; /* Bias depending on TX fifo level */ - level = e1_tx_level(0); + level = e1_tx_level(port); if (level < (3 * 16)) val += 256; else if (level > (8 * 16)) val -= 256; /* Prepare buffer */ - ep_regs = _get_ep_regs(USB_EP_E1_FB(0)); + ep_regs = _get_ep_regs(USB_EP_E1_FB(port)); usb_data_write(ep_regs->bd[0].ptr, &val, 4); ep_regs->bd[0].csr = USB_BD_STATE_RDY_DATA | USB_BD_LEN(3); } void -usb_e1_run(void) +usb_e1_run(int port) { + struct usb_e1_state *usb_e1 = _get_state(port); volatile struct usb_ep *ep_regs; int bdi; - if (!g_usb_e1.running) + if (!usb_e1->running) return; /* Interrupt endpoint */ - ep_regs = _get_ep_regs(USB_EP_E1_INT(0)); + ep_regs = _get_ep_regs(USB_EP_E1_INT(port)); if ((ep_regs->bd[0].csr & USB_BD_STATE_MSK) != USB_BD_STATE_RDY_DATA) { - const struct e1_error_count *cur_err = e1_get_error_count(0); - if (memcmp(cur_err, &g_usb_e1.last_err, sizeof(*cur_err))) { + const struct e1_error_count *cur_err = e1_get_error_count(port); + if (memcmp(cur_err, &usb_e1->last_err, sizeof(*cur_err))) { struct ice1usb_irq errmsg = { .type = ICE1USB_IRQ_T_ERRCNT, .u = { @@ -107,13 +132,13 @@ printf("E"); usb_data_write(ep_regs->bd[0].ptr, &errmsg, sizeof(errmsg)); ep_regs->bd[0].csr = USB_BD_STATE_RDY_DATA | USB_BD_LEN(sizeof(errmsg)); - g_usb_e1.last_err = *cur_err; + usb_e1->last_err = *cur_err; } } /* Data IN endpoint */ - ep_regs = _get_ep_regs(USB_EP_E1_IN(0)); - bdi = g_usb_e1.in_bdi; + ep_regs = _get_ep_regs(USB_EP_E1_IN(port)); + bdi = usb_e1->in_bdi; while ((ep_regs->bd[bdi].csr & USB_BD_STATE_MSK) != USB_BD_STATE_RDY_DATA) { @@ -126,7 +151,7 @@ puts("Err EP IN\n"); /* Get some data from E1 */ - int n = e1_rx_level(0); + int n = e1_rx_level(port); if (n > 32) n = 9; @@ -135,7 +160,7 @@ else if (!n) break; - n = e1_rx_need_data(0, (ptr >> 2) + 1, n, &pos); + n = e1_rx_need_data(port, (ptr >> 2) + 1, n, &pos); /* Write header: currently version and pos (mfr/fr number) */ hdr = (0 << 28) | (pos & 0xff); @@ -146,12 +171,12 @@ /* Next BDI */ bdi ^= 1; - g_usb_e1.in_bdi = bdi; + usb_e1->in_bdi = bdi; } /* Data OUT endpoint */ - ep_regs = _get_ep_regs(USB_EP_E1_OUT(0)); - bdi = g_usb_e1.out_bdi; + ep_regs = _get_ep_regs(USB_EP_E1_OUT(port)); + bdi = usb_e1->out_bdi; while ((ep_regs->bd[bdi].csr & USB_BD_STATE_MSK) != USB_BD_STATE_RDY_DATA) { @@ -171,7 +196,7 @@ /* Empty data into the FIFO */ int n = ((int)(csr & USB_BD_LEN_MSK) - 6) / 32; if (n > 0) - e1_tx_feed_data(0, (ptr >> 2) + 1, n); + e1_tx_feed_data(port, (ptr >> 2) + 1, n); refill: /* Refill it */ @@ -179,7 +204,7 @@ /* Next BDI */ bdi ^= 1; - g_usb_e1.out_bdi = bdi; + usb_e1->out_bdi = bdi; static int x = 0; if ((x++ & 0xff) == 0xff) @@ -187,11 +212,11 @@ } /* Feedback endpoint */ - ep_regs = _get_ep_regs(USB_EP_E1_FB(0)); + ep_regs = _get_ep_regs(USB_EP_E1_FB(port)); if ((ep_regs->bd[0].csr & USB_BD_STATE_MSK) != USB_BD_STATE_RDY_DATA) { - _usb_fill_feedback_ep(); + _usb_fill_feedback_ep(port); } } @@ -204,24 +229,28 @@ if (!conf) return USB_FND_SUCCESS; - intf = usb_desc_find_intf(conf, USB_INTF_E1(0), 0, NULL); - if (!intf) - return USB_FND_ERROR; + for (int port=0; port<2; port++) + { + intf = usb_desc_find_intf(conf, USB_INTF_E1(port), 0, NULL); + if (!intf) + return USB_FND_ERROR; - printf("e1 set_conf %08x\n", intf); + printf("e1 set_conf[%d] %08x\n", port, intf); - usb_ep_boot(intf, USB_EP_E1_IN(0), true); - usb_ep_boot(intf, USB_EP_E1_OUT(0), true); - usb_ep_boot(intf, USB_EP_E1_FB(0), false); - usb_ep_boot(intf, USB_EP_E1_INT(0), false); + usb_ep_boot(intf, USB_EP_E1_IN(port), true); + usb_ep_boot(intf, USB_EP_E1_OUT(port), true); + usb_ep_boot(intf, USB_EP_E1_FB(port), false); + usb_ep_boot(intf, USB_EP_E1_INT(port), false); + } return USB_FND_SUCCESS; } -static void _perform_tx_config(void) +static void _perform_tx_config(int port) { - const struct ice1usb_tx_config *cfg = &g_usb_e1.tx_cfg; - e1_tx_config(0, + struct usb_e1_state *usb_e1 = _get_state(port); + const struct ice1usb_tx_config *cfg = &usb_e1->tx_cfg; + e1_tx_config(port, ((cfg->mode & 3) << 1) | ((cfg->timing & 1) << 3) | ((cfg->alarm & 1) << 4) | @@ -229,10 +258,11 @@ ); } -static void _perform_rx_config(void) +static void _perform_rx_config(int port) { - const struct ice1usb_rx_config *cfg = &g_usb_e1.rx_cfg; - e1_rx_config(0, + struct usb_e1_state *usb_e1 = _get_state(port); + const struct ice1usb_rx_config *cfg = &usb_e1->rx_cfg; + e1_rx_config(port, (cfg->mode << 1) ); } @@ -241,50 +271,60 @@ _e1_set_intf(const struct usb_intf_desc *base, const struct usb_intf_desc *sel) { volatile struct usb_ep *ep_regs; + struct usb_e1_state *usb_e1; + int port; - /* Validity checks */ + /* Is it for E1 interface ? */ if ((base->bInterfaceClass != 0xff) || (base->bInterfaceSubClass != 0xe1)) return USB_FND_CONTINUE; + /* Get matching port (if any) */ + port = _ifnum2port(base->bInterfaceNumber); + if (port < 0) + return USB_FND_ERROR; + + usb_e1 = _get_state(port); + + /* Valid setting ? */ if (sel->bAlternateSetting > 1) return USB_FND_ERROR; /* Don't do anything if no change */ - if (g_usb_e1.running == (sel->bAlternateSetting != 0)) + if (usb_e1->running == (sel->bAlternateSetting != 0)) return USB_FND_SUCCESS; - g_usb_e1.running = (sel->bAlternateSetting != 0); + usb_e1->running = (sel->bAlternateSetting != 0); /* Reconfigure the endpoints */ - usb_ep_reconf(sel, USB_EP_E1_IN(0)); - usb_ep_reconf(sel, USB_EP_E1_OUT(0)); - usb_ep_reconf(sel, USB_EP_E1_FB(0)); - usb_ep_reconf(sel, USB_EP_E1_INT(0)); + usb_ep_reconf(sel, USB_EP_E1_IN(port)); + usb_ep_reconf(sel, USB_EP_E1_OUT(port)); + usb_ep_reconf(sel, USB_EP_E1_FB(port)); + usb_ep_reconf(sel, USB_EP_E1_INT(port)); /* Update E1 and USB state */ - switch (g_usb_e1.running) { + switch (usb_e1->running) { case false: /* Disable E1 rx/tx */ - e1_init(0, 0, 0); + e1_init(port, 0, 0); break; case true: /* Reset and Re-Enable E1 */ - e1_init(0, 0, 0); - _perform_rx_config(); - _perform_tx_config(); + e1_init(port, 0, 0); + _perform_rx_config(port); + _perform_tx_config(port); /* Reset BDI */ - g_usb_e1.in_bdi = 0; - g_usb_e1.out_bdi = 0; + usb_e1->in_bdi = 0; + usb_e1->out_bdi = 0; /* EP OUT: Queue two buffers */ - ep_regs = _get_ep_regs(USB_EP_E1_FB(0)); + ep_regs = _get_ep_regs(USB_EP_E1_OUT(port)); ep_regs->bd[0].csr = USB_BD_STATE_RDY_DATA | USB_BD_LEN(292); ep_regs->bd[1].csr = USB_BD_STATE_RDY_DATA | USB_BD_LEN(292); /* EP Feedback: Pre-fill */ - _usb_fill_feedback_ep(); + _usb_fill_feedback_ep(port); break; } @@ -295,10 +335,22 @@ static enum usb_fnd_resp _e1_get_intf(const struct usb_intf_desc *base, uint8_t *alt) { + struct usb_e1_state *usb_e1; + int port; + + /* Is it for E1 interface ? */ if ((base->bInterfaceClass != 0xff) || (base->bInterfaceSubClass != 0xe1)) return USB_FND_CONTINUE; - *alt = g_usb_e1.running ? 1 : 0; + /* Get matching port (if any) */ + port = _ifnum2port(base->bInterfaceNumber); + if (port < 0) + return USB_FND_ERROR; + + usb_e1 = _get_state(port); + + /* Return current alt-setting */ + *alt = usb_e1->running ? 1 : 0; return USB_FND_SUCCESS; } @@ -307,10 +359,13 @@ _set_tx_mode_done(struct usb_xfer *xfer) { const struct ice1usb_tx_config *cfg = (const struct ice1usb_tx_config *) xfer->data; - printf("set_tx_mode %02x%02x%02x%02x\r\n", + struct usb_ctrl_req *req = xfer->cb_ctx; + int port = _ifnum2port(req->wIndex); + struct usb_e1_state *usb_e1 = _get_state(port); + printf("set_tx_mode[%d] %02x%02x%02x%02x\r\n", port, xfer->data[0], xfer->data[1], xfer->data[2], xfer->data[3]); - g_usb_e1.tx_cfg = *cfg; - _perform_tx_config(); + usb_e1->tx_cfg = *cfg; + _perform_tx_config(port); return true; } @@ -318,9 +373,12 @@ _set_rx_mode_done(struct usb_xfer *xfer) { const struct ice1usb_rx_config *cfg = (const struct ice1usb_rx_config *) xfer->data; - printf("set_rx_mode %02x\r\n", xfer->data[0]); - g_usb_e1.rx_cfg = *cfg; - _perform_rx_config(); + struct usb_ctrl_req *req = xfer->cb_ctx; + int port = _ifnum2port(req->wIndex); + struct usb_e1_state *usb_e1 = _get_state(port); + printf("set_rx_mode[%d] %02x\r\n", port, xfer->data[0]); + usb_e1->rx_cfg = *cfg; + _perform_rx_config(port); return true; } @@ -328,8 +386,17 @@ static enum usb_fnd_resp _e1_ctrl_req_intf(struct usb_ctrl_req *req, struct usb_xfer *xfer) { - unsigned int i; + struct usb_e1_state *usb_e1; + int port; + /* Get matching port (if any) */ + port = _ifnum2port(req->wIndex); + if (port < 0) + return USB_FND_CONTINUE; + + usb_e1 = _get_state(port); + + /* Process request */ switch (req->bRequest) { case ICE1USB_INTF_GET_CAPABILITIES: /* no optional capabilities yet */ @@ -345,7 +412,7 @@ case ICE1USB_INTF_GET_TX_CFG: if (req->wLength < sizeof(struct ice1usb_tx_config)) return USB_FND_ERROR; - memcpy(xfer->data, &g_usb_e1.tx_cfg, sizeof(struct ice1usb_tx_config)); + memcpy(xfer->data, &usb_e1->tx_cfg, sizeof(struct ice1usb_tx_config)); xfer->len = sizeof(struct ice1usb_tx_config); break; case ICE1USB_INTF_SET_RX_CFG: @@ -358,7 +425,7 @@ case ICE1USB_INTF_GET_RX_CFG: if (req->wLength < sizeof(struct ice1usb_rx_config)) return USB_FND_ERROR; - memcpy(xfer->data, &g_usb_e1.rx_cfg, sizeof(struct ice1usb_rx_config)); + memcpy(xfer->data, &usb_e1->rx_cfg, sizeof(struct ice1usb_rx_config)); xfer->len = sizeof(struct ice1usb_rx_config); break; default: @@ -396,8 +463,6 @@ case USB_REQ_RCPT_DEV: return _e1_ctrl_req_dev(req, xfer); case USB_REQ_RCPT_INTF: - if (req->wIndex != USB_INTF_E1(0)) - return USB_FND_CONTINUE; return _e1_ctrl_req_intf(req, xfer); case USB_REQ_RCPT_EP: case USB_REQ_RCPT_OTHER: @@ -417,8 +482,12 @@ void usb_e1_init(void) { - memset(&g_usb_e1, 0x00, sizeof(g_usb_e1)); - g_usb_e1.tx_cfg = tx_cfg_default; - g_usb_e1.rx_cfg = rx_cfg_default; + for (int i=0; i<2; i++) { + struct usb_e1_state *usb_e1 = _get_state(i); + memset(usb_e1, 0x00, sizeof(struct usb_e1_state)); + usb_e1->tx_cfg = tx_cfg_default; + usb_e1->rx_cfg = rx_cfg_default; + } + usb_register_function_driver(&_e1_drv); } diff --git a/firmware/ice40-riscv/icE1usb/usb_e1.h b/firmware/ice40-riscv/icE1usb/usb_e1.h index a573b38..06723ea 100644 --- a/firmware/ice40-riscv/icE1usb/usb_e1.h +++ b/firmware/ice40-riscv/icE1usb/usb_e1.h @@ -7,5 +7,5 @@ #pragma once -void usb_e1_run(void); +void usb_e1_run(int port); void usb_e1_init(void); diff --git a/firmware/ice40-riscv/icE1usb/usb_str_app.txt b/firmware/ice40-riscv/icE1usb/usb_str_app.txt index 10887d3..3aa6b4a 100644 --- a/firmware/ice40-riscv/icE1usb/usb_str_app.txt +++ b/firmware/ice40-riscv/icE1usb/usb_str_app.txt @@ -2,7 +2,10 @@ osmocom icE1usb Main -E1 -Console (control) -Console (data) +E1 port 0 (disabled) +E1 port 0 +E1 port 1 (disabled) +E1 port 1 +GPS (CDC control) +GPS (CDC data) DFU runtime -- To view, visit https://gerrit.osmocom.org/c/osmo-e1-hardware/+/26841 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: I134410b542461c34339baa8d9120a5c86fc35d46 Gerrit-Change-Number: 26841 Gerrit-PatchSet: 1 Gerrit-Owner: tnt <tnt(a)246tNt.com> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-MessageType: newchange
2 6
0 0
Change in osmo-e1-hardware[master]: icE1usb fw: Use 'int' as the default type for port index
by tnt 12 Jan '22

12 Jan '22
tnt has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-e1-hardware/+/26837 ) Change subject: icE1usb fw: Use 'int' as the default type for port index ...................................................................... icE1usb fw: Use 'int' as the default type for port index No benefit to use uint8_t and for consistency with later patches, use 'int' here too. Signed-off-by: Sylvain Munaut <tnt(a)246tNt.com> Change-Id: I50a76476af844acf20436b9d410cb917b723590d --- M firmware/ice40-riscv/icE1usb/e1.h M firmware/ice40-riscv/icE1usb/misc.c 2 files changed, 2 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-e1-hardware refs/changes/37/26837/1 diff --git a/firmware/ice40-riscv/icE1usb/e1.h b/firmware/ice40-riscv/icE1usb/e1.h index 9ceffdd..862d568 100644 --- a/firmware/ice40-riscv/icE1usb/e1.h +++ b/firmware/ice40-riscv/icE1usb/e1.h @@ -57,5 +57,5 @@ E1P_LED_ST_BLINK_FAST = 3 }; -extern void e1_platform_led_set(uint8_t port, enum e1_platform_led led, +extern void e1_platform_led_set(int port, enum e1_platform_led led, enum e1_platform_led_state state); diff --git a/firmware/ice40-riscv/icE1usb/misc.c b/firmware/ice40-riscv/icE1usb/misc.c index 3117be9..a25bcc5 100644 --- a/firmware/ice40-riscv/icE1usb/misc.c +++ b/firmware/ice40-riscv/icE1usb/misc.c @@ -53,7 +53,7 @@ } void -e1_platform_led_set(uint8_t port, enum e1_platform_led led, +e1_platform_led_set(int port, enum e1_platform_led led, enum e1_platform_led_state state) { uint32_t tmp; -- To view, visit https://gerrit.osmocom.org/c/osmo-e1-hardware/+/26837 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: I50a76476af844acf20436b9d410cb917b723590d Gerrit-Change-Number: 26837 Gerrit-PatchSet: 1 Gerrit-Owner: tnt <tnt(a)246tNt.com> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-MessageType: newchange
2 5
0 0
  • ← Newer
  • 1
  • ...
  • 9693
  • 9694
  • 9695
  • 9696
  • 9697
  • 9698
  • 9699
  • ...
  • 9721
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.