μHAL
si57x_ctrl::Controller Class Reference

#include <si57x_ctrl.h>

Inheritance diagram for si57x_ctrl::Controller:
Collaboration diagram for si57x_ctrl::Controller:

Public Member Functions

 Controller (struct pcie_bars &, double=0)
 
void write_params () override
 
bool read_startup_regs ()
 
bool apply_config ()
 
bool set_freq (double)
 
- Public Member Functions inherited from RegisterDecoderController
void set_devinfo (const struct sdb_device_info &devinfo) override
 
virtual void encode_params () override
 
void write_general (const char *name, decoders::data_type value)
 
void write_channel (const char *name, unsigned pos, decoders::data_type value)
 
void set_devinfo (const struct sdb_device_info &) override
 
virtual void write_params ()
 
- Public Member Functions inherited from RegisterDecoderBase
void check_devinfo_is_set () const
 
virtual void set_devinfo (const struct sdb_device_info &)
 

Private Member Functions

bool get_busy ()
 
bool still_busy ()
 

Private Attributes

std::unique_ptr< struct wb_si57x_ctrl_regs > regs_storage
 
struct wb_si57x_ctrl_regs & regs
 
Core dec
 
double fstartup
 
double fxtal
 

Additional Inherited Members

- Public Attributes inherited from RegisterDecoderBase
const device_match_fn match_devinfo_lambda
 
- Protected Member Functions inherited from RegisterDecoderController
 RegisterDecoderController (struct pcie_bars &bars, const struct sdb_device_info &devinfo, RegisterDecoder *pdec)
 
- Protected Member Functions inherited from RegisterController
 RegisterController (struct pcie_bars &bars, const struct sdb_device_info &)
 
virtual void set_devinfo_callback ()
 
virtual void encode_params ()=0
 
virtual void unset_commands ()
 
- Protected Member Functions inherited from RegisterDecoderBase
void set_read_dest (auto &dest)
 
 RegisterDecoderBase (struct pcie_bars &, const struct sdb_device_info &)
 
virtual void read ()
 
- Protected Attributes inherited from RegisterDecoderBase
size_t read_size
 
void * read_dest
 
struct pcie_barsbars
 
struct sdb_device_info devinfo
 
size_t addr
 

Detailed Description

This controller may need to reset the IC managed by this core, in order to obtain its startup parameters. These parameters are used to calculate the internal crystal oscillator's frequency, and allow core users to configure the IC using calibrated values, instead of datasheet ones.

Constructor & Destructor Documentation

◆ Controller()

si57x_ctrl::Controller::Controller ( struct pcie_bars bars,
double  fstartup = 0 
)

The startup frequency has to be provided if read_startup_regs() is going to be called.

Member Function Documentation

◆ apply_config()

bool si57x_ctrl::Controller::apply_config ( )

Apply the frequency configuration provided by set_freq(). This function blocks while the configuration is applied. Returns false in case of failure.

◆ get_busy()

bool si57x_ctrl::Controller::get_busy ( )
private

Update all registers and return state of busy flag.

◆ read_startup_regs()

bool si57x_ctrl::Controller::read_startup_regs ( )

Read the device's startup registers and obtain fxtal. Will reset it if necessary, as determined by the value of STRP_COMPLETE. fstartup must be set. This function blocks while the startup registers are read. Returns false in case of failure.

◆ set_freq()

bool si57x_ctrl::Controller::set_freq ( double  freq)

Determine the value for the device's registers in order to output the desired frequency. If read_startup_regs() wasn't called, uses the nominal value for fxtal. Returns false in case of failure.

◆ still_busy()

bool si57x_ctrl::Controller::still_busy ( )
private

Loop until timeout while busy, return immediately otherwise. Updates all registers every iteration. Returns the final state of the busy flag.

◆ write_params()

void si57x_ctrl::Controller::write_params ( )
overridevirtual

Child classes can implement this function when their write procedures require more than simply writing the regs structure

Reimplemented from RegisterController.

Member Data Documentation

◆ fstartup

double si57x_ctrl::Controller::fstartup
private

The device's startup frequency.

◆ fxtal

double si57x_ctrl::Controller::fxtal
private

The device's internal crystal frequency.


The documentation for this class was generated from the following files: