Skip to content

Create queued register access functions #34

@aacuevas

Description

@aacuevas

Following open-ephys/ONI#26, we need to create new functions to access regs using the queue system, and modify existing ones:

The base would be low level functions:

int _oni_read_regs(oni_dev_idx_t *dev_addrs, oni_reg_addr_t *reg_addrs, oni_reg_val_t* vals, unsigned int num)
int _oni_write_regs(oni_dev_idx_t *dev_addrs, oni_reg_addr_t *reg_addsr, oni_reg_val_t* vals, unsigned int num)
{
  for_each_value
  {
    //call oni_driver_write_config with the appropriate values for the RI_* registers
    //call oni_driver_write_config with RI_TRIGGER = 0x01 to queue the transaction
  }
  //Once all the transactions are in the queue
 for_each_value
 {
    //pump signal channel for ack/nack
    // if read, read the transaction result for signal channel
 }
}

Then, we have the public functions:

int oni_read_regs(oni_dev_idx_t *dev_addrs, oni_reg_addr_t *reg_addrs, oni_reg_val_t* vals, size_t num)
int oni_write_regs(oni_dev_idx_t *dev_addrs, oni_reg_addr_t *reg_addsr, oni_reg_val_t* vals, size_t  num)
{
  //split num in blocks of ONI_ATTR_MAX_REGISTER_Q_SIZE
  //if num > ONI_ATTR_MAX_REGISTER_Q_SIZE then call _oni_read_reg/_oni_write_reg with a max of ONI_ATTR_MAX_REGISTER_Q_SIZE 
  //and after completion, call it again with the next block
}

existing

oni_read_reg()
oni_write_reg()

will call the *regs functions with num=1

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions