Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions drivers/dose/dose.c
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@
ctx->state = DOSE_STATE_SEND;
break;
default:
DEBUG("dose state(): unexpected state transition (STATE=0x%02x SIGNAL=0x%02x)\n", ctx->state, signal);

Check warning on line 321 in drivers/dose/dose.c

View workflow job for this annotation

GitHub Actions / static-tests

line is longer than 100 characters
/* fall-through */
case DOSE_STATE_RECV + DOSE_SIGNAL_SEND:
signal = DOSE_SIGNAL_NONE;
Expand Down Expand Up @@ -358,7 +358,7 @@
state(dev, DOSE_SIGNAL_ZTIMER);
break;
default:
;

Check warning on line 361 in drivers/dose/dose.c

View workflow job for this annotation

GitHub Actions / static-tests

semicolon is isolated from other tokens
}
}

Expand Down Expand Up @@ -532,9 +532,9 @@

static int _confirm_send(netdev_t *dev, void *info)
{
(void)dev;
(void)info;
return -EOPNOTSUPP;
dose_t *ctx = container_of(dev, dose_t, netdev);
return ctx->tx_result;
}

static int _send(netdev_t *dev, const iolist_t *iolist)
Expand All @@ -543,6 +543,7 @@
int8_t retries = 3;
size_t pktlen;
uint16_t crc;
ctx->tx_result = -EAGAIN;

/* discard data when interface is in SLEEP mode */
if (ctx->state == DOSE_STATE_SLEEP) {
Expand Down Expand Up @@ -603,7 +604,10 @@
/* Get out of the SEND state */
state(ctx, DOSE_SIGNAL_END);

return pktlen;
ctx->tx_result = (int)pktlen;
dev->event_callback(dev, NETDEV_EVENT_TX_COMPLETE);

return 0;

collision:
_send_done(ctx, true);
Expand Down
1 change: 1 addition & 0 deletions drivers/include/dose.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,13 @@
*/
typedef enum {
DOSE_STATE_INIT = 0x00, /**< Initial state that will never be reentered */
DOSE_STATE_BLOCKED = 0x01, /**< The driver just listens to incoming frames and blocks outgress frames */

Check warning on line 104 in drivers/include/dose.h

View workflow job for this annotation

GitHub Actions / static-tests

line is longer than 100 characters
DOSE_STATE_IDLE = 0x02, /**< Frames will be received or sent */
DOSE_STATE_RECV = 0x03, /**< Currently receiving a frame */
DOSE_STATE_SEND = 0x04, /**< Currently sending a frame */
DOSE_STATE_STANDBY = 0x05, /**< Receiver is turned off, but send will wake it up */
DOSE_STATE_SLEEP = 0x06, /**< Receiver is turned off and send will be discarded */
DOSE_STATE_ANY = 0x0F /**< Special state filter used internally to observe any state transition */

Check warning on line 110 in drivers/include/dose.h

View workflow job for this annotation

GitHub Actions / static-tests

line is longer than 100 characters
} dose_state_t;

/**
Expand All @@ -129,7 +129,7 @@
* @brief Hold in dose_t.flags
* @{
*/
#define DOSE_FLAG_RECV_BUF_DIRTY (BIT0) /**< Receive buffer contains a complete unhandled frame */

Check warning on line 132 in drivers/include/dose.h

View workflow job for this annotation

GitHub Actions / static-tests

line is longer than 100 characters
#define DOSE_FLAG_END_RECEIVED (BIT1) /**< END octet has been received */
#define DOSE_FLAG_ESC_RECEIVED (BIT2) /**< ESC octet has been received */
#define DOSE_FLAG_SEND_PENDING (BIT3) /**< A send operation is pending */
Expand All @@ -140,11 +140,11 @@
* @brief Hold in dose_t.opts
* @{
*/
#define DOSE_OPT_PROMISCUOUS (BIT0) /**< Don't check the destination MAC - pass every frame to upper layers */

Check warning on line 143 in drivers/include/dose.h

View workflow job for this annotation

GitHub Actions / static-tests

line is longer than 100 characters
/** @} */

/**
* @defgroup drivers_dose_config Differentially Operated Serial Ethernet (DOSE) driver compile configuration

Check warning on line 147 in drivers/include/dose.h

View workflow job for this annotation

GitHub Actions / static-tests

line is longer than 100 characters
* @ingroup config_drivers_netdev
* @{
*/
Expand Down Expand Up @@ -195,15 +195,16 @@
/* consumed exclusively in the network stack's */
/* loop at _isr. */
#if defined(MODULE_DOSE_WATCHDOG) || DOXYGEN
void *recv_buf_ptr_last; /**< Last value of recv_buf_ptr when the watchdog visited */

Check warning on line 198 in drivers/include/dose.h

View workflow job for this annotation

GitHub Actions / static-tests

line is longer than 100 characters
#endif
#if !defined(MODULE_PERIPH_UART_RXSTART_IRQ) || DOXYGEN
gpio_t sense_pin; /**< GPIO to sense for start bits on the UART's rx line */

Check warning on line 201 in drivers/include/dose.h

View workflow job for this annotation

GitHub Actions / static-tests

line is longer than 100 characters
#endif
gpio_t standby_pin; /**< GPIO to put the CAN transceiver in standby mode */
ztimer_t timeout; /**< Timeout timer ensuring always to get back to IDLE state */

Check warning on line 204 in drivers/include/dose.h

View workflow job for this annotation

GitHub Actions / static-tests

line is longer than 100 characters
uint32_t timeout_base; /**< Base timeout in us */
uart_t uart; /**< UART device to use */
int tx_result; /**< return code for confirm_send() */
uint8_t uart_octet; /**< Last received octet */
uint8_t flags; /**< Several flags */
} dose_t;
Expand Down