-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ng_slip: initial import #2688
ng_slip: initial import #2688
Conversation
c402c53
to
b0b0e6f
Compare
break; | ||
|
||
default: | ||
if (uart_write(uart, data[i]) < 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this will not work (you will lose chars). Use uart_write_blocking()
when you use the uart like this. Better (and I really would to this here): use the transmit interrupt and a transmit buffer!
static ringbuffer_t *out_buf;
_slip_send(..) {
...
default:
ringbuffer_add_one(&out_buf, data[i]);
uart_tx_begin(uart);
...
}
// and
int _slip_rx_cb(void *arg) {
if (_out_buf.avail > 0) {
char c = (char)ringbuffer_get_one(&out_buf);
uart_write(uart, c);
return 1;
}
return 0;
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you mean tx_cb, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem I have with this is, that we than need a second buffer of at least size IPV6_MTU
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and true for the buffer size. But the blocking use of the UART interface is very slow. This basically means, that for sending one full IPv6 MTU, you controller basically blocks for about 10ms...
You should spend the SLIP interface a device descriptor to make it possible to run more than one instance at a time! This could be interesting for setups, where one interface is connected to linux, and another one is connected to another RIOT based board - some of our boards have up to 8 UART interfaces :-) |
I was thinking about it, but than thought it might be an interesting challenge for future generations :D |
c4d8ef0
to
2c84dee
Compare
hm, why not do it right in the first place? So others don't even get the idea to implement drivers with global variables (and the SLIP device would be in line with all new readio and device drivers...). |
You saw that I did it, right? |
Ups, did not. But the new version does not work -> you will have data garbage as to shared uart buffers... I would really do it the same way we do any other device driver: declare the device descriptor in the header file and include the uart buffers with full size in this struct. Then it is up to the user of a slip device to allocate this device descriptor (not on the stack!) and just give the pointer to this memory to the init function. |
The uart buffers are not shared, they are uart local, but I can make the struct public. As for the full size data buffers: I chose very carefully not to include the size of the ringbuffers into this PR, simply because it mainly depends on the network layer what size is required. |
Done |
a78734a
to
14e48f3
Compare
Sorry, somehow there was a foreign commit in my rebase |
14e48f3
to
7033297
Compare
Rebased to current master |
9f184dd
to
45554bf
Compare
e225b57
to
6cf1e6f
Compare
Rebased to current master |
465fc8a
to
5ec27fd
Compare
Fixed a whitespace error |
5ec27fd
to
301643d
Compare
Rebased to current master |
eaefaf6
to
83d0252
Compare
Rebased to current master and #3005. |
83d0252
to
6d556f7
Compare
Another day another rebase :D |
24f1c27
to
efe0f1f
Compare
Rebased to current master… can we FINALLY merge this |
efe0f1f
to
f94fa7a
Compare
Ah, a rebase error was the culprit. Let's see if it works now. |
f94fa7a
to
3fa750d
Compare
3fa750d
to
d2275ae
Compare
Okay… don't know exactly why, but it seems to be fixed... Now cppcheck complaining about the Contiki code… do I have to fix those? |
Ignore the cppcheck warnings/errors in tunslip6 (Contiki). We'll fix it in a follow up PR. |
Ok, then I'll merge |
\o/ |
typedef struct xbee_params { | ||
uart_t uart; /**< UART interfaced the device is connected to */ | ||
uint32_t baudrate; /**< baudrate to use */ | ||
} xbee_params_t; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry to being a bit late: but this is copy pasta, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes... Should I open a PR or did you already?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope, I didn't, so feel free.
Updated version of #1454. I removed the
board_uart0
support for now, to keep it simple.Depends on #2575.(merged)Needs #2901 to build properly(merged)