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
This commit is contained in:
parent
3722b186e0
commit
326a08fe63
|
@ -2,6 +2,7 @@
|
|||
* e1.c
|
||||
*
|
||||
* Copyright (C) 2019-2020 Sylvain Munaut <tnt@246tNt.com>
|
||||
* Copyright (C) 2022 Harald Welte <laforge@osmocom.org>
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
|
@ -276,53 +277,36 @@ e1_init(void)
|
|||
}
|
||||
|
||||
void
|
||||
e1_start(void)
|
||||
e1_start(int 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(int 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;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
#pragma once
|
||||
|
||||
void e1_init();
|
||||
void e1_start();
|
||||
void e1_stop();
|
||||
void e1_start(int chan);
|
||||
void e1_stop(int chan);
|
||||
|
||||
void e1_poll(void);
|
||||
|
||||
|
|
|
@ -149,7 +149,8 @@ _e1_set_intf(const struct usb_intf_desc *base, const struct usb_intf_desc *sel)
|
|||
g_usb_e1.running = false;
|
||||
|
||||
/* Stop E1 */
|
||||
e1_stop();
|
||||
e1_stop(0);
|
||||
e1_stop(1);
|
||||
|
||||
/* Disable end-points */
|
||||
usb_ep_regs[1].in.status = 0;
|
||||
|
@ -187,7 +188,8 @@ _e1_set_intf(const struct usb_intf_desc *base, const struct usb_intf_desc *sel)
|
|||
usb_ep_regs[2].in.bd[1].csr = 0;
|
||||
|
||||
/* Start E1 */
|
||||
e1_start();
|
||||
e1_start(0);
|
||||
e1_start(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue