Document number
205065
Version
Rev. N
Issue date
2019-02-04
Sirius OBC and TCM User Manual
Page
45
of
174
Inclusion of
<fcntl.h>
and <unistd.h>
are required for using the POSIX functions:
open
,
close, ioctl
.
Inclusion of
<errno.h>
is required for retrieving error values on failures.
Inclusion of <
bsp/scet_rtems.h>
is required for accessing SCET device name
RTEMS_SCET_DEVICE_NAME
as well as other defines
.
CONFIGURE_APPLICATION_NEEDS_SCET_DRIVER
must be defined for using the SCET
driver. By defining this as part of RTEMS configuration, the driver will automatically be
initialized at boot up.
5.4.6. Limitations
None
secs_to_adjust, subsecs_to_adjust);
memcpy(write_buffer, &secs_to_adjust,
sizeof(uint32_t));
memcpy(write_ sizeof(uint32_t),
&subsecs_to_adjust, sizeof(uint16_t));
result = write(scet_fd, write_buffer, 6);
assert(result == 6);
result = read(scet_fd, read_buffer, 6);
assert(result == 6);
memcpy(&new_seconds, read_buffer,
sizeof(uint32_t));
memcpy(&new_subseconds, read_
sizeof(uint32_t), sizeof(uint16_t));
printf("New SCET time is %lu.%u\n", new_seconds,
new_subseconds);
result = close(scet_fd);
assert(result == 0);
rtems_task_delete(RTEMS_SELF);
}