* [RFC ben-wpan] fw: add trac reg to tx done
@ 2022-09-05 0:49 Alexander Aring
2022-09-05 11:09 ` Alexander Aring
0 siblings, 1 reply; 2+ messages in thread
From: Alexander Aring @ 2022-09-05 0:49 UTC (permalink / raw)
To: stefan; +Cc: linux-wpan
This patch adds an additional byte for tx done for the trac status
register which can then evaluated by the atusb Linux driver.
---
Just an RFC, need another weekend to test it.
atusb/fw/mac.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/atusb/fw/mac.c b/atusb/fw/mac.c
index 835002c..045d5fa 100644
--- a/atusb/fw/mac.c
+++ b/atusb/fw/mac.c
@@ -32,7 +32,7 @@ static uint8_t tx_buf[MAX_PSDU];
static uint8_t tx_size = 0;
static bool txing = 0;
static bool queued_tx_ack = 0;
-static uint8_t next_seq, this_seq, queued_seq;
+static uint8_t next_seq, this_seq, queued_seq, queued_tx_trac;
/* ----- Receive buffer management ----------------------------------------- */
@@ -57,6 +57,7 @@ static void tx_ack_done(void *user);
static void usb_next(void)
{
const uint8_t *buf;
+ uint8_t data[2];
if (rx_in != rx_out) {
buf = rx_buf[rx_out];
@@ -65,7 +66,9 @@ static void usb_next(void)
}
if (queued_tx_ack) {
- usb_send(&eps[1], &queued_seq, 1, tx_ack_done, NULL);
+ data[0] = queued_seq;
+ data[1] = queued_tx_trac;
+ usb_send(&eps[1], data, sizeof(data), tx_ack_done, NULL);
queued_tx_ack = 0;
}
}
@@ -116,7 +119,7 @@ static void receive_frame(void)
static bool handle_irq(void)
{
- uint8_t irq;
+ uint8_t irq, data[2];
irq = reg_read(REG_IRQ_STATUS);
if (!(irq & IRQ_TRX_END))
@@ -124,10 +127,13 @@ static bool handle_irq(void)
if (txing) {
if (eps[1].state == EP_IDLE) {
- usb_send(&eps[1], &this_seq, 1, tx_ack_done, NULL);
+ data[0] = this_seq;
+ data[1] = reg_read(REG_TRX_STATE);
+ usb_send(&eps[1], data, sizeof(data), tx_ack_done, NULL);
} else {
queued_tx_ack = 1;
queued_seq = this_seq;
+ queued_tx_trac = reg_read(REG_TRX_STATE);
}
txing = 0;
return 1;
--
2.31.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [RFC ben-wpan] fw: add trac reg to tx done
2022-09-05 0:49 [RFC ben-wpan] fw: add trac reg to tx done Alexander Aring
@ 2022-09-05 11:09 ` Alexander Aring
0 siblings, 0 replies; 2+ messages in thread
From: Alexander Aring @ 2022-09-05 11:09 UTC (permalink / raw)
To: Stefan Schmidt; +Cc: linux-wpan - ML
Hi,
On Sun, Sep 4, 2022 at 8:49 PM Alexander Aring <aahringo@redhat.com> wrote:
>
> This patch adds an additional byte for tx done for the trac status
> register which can then evaluated by the atusb Linux driver.
> ---
>
> Just an RFC, need another weekend to test it.
>
> atusb/fw/mac.c | 14 ++++++++++----
> 1 file changed, 10 insertions(+), 4 deletions(-)
>
> diff --git a/atusb/fw/mac.c b/atusb/fw/mac.c
> index 835002c..045d5fa 100644
> --- a/atusb/fw/mac.c
> +++ b/atusb/fw/mac.c
> @@ -32,7 +32,7 @@ static uint8_t tx_buf[MAX_PSDU];
> static uint8_t tx_size = 0;
> static bool txing = 0;
> static bool queued_tx_ack = 0;
> -static uint8_t next_seq, this_seq, queued_seq;
> +static uint8_t next_seq, this_seq, queued_seq, queued_tx_trac;
>
>
> /* ----- Receive buffer management ----------------------------------------- */
> @@ -57,6 +57,7 @@ static void tx_ack_done(void *user);
> static void usb_next(void)
> {
> const uint8_t *buf;
> + uint8_t data[2];
>
> if (rx_in != rx_out) {
> buf = rx_buf[rx_out];
> @@ -65,7 +66,9 @@ static void usb_next(void)
> }
>
> if (queued_tx_ack) {
> - usb_send(&eps[1], &queued_seq, 1, tx_ack_done, NULL);
> + data[0] = queued_seq;
> + data[1] = queued_tx_trac;
> + usb_send(&eps[1], data, sizeof(data), tx_ack_done, NULL);
> queued_tx_ack = 0;
> }
> }
> @@ -116,7 +119,7 @@ static void receive_frame(void)
>
> static bool handle_irq(void)
> {
> - uint8_t irq;
> + uint8_t irq, data[2];
>
> irq = reg_read(REG_IRQ_STATUS);
> if (!(irq & IRQ_TRX_END))
> @@ -124,10 +127,13 @@ static bool handle_irq(void)
>
> if (txing) {
> if (eps[1].state == EP_IDLE) {
> - usb_send(&eps[1], &this_seq, 1, tx_ack_done, NULL);
> + data[0] = this_seq;
> + data[1] = reg_read(REG_TRX_STATE);
> + usb_send(&eps[1], data, sizeof(data), tx_ack_done, NULL);
> } else {
> queued_tx_ack = 1;
> queued_seq = this_seq;
> + queued_tx_trac = reg_read(REG_TRX_STATE);
> }
> txing = 0;
There is probably some race the trac register also have values stored
for RX_AACK_ON state which is being changed after the transmit but we
need at first to get the trac and then turn into RX_AACK_ON, so I
think the state change "change_state(TRX_CMD_RX_AACK_ON);" should be
moved after reading the trac.
- Alex
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-09-05 11:09 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-05 0:49 [RFC ben-wpan] fw: add trac reg to tx done Alexander Aring
2022-09-05 11:09 ` Alexander Aring
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).