Document number
204911
Version
Rev. K
Issue date
2016-10-11
Sirius Breadboard User Manual
www.aacmicrotec.com
Page
50
of
106
Return value
Description
0
Device name deregistered successfully
-1
see
errno
values
errno values
EBADF
The file descriptor
fd
is not an open file
descriptor
5.8.2.3.
size_t read(…)
Receives a packet.
Note!
Given buffer must be aligned to
CPU_STRUCTURE_ALIGNMENT
. It is recommended to
assign the buffer in the following way:
uint8_t __attribute__ ((aligned (SPWN_RX_PACKET_ALIGN_BYTES))
buf_rx[PACKET_SIZE];
Note!
This call is blocking until a package for the logic address is received
Argument name
Type
Direction Description
fd
int
in
File descriptor received at
open
.
buf
void *
in
Character buffer where to store the packet
nbytes
size_t
In
Packet
size in bytes. Must be between 0 and
SPWN_MAX_PACKET_SIZE bytes
.
Return value
Description
>0
Received size of the actual packet. Can
be less than
nbytes
.
- 1
see
errno
values
errno values
EBADF
The file descriptor
fd
is not an open file
descriptor
EINVAL
buf
size is 0.
5.8.2.4.
size_t write(…)
Transmits a packet.
Note!
This call is blocking until the package is transmitted.
Argument name
Type
Direction Description
fd
int
in
File descriptor received at
open
.
buf
void *
in
Character buffer containing the packet.
nbytes
size_t
in
Packet size in bytes. Must be between 0 and
SPWN_MAX_PACKET_SIZE bytes
.
Return value
Description
>0
Number of bytes that were transmitted.
- 1
see
errno
values