Developer World
Spresense SDK Library v3.2.0-ebc0364
Functions
Collaboration diagram for Functions:

Functions

struct seq_s * seq_open (int type, int bustype)
 
void seq_close (struct seq_s *seq)
 
int seq_read (struct seq_s *seq, int fifoid, char *buffer, int length)
 
int seq_ioctl (struct seq_s *seq, int fifoid, int cmd, unsigned long arg)
 
int seq_setinstruction (struct seq_s *seq, const uint16_t *inst, uint16_t nr_insts)
 
void seq_setsample (struct seq_s *seq, uint8_t sample, uint8_t offset, uint8_t elemsize, bool swapbyte)
 
void seq_setaddress (struct seq_s *seq, uint32_t slave_addr)
 
int scu_spitransfer (int slavesel, uint16_t *inst, uint32_t nr_insts, uint8_t *buffer, int len)
 
int scu_i2ctransfer (int port, int slave, uint16_t *inst, uint32_t nr_insts, uint8_t *buffer, int len)
 
void scu_initialize (void)
 
void scu_uninitialize (void)
 

Detailed Description

Function Documentation

◆ seq_open()

struct seq_s * seq_open ( int  type,
int  bustype 
)

Open sequencer

Parameters
[in]type: Sequencer type. Set one of the following definitions.
[in]bustype: Bustype. Set one of the foollowing definitions.
Returns
struct seq_s pointer is success. NULL is failure.

◆ seq_close()

void seq_close ( struct seq_s *  seq)

Close sequencer device

Parameters
[in]seq: Sequencer instance

◆ seq_read()

int seq_read ( struct seq_s *  seq,
int  fifoid,
char *  buffer,
int  length 
)

Read sequencer FIFO data

Parameters
[in]seq: Sequencer instance
[in]fifoid: FIFO ID (decimator only)
[out]buffer: Pointer to data receive buffer
[in]length: Buffer length
Returns
OK(0) is success. negative value is failure.

◆ seq_ioctl()

int seq_ioctl ( struct seq_s *  seq,
int  fifoid,
int  cmd,
unsigned long  arg 
)

Sequencer specific ioctl

This API should be called from each sensor driver ioctl().

Parameters
[in]seq: Sequencer instance
[in]fifoid: FIFO ID (decimator only)
[in]cmd: ioctl commands (SCUIOC_*).
[in,out]arg: Argument for each commands
See also
IOCTL commands
Returns
OK(0) is success. negative value is failure.

◆ seq_setinstruction()

int seq_setinstruction ( struct seq_s *  seq,
const uint16_t *  inst,
uint16_t  nr_insts 
)

Set cyclic sequencer instruction

Parameters
[in]seq: Sequencer instance
[in]inst: Pointer to instruction array
[in]nr_insts: Number of instructions
Returns
OK(0) is success. negative value is failure.

◆ seq_setsample()

void seq_setsample ( struct seq_s *  seq,
uint8_t  sample,
uint8_t  offset,
uint8_t  elemsize,
bool  swapbyte 
)

Set sample data format

Parameters
[in]seq: Sequencer instance
[in]sample: Bytes per sample
[in]offset: Start offset of sampling data
[in]elemsize: Bytes of 1 element in sample
[in]swapbyte: Enable/Disable byte swapping
Returns
OK(0) is success. negative value is failure.

◆ seq_setaddress()

void seq_setaddress ( struct seq_s *  seq,
uint32_t  slave_addr 
)

Set slave ID or address

Parameters
[in]seq: An instance of sequencer
[in]slave_addr: In SPI, slave select ID. In I2C, bus address.

◆ scu_spitransfer()

int scu_spitransfer ( int  slavesel,
uint16_t *  inst,
uint32_t  nr_insts,
uint8_t *  buffer,
int  len 
)

SPI data transfer via sequencer.

This function use 'oneshot' feature on SCU. So user unnecessary to specify any opened sequencer. This function useful for accessing register directly.

Parameters
[in]slavesel: Slave select
[in]inst: Sequencer instruction
[in]nr_insts: Number of instructions
[out]buffer: Pointer to receive buffer, if no need to receive, then NULL.
[in]len: buffer length (ignored when buffer is NULL), up to 16 bytes.
Returns
OK(0) is success. negative value is failure.

◆ scu_i2ctransfer()

int scu_i2ctransfer ( int  port,
int  slave,
uint16_t *  inst,
uint32_t  nr_insts,
uint8_t *  buffer,
int  len 
)

I2C data transfer via sequencer

This function use 'oneshot' feature on SCU. So user unnecessary to specify any opened sequencer. This function useful for accessing register directly.

Parameters
[in]port: I2C port (0 or 1)
[in]slave: Slave address
[in]inst: Sequencer instruction
[in]nr_insts: Number of instructions
[out]buffer: Pointer to receive buffer, if no need to receive, then NULL.
[in]len: buffer length (ignored when buffer is NULL), up to 16 bytes.
Returns
OK(0) is success. negative value is failure.

◆ scu_initialize()

void scu_initialize ( void  )

Initialize SCU

Warning
This API called from board_app_initialize(). Do not call this API from each sensor drivers.

◆ scu_uninitialize()

void scu_uninitialize ( void  )

Uninitialize SCU

Warning
This API called from board_app_initialize(). Do not call this API from each sensor drivers.