Skip to content

Commit 61cc258

Browse files
committed
move notify to be contained in submod
1 parent af0fb2e commit 61cc258

File tree

4 files changed

+39
-6
lines changed

4 files changed

+39
-6
lines changed

drivers/slipmux/coap.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ static event_queue_t queue;
2929
static uint8_t buf[CONFIG_SLIPMUX_COAP_BUFSIZE];
3030

3131
/* called in ISR context */
32-
void _slipmux_coap_dispatch_recv(event_t *event)
32+
void slipmux_coap_notify(slipmux_t *dev)
3333
{
3434
if (queue.waiter) {
35-
event_post(&queue, event);
35+
event_post(&queue, &dev->event);
3636
}
3737
}
3838

drivers/slipmux/include/slipmux_internal.h

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,10 +169,38 @@ static inline void slipmux_unlock(void)
169169
}
170170

171171
#if IS_USED(MODULE_SLIPMUX_COAP)
172+
/**
173+
* @brief Initialise the CoAP handling
174+
*
175+
* @param[in] dev The Slipmux device to initialise.
176+
* @param[in] index Device number.
177+
*/
172178
void slipmux_coap_init(slipmux_t *dev, unsigned index);
179+
180+
/**
181+
* @brief Inform the CoAP server there is new work to do.
182+
* Called in ISR context!
183+
*
184+
* @param[in] dev The Slipmux device to notify.
185+
*/
186+
void slipmux_coap_notify(slipmux_t *dev);
173187
#endif
174188
#if IS_USED(MODULE_SLIPMUX_NET)
189+
/**
190+
* @brief Initialise the network handling
191+
*
192+
* @param[in] dev The Slipmux device to initialise.
193+
* @param[in] index Device number.
194+
*/
175195
void slipmux_net_init(slipmux_t *dev, unsigned index);
196+
197+
/**
198+
* @brief Inform the Network interface there is new work to do.
199+
* Called in ISR context!
200+
*
201+
* @param[in] dev The Slipmux device to notify.
202+
*/
203+
void slipmux_net_notify(slipmux_t *dev);
176204
#endif
177205

178206
#ifdef __cplusplus

drivers/slipmux/net.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,13 @@ static const netdev_driver_t slip_driver = {
216216
#endif
217217
};
218218

219-
void slipmux_net_init(slipmux_t * dev, unsigned index) {
219+
void slipmux_net_notify(slipmux_t *dev)
220+
{
221+
netdev_trigger_event_isr(&dev->netdev);
222+
}
223+
224+
void slipmux_net_init(slipmux_t * dev, unsigned index)
225+
{
220226
dev->netdev.driver = &slip_driver;
221227
crb_init(&dev->net_rb, dev->net_rx, sizeof(dev->net_rx));
222228
netdev_register(&dev->netdev, NETDEV_SLIPDEV, index);

drivers/slipmux/slipmux.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,7 @@ void slipmux_rx_cb(void *arg, uint8_t byte)
8181
dev->state = SLIPMUX_STATE_NONE;
8282
#if IS_USED(MODULE_SLIPMUX_COAP)
8383
crb_end_chunk(&dev->coap_rb, true);
84-
extern void _slipmux_coap_dispatch_recv(event_t *);
85-
_slipmux_coap_dispatch_recv(&dev->event);
84+
slipmux_coap_notify(dev);
8685
#endif
8786
break;
8887
default:
@@ -126,7 +125,7 @@ void slipmux_rx_cb(void *arg, uint8_t byte)
126125
case SLIPMUX_END:
127126
#if IS_USED(MODULE_SLIPMUX_NET)
128127
crb_end_chunk(&dev->net_rb, true);
129-
netdev_trigger_event_isr(&dev->netdev);
128+
slipmux_net_notify(dev);
130129
#endif
131130
dev->state = SLIPMUX_STATE_NONE;
132131
return;

0 commit comments

Comments
 (0)