linux-wpan.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexander Aring <aahringo@redhat.com>
To: stefan@datenfreihafen.org
Cc: linux-wpan@vger.kernel.org
Subject: [RFC ben-wpan] fw: add trac reg to tx done
Date: Sun,  4 Sep 2022 20:49:44 -0400	[thread overview]
Message-ID: <20220905004944.967757-1-aahringo@redhat.com> (raw)

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


             reply	other threads:[~2022-09-05  0:49 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-05  0:49 Alexander Aring [this message]
2022-09-05 11:09 ` [RFC ben-wpan] fw: add trac reg to tx done Alexander Aring

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220905004944.967757-1-aahringo@redhat.com \
    --to=aahringo@redhat.com \
    --cc=linux-wpan@vger.kernel.org \
    --cc=stefan@datenfreihafen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).