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: Expose the ticks from multiple E1 ports in misc.{c,h}
by tnt 12 Jan '22

12 Jan '22
tnt has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-e1-hardware/+/26838 ) Change subject: icE1usb fw: Expose the ticks from multiple E1 ports in misc.{c,h} ...................................................................... icE1usb fw: Expose the ticks from multiple E1 ports in misc.{c,h} Signed-off-by: Sylvain Munaut <tnt(a)246tNt.com> Change-Id: I4dfdeecb6d3a25025095cd017ebbf74aee41c8b2 --- M firmware/ice40-riscv/icE1usb/misc.c M firmware/ice40-riscv/icE1usb/misc.h M firmware/ice40-riscv/icE1usb/usb_e1.c 3 files changed, 4 insertions(+), 4 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-e1-hardware refs/changes/38/26838/1 diff --git a/firmware/ice40-riscv/icE1usb/misc.c b/firmware/ice40-riscv/icE1usb/misc.c index a25bcc5..4b32fcd 100644 --- a/firmware/ice40-riscv/icE1usb/misc.c +++ b/firmware/ice40-riscv/icE1usb/misc.c @@ -71,9 +71,9 @@ } uint16_t -e1_tick_read(void) +e1_tick_read(int port) { - return misc_regs->e1_tick[0].tx; + return misc_regs->e1_tick[port].tx; } void diff --git a/firmware/ice40-riscv/icE1usb/misc.h b/firmware/ice40-riscv/icE1usb/misc.h index 69c0da7..dac5730 100644 --- a/firmware/ice40-riscv/icE1usb/misc.h +++ b/firmware/ice40-riscv/icE1usb/misc.h @@ -27,6 +27,6 @@ void pdm_set(int chan, bool enable, unsigned value, bool normalize); void e1_led_set(bool enable, uint8_t cfg); -uint16_t e1_tick_read(void); +uint16_t e1_tick_read(int port); void reboot(int fw); diff --git a/firmware/ice40-riscv/icE1usb/usb_e1.c b/firmware/ice40-riscv/icE1usb/usb_e1.c index ed4826f..fe94698 100644 --- a/firmware/ice40-riscv/icE1usb/usb_e1.c +++ b/firmware/ice40-riscv/icE1usb/usb_e1.c @@ -57,7 +57,7 @@ volatile struct usb_ep *ep_regs; /* Compute real E1 tick count (with safety against bad values) */ - ticks = e1_tick_read(); + ticks = e1_tick_read(0); val = (ticks - ticks_prev) & 0xffff; ticks_prev = ticks; if ((val < 7168) | (val > 9216)) -- To view, visit https://gerrit.osmocom.org/c/osmo-e1-hardware/+/26838 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: I4dfdeecb6d3a25025095cd017ebbf74aee41c8b2 Gerrit-Change-Number: 26838 Gerrit-PatchSet: 1 Gerrit-Owner: tnt <tnt(a)246tNt.com> Gerrit-MessageType: newchange
2 3
0 0
Change in osmo-e1-hardware[master]: icE1usb fw: Add multi-port support for e1.{c,h}
by tnt 12 Jan '22

12 Jan '22
tnt has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-e1-hardware/+/26839 ) Change subject: icE1usb fw: Add multi-port support for e1.{c,h} ...................................................................... icE1usb fw: Add multi-port support for e1.{c,h} Currently all the users of those function just statically use port 0 only. Signed-off-by: Sylvain Munaut <tnt(a)246tNt.com> Change-Id: I17671be65543f5a2bf3d16ba2b5a5081eb38ebdf --- M firmware/ice40-riscv/icE1usb/e1.c M firmware/ice40-riscv/icE1usb/e1.h M firmware/ice40-riscv/icE1usb/fw_app.c M firmware/ice40-riscv/icE1usb/usb_e1.c 4 files changed, 151 insertions(+), 110 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-e1-hardware refs/changes/39/26839/1 diff --git a/firmware/ice40-riscv/icE1usb/e1.c b/firmware/ice40-riscv/icE1usb/e1.c index 6a4c73c..6a87c12 100644 --- a/firmware/ice40-riscv/icE1usb/e1.c +++ b/firmware/ice40-riscv/icE1usb/e1.c @@ -16,12 +16,13 @@ #include "dma.h" #include "led.h" // FIXME +#include "utils.h" // HW access // --------- -static volatile struct e1_core * const e1_regs = (void *)(E1_CORE_BASE); +static volatile struct e1_core * const e1_regs_base = (void *)(E1_CORE_BASE); static volatile uint8_t * const e1_data = (void *)(E1_DATA_BASE); @@ -224,7 +225,7 @@ RECOVER = 3, /* after underflow, overflow or alignment error */ }; -static struct { +struct e1_state { struct { uint32_t cr; struct e1_fifo fifo; @@ -240,30 +241,52 @@ } tx; struct e1_error_count errors; -} g_e1; +}; + +static struct e1_state g_e1[2]; + + +static volatile struct e1_core * +_get_regs(int port) +{ + if ((port < 0) || (port > 1)) + panic("_get_regs invalid port %d", port); + return &e1_regs_base[port]; +} + +static struct e1_state * +_get_state(int port) +{ + if ((port < 0) || (port > 1)) + panic("_get_state invalid port %d", port); + return &g_e1[port]; +} void -e1_init(uint16_t rx_cr, uint16_t tx_cr) +e1_init(int port, uint16_t rx_cr, uint16_t tx_cr) { + volatile struct e1_core *e1_regs = _get_regs(port); + struct e1_state *e1 = _get_state(port); + /* Global state init */ - memset(&g_e1, 0x00, sizeof(g_e1)); + memset(e1, 0x00, sizeof(struct e1_state)); /* Reset FIFOs */ - e1f_reset(&g_e1.rx.fifo, 0, 128); - e1f_reset(&g_e1.tx.fifo, 128, 128); + e1f_reset(&e1->rx.fifo, (256 * port) + 0, 128); + e1f_reset(&e1->tx.fifo, (256 * port) + 128, 128); /* Enable Rx */ - g_e1.rx.cr = E1_RX_CR_ENABLE | rx_cr; - e1_regs->rx.csr = E1_RX_CR_OVFL_CLR | g_e1.rx.cr; + e1->rx.cr = E1_RX_CR_ENABLE | rx_cr; + e1_regs->rx.csr = E1_RX_CR_OVFL_CLR | e1->rx.cr; /* Enable Tx */ - g_e1.tx.cr = E1_TX_CR_ENABLE | tx_cr; - e1_regs->tx.csr = E1_TX_CR_UNFL_CLR | g_e1.tx.cr; + e1->tx.cr = E1_TX_CR_ENABLE | tx_cr; + e1_regs->tx.csr = E1_TX_CR_UNFL_CLR | e1->tx.cr; /* State */ - g_e1.rx.state = BOOT; - g_e1.tx.state = BOOT; + e1->rx.state = BOOT; + e1->tx.state = BOOT; } #define TXCR_PERMITTED ( \ @@ -274,25 +297,30 @@ E1_TX_CR_LOOPBACK_CROSS ) void -e1_tx_config(uint16_t cr) +e1_tx_config(int port, uint16_t cr) { - g_e1.tx.cr = (g_e1.tx.cr & ~TXCR_PERMITTED) | (cr & TXCR_PERMITTED); - e1_regs->tx.csr = g_e1.tx.cr; + volatile struct e1_core *e1_regs = _get_regs(port); + struct e1_state *e1 = _get_state(port); + e1->tx.cr = (e1->tx.cr & ~TXCR_PERMITTED) | (cr & TXCR_PERMITTED); + e1_regs->tx.csr = e1->tx.cr; } #define RXCR_PERMITTED ( \ E1_RX_CR_MODE_MFA ) void -e1_rx_config(uint16_t cr) +e1_rx_config(int port, uint16_t cr) { - g_e1.rx.cr = (g_e1.rx.cr & ~RXCR_PERMITTED) | (cr & RXCR_PERMITTED); - e1_regs->rx.csr = g_e1.rx.cr; + volatile struct e1_core *e1_regs = _get_regs(port); + struct e1_state *e1 = _get_state(port); + e1->rx.cr = (e1->rx.cr & ~RXCR_PERMITTED) | (cr & RXCR_PERMITTED); + e1_regs->rx.csr = e1->rx.cr; } unsigned int -e1_rx_need_data(unsigned int usb_addr, unsigned int max_frames, unsigned int *pos) +e1_rx_need_data(int port, unsigned int usb_addr, unsigned int max_frames, unsigned int *pos) { + struct e1_state *e1 = _get_state(port); bool rai_received = false; bool rai_possible = false; unsigned int ofs; @@ -301,13 +329,13 @@ while (max_frames) { /* Get some data from the FIFO */ - n_frames = e1f_frame_read(&g_e1.rx.fifo, &ofs, max_frames); + n_frames = e1f_frame_read(&e1->rx.fifo, &ofs, max_frames); if (!n_frames) break; /* Give pos */ if (pos) { - *pos = ofs & g_e1.rx.fifo.mask; + *pos = ofs & e1->rx.fifo.mask; pos = NULL; } @@ -339,11 +367,11 @@ if (rai_possible) { if (rai_received) { - g_e1.errors.flags |= E1_ERR_F_RAI; - e1_platform_led_set(0, E1P_LED_YELLOW, E1P_LED_ST_ON); + e1->errors.flags |= E1_ERR_F_RAI; + e1_platform_led_set(port, E1P_LED_YELLOW, E1P_LED_ST_ON); } else { - g_e1.errors.flags &= ~E1_ERR_F_RAI; - e1_platform_led_set(0, E1P_LED_YELLOW, E1P_LED_ST_OFF); + e1->errors.flags &= ~E1_ERR_F_RAI; + e1_platform_led_set(port, E1P_LED_YELLOW, E1P_LED_ST_OFF); } } @@ -351,16 +379,18 @@ } unsigned int -e1_tx_feed_data(unsigned int usb_addr, unsigned int frames) +e1_tx_feed_data(int port, unsigned int usb_addr, unsigned int frames) { + struct e1_state *e1 = _get_state(port); unsigned int ofs; int n_frames; while (frames) { /* Get some space in FIFO */ - n_frames = e1f_frame_write(&g_e1.tx.fifo, &ofs, frames); + n_frames = e1f_frame_write(&e1->tx.fifo, &ofs, frames); if (!n_frames) { - printf("[!] TX FIFO Overflow %d %d\n", frames, n_frames); + printf("[!] TX FIFO Overflow (port=%d, req=%d, done=%d)\n", port, frames, n_frames); + e1f_debug(&e1->tx.fifo, "TX"); break; } @@ -379,65 +409,70 @@ } unsigned int -e1_tx_level(void) +e1_tx_level(int port) { - return e1f_valid_frames(&g_e1.tx.fifo); + struct e1_state *e1 = _get_state(port); + return e1f_valid_frames(&e1->tx.fifo); } unsigned int -e1_rx_level(void) +e1_rx_level(int port) { - return e1f_valid_frames(&g_e1.rx.fifo); + struct e1_state *e1 = _get_state(port); + return e1f_valid_frames(&e1->rx.fifo); } const struct e1_error_count * -e1_get_error_count(void) +e1_get_error_count(int port) { - return &g_e1.errors; + struct e1_state *e1 = _get_state(port); + return &e1->errors; } void -e1_poll(void) +e1_poll(int port) { + volatile struct e1_core *e1_regs = _get_regs(port); + struct e1_state *e1 = _get_state(port); uint32_t bd; unsigned int ofs; /* Active ? */ - if ((g_e1.rx.state == IDLE) && (g_e1.tx.state == IDLE)) + 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(0, E1P_LED_GREEN, E1P_LED_ST_ON); + e1_platform_led_set(port, E1P_LED_GREEN, E1P_LED_ST_ON); led_color(0, 48, 0); - g_e1.errors.flags &= ~(E1_ERR_F_LOS|E1_ERR_F_ALIGN_ERR); + e1->errors.flags &= ~(E1_ERR_F_LOS|E1_ERR_F_ALIGN_ERR); } else { - e1_platform_led_set(0, E1P_LED_GREEN, E1P_LED_ST_BLINK); + e1_platform_led_set(port, E1P_LED_GREEN, E1P_LED_ST_BLINK); led_color(48, 0, 0); - g_e1.errors.flags |= E1_ERR_F_ALIGN_ERR; + e1->errors.flags |= E1_ERR_F_ALIGN_ERR; /* TODO: completely off if rx tick counter not incrementing */ } /* Recover any done TX BD */ while ( (bd = e1_regs->tx.bd) & E1_BD_VALID ) { - e1f_multiframe_read_discard(&g_e1.tx.fifo); - g_e1.tx.in_flight--; + e1f_multiframe_read_discard(&e1->tx.fifo); + e1->tx.in_flight--; } /* Recover any done RX BD */ while ( (bd = e1_regs->rx.bd) & E1_BD_VALID ) { /* FIXME: CRC status ? */ - e1f_multiframe_write_commit(&g_e1.rx.fifo); + e1f_multiframe_write_commit(&e1->rx.fifo); if ((bd & (E1_BD_CRC0 | E1_BD_CRC1)) != (E1_BD_CRC0 | E1_BD_CRC1)) { - printf("b: %03x\n", bd); - g_e1.errors.crc++; + printf("[!] E1 crc err (port=%d, bd=%03x)\n", port, bd); + e1->errors.crc++; } - g_e1.rx.in_flight--; + e1->rx.in_flight--; } /* Boot procedure */ - if (g_e1.tx.state == BOOT) { - if (e1f_unseen_frames(&g_e1.tx.fifo) < (16 * 5)) + if (e1->tx.state == BOOT) { + if (e1f_unseen_frames(&e1->tx.fifo) < (16 * 5)) return; /* HACK: LED flow status */ led_blink(true, 200, 1000); @@ -446,88 +481,90 @@ /* Handle RX */ /* Misalign ? */ - if (g_e1.rx.state == RUN) { + if (e1->rx.state == RUN) { if (!(e1_regs->rx.csr & E1_RX_SR_ALIGNED)) { - printf("[!] E1 rx misalign\n"); - g_e1.rx.state = RECOVER; - g_e1.errors.align++; + printf("[!] E1 rx misalign (port=%d)\n", port); + e1->rx.state = RECOVER; + e1->errors.align++; } } /* Overflow ? */ - if (g_e1.rx.state == RUN) { + if (e1->rx.state == RUN) { if (e1_regs->rx.csr & E1_RX_SR_OVFL) { - printf("[!] E1 overflow %d\n", g_e1.rx.in_flight); - g_e1.rx.state = RECOVER; - g_e1.errors.ovfl++; + printf("[!] E1 overflow (port=%d, inf=%d)\n", port, e1->rx.in_flight); + e1->rx.state = RECOVER; + e1->errors.ovfl++; } } /* Recover ready ? */ - if (g_e1.rx.state == RECOVER) { - if (g_e1.rx.in_flight != 0) + if (e1->rx.state == RECOVER) { + if (e1->rx.in_flight != 0) goto done_rx; - e1f_multiframe_empty(&g_e1.rx.fifo); + e1f_multiframe_empty(&e1->rx.fifo); } /* Fill new RX BD */ - while (g_e1.rx.in_flight < 4) { - if (!e1f_multiframe_write_prepare(&g_e1.rx.fifo, &ofs)) + while (e1->rx.in_flight < 4) { + if (!e1f_multiframe_write_prepare(&e1->rx.fifo, &ofs)) break; e1_regs->rx.bd = e1f_ofs_to_mf(ofs); - g_e1.rx.in_flight++; + e1->rx.in_flight++; } /* Clear overflow if needed */ - if (g_e1.rx.state != RUN) { - e1_regs->rx.csr = g_e1.rx.cr | E1_RX_CR_OVFL_CLR; - g_e1.rx.state = RUN; + if (e1->rx.state != RUN) { + e1_regs->rx.csr = e1->rx.cr | E1_RX_CR_OVFL_CLR; + e1->rx.state = RUN; } done_rx: /* Handle TX */ /* Underflow ? */ - if (g_e1.tx.state == RUN) { + if (e1->tx.state == RUN) { if (e1_regs->tx.csr & E1_TX_SR_UNFL) { - printf("[!] E1 underflow %d\n", g_e1.tx.in_flight); - g_e1.tx.state = RECOVER; - g_e1.errors.unfl++; + printf("[!] E1 underflow (port=%d, inf=%d)\n", port, e1->tx.in_flight); + e1->tx.state = RECOVER; + e1->errors.unfl++; } } /* Recover ready ? */ - if (g_e1.tx.state == RECOVER) { - if (e1f_unseen_frames(&g_e1.tx.fifo) < (16 * 5)) + if (e1->tx.state == RECOVER) { + if (e1f_unseen_frames(&e1->tx.fifo) < (16 * 5)) return; } /* Fill new TX BD */ - while (g_e1.tx.in_flight < 4) { - if (!e1f_multiframe_read_peek(&g_e1.tx.fifo, &ofs)) + while (e1->tx.in_flight < 4) { + if (!e1f_multiframe_read_peek(&e1->tx.fifo, &ofs)) break; e1_regs->tx.bd = e1f_ofs_to_mf(ofs); - g_e1.tx.in_flight++; + e1->tx.in_flight++; } /* Clear underflow if needed */ - if (g_e1.tx.state != RUN) { - e1_regs->tx.csr = g_e1.tx.cr | E1_TX_CR_UNFL_CLR; - g_e1.tx.state = RUN; + if (e1->tx.state != RUN) { + e1_regs->tx.csr = e1->tx.cr | E1_TX_CR_UNFL_CLR; + e1->tx.state = RUN; } } void -e1_debug_print(bool data) +e1_debug_print(int port, bool data) { + volatile struct e1_core *e1_regs = _get_regs(port); + struct e1_state *e1 = _get_state(port); volatile uint8_t *p; - puts("E1\n"); + printf("E1 port %d\n", port); printf("CSR: Rx %04x / Tx %04x\n", e1_regs->rx.csr, e1_regs->tx.csr); - printf("InF: Rx %d / Tx %d\n", g_e1.rx.in_flight, g_e1.tx.in_flight); - printf("Sta: Rx %d / Tx %d\n", g_e1.rx.state, g_e1.tx.state); + 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); - e1f_debug(&g_e1.rx.fifo, "Rx FIFO"); - e1f_debug(&g_e1.tx.fifo, "Tx FIFO"); + e1f_debug(&e1->rx.fifo, "Rx FIFO"); + e1f_debug(&e1->tx.fifo, "Tx FIFO"); if (data) { puts("\nE1 Data\n"); diff --git a/firmware/ice40-riscv/icE1usb/e1.h b/firmware/ice40-riscv/icE1usb/e1.h index 862d568..a93a881 100644 --- a/firmware/ice40-riscv/icE1usb/e1.h +++ b/firmware/ice40-riscv/icE1usb/e1.h @@ -10,20 +10,20 @@ /* control */ -void e1_init(uint16_t rx_cr, uint16_t tx_cr); -void e1_poll(void); -void e1_debug_print(bool data); +void e1_init(int port, uint16_t rx_cr, uint16_t tx_cr); +void e1_poll(int port); +void e1_debug_print(int port, bool data); -void e1_tx_config(uint16_t cr); -void e1_rx_config(uint16_t cr); +void e1_tx_config(int port, uint16_t cr); +void e1_rx_config(int port, uint16_t cr); /* data flow */ -unsigned int e1_rx_need_data(unsigned int usb_addr, unsigned int max_len, unsigned int *pos); -unsigned int e1_tx_feed_data(unsigned int usb_addr, unsigned int len); -unsigned int e1_tx_level(void); -unsigned int e1_rx_level(void); +unsigned int e1_rx_need_data(int port, unsigned int usb_addr, unsigned int max_len, unsigned int *pos); +unsigned int e1_tx_feed_data(int port, unsigned int usb_addr, unsigned int len); +unsigned int e1_tx_level(int port); +unsigned int e1_rx_level(int port); /* error reporting */ @@ -40,7 +40,7 @@ uint8_t flags; }; -const struct e1_error_count *e1_get_error_count(void); +const struct e1_error_count *e1_get_error_count(int port); /* external function provided by the platform; used by E1 driver to control LEDs */ diff --git a/firmware/ice40-riscv/icE1usb/fw_app.c b/firmware/ice40-riscv/icE1usb/fw_app.c index 39173f2..3340f4a 100644 --- a/firmware/ice40-riscv/icE1usb/fw_app.c +++ b/firmware/ice40-riscv/icE1usb/fw_app.c @@ -101,7 +101,7 @@ usb_e1_init(); /* Start */ - e1_init(0, 0); + e1_init(0, 0, 0); led_state(true); usb_connect(); @@ -131,10 +131,10 @@ boot_dfu(); break; case 'o': - e1_debug_print(false); + e1_debug_print(0, false); break; case 'O': - e1_debug_print(true); + e1_debug_print(0, true); break; case 'c': usb_connect(); @@ -151,7 +151,7 @@ usb_poll(); /* E1 poll */ - e1_poll(); + e1_poll(0); usb_e1_run(); } } diff --git a/firmware/ice40-riscv/icE1usb/usb_e1.c b/firmware/ice40-riscv/icE1usb/usb_e1.c index fe94698..8e78ffa 100644 --- a/firmware/ice40-riscv/icE1usb/usb_e1.c +++ b/firmware/ice40-riscv/icE1usb/usb_e1.c @@ -64,7 +64,7 @@ val = 8192; /* Bias depending on TX fifo level */ - level = e1_tx_level(); + level = e1_tx_level(0); if (level < (3 * 16)) val += 256; else if (level > (8 * 16)) @@ -90,7 +90,7 @@ ep_regs = _get_ep_regs(USB_EP_E1_INT(0)); 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(); + const struct e1_error_count *cur_err = e1_get_error_count(0); if (memcmp(cur_err, &g_usb_e1.last_err, sizeof(*cur_err))) { struct ice1usb_irq errmsg = { .type = ICE1USB_IRQ_T_ERRCNT, @@ -126,7 +126,7 @@ puts("Err EP IN\n"); /* Get some data from E1 */ - int n = e1_rx_level(); + int n = e1_rx_level(0); if (n > 64) n = 12; @@ -137,7 +137,7 @@ else if (!n) break; - n = e1_rx_need_data((ptr >> 2) + 1, n, &pos); + n = e1_rx_need_data(0, (ptr >> 2) + 1, n, &pos); /* Write header: currently version and pos (mfr/fr number) */ hdr = (0 << 28) | (pos & 0xff); @@ -173,7 +173,7 @@ /* Empty data into the FIFO */ int n = ((int)(csr & USB_BD_LEN_MSK) - 6) / 32; if (n > 0) - e1_tx_feed_data((ptr >> 2) + 1, n); + e1_tx_feed_data(0, (ptr >> 2) + 1, n); refill: /* Refill it */ @@ -223,16 +223,20 @@ static void _perform_tx_config(void) { const struct ice1usb_tx_config *cfg = &g_usb_e1.tx_cfg; - e1_tx_config( ((cfg->mode & 3) << 1) | - ((cfg->timing & 1) << 3) | - ((cfg->alarm & 1) << 4) | - ((cfg->ext_loopback & 3) << 5) ); + e1_tx_config(0, + ((cfg->mode & 3) << 1) | + ((cfg->timing & 1) << 3) | + ((cfg->alarm & 1) << 4) | + ((cfg->ext_loopback & 3) << 5) + ); } static void _perform_rx_config(void) { const struct ice1usb_rx_config *cfg = &g_usb_e1.rx_cfg; - e1_rx_config((cfg->mode << 1)); + e1_rx_config(0, + (cfg->mode << 1) + ); } static enum usb_fnd_resp @@ -263,12 +267,12 @@ switch (g_usb_e1.running) { case false: /* Disable E1 rx/tx */ - e1_init(0, 0); + e1_init(0, 0, 0); break; case true: /* Reset and Re-Enable E1 */ - e1_init(0, 0); + e1_init(0, 0, 0); _perform_rx_config(); _perform_tx_config(); -- To view, visit https://gerrit.osmocom.org/c/osmo-e1-hardware/+/26839 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: I17671be65543f5a2bf3d16ba2b5a5081eb38ebdf Gerrit-Change-Number: 26839 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: Use the interface/endpoints #define in usb_e1.c
by tnt 12 Jan '22

12 Jan '22
tnt has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-e1-hardware/+/26835 ) Change subject: icE1usb fw: Use the interface/endpoints #define in usb_e1.c ...................................................................... icE1usb fw: Use the interface/endpoints #define in usb_e1.c Avoid hardcoded ids everywhere. This also prepares a bit for multi-port support in the future. Signed-off-by: Sylvain Munaut <tnt(a)246tNt.com> Change-Id: I89c86ac6afd52dd19e3383b38c3311276a090d50 --- M firmware/ice40-riscv/icE1usb/usb_e1.c 1 file changed, 56 insertions(+), 37 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-e1-hardware refs/changes/35/26835/1 diff --git a/firmware/ice40-riscv/icE1usb/usb_e1.c b/firmware/ice40-riscv/icE1usb/usb_e1.c index 09b428c..3de6071 100644 --- a/firmware/ice40-riscv/icE1usb/usb_e1.c +++ b/firmware/ice40-riscv/icE1usb/usb_e1.c @@ -13,8 +13,9 @@ #include <no2usb/usb_priv.h> #include "console.h" -#include "misc.h" #include "e1.h" +#include "misc.h" +#include "usb_desc_ids.h" #include "ice1usb_proto.h" @@ -40,6 +41,12 @@ }; +static volatile struct usb_ep * +_get_ep_regs(uint8_t ep) +{ + return (ep & 0x80) ? &usb_ep_regs[ep & 0x1f].in : &usb_ep_regs[ep & 0x1f].out; +} + static void _usb_fill_feedback_ep(void) { @@ -47,6 +54,7 @@ uint16_t ticks; uint32_t val = 8192; unsigned int level; + volatile struct usb_ep *ep_regs; /* Compute real E1 tick count (with safety against bad values) */ ticks = e1_tick_read(); @@ -63,21 +71,25 @@ val -= 256; /* Prepare buffer */ - usb_data_write(usb_ep_regs[1].in.bd[0].ptr, &val, 4); - usb_ep_regs[1].in.bd[0].csr = USB_BD_STATE_RDY_DATA | USB_BD_LEN(3); + ep_regs = _get_ep_regs(USB_EP_E1_FB(0)); + 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) { + volatile struct usb_ep *ep_regs; int bdi; if (!g_usb_e1.running) return; - /* EP3 IRQ */ - if ((usb_ep_regs[3].in.bd[0].csr & USB_BD_STATE_MSK) != USB_BD_STATE_RDY_DATA) { + /* Interrupt endpoint */ + ep_regs = _get_ep_regs(USB_EP_E1_INT(0)); + + 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(); if (memcmp(cur_err, &g_usb_e1.last_err, sizeof(*cur_err))) { struct ice1usb_irq errmsg = { @@ -93,24 +105,25 @@ } }; printf("E"); - usb_data_write(usb_ep_regs[3].in.bd[0].ptr, &errmsg, sizeof(errmsg)); - usb_ep_regs[3].in.bd[0].csr = USB_BD_STATE_RDY_DATA | USB_BD_LEN(sizeof(errmsg)); + 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; } } - /* EP2 IN */ + /* Data IN endpoint */ + ep_regs = _get_ep_regs(USB_EP_E1_IN(0)); bdi = g_usb_e1.in_bdi; - while ((usb_ep_regs[2].in.bd[bdi].csr & USB_BD_STATE_MSK) != USB_BD_STATE_RDY_DATA) + while ((ep_regs->bd[bdi].csr & USB_BD_STATE_MSK) != USB_BD_STATE_RDY_DATA) { - uint32_t ptr = usb_ep_regs[2].in.bd[bdi].ptr; + uint32_t ptr = ep_regs->bd[bdi].ptr; uint32_t hdr; unsigned int pos; /* Error check */ - if ((usb_ep_regs[2].in.bd[bdi].csr & USB_BD_STATE_MSK) == USB_BD_STATE_DONE_ERR) - puts("Err EP2 IN\n"); + if ((ep_regs->bd[bdi].csr & USB_BD_STATE_MSK) == USB_BD_STATE_DONE_ERR) + puts("Err EP IN\n"); /* Get some data from E1 */ int n = e1_rx_level(); @@ -131,25 +144,26 @@ usb_data_write(ptr, &hdr, 4); /* Resubmit */ - usb_ep_regs[2].in.bd[bdi].csr = USB_BD_STATE_RDY_DATA | USB_BD_LEN((n * 32) + 4); + ep_regs->bd[bdi].csr = USB_BD_STATE_RDY_DATA | USB_BD_LEN((n * 32) + 4); /* Next BDI */ bdi ^= 1; g_usb_e1.in_bdi = bdi; } - /* EP1 OUT */ + /* Data OUT endpoint */ + ep_regs = _get_ep_regs(USB_EP_E1_OUT(0)); bdi = g_usb_e1.out_bdi; - while ((usb_ep_regs[1].out.bd[bdi].csr & USB_BD_STATE_MSK) != USB_BD_STATE_RDY_DATA) + while ((ep_regs->bd[bdi].csr & USB_BD_STATE_MSK) != USB_BD_STATE_RDY_DATA) { - uint32_t ptr = usb_ep_regs[1].out.bd[bdi].ptr; - uint32_t csr = usb_ep_regs[1].out.bd[bdi].csr; + uint32_t ptr = ep_regs->bd[bdi].ptr; + uint32_t csr = ep_regs->bd[bdi].csr; uint32_t hdr; /* Error check */ if ((csr & USB_BD_STATE_MSK) == USB_BD_STATE_DONE_ERR) { - puts("Err EP1 OUT\n"); + puts("Err EP OUT\n"); goto refill; } @@ -162,7 +176,7 @@ refill: /* Refill it */ - usb_ep_regs[1].out.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(388); /* Next BDI */ bdi ^= 1; @@ -173,8 +187,10 @@ puts("."); } - /* EP1 IN */ - if ((usb_ep_regs[1].in.bd[0].csr & USB_BD_STATE_MSK) != USB_BD_STATE_RDY_DATA) + /* Feedback endpoint */ + ep_regs = _get_ep_regs(USB_EP_E1_FB(0)); + + if ((ep_regs->bd[0].csr & USB_BD_STATE_MSK) != USB_BD_STATE_RDY_DATA) { _usb_fill_feedback_ep(); } @@ -189,16 +205,16 @@ if (!conf) return USB_FND_SUCCESS; - intf = usb_desc_find_intf(conf, 0, 0, NULL); + intf = usb_desc_find_intf(conf, USB_INTF_E1(0), 0, NULL); if (!intf) return USB_FND_ERROR; printf("e1 set_conf %08x\n", intf); - usb_ep_boot(intf, 0x01, true); - usb_ep_boot(intf, 0x81, false); - usb_ep_boot(intf, 0x82, true); - usb_ep_boot(intf, 0x83, false); + 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); return USB_FND_SUCCESS; } @@ -221,8 +237,10 @@ static enum usb_fnd_resp _e1_set_intf(const struct usb_intf_desc *base, const struct usb_intf_desc *sel) { + volatile struct usb_ep *ep_regs; + /* Validity checks */ - if (base->bInterfaceNumber != 0) + if ((base->bInterfaceClass != 0xff) || (base->bInterfaceSubClass != 0xe1)) return USB_FND_CONTINUE; if (sel->bAlternateSetting > 1) @@ -235,10 +253,10 @@ g_usb_e1.running = (sel->bAlternateSetting != 0); /* Reconfigure the endpoints */ - usb_ep_reconf(sel, 0x01); - usb_ep_reconf(sel, 0x81); - usb_ep_reconf(sel, 0x82); - usb_ep_reconf(sel, 0x83); + 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)); /* Update E1 and USB state */ switch (g_usb_e1.running) { @@ -257,11 +275,12 @@ g_usb_e1.in_bdi = 0; g_usb_e1.out_bdi = 0; - /* EP1 OUT: Queue two buffers */ - usb_ep_regs[1].out.bd[0].csr = USB_BD_STATE_RDY_DATA | USB_BD_LEN(388); - usb_ep_regs[1].out.bd[1].csr = USB_BD_STATE_RDY_DATA | USB_BD_LEN(388); + /* 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); - /* EP1 IN: Queue buffer */ + /* EP Feedback: Pre-fill */ _usb_fill_feedback_ep(); break; @@ -273,7 +292,7 @@ static enum usb_fnd_resp _e1_get_intf(const struct usb_intf_desc *base, uint8_t *alt) { - if (base->bInterfaceNumber != 0) + if ((base->bInterfaceClass != 0xff) || (base->bInterfaceSubClass != 0xe1)) return USB_FND_CONTINUE; *alt = g_usb_e1.running ? 1 : 0; @@ -374,7 +393,7 @@ case USB_REQ_RCPT_DEV: return _e1_ctrl_req_dev(req, xfer); case USB_REQ_RCPT_INTF: - if (req->wIndex != 0) + if (req->wIndex != USB_INTF_E1(0)) return USB_FND_CONTINUE; return _e1_ctrl_req_intf(req, xfer); case USB_REQ_RCPT_EP: -- To view, visit https://gerrit.osmocom.org/c/osmo-e1-hardware/+/26835 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: I89c86ac6afd52dd19e3383b38c3311276a090d50 Gerrit-Change-Number: 26835 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: Fix computation of received E1 frames from USB
by tnt 12 Jan '22

12 Jan '22
tnt has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-e1-hardware/+/26836 ) Change subject: icE1usb fw: Fix computation of received E1 frames from USB ...................................................................... icE1usb fw: Fix computation of received E1 frames from USB 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(a)246tNt.com> Change-Id: Ib754e460290fe2e1551a0090e30a51846131d07d --- M firmware/ice40-riscv/icE1usb/usb_e1.c 1 file changed, 3 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-e1-hardware refs/changes/36/26836/1 diff --git a/firmware/ice40-riscv/icE1usb/usb_e1.c b/firmware/ice40-riscv/icE1usb/usb_e1.c index 3de6071..ed4826f 100644 --- a/firmware/ice40-riscv/icE1usb/usb_e1.c +++ b/firmware/ice40-riscv/icE1usb/usb_e1.c @@ -171,8 +171,9 @@ usb_data_read(&hdr, ptr, 4); /* Empty data into the FIFO */ - int n = ((csr & USB_BD_LEN_MSK) - 4) / 32; - n = e1_tx_feed_data((ptr >> 2) + 1, n); + int n = ((int)(csr & USB_BD_LEN_MSK) - 6) / 32; + if (n > 0) + e1_tx_feed_data((ptr >> 2) + 1, n); refill: /* Refill it */ -- To view, visit https://gerrit.osmocom.org/c/osmo-e1-hardware/+/26836 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: Ib754e460290fe2e1551a0090e30a51846131d07d Gerrit-Change-Number: 26836 Gerrit-PatchSet: 1 Gerrit-Owner: tnt <tnt(a)246tNt.com> Gerrit-MessageType: newchange
2 3
0 0
Change in osmo-upf[master]: initial osmocom boilerplate source tree
by laforge 12 Jan '22

12 Jan '22
laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-upf/+/26691 ) Change subject: initial osmocom boilerplate source tree ...................................................................... Patch Set 5: Code-Review+1 (1 comment) https://gerrit.osmocom.org/c/osmo-upf/+/26691/5/README.md File README.md: https://gerrit.osmocom.org/c/osmo-upf/+/26691/5/README.md@37 PS5, Line 37: h URL works (via redirect) but one could use the correct/new URL of mailman3 -- To view, visit https://gerrit.osmocom.org/c/osmo-upf/+/26691 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-upf Gerrit-Branch: master Gerrit-Change-Id: I4352dd8738a1a9de6ba2fc250ee8eef69c65ff1e Gerrit-Change-Number: 26691 Gerrit-PatchSet: 5 Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Comment-Date: Wed, 12 Jan 2022 15:35:51 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
Change in libosmocore[master]: ports.h: add osmo-pfcp-tool ports
by laforge 12 Jan '22

12 Jan '22
laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/26607 ) Change subject: ports.h: add osmo-pfcp-tool ports ...................................................................... Patch Set 2: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/26607 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: I8a5f437d934b9bda11ea593b50bd18c7d5d71ce9 Gerrit-Change-Number: 26607 Gerrit-PatchSet: 2 Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Comment-Date: Wed, 12 Jan 2022 15:33:43 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
Change in libosmocore[master]: PFCP: add DLPFCP and osmo-upf port numbers
by laforge 12 Jan '22

12 Jan '22
laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/26606 ) Change subject: PFCP: add DLPFCP and osmo-upf port numbers ...................................................................... Patch Set 2: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/26606 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: I0a46b147ec6a76d909df28136cfd2b764b2c75ea Gerrit-Change-Number: 26606 Gerrit-PatchSet: 2 Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: lynxis lazus <lynxis(a)fe80.eu> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Comment-Date: Wed, 12 Jan 2022 15:33:29 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
Change in osmo-ttcn3-hacks[master]: bsc: Fix TC_rsl_drop_counter due to IPA_Emulation component being ali...
by pespin 12 Jan '22

12 Jan '22
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/26874 ) Change subject: bsc: Fix TC_rsl_drop_counter due to IPA_Emulation component being alive-type ...................................................................... bsc: Fix TC_rsl_drop_counter due to IPA_Emulation component being alive-type IPA_Emulation component was marked with the "alive" type recently, in order to avoid race conditions leading to errors during tear down of the test. It turns out, the way "alive" keeps the component alive is by means of not closing the sockets when the component is stopped. As a result, TC_rsl_drop_counter test stopped working properly because it was specting a TCP FIN to be sent to osmo-bsc when the component was stopped. In order to fix it, add a new CFG port to the IPA_Emulation component on which one can operate. Add a a new method to tell the component to close the socket. Then, put that in BSC_Tests into a function which was actually unsued until now, and use it in the test in order to have the specific logic enclosed in a function helper. Fixes: 7138913d664c33b2404e3d293ab820fb3516ff73 Change-Id: I68163b053313d9907ba8e40954a5933d14cb7db6 --- M bsc/BSC_Tests.ttcn M library/IPA_Emulation.ttcnpp 2 files changed, 56 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/74/26874/1 diff --git a/bsc/BSC_Tests.ttcn b/bsc/BSC_Tests.ttcn index c485ec5..7bfc387 100644 --- a/bsc/BSC_Tests.ttcn +++ b/bsc/BSC_Tests.ttcn @@ -595,6 +595,8 @@ port IPA_CODEC_PT IPA; /* Required for compilation of TC_rsl_unknown_unit_id() */ /* CTRL muxed over IPA in SCCPlite conn BSC<->MSC (or BSC-NAT) */ port IPA_CTRL_PT SCCPLITE_IPA_CTRL; + /* Configure/manage IPA_Emulation: */ + port IPA_CFG_PT IPA_CFG_PORT; var MGCP_Emulation_CT vc_MGCP; port TELNETasp_PT BSCVTY; @@ -926,6 +928,7 @@ } map(clnt.vc_IPA:IPA_PORT, system:IPA_CODEC_PT); + connect(clnt.vc_IPA:CFG_PORT, self:IPA_CFG_PORT); if (handler_mode) { connect(clnt.vc_IPA:IPA_RSL_PORT, clnt.vc_RSL:IPA_PT); } else { @@ -955,9 +958,22 @@ } function f_ipa_rsl_stop(inout IPA_Client clnt) runs on test_CT { + var IPL4asp_Types.Result res := { + errorCode := omit, + connId := omit, + os_error_code := omit, + os_error_text := omit + }; + if (not isbound(clnt) or not isbound(clnt.vc_IPA)) { return; } + + /* Alive components don't finish sockets (TCP FIN) when they are + * stopped. Hence, we need to manually call close() on them to make sure + * the IUT knows about it. */ + f_ipa_cfg_disconnect(IPA_CFG_PORT, res); + clnt.vc_IPA.stop; if (isbound(clnt.vc_RSL)) { clnt.vc_RSL.stop; @@ -3555,7 +3571,7 @@ rsl_fail := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "rsl_fail"); - bts[0].rsl.vc_IPA.stop; + f_ipa_rsl_stop(bts[0].rsl); f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "rsl_fail", rsl_fail+1); diff --git a/library/IPA_Emulation.ttcnpp b/library/IPA_Emulation.ttcnpp index 5cdf324..0cd7314 100644 --- a/library/IPA_Emulation.ttcnpp +++ b/library/IPA_Emulation.ttcnpp @@ -206,6 +206,9 @@ type component IPA_Emulation_CT { /* down-facing port to IPA codec port */ port IPA_CODEC_PT IPA_PORT; + /* Down facing port to configure the component */ + port IPA_CFG_PT CFG_PORT; + #ifdef IPA_EMULATION_SCCP /* up-facing port to SCCP */ port MTP3asp_SP_PT MTP3_SP_PORT; @@ -286,6 +289,17 @@ osmo_rand := "" }; +signature IPA_CFG_disconnect(inout IPL4asp_Types.Result res); +type port IPA_CFG_PT procedure { + inout IPA_CFG_disconnect; +} with { extension "internal" }; + +function f_ipa_cfg_disconnect(IPA_CFG_PT pt, inout IPL4asp_Types.Result res) { + pt.call(IPA_CFG_disconnect:{res}) { + [] pt.getreply(IPA_CFG_disconnect:{?}) -> param (res) {}; + } +} + /* Function to use to connect as client to a remote IPA Server */ function f_connect(charstring remote_host, IPL4asp_Types.PortNumber remote_port, charstring local_host, IPL4asp_Types.PortNumber local_port, @@ -318,6 +332,25 @@ g_is_bsc_mgw := false; } +private function f_close() runs on IPA_Emulation_CT return IPL4asp_Types.Result { + var IPL4asp_Types.Result res; + select (g_mode) { + case (IPA_MODE_CLIENT) { + res := IPA_CodecPort_CtrlFunct.f_IPL4_close(IPA_PORT, g_self_conn_id, {tcp := {}}); + g_self_conn_id := -1; + } + case (IPA_MODE_SERVER) { + res := IPA_CodecPort_CtrlFunct.f_IPL4_close(IPA_PORT, g_last_conn_id, {tcp := {}}); + g_last_conn_id := -1; + } + case else { + setverdict(fail, "Unknown mode"); + mtc.stop; + } + } + return res; +} + #ifdef IPA_EMULATION_SCCP template ASP_MTP3_TRANSFERind ts_MTP3_XFER_ind(integer opc, octetstring data) := { sio := { '10'B, '00'B, '0011'B }, @@ -661,6 +694,7 @@ var Socket_API_Definitions.PortEvent port_evt; var octetstring payload; var ASP_IPA_Unitdata ipa_ud; + var IPL4asp_Types.Result res; #ifdef IPA_EMULATION_CTRL var CtrlMessage ctrl_msg; #endif @@ -888,6 +922,11 @@ IPA_PORT.send(f_from_asp(f_ipa_conn_id(), ipa_ud)); } + /* Received call to configure/operate the component */ + [] CFG_PORT.getcall(IPA_CFG_disconnect:{?}) { + res := f_close(); + CFG_PORT.reply(IPA_CFG_disconnect:{res}); + } } } -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/26874 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ttcn3-hacks Gerrit-Branch: master Gerrit-Change-Id: I68163b053313d9907ba8e40954a5933d14cb7db6 Gerrit-Change-Number: 26874 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: newchange
3 4
0 0
Change in osmo-iuh[master]: test_common: use osmo_init_logging2 instead of osmo_init_logging
by dexter 12 Jan '22

12 Jan '22
dexter has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-iuh/+/26892 ) Change subject: test_common: use osmo_init_logging2 instead of osmo_init_logging ...................................................................... test_common: use osmo_init_logging2 instead of osmo_init_logging osmo_init_logging is deprecated, lets use osmo_init_logging2 Change-Id: I00ff05e27a89f515f0ce874d6f130b2937b8f1cc --- M src/tests/test_common.c 1 file changed, 3 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/osmo-iuh refs/changes/92/26892/1 diff --git a/src/tests/test_common.c b/src/tests/test_common.c index 899c73a..187a269 100644 --- a/src/tests/test_common.c +++ b/src/tests/test_common.c @@ -70,16 +70,18 @@ .num_cat = ARRAY_SIZE(log_cat), }; +static void *tall_hnb_ctx; static void *msgb_ctx; int test_common_init(void) { int rc; + tall_hnb_ctx = talloc_named_const(NULL, 0, "hnb_context"); msgb_ctx = msgb_talloc_ctx_init(NULL, 0); talloc_asn1_ctx = talloc_named_const(NULL, 0, "asn1_context"); - rc = osmo_init_logging(&test_log_info); + rc = osmo_init_logging2(tall_hnb_ctx, &test_log_info); if (rc < 0) exit(1); -- To view, visit https://gerrit.osmocom.org/c/osmo-iuh/+/26892 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-iuh Gerrit-Branch: master Gerrit-Change-Id: I00ff05e27a89f515f0ce874d6f130b2937b8f1cc Gerrit-Change-Number: 26892 Gerrit-PatchSet: 1 Gerrit-Owner: dexter <pmaier(a)sysmocom.de> Gerrit-MessageType: newchange
2 2
0 0
Change in osmo-ttcn3-hacks[master]: bsc: Fix CC bits expectancies in TC_rll_sapi_n_reject_dlci_cc
by pespin 12 Jan '22

12 Jan '22
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/26891 ) Change subject: bsc: Fix CC bits expectancies in TC_rll_sapi_n_reject_dlci_cc ...................................................................... bsc: Fix CC bits expectancies in TC_rll_sapi_n_reject_dlci_cc Change-Id: Ie9d88acd083fa0db35e2addec07b2f810bcc8213 Related: OS#4728 Related: SYS#5047 Fixes: 999ceb66373a93c0ab5adf14b313187789288c53 --- M bsc/BSC_Tests.ttcn 1 file changed, 3 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/91/26891/1 diff --git a/bsc/BSC_Tests.ttcn b/bsc/BSC_Tests.ttcn index 0dd4440..e97121b 100644 --- a/bsc/BSC_Tests.ttcn +++ b/bsc/BSC_Tests.ttcn @@ -2578,6 +2578,7 @@ var octetstring rnd_data := f_rnd_octstring(16); var RSL_Message rx_rsl; var DchanTuple dt; + var RslLinkId rlid := valueof(ts_RslLinkID_DCCH(3)); f_init(1); @@ -2590,8 +2591,8 @@ rx_rsl := f_exp_ipa_rx(0, tr_RSL_EST_REQ(dt.rsl_chan_nr, tr_RslLinkID_DCCH(3))); /* MS sends unexpected ERROR INDication on DCCH/ACCH SAPI=3 */ - f_ipa_tx(0, ts_RSL_ERROR_IND(dt.rsl_chan_nr, ts_RslLinkID_DCCH(3), ''O)); - f_exp_sapi_n_reject(3, GSM0808_CAUSE_BSS_NOT_EQUIPPED, '10'B); + f_ipa_tx(0, ts_RSL_ERROR_IND(dt.rsl_chan_nr, rlid, ''O)); + f_exp_sapi_n_reject(3, GSM0808_CAUSE_BSS_NOT_EQUIPPED, int2bit(enum2int(rlid.c), 2)); /* Clean up the connection */ BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/26891 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ttcn3-hacks Gerrit-Branch: master Gerrit-Change-Id: Ie9d88acd083fa0db35e2addec07b2f810bcc8213 Gerrit-Change-Number: 26891 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: newchange
2 2
0 0
  • ← Newer
  • 1
  • ...
  • 9694
  • 9695
  • 9696
  • 9697
  • 9698
  • 9699
  • 9700
  • ...
  • 9721
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.