Document number
205065
Version
Rev. N
Issue date
2019-02-04
Sirius OBC and TCM User Manual
Page
101
of
174
5.12.3.4. 13Function
ssize_t read(…)
Reads requested size of bytes from the device starting from the offset set using
lseek
.
NOTE:
For iterative read operations,
lseek
must be called to set page offset
before
each
read operation.
Argument name
Type
Direction Description
fd
Int
in
File descriptor received at
open
.
buf
void *
in
Character buffer where to store the data (should be
32-bit aligned for most efficient read).
nbytes
size_t
in
Number of bytes to read into
buf
(should be a multiple
of 4 for most efficient read).
Return value
Description
>0
Number of bytes that were read.
- 1
see
errno
values
errno values
EBADF
The file descriptor
fd
is not an open file descriptor
EINVAL
Page offset set in
lseek
is out of range or
nbytes
is
too large and reaches a page that is out of range.
ENODEV
Semaphore not available.
EBUSY
Flash controller busy.
EIO
Semaphore error or internal driver error.
5.12.3.5. Function
ssize_t write(…)
Writes requested size of bytes to the device starting from the offset set in
lseek
.
NOTE:
For iterative write operations,
lseek
must be called to set page offset before each
write operation.
Argument name
Type
Direction Description
fd
Int
in
File descriptor received at
open
.
buf
void *
in
Character buffer to write data from (should be 32-bit
aligned for most efficient write).
nbytes
size_t
in
Number of bytes to write from buf (should be a
multiple of 4 for most efficient write).
Return value
Description
>0
Number of bytes that were written.
- 1
see
errno
values
errno values
EBADF
The file descriptor
fd
is not an open file descriptor
EINVAL
Page offset set in
lseek
is out of range or
nbytes
is
too large and reaches a page that is out of range.
ENODEV
Semaphore not available.