Document number
204911
Version
Rev. K
Issue date
2016-10-11
Sirius Breadboard User Manual
www.aacmicrotec.com
Page
71
of
106
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/adc_rtems.h>
is required for accessing the ADC.
5.11.4. Limitations
Only one enabled channel at a time is supported in current implementation.
Only the default divisor value is supported in the current implementation which set the SPI
frequency for read out of the buffered ADC data. Default val is ~200kHz.
5.12. NVRAM
The NVRAM on the OBC and TCM is a 262,144-bit magnetoresistive random access
memory (MRAM) device organized as 32,768 bytes of 8 bits. EDAC is implemented on a
byte basis meaning that half the address space is filled with checksums for correction. It’s a
strong correction which corrects 1 or 2 bit errors on a byte and detects multiple. The table
below presents the address space defined as words (
16,384
bytes can be used). The
address space is divided into two sub groups as product- and user address space.
#include <bsp.h>
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
#include <bsp/adc_rtems.h>
#define CONFIGURE_APPLICATION_NEEDS_ADC_DRIVER
#include <bsp/bsp_confdefs.h>
#include <rtems/confdefs.h>
#define CONFIGURE_INIT
rtems_task Init (rtems_task_argument argument);
rtems_task Init (rtems_task_argument argument){
rtems_status_code status;
int read_fd;
uint32_t buffer;
read_fd = open(ADC_DEVICE_NAME, O_RDONLY);
status = ioctl(read_fd, ADC_ENABLE_CHANNEL_IOCTL, 4);
size = read(read_fd, &buffer, 4);
status = ioctl(read_fd, ADC_DISABLE_CHANNEL_IOCTL, 4);
status = close(read_fd);
}