24#ifndef __ARCH_ARM_INCLUDE_CXD56XX_SCU_H
25#define __ARCH_ARM_INCLUDE_CXD56XX_SCU_H
38#include <nuttx/fs/ioctl.h>
44#define _SCUIOCBASE (0xa000)
46#define _SCUIOCVALID(c) (_IOC_TYPE(c)==_SCUIOCBASE)
47#define _SCUIOC(nr) _IOC(_SCUIOCBASE,nr)
61#define SCUIOC_SETFIFO _SCUIOC(0x0001)
70#define SCUIOC_FREEFIFO _SCUIOC(0x0002)
79#define SCUIOC_SETSAMPLE _SCUIOC(0x0003)
88#define SCUIOC_SETSIGNCONV _SCUIOC(0x0004)
97#define SCUIOC_SETOGADJUST _SCUIOC(0x0005)
106#define SCUIOC_CLROGADJUST _SCUIOC(0x0006)
115#define SCUIOC_SETFILTER _SCUIOC(0x0007)
127#define SCUIOC_SETNOTIFY _SCUIOC(0x0008)
141#define SCUIOC_SETELEMENTS _SCUIOC(0x0009)
150#define SCUIOC_SETDECIMATION _SCUIOC(0x000a)
159#define SCUIOC_SETWATERMARK _SCUIOC(0x000b)
168#define SCUIOC_START _SCUIOC(0x0010)
177#define SCUIOC_STOP _SCUIOC(0x0011)
186#define SCUIOC_SETFIFOMODE _SCUIOC(0x0012)
195#define SCUIOC_DELFIFODATA _SCUIOC(0x0013)
205#define SCU_BUS_I2C0 2
206#define SCU_BUS_I2C1 3
207#define SCU_BUS_LPADC0 0x10
208#define SCU_BUS_LPADC1 0x11
209#define SCU_BUS_LPADC2 0x12
210#define SCU_BUS_LPADC3 0x13
211#define SCU_BUS_HPADC0 0x14
212#define SCU_BUS_HPADC1 0x15
216#define SCU_INST_SEND(val) ((val) & 0xff)
220#define SCU_INST_RECV(n) ((1 << 8) | (((n) - 1) & 0x7) << 12)
222#define SCU_INST_TERM (1 << 11)
223#define SCU_INST_RESTART (1 << 10)
224#define SCU_INST_STOP (1 << 9)
228#define SCU_INST_LAST (SCU_INST_TERM|SCU_INST_STOP)
232#define SEQ_TYPE_NORMAL 0
233#define SEQ_TYPE_DECI 1
237#define SCU_EV_RISE_EN (1 << 31)
238#define SCU_EV_FALL_EN (1 << 30)
239#define SCU_EV_OUT8BITS (1 << 29)
241#define SCU_EV_OUTSHIFT 16
242#define SCU_EV_OUTMASK (3 << SCU_EV_OUTSHIFT)
243#define SCU_EV_OUTALWAYS (0 << SCU_EV_OUTSHIFT)
244#define SCU_EV_OUTSTART (1 << SCU_EV_OUTSHIFT)
245#define SCU_EV_OUTSTOP (2 << SCU_EV_OUTSHIFT)
246#define SCU_EV_NOTOUT (3 << SCU_EV_OUTSHIFT)
248#define SCU_EV_WRITESAMPLEMASK 0xfff
252#define SCU_EV_WRITESAMPLES(sample) ((sample) & SCU_EV_WRITESAMPLEMASK)
256#define SCU_EV_RISE (1)
257#define SCU_EV_FALL (2)
261#define SCU_LEVELADJ_X1 (0)
262#define SCU_LEVELADJ_X2 (1)
263#define SCU_LEVELADJ_X4 (2)
264#define SCU_LEVELADJ_X8 (3)
464int seq_read(
struct seq_s *seq,
int fifoid,
char *buffer,
int length);
481int seq_ioctl(
struct seq_s *seq,
int fifoid,
int cmd,
unsigned long arg);
509 uint8_t elemsize,
bool swapbyte);
537 uint8_t *buffer,
int len);
557 uint8_t *buffer,
int len);
filter_pos_e
Definition: scu.h:283
@ FILTER_POS_FE
Definition: scu.h:290
@ FILTER_POS_FF
Definition: scu.h:286
@ FILTER_POS_EE
Definition: scu.h:288
@ FILTER_POS_AF
Definition: scu.h:287
@ FILTER_POS_NONE
Definition: scu.h:284
@ FILTER_POS_AE
Definition: scu.h:289
@ FILTER_POS_AA
Definition: scu.h:285
int scu_i2ctransfer(int port, int slave, uint16_t *inst, uint32_t nr_insts, uint8_t *buffer, int len)
int seq_read(struct seq_s *seq, int fifoid, char *buffer, int length)
void scu_initialize(void)
int seq_ioctl(struct seq_s *seq, int fifoid, int cmd, unsigned long arg)
void seq_setaddress(struct seq_s *seq, uint32_t slave_addr)
void seq_close(struct seq_s *seq)
void seq_setsample(struct seq_s *seq, uint8_t sample, uint8_t offset, uint8_t elemsize, bool swapbyte)
int seq_setinstruction(struct seq_s *seq, const uint16_t *inst, uint16_t nr_insts)
int scu_spitransfer(int slavesel, uint16_t *inst, uint32_t nr_insts, uint8_t *buffer, int len)
void scu_uninitialize(void)
struct seq_s * seq_open(int type, int bustype)
uint16_t gain
Definition: scu.h:380
uint16_t offset
Definition: scu.h:379
struct adjust_s z
Definition: scu.h:389
struct adjust_s y
Definition: scu.h:388
struct adjust_s x
Definition: scu.h:387
uint8_t forcethrough
Definition: scu.h:398
uint8_t leveladj
Definition: scu.h:397
uint8_t ratio
Definition: scu.h:396
uint8_t l
Definition: scu.h:306
uint8_t oshift
Definition: scu.h:314
struct iir_coeff_s coeff[5]
Definition: scu.h:315
uint8_t ishift
Definition: scu.h:313
enum filter_pos_e pos
Definition: scu.h:322
struct iir_filter_s filter[2]
Definition: scu.h:323
struct scutimestamp_s ts
Definition: scu.h:357
uint32_t type
Definition: scu.h:358
struct sensor_event_s rise
Definition: scu.h:367
int signo
Definition: scu.h:365
struct sensor_event_s fall
Definition: scu.h:368
uint32_t ctrl
Definition: scu.h:370
struct scuev_arg_s * arg
Definition: scu.h:372
struct scutimestamp_s * ts
Definition: scu.h:409
int signo
Definition: scu.h:405
uint16_t watermark
Definition: scu.h:417
uint16_t tick
Definition: scu.h:298
uint32_t sec
Definition: scu.h:297
uint16_t count1
Definition: scu.h:349
uint16_t threshold
Definition: scu.h:347
uint16_t count0
Definition: scu.h:348
uint16_t delaysamples
Definition: scu.h:350