laforge has uploaded this change for review. (
https://gerrit.osmocom.org/c/osmo-e1-hardware/+/29947 )
Change subject: fw/e1-tracer: e1_start/e1_stop of individual channel
......................................................................
fw/e1-tracer: e1_start/e1_stop of individual channel
Let's split the starting and stopping between the two channels.
This is a preparation for a future e1d-compatible mode where each
channel (direction) has its own USB interface and hence must be
individually started/stopped.
Related: OS#5733
Change-Id: I7492325352222269bf0ba1346511c7dfa99c4f64
---
M firmware/ice40-riscv/e1-tracer/e1.c
M firmware/ice40-riscv/e1-tracer/e1.h
M firmware/ice40-riscv/e1-tracer/usb_e1.c
3 files changed, 21 insertions(+), 35 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-e1-hardware refs/changes/47/29947/1
diff --git a/firmware/ice40-riscv/e1-tracer/e1.c b/firmware/ice40-riscv/e1-tracer/e1.c
index dc2ae11..6b35e1d 100644
--- a/firmware/ice40-riscv/e1-tracer/e1.c
+++ b/firmware/ice40-riscv/e1-tracer/e1.c
@@ -2,6 +2,7 @@
* e1.c
*
* Copyright (C) 2019-2020 Sylvain Munaut <tnt(a)246tNt.com>
+ * Copyright (C) 2022 Harald Welte <laforge(a)osmocom.org>
* SPDX-License-Identifier: GPL-3.0-or-later
*/
@@ -276,53 +277,36 @@
}
void
-e1_start(void)
+e1_start_one(uint8_t chan)
{
/* Reset FIFOs */
#ifdef BIGBUF
- e1f_reset(&g_e1.rx[0].fifo, 0, 1024);
- e1f_reset(&g_e1.rx[1].fifo, 1024, 1024);
+ e1f_reset(&g_e1.rx[chan].fifo, 0, 1024);
#else
- e1f_reset(&g_e1.rx[0].fifo, 0, 128);
- e1f_reset(&g_e1.rx[1].fifo, 128, 128);
+ e1f_reset(&g_e1.rx[chan].fifo, 0, 128);
#endif
- /* Enable Rx0 */
- g_e1.rx[0].cr = E1_RX_CR_OVFL_CLR |
+ /* Enable Rx */
+ g_e1.rx[chan].cr = E1_RX_CR_OVFL_CLR |
E1_RX_CR_MODE_MFA |
E1_RX_CR_ENABLE;
- e1_regs->rx[0].csr = g_e1.rx[0].cr;
-
- /* Enable Rx1 */
- g_e1.rx[1].cr = E1_RX_CR_OVFL_CLR |
- E1_RX_CR_MODE_MFA |
- E1_RX_CR_ENABLE;
- e1_regs->rx[1].csr = g_e1.rx[1].cr;
+ e1_regs->rx[chan].csr = g_e1.rx[chan].cr;
/* State */
- g_e1.rx[0].state = BOOT;
- g_e1.rx[0].in_flight = 0;
- g_e1.rx[0].flags = 0;
-
- g_e1.rx[1].state = BOOT;
- g_e1.rx[1].in_flight = 0;
- g_e1.rx[1].flags = 0;
+ g_e1.rx[chan].state = BOOT;
+ g_e1.rx[chan].in_flight = 0;
+ g_e1.rx[chan].flags = 0;
}
void
-e1_stop()
+e1_stop_one(uint8_t chan)
{
- /* Disable RX0 */
- g_e1.rx[0].cr = 0;
- e1_regs->rx[0].csr = g_e1.rx[0].cr;
-
- /* Disable RX1 */
- g_e1.rx[1].cr = 0;
- e1_regs->rx[1].csr = g_e1.rx[1].cr;
+ /* Disable RX */
+ g_e1.rx[chan].cr = 0;
+ e1_regs->rx[chan].csr = g_e1.rx[0].cr;
/* State */
- g_e1.rx[0].state = IDLE;
- g_e1.rx[1].state = IDLE;
+ g_e1.rx[chan].state = IDLE;
}
diff --git a/firmware/ice40-riscv/e1-tracer/e1.h b/firmware/ice40-riscv/e1-tracer/e1.h
index b99c682..02031aa 100644
--- a/firmware/ice40-riscv/e1-tracer/e1.h
+++ b/firmware/ice40-riscv/e1-tracer/e1.h
@@ -8,8 +8,8 @@
#pragma once
void e1_init();
-void e1_start();
-void e1_stop();
+void e1_start_one(uint8_t chan);
+void e1_stop_one(uint8_t chan);
void e1_poll(void);
diff --git a/firmware/ice40-riscv/e1-tracer/usb_e1.c
b/firmware/ice40-riscv/e1-tracer/usb_e1.c
index 3c577a4..12c3906 100644
--- a/firmware/ice40-riscv/e1-tracer/usb_e1.c
+++ b/firmware/ice40-riscv/e1-tracer/usb_e1.c
@@ -149,7 +149,8 @@
g_usb_e1.running = false;
/* Stop E1 */
- e1_stop();
+ e1_stop_one(0);
+ e1_stop_one(1);
/* Disable end-points */
usb_ep_regs[1].in.status = 0;
@@ -187,7 +188,8 @@
usb_ep_regs[2].in.bd[1].csr = 0;
/* Start E1 */
- e1_start();
+ e1_start_one(0);
+ e1_start_one(1);
}
else
{
--
To view, visit
https://gerrit.osmocom.org/c/osmo-e1-hardware/+/29947
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: I7492325352222269bf0ba1346511c7dfa99c4f64
Gerrit-Change-Number: 29947
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge(a)osmocom.org>
Gerrit-MessageType: newchange