Document number
204911
Version
Rev. K
Issue date
2016-10-11
Sirius Breadboard User Manual
www.aacmicrotec.com
Page
69
of
106
EINVAL
Invalid options
5.11.2.4.
Function ssize_t read(…)
This is a blocking call to read data from the ADC.
Note!
The size of the given buffer must be a multiple of 32 bit as this is the minimum return
element from a read, see bit definition table below.
Argument name
Type
Direction Description
Fd
int
in
File descriptor received at open.
Buf
void*
in
Pointer to buffer to write data into.
Count
size_t
in
Number of bytes to read. Only 4 bytes is
supported in this implementation.
Return value
Description
>= 0
Number of bytes that were
read.
- 1
see
errno
values
errno values
EPERM
Device not open
EINVAL
Invalid number of bytes to be
read
ADC data buffer bit definition
Description
31:8
ADC value
7:4
ADC status
3:0
Channel number
5.11.2.5.
Function int ioctl(…)
Ioctl allows for more in-depth control of the ADC IP like setting the sample mode, clock
divisor etc.
Argument name
Type
Direction Description
Fd
int
in
File descriptor received at open
Cmd
int
in
Command to send
Val
int / int*
in/out
Value to write or a pointer to a buffer
where data will be written.
Command table
Type
Direction
Description
ADC_SET_SAMPLE_RATE_IOCTL
uint32_t
in
Set the sample rate of the ADC chip,
see [RD6].
ADC_GET_SAMPLE_RATE_IOCTL
uint32_t
out
Get the sample rate of the ADC chip,
see [RD6].
ADC_SET_CLOCK_DIVISOR
uint32_t
in
Set the clock divisor of the clock used
for communication with the ADC chip.
Minimum 0 and maximum 255.